1
votes

Using Matlab, plot the frequency response (magnitude vs. frequency, and phase vs. frequency) with frequency on a log scale (frequency range: 10^-1 ~ 10^2).

This is the code i have at the moment:

 w = linspace(10^-1,10^2,1);
 p = atan((3*w)/4) - atan((3*w)/(4-10000*w^2));
 magnitude = sqrt((16+9*w^2)/((10^8*w^4)-7.99e4*w^2+16));
 T(w) = (16+9*w^2)/((10^8*w^4)-7.99e4*w^2+16);
 subplot (2,1,1)
 plot(magnitude,T,'*')
 ylabel('Magnitude')
 subplot(2,1,2)
 plot(p,T,'*')
 xlabel('Frequency')
 ylabel('Phase')

If someone could help with why it is only outputting points instead of lines that would be great!

1

1 Answers

1
votes

When you call plot(magnitude,T,'*') you specify the marker you're using in the 3rd parameters. * means points, if you'd like to have a line instead, use -, or if you'd like to have points connected by by lines, use *-.

plot(magnitude,T,'-')