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)
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
So at least two of the uncontrollable modes are on the imaginary axis, which (I think) means the augmented system is not stabilizable, which violates one of the conditions for the solution to exist as stated here:
doc lqi
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.