How to use lqr for R=0?

I try to get a lqr controller with R=0, and the command lqr does not let me.
How do I plan an lqr controller for R=0 in matlab?

 Accepted Answer

Sam Chak
Sam Chak on 21 Mar 2024
Why would you want to set the input-weighted matrix R to zero?
If you set R to zero in the LQR control gain design, it means that you are assigning zero importance to the control effort in the cost function. In this case, the LQR control algorithm will mainly focus on minimizing the state error (based on the weight matrix Q) while disregarding the control effort.
Practically, setting R = 0 implies that the control gain matrix K will not have any contribution from the control input term. Consequently, the gain matrix K may become infinitely large to drive the state error to zero in a split second. This makes the tuning process becomes impractical.

4 Comments

I need to do it for homework.
Alright @tevel hedi, please provide the homework question so that we can fully understand the requirements for solving the problem. Setting R to zero will lead to the following error message:
Error using ss/lqr
Cannot compute the stabilizing Riccati solution S for the LQR design.
This could be because:
* (A,E) has imaginary-axis or unit-circle modes that are not controllable through B,
* R is not positive definite,
* [Q N;N' R] is indefinite,
* The E matrix in the state equation is singular.
To overcome this, you can try using the 'eps' trick. This involves setting R to a very small positive definite value. The 'eps' value represents the smallest positive double-precision number that is greater than zero (0). But as explained previously, expect the gain matrix K to be very large. 😉
sys = ss([0 1; -1 -2], [0; 1], [1 0], 0);
Q = eye(2);
R = eps % smallest positive double-precision number
R = 2.2204e-16
K = lqr(sys, Q, R)
K = 1x2
1.0e+07 * 6.7109 6.7109
Yes that is great! Thank you so much!
I'm glad to hear that the solution worked. If you found the 'eps' trick helpful in solving your LQR problem, please consider clicking 'Accept' ✔️ on the answer and voting 👍 for it.

Sign in to comment.

More Answers (0)

Tags

Asked:

on 21 Mar 2024

Commented:

on 22 Mar 2024

Community Treasure Hunt

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

Start Hunting!