How to get output results when using the lqr command in matlab

10 visualizzazioni (ultimi 30 giorni)
I have a linear system where A is 3 x 3 and B is 3 x 1.
Ak = 1 6.7514e-15 -2.6163e-15
-0.0075042 1 -0.027778
1.4838 0.0096057 0.9984
Bk = -3.4564e-16
29.996
-3.3325
I want to use the lqr command to generate optimal K gains, but when I look at the rank of the controllability matrix, it is only 2:
cont_matrix = ctrb(Ak, Bk);
controllability_rank = rank(cont_matrix);
Size of the controllability matrix for matrices A and B:
3 3
Rank of controllability matrix for matrices A and B:
2
--> I "think" the rank of the controllability matrix needs to be 3, if I want the system to be controllable (is this correct?).
I have also picked simple Q and R matrices for now:
temp_vector_v = ones(size(Ak,1),1);
Qk = diag(temp_vector_v);
Rk = 1;
As a result of the above, when I use the lqr command, I get the following error:
lqr(Ak, Bk, Qk, Rk);
Error using lqr (line 42)
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 have seen this error discussed before on the forums. What are some things I can do to try and get Matlab to generate optimal K gains using the lqr function, instead of throwing this error?

Risposta accettata

Shrey Tripathi
Shrey Tripathi il 14 Giu 2023
You are correct: to ensure that a system is controllable, the controllability matrix should have a full rank equivalent to the number of states. However, in this situation, with a controllability matrix rank of 2, the system is not entirely controllable. In other words, some states can't be directly controlled using the input (i.e., Bk).
One potential remedy would be to reconfigure the system such that it becomes fully controllable. This could involve incorporating additional inputs (controls) or modifying the system's dynamics. However, that approach might not always be viable or desirable.
Since the system isn't completely controllable in this case, you can't use the LQR command directly to obtain optimal K gains. Instead, you can use the DLQR command, which is suitable for discrete-time systems and offers partial controllability. The following block of code exemplifies this approach:
[K,~,~] = dlqr(Ak,Bk,Qk,Rk);
The output K matrix will contain optimal gain values for states that can be directly controlled using the input. It's worth noting that the DLQR command relies on discrete-time system matrices Ak and Bk, which means you should make sure these matrices represent the continuous-time system's discrete-time version.
Alternatively, you may wish to employ other control methods that are better suited for partially controllable systems, such as pole placement or observer-based control.

Più risposte (1)

richard
richard il 14 Giu 2023
The dlqr command worked - thank you!
Also, I have researched that although my system is not "controllable" (controllability matrix rank is less than the number of states I have), it can still be "stabilizable", which could be useful.

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by