# dare

(Not recommended) Solve discrete-time algebraic Riccati equations (DAREs)

`dare` is not recommended. Use `idare` instead. For more information, see Compatibility Considerations.

## Syntax

```[X,L,G] = dare(A,B,Q,R) [X,L,G] = dare(A,B,Q,R,S,E) [X,L,G,report] = dare(A,B,Q,...) [X1,X2,L,report] = dare(A,B,Q,...,'factor') ```

## Description

`[X,L,G] = dare(A,B,Q,R) ` computes the unique stabilizing solution `X` of the discrete-time algebraic Riccati equation

`${A}^{T}XA-X-{A}^{T}XB{\left({B}^{T}XB+R\right)}^{-1}{B}^{T}XA+Q=0$`

The `dare` function also returns the gain matrix, $G={\left({B}^{T}XB+R\right)}^{-1}{B}^{T}XA$, and the vector `L` of closed loop eigenvalues, where

```L=eig(A-B*G,E) ```

`[X,L,G] = dare(A,B,Q,R,S,E) ` solves the more general discrete-time algebraic Riccati equation,

`${A}^{T}XA-{E}^{T}XE-\left({A}^{T}XB+S\right){\left({B}^{T}XB+R\right)}^{-1}\left({B}^{T}XA+{S}^{T}\right)+Q=0$`

or, equivalently, if `R` is nonsingular,

`${E}^{T}XE={F}^{T}XF-{F}^{T}XB{\left({B}^{T}XB+R\right)}^{-1}{B}^{T}XF+Q-S{R}^{-1}{S}^{T}$`

where $F=A-B{R}^{-1}{S}^{T}$. When omitted, `R`, `S`, and `E` are set to the default values `R=I`, `S=0`, and `E=I`.

The `dare` function returns the corresponding gain matrix $G={\left({B}^{T}XB+R\right)}^{-1}\left({B}^{T}XA+{S}^{T}\right)$

and a vector `L` of closed-loop eigenvalues, where

```L= eig(A-B*G,E) ```

`[X,L,G,report] = dare(A,B,Q,...)` returns a diagnosis `report` with value:

• -`1 `when the associated symplectic pencil has eigenvalues on or very near the unit circle

• -`2 `when there is no finite stabilizing solution `X`

• The Frobenius norm if `X` exists and is finite

`[X1,X2,L,report] = dare(A,B,Q,...,'factor')` returns two matrices, `X1` and `X2`, and a diagonal scaling matrix D such that `X = D*(X2/X1)*D`. The vector L contains the closed-loop eigenvalues. All outputs are empty when the associated Symplectic matrix has eigenvalues on the unit circle.

## Limitations

The (A, B) pair must be stabilizable (that is, all eigenvalues of A outside the unit disk must be controllable). In addition, the associated symplectic pencil must have no eigenvalue on the unit circle. Sufficient conditions for this to hold are (Q, A) detectable when S = 0 and R > 0, or

`$\left[\begin{array}{cc}Q& S\\ {S}^{T}& R\end{array}\right]>0$`

## Algorithms

`dare` implements the algorithms described in [1]. It uses the QZ algorithm to deflate the extended symplectic pencil and compute its stable invariant subspace.

## References

[1] Arnold, W.F., III and A.J. Laub, "Generalized Eigenproblem Algorithms and Software for Algebraic Riccati Equations," Proc. IEEE®, 72 (1984), pp. 1746-1754.

## Version History

Introduced before R2006a

collapse all

### R2019a: `dare` not recommended

Starting in R2019a, use the `idare` command to solve discrete-time Riccati equations. This approach has improved accuracy through better scaling and the computation of `K` is more accurate when `R` is ill-conditioned relative to `dare`. Furthermore, `idare` includes an optional `info` structure to gather the implicit solution data of the Riccati equation.

The following table shows some typical uses of `dare` and how to update your code to use `idare` instead.

Not RecommendedRecommended

```[X,L,G] = dare(A,B,Q,R,S,E)```

`[X,K,L] = idare(A,B,Q,R,S,E)` computes the stabilizing solution `X`, the state-feedback gain `K` and the closed-loop eigenvalues `L` of the discrete-time algebraic Riccati equation. For more information, see `idare`.

```[X,L,G,report] = dare(A,B,Q,R,S,E)```

`[X,K,L,info] = idare(A,B,Q,R,S,E)` computes the stabilizing solution `X`, the state-feedback gain `K`, the closed-loop eigenvalues `L` of the discrete-time algebraic Riccati equation. The `info` structure contains the implicit solution data. For more information, see `idare`.

There are no plans to remove `dare` at this time.