EE611 - solution to HW#17
| » inv([C [0 0;0 0];A B])*[eye(2,2);zeros(4,2)]
ans = -0.7727 1.1364 0.2273 -0.3636 0.5000 -0.5000 -0.4091 0.4545 1.6364 -1.8182 -0.1818 0.0909 » Nx = ans(1:4,:) Nx = -0.7727 1.1364 0.2273 -0.3636 0.5000 -0.5000 -0.4091 0.4545 » Nu = ans(5:6,:) Nu = 1.6364 -1.8182 -0.1818 0.0909 » yref = [4;6] yref = 4 6 » K K = 0 0 0 0 14.1500 -17.2500 53.0000 -57.7500 » t=[0:100]/20; » a=A-B*K; » u=((Nu+K*Nx)*yref*ones(1,length(t)))'; |
» [y,x] = lsim(a,B,C,[0 0;0 0],u,t); » plot(t,x) » grid » title('Response of states'); xlabel('Time (sec.)'); ylabel('x(t)'); » plot(t,y) » grid » title('Output Response'); xlabel('Time (sec.)'); ylabel('y(t)'); » %look at decoupled states: » [p,l]=eig(a); » z = inv(v)*x'; » zss=max(max(abs(z))); » ts = 4/5 ts = 0.8000 » plot(t,abs(z),[0 5],zss*[.98 .98],[0 5],zss*[1.02 1.02],[ts ts],[0 1.02*zss]) » grid » title('Response of decoupled states'); xlabel('Time (sec.)'); ylabel('z(t)'); » %now let Nu = 0: » Nu=[0 0;0 0]; » u=((Nu+K*Nx)*yref*ones(1,length(t)))'; » [y,x] = lsim(a,B,C,[0 0;0 0],u,t); » plot(t,x) » grid » title('Response of states (Nu=0)'); xlabel('Time (sec.)'); ylabel('x(t)'); » plot(t,y) » grid |
|
|