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

Linear quadratic regulator design

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

J = \int_0^\infty (x' Q x + u' R u + 2 x' N u) dt

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.

  • 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


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

See also