# LQI for angular speed control in MATLAB

With the following state space system and setting for the Linear Quadratic Integrator (LQI) Q = diag([1,1,1]) and r = 1; for optimal gains computation, the system is not reaching the desired output by an unit step input (reaching 0.5 as shown in image below), strangely when I set the C matrix to measure position C = [1 0], the output does track the reference input.

Jm  = 0.008; % Rotor inertia
dm  = 0.015; % Damping

A = [0 1;0 -dm/Jm];
B = [0;1/Jm];
C = [0 1];
D =0;
sys  = ss(A,B,C,D);

Q = diag([1,1,1]);
r = 1;

[K,S,e] = lqi(sys,Q,r,0);

Aa = [A [0;0];-C 0];
Ba = [B;0];
Ca = [C 0];

Bi = [0;0;1];
sys_cl = ss(Aa-Ba*K,Bi,Ca,D);
step(sys_cl);


Is it ppossible that the corresponding Q and r values to be off causing this?

• Why don't you post this on stackoverflow? Apr 19, 2022 at 14:23
• Are you taking print-screens from Matlab? If you save in PNG, it should be possible to have much nicer-looking plots than this. Also, why don't you choose better titles for the plots? Also, LQI stands for... ? Apr 19, 2022 at 14:37
• @RodrigodeAzevedo Linear Quadratic Integrator, thank you for the edit. Apr 19, 2022 at 17:53
• You provide neither a reference nor a brief explanation of what you mean by LQI. Apr 19, 2022 at 18:26

If you are only interested in controlling angular speed (not the angle itself) your model is first order. You don't need the integrator (and in fact you are not measuring it anyway when $$C = [0 ~~ 1]$$ and it is not observable).
When you set $$C = [1 ~~ 0]$$ you are basically controlling the angle, not angular speed.
• Furthremore, you MUST discern between output matrix $C$ and integration matrix $C_i$. The former corresponds to the sensor matrix, for example, the angular position. The latter corresponds to matrix you wish to track, for example, the angular speed. Apr 19, 2022 at 19:08
• The LQI MUST utilize the tracking output $C_i$. Apr 19, 2022 at 20:29