w=1;
t1=1;
clear A;
for e=0.2:0.5:3
sys0=tf(w*w,[1,2*e*w,w*w]);
t=0:0.01:4;
step(sys0,t);
STR=sprintf('阻尼为%3.2f',e);
A(t1)=cellstr(STR);
t1=t1+1;
hold on
end
legend(A);
grid
w=1;
t1=1;
clear A;
for e=-0.2:0.5:3
sys0=tf(w*w,[1,2*e*w,w*w]);
t=0:0.1:8;
step(sys0,t);
STR=sprintf('阻尼为%3.2f',e);
A(t1)=cellstr(STR);
t1=t1+1;
hold on
end
legend(A);
grid