dlqr
Linear-quadratic regulator for a discrete-time model.
Syntax
[K, S, L] = dlqr(A, B, Q, R)
[K, S, L] = dlqr(A, B, Q, R, N)
Inputs
- A
 - The state matrix (n x n), where n is the number of states.
 - B
 - The input matrix (n x p), where p is the number of inputs.
 - Q
 - The state weighting matrix (n x n), which is symmetric positive semi-definite.
 - R
 - The input weighting matrix (p x p), which is symmetric positive definite.
 - N
 - The state/input cross product weighting matrix, such that Q - N*inv(R)*N' is positive semi-definite.
 
Outputs
- K
 - The feedback gain matrix.
 - S
 - The solution of the Discrete Algebraic Riccati Equation.
 - L
 - The closed-loop pole locations, which are the eigenvalues of the matrix A-BK.
 
Example
A = [9, 0.2; 0, 8];
B = [0; 1];
Q = [2, 1; 1, 2];
R = 1;
[K, X, L] = dlqr(A, B, Q, R)
        K = [Matrix] 1 x 2
394.61003  16.76761
X = [Matrix] 2 x 2
1.04036e+07  2.34349e+05
2.34349e+05  5.34387e+03
L = [Matrix] 2 x 1
0.11073
0.12166Comments
Output K minimizes a quadratic cost function for a linear state-space system model.