lqr

Linear-Quadratic Regulator (LQR) design

Syntax

[K,S,e] = lqr(SYS,Q,R,N)
[K,S,e] = LQR(A,B,Q,R,N)

Description

[K,S,e] = lqr(SYS,Q,R,N) calculates the optimal gain matrix K.

For a continuous time system, the state-feedback law u = –Kx minimizes the quadratic cost function

J(u)=0(xTQx+uTRu+2xTNu)dt

subject to the system dynamics

x˙=Ax+Bu.

In addition to the state-feedback gain K, lqr returns the solution S of the associated Riccati equation

ATS+SA(SB+N)R1(BTS+NT)+Q=0

and the closed-loop eigenvalues e = eig(A-B*K). K is derived from S using

K=R1(BTS+NT).

For a discrete-time state-space model, u[n] = –Kx[n] minimizes

J=n=0{xTQx+uTRu+2xTNu}

subject to x[n + 1] = Ax[n] + Bu[n].

[K,S,e] = LQR(A,B,Q,R,N) is an equivalent syntax for continuous-time models with dynamics x˙=Ax+Bu.

In all cases, when you omit the matrix N, N is set to 0.

Limitations

The problem data must satisfy:

  • The pair (A,B) is stabilizable.

  • R > 0 and QNR1NT0.

  • (QNR1NT,ABR1NT) has no unobservable mode on the imaginary axis (or unit circle in discrete time).

Tips

lqr supports descriptor models with nonsingular E. The output S of lqr is the solution of the Riccati equation for the equivalent explicit state-space model:

dxdt=E1Ax+E1Bu

See Also

| | | | |

Introduced before R2006a