1、Matlab与控制系统仿真部分习题答案【4.2】 程序:num=5,0;den=conv(1,1,conv(1,2,1,3);numc,denc=cloop(num,den);z,p,k=tf2zp(numc,denc);A,B,C,D=tf2ss(numc,denc);g_zp=zpk(z,p,k)g_tf=tf(numc,denc)g_ss=ss(A,B,C,D)运行结果:Zero/pole/gain: 5 s-(s+0.4432) (s2 + 5.557s + 13.54) Transfer function: 5 s-s3 + 6 s2 + 16 s + 6 a = x1 x2 x3
2、x1 -6 -16 -6 x2 1 0 0 x3 0 1 0 b = u1 x1 1 x2 0 x3 0 c = x1 x2 x3 y1 0 5 0 d = u1 y1 0【4.3】程序:A=0 0 0 -1;1 0 0 -2;0 1 0 -3;0 0 1 -4;B=0;0;0;1;C=1 0 0 0;g_ss=ss(A,B,C,D)num,den=ss2tf(A,B,C,D);g_tf=tf(num,den)z,p,k=ss2zp(A,B,C,D);g_zpk=zpk(z,p,k)运行结果:a = x1 x2 x3 x4 x1 0 0 0 -1 x2 1 0 0 -2 x3 0 1 0 -3
3、 x4 0 0 1 -4b = u1 x1 0 x2 0 x3 0 x4 1 c = x1 x2 x3 x4 y1 1 0 0 0 d = u1 y1 0 Continuous-time model. Transfer function:-3.109e-015 s3 - s2 - 3.331e-015 s - 4.441e-016- s4 + 4 s3 + 3 s2 + 2 s + 1 Zero/pole/gain: - s2-(s+0.6724) (s+3.234) (s2 + 0.0936s + 0.4599) 【5.1】(1) 程序num=0,10;den=conv(1,0,1,7,17
4、);numc,denc=cloop(num,den,-1);G=tf(numc,denc)y,t=step(G);plot(t,y,b-)C=dcgain(G);n=1;while y(n)0.1*C n=n+1;endm=1;while y(m)0.98*C)&(y(i)0 i=i+1; endendif i0 disp(系统不稳定);else disp(系统稳定);end运行结果:p = 0 5.0000 -8.0000 -7.0000系统不稳定(3)(4)程序:AA=0,1,0;0,5,0;0,0,-8;BB=0;1;1;P=-1,-2,-8;K=acker(AA,BB,P);i=4;K
5、(4)=0;Kpp=eig(A-B*K)sys1=tf(num1,den1);y1,t=step(sys1);plot(t,y1)hold onA_feedback=A-B*K;num2,den2=ss2tf(A_feedback,B,C,D);sys2=tf(num2,den2);y2,t=step(sys2);plot(t,y2,r)gridgtext(反馈前)gtext(反馈后)运行结果:K = 2 8 0 0pp = -8 -2 -1-7图形:【13.1】程序:A=0,1;0,0;B=0;1;C=1,0;D=zeros(1,1);G_ss=ss(A,B,C,D)M=ctrb(A,B);
6、if rank(M)=2 disp(系统完全能控);else disp(系统不完全能控);endS=1,0;N=obsv(A,S);if rank(N)=2 disp(A,S)可观测);else disp(A,S)不可观测);endR=1;Q=1,0;0,0;K,P,E=Lqr(A,B,Q,R)A_new=A-B*K;G_new=ss(A_new,B,C,D);t=linspace(0,5,100);y1=step(G_ss,t);y2=step(G_new,t);plot(t,y1,r:,t,y2,b-)gridgtext(反馈前)gtext(反馈后)运行结果:a = x1 x2 x1 0 1 x2 0 0 b = u1 x1 0 x2 1 c = x1 x2 y1 1 0 d = u1 y1 0 Continuous-time model.系统完全能控(A,S)可观测K = 1.0000 1.4142P = 1.4142 1.0000 1.0000 1.4142E = -0.7071 + 0.7071i -0.7071 - 0.7071i图形:
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2