how can I plot bode plot and phase magnitude plot of this code?

5 views (last 30 days)
close all; clear all; clc; w=[.001 .0036 .0126 .0464 .1668 .5995 2.1544 7.7426 27.8256 100 200]; for k=1:0.5:10; for a=1:0.5:5; num=k; den=[1 a 0]; sys=tf(num,den); end end for k0=1:1:171 figure(k0) [magk0,pha2k0,w]= bode(sysk0,w); end for k1 = 1:171 figure(k1) subplot(2,1,1) plot(w,20*log10(Magnitude(k1,:))) title('Magnitude (dB)') grid subplot(2,1,2) plot(w,Phase(k1,:)) title('Phase (°)') grid end
  1 Comment
Michael Dombrowski
Michael Dombrowski on 12 Jul 2017
What you need is a simple bode plot.
you can simply use:
w=[.001 .0036 .0126 .0464 .1668 .5995 2.1544 7.7426 27.8256 100 200];
for k=1:0.5:10
for a=1:0.5:5
num=k;
den=[1 a 0];
sys=tf(num,den);
end
end
bode(sys,w);
grid on

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!