I have a system described by xdot=Adx+Bdu and y=Cdx+Ddu, where dx and du are the changes in the states and control variables, based on the matrices A, B, C, and D which contain the linearized dynamics of the system. The lqr controller is set up the following way:
The A, B, C, and D matrices:
A =
-0.0204 0.0994 -0.1976 0 -50.0000 12.0000 0 7.6460 0.6088
-0.0994 0.0006 0.3023 50.0000 0 -12.0000 -7.5940 -1.7931 9.5517
0.1927 -0.3085 -0.0359 -12.0000 12.0000 0 1.3239 -5.7965 -2.1517
-0.0159 -0.0054 -0.0201 0 0 0 0 0 0
0.2922 0.6400 2.7503 0 0 0 0 0 0
0.0170 0.0215 0.0906 0 0 0 0 0 0
0 0 0 1.0000 0.3724 1.2039 0.2035 0.4002 0
0 0 0 0 0.9553 -0.2955 -0.1546 0 0
0 0 0 0 0.4754 1.5369 0.2598 0.3135 0
B =
0.0186 -0.0473 0.0202 0.0100
0 0 -0.0316 -0.0817
0.0903 0.0792 0.0843 0.0416
0.0544 -1.1601 0.5681 -1.4700
-0.0907 -1.9335 1.5596 -0.7709
-1.6589 1.1871 -0.9469 -2.4499
0 0 0 0
0 0 0 0
0 0 0 0
C =
1.0e+03 *
-0.0159 -0.0054 -0.0201 0 0 0 0 0 0
0.2922 0.6400 2.7503 0 0 0 0 0 0
0.0170 0.0215 0.0906 0 0 0 0 0 0
D =
1.0e+03 *
0.0544 -1.1601 0.5681 -1.4700
-0.0907 -1.9335 1.5596 -0.7709
-1.6589 1.1871 -0.9469 -2.4499
The lqr controller:
Q=1e-3*eye(9,9);
R=1e10*eye(4,4);
K=lqr(A,B,Q,R);
x0=ones(9,1);
sys=ss((A-B*K),B,C,D);
t=0:1/10:30;
[y,t,dx]=initial(sys,x0,t);
I then retrieve the values of du and apply it to u the following way:
u0 =
-0.1014
0.2692
-0.6107
-0.2415
for ii=1:length(t)
du(:,ii)=pinv(D)*(y(ii,:)'-C*(dx(ii,:))');
end
u=u0+cumtrapz(t,du(1:4,:)')';
This then gives me the attached results. The controller returns to error, and the y values reach steady state of 0 after 15 or so seconds. The issue however Is that the control values seem incredibly small. In fact, the total change for the control values are in the order of 1e-14 units of control. I have tried also setting the R matrix to be larger. I understand that it may just be that "it is what it is", but I am wondering if I have defined the controls incorrectly or there is a output option for the initial function that gives the control?