Documentation

### This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# lqrd

Design discrete linear-quadratic (LQ) regulator for continuous plant

## Syntax

```lqrd [Kd,S,e] = lqrd(A,B,Q,R,Ts) [Kd,S,e] = lqrd(A,B,Q,R,N,Ts) ```

## Description

`lqrd ` designs a discrete full-state-feedback regulator that has response characteristics similar to a continuous state-feedback regulator designed using `lqr`. This command is useful to design a gain matrix for digital implementation after a satisfactory continuous state-feedback gain has been designed.

`[Kd,S,e] = lqrd(A,B,Q,R,Ts) ` calculates the discrete state-feedback law

`$u\left[n\right]=-{K}_{d}x\left[n\right]$`

that minimizes a discrete cost function equivalent to the continuous cost function

`$J={\int }_{0}^{\infty }\left({x}^{T}Qx+{u}^{T}Ru\right)dt$`

The matrices `A` and `B` specify the continuous plant dynamics

`$\stackrel{˙}{x}=Ax+Bu$`

and `Ts` specifies the sample time of the discrete regulator. Also returned are the solution `S` of the discrete Riccati equation for the discretized problem and the discrete closed-loop eigenvalues` e = eig(Ad-Bd*Kd)`.

`[Kd,S,e] = lqrd(A,B,Q,R,N,Ts) ` solves the more general problem with a cross-coupling term in the cost function.

`$J={\int }_{0}^{\infty }\left({x}^{T}Qx+{u}^{T}Ru+2{x}^{T}Nu\right)dt$`

## Limitations

The discretized problem data should meet the requirements for `dlqr`.

## Algorithms

The equivalent discrete gain matrix `Kd` is determined by discretizing the continuous plant and weighting matrices using the sample time `Ts` and the zero-order hold approximation.

With the notation

`$\begin{array}{cc}\Phi \left(\tau \right)={e}^{A\tau },& {A}_{d}=\Phi \left({T}_{s}\right)\\ \Gamma \left(\tau \right)={\int }_{0}^{\tau }{e}^{A\eta }Bd\eta ,& {B}_{d}=\Gamma \left({T}_{s}\right)\end{array}$`

the discretized plant has equations

`$x\left[n+1\right]={A}_{d}x\left[n\right]+{B}_{d}u\left[n\right]$`

and the weighting matrices for the equivalent discrete cost function are

`$\left[\begin{array}{cc}{Q}_{d}& {N}_{d}\\ {N}_{d}^{T}& {R}_{d}\end{array}\right]={\int }_{0}^{{T}_{s}}\left[\begin{array}{cc}{\Phi }^{T}\left(\tau \right)& 0\\ {\Gamma }^{T}\left(\tau \right)& I\end{array}\right]\left[\begin{array}{cc}Q& N\\ {N}^{T}& R\end{array}\right]\left[\begin{array}{cc}\Phi \left(\tau \right)& \Gamma \left(\tau \right)\\ 0& I\end{array}\right]d\tau$`

The integrals are computed using matrix exponential formulas due to Van Loan (see ). The plant is discretized using `c2d` and the gain matrix is computed from the discretized data using `dlqr`.

## References

 Franklin, G.F., J.D. Powell, and M.L. Workman, Digital Control of Dynamic Systems, Second Edition, Addison-Wesley, 1980, pp. 439-440.

 Van Loan, C.F., "Computing Integrals Involving the Matrix Exponential," IEEE® Trans. Automatic Control, AC-23, June 1978.

## See Also

#### Learn how to automatically tune PID controller gains

Download code examples