t=(0:0.01:10);

%

nG1=(2,3,6,10,24);

dG1=(1,8,20,30,12);G1=tf(nG1,dG1);

nG2=(2);

den1=[2,1];den2=[1,3];den3=[2,3,1];

dG2=conv(conv(den1,den2),den3);G2=tf(nG2,nG2);

nG3=[1];

den1’=[1,-1];den2’=[1,4];den3’=[2,-3,1];

dG3=conv(conv(den1′,den2′),den3′);G3=(nG3,dG3);

%

[y1,T]=inpulse(G1,t);[y1a,T]=step(G1,t);[y1b,T]=lsim(G1,t);

[y2,T]=impulse(G2,t);[y2a,T]=step(G2,t);[y2b,T]=lsim(G2,t);

[y3,T]=impulse(G3,t);[y3a,T]=step(G3,t);[y3b,T]=lsim(G3,t);

%

subplot(131),plot(T,y1,’–‘,T,y2,’-.’,T,y3,’-‘)

legend(‘G1=tf(nG1,dG1)’,’G2=tf(nG2,dG2)’,’G3=tf(nG3,dG3)’)

xlable(‘t(sec)’),ylable(‘x(t)’);grid on;

subplot(132),plot(T,y1a,’–‘,T,y2a,’-.’,T,y3a,’-‘)

legend(‘G1=tf(nG1,dG1)’,’G2=tf(nG2,dG2)’,’G3=tf(nG3,dG3)’)

xlable(‘t(sec)’),ylable(‘x(t)’);grid on;

subplot(133),plot(T,y1b,’–‘,T,y2b,’-.’,T,y3b,’-‘)

legend(‘G1=tf(nG1,dG1)’,’G2=tf(nG2,dG2)’,’G3=tf(nG3,dG3)’)

grid
on;xlable(‘t(sec)’),ylable(‘x(t)’);

不知道哪出错了,望指教。。。

相关文章