简体   繁体   中英

Plot the frequency response (magnitude vs. frequency, and phase vs. frequency)

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!

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,'-')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM