相关代码 |
|
A=[-0.2,0.5,0,0,0;0,-0.5,1.6,0,0;0,0,-14.3,85.8,0; 0,0,0,-33.3,100;0,0,0,0,-10]; B=[0; 0; 0; 0; 30]; Q=diag([10,20,6,2,5]); R=1; C=[1,0,0,0,0]; D=0; [K,P]=lqr(A,B,Q,R); eig(A-B*K) [K2,P2]=lqr(A+eye(size(A)),B,Q,R); eig(A-B*K2) [y,t,x]=step(ss(A-B*K,B,C,D)); y1=step(ss(A-B*K2,B,C,D),t); [m,p,w]=bode(ss(A-B*K,B,C,D)); [m1,p1]=bode(ss(A-B*K2,B,C,D),w); plot(t,y,'-',t,y1,':'), figure subplot(211), semilogx(w,20*log10(m(:)),'-',w,20*log10(m1(:)),':') subplot(212), semilogx(w,p(:),'-',w,p1(:),':')
相关资源 |
|