# control.matlab.lqr¶

control.matlab.lqr(A, B, Q, R[, N])

The lqr() function computes the optimal state feedback controller that minimizes the quadratic cost

The function can be called with either 3, 4, or 5 arguments:

• lqr(sys, Q, R)
• lqr(sys, Q, R, N)
• lqr(A, B, Q, R)
• lqr(A, B, Q, R, N)

where sys is an LTI object, and A, B, Q, R, and N are 2d arrays or matrices of appropriate dimension.

Parameters: B (A,) – Dynamics and input matrices sys (LTI (StateSpace or TransferFunction)) – Linear I/O system R (Q,) – State and input weight matrices N (2-d array, optional) – Cross weight matrix K (2D array) – State feedback gains S (2D array) – Solution to Riccati equation E (1D array) – Eigenvalues of the closed loop system

Examples

>>> K, S, E = lqr(sys, Q, R, [N])
>>> K, S, E = lqr(A, B, Q, R, [N])


lqe()