lqr
Linear-Quadratic Regulator (LQR) design.
📝Syntax
[K, S, P] = lqr(sys, Q, R, N)
[K, S, P] = lqr(A, B, Q, R, N)
📥Input Arguments
Parameter Description
sys LTI model
Q State-cost weighted matrix
R Input-cost weighted matrix
N Optional cross term matrix: 0 by default.
A State matrix: n x n matrix.
B Input-to-state matrix: n x m matrix.
📤Output Arguments
Parameter Description
K Optimal gain: row vector.
S Solution of the Algebraic Riccati Equation.
p Poles of the closed-loop system: column vector.
📄Description

In the context of continuous-time state-space matrices A and B, the command [K, S, P] = lqr(A, B, Q, R, N) computes the optimal gain matrix K, the solution S to the associated algebraic Riccati equation, and the closed-loop poles P.

This syntax is applicable exclusively to continuous-time models.

When applied to a continuous-time or discrete-time state-space model represented by sys, the command [K, S, P] = lqr(sys, Q, R, N) computes the optimal gain matrix K, the solution S to the associated algebraic Riccati equation, and the closed-loop poles P.

The weight matrices Q and R govern the importance of states and inputs, and the cross term matrix N is zero by default when not specified.

💡Examples
A = [-0.313 56.7 0; -0.0139 -0.426 0; 0 56.7 0];
B = [0.232; 0.0203; 0];
C = [0 0 1];
D = 1;
Ts = 1.2;
sys1 = ss(A, B, C, D, Ts);
sys2 = ss(A, B, C, D);

P = 2;
Q = P * C' * C;
R = 2;
[K1, S1, e1] = lqr(sys1, Q, R)
[K2, S2, e2] = lqr(sys2, Q, R)
🔗See Also
caredarelqe
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub