www.pudn.com > controlsystem.ZIP > EX3047.M
% Example 3.47
%
% Design of quadratic optimal regulator system
%
a=-diag([0.2 0.5 14.3 33.3 10])+diag([0.5 1.6 85.8 100],1);
b=[0 0 0 0 30]';
c=[1 0 0 0 0]; d=[0];
q=diag([1 1 1 1 1]); r=1;
[k,p,e]=lqr(a,b,q,r);
disp(' The optimal feedback gain matrix k is')
k
%
% Step response
%
% The close loop state system is denoted as (ac,bc,cc,dc)
%
k1=k(1);
ac=a-b*k;
bc=b*k1;
cc=c; dc=d;
figure(1)
step(ac,bc,cc,dc)
title('Step Response of Quadratic Optimal Control system')
xlabel('Sec')
ylabel('Output y=x1')
figure(2)
[y,x,t]=step(ac,bc,cc,dc);
plot(t,x,'y')
title('Step Response Curves for x1,x2,x3,x4,x5')
xlabel('Sec')
ylabel('x1,x2,x3,x4,x5')