# Cannot compute Riccati solution for LQI controller

This is my code right now:

`u=0.5;v=0;omega=0;m=50;psi=0;c_d_Long=0.5;c_dr=0.6;c_d_Lat=1;rho=1000;L=1.2;W=0.275;H=0.416;I=38;A =[0, 0, - v*cos(psi) - u*sin(psi),    cos(psi),      -sin(psi),    0;0, 0,   u*cos(psi) - v*sin(psi),   sin(psi),  cos(psi),   0;0, 0, 0, 0,    0,  1;0, 0,  0, -((3*W*c_d_Long*rho*u^2*1)/10 + (3*W*c_d_Long*rho*u*sign(u))/10)/m, omega,      v;0, 0, 0,  -omega, -((3*L*c_d_Lat*rho*v^2*1)/10 + (3*L*c_d_Lat*rho*v*sign(v))/10)/m, -u;0, 0,  0,   0,     0, - (300*L*c_dr*omega^2*rho*1)/38347 - (300*L*c_dr*omega*rho*sign(omega))/38347];B =[ 0,          0,         0,          0,         0,         0,          0,          0;  0,          0,         0,          0,         0,         0,          0,          0;   0,          0,         0,          0,         0,         0,          0,          0; 1/m,        1/m,       1/m,        1/m,         0,         0,          0,          0;    0,          0,         0,          0,       1/m,       1/m,        1/m,        1/m;825/76694, -825/76694, 825/76694, -825/76694, 325/38347, 325/38347, -325/38347, -325/38347];C=[1 0 0 0 0 0;    0 1 0 0 0 0;    0 0 1 0 0 0;    0 0 0 1 0 0;    0 0 0 0 0 0;    0 0 0 0 0 1];    SYS=ss(A,B,C,0);Co = ctrb(SYS);C=rank(Co);Ob=obsv(SYS);O=rank(Ob);Q=eye(12);R=eye(8);klqi=lqi(SYS,Q,R)`

As you can see I have a 6-dimension state with 8 input and 6 output. When i Run this code i have the following error:

`Cannot compute a stabilizing LQR gain (the Riccati solution S and gain matrix K are infinite).This could be because:  * A has unstable modes that are not controllable through B,  * Q,R,N values are too large,  * [Q N;N' R] is indefinite,  * The E matrix in the state equation is singular.`

I had the same issue in the past but every time the problem was the controllabilty of the state but in this case I haven’t this problem (rank of the controllabilty matrix= 6)

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

I suspect the issue is with stabilizability of the augmented system. Note that the code as posted is checking controllability of the plant, but the LQR solution requires stabilizability of the augmented plant, i.e., the plant combined with the integral control. I think the augmented system (not incuding the reference input) can be formed as

`sysaugmented = series(SYS,ss(zeros(6),eye(6),eye(6),0)); % with SYS.c = eye(6)`

Then the rank of the controllability matrix is

`>> rank(ctrb(sysaugmented)) ans =     9`

So the augmented system is not controllable. The eigenvalues are:

`>> eig(sysaugmented)ans =         0         0         0         0         0         0         0         0         0   -0.6188         0         0`

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

## More from Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.