# idare

Implicit solver for discrete-time algebraic Riccati equations

## Syntax

``[X,K,L] = idare(A,B,Q,R,S,E)``
``[X,K,L,info] = idare(___)``
``[___] = idare(___,'noscaling')``
``[___] = idare(___,'anti')``

## Description

example

````[X,K,L] = idare(A,B,Q,R,S,E)` computes the unique stabilizing solution `X`, state-feedback gain `K`, and the closed-loop eigenvalues `L` of the following discrete-time algebraic Riccati equation. The stabilizing solution `X` puts all the eigenvalues `L` inside the unit disk.Algebraic Riccati equations play a key role in LQR/LQG control, H2- and H-infinity control, Kalman filtering, and spectral or co-prime factorizations.```

example

````[X,K,L,info] = idare(___)` also returns a structure `info` which contains additional information about the solution to the discrete-time algebraic Riccati equation.```
````[___] = idare(___,'noscaling')` turns off the built-in scaling and sets all entries of the scaling vectors `info.Sx` and `info.Sr` to 1. Turning off scaling speeds up computation but can be detrimental to accuracy when `A,B,Q,R,S,E` are poorly scaled.```

example

````[___] = idare(___,'anti')` computes the anti-stabilizing solution `X` that puts all eigenvalues `L` outside the unit disk.```

## Examples

collapse all

For this example, solve the discrete-time algebraic Riccati equation considering the following set of matrices:

`$A=\left[\begin{array}{cc}-0.9& -3\\ 0.7& 0.1\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}B=\left[\begin{array}{c}1\\ 1\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}Q=\left[\begin{array}{cc}1& 0\\ 0& 3\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}R=0.1.$`

Find the stabilizing solution using `idare` to solve for the above matrices with default values for `S` and `E`.

```A = [-0.9,-0.3;0.7,0.1]; B = [1;1]; Q = [1,0;0,3]; R = 0.1; [X,K,L,info] = idare(A,B,Q,R,[],[])```
```X = 2×2 4.7687 0.9438 0.9438 3.2369 ```
```K = 1×2 -0.2216 -0.1297 ```
```L = 2×1 -0.4460 -0.0027 ```
```info = struct with fields: Sx: [2x1 double] Sr: 1 U: [2x2 double] V: [2x2 double] W: [-0.0232 0.0428] Report: 0 ```

Here, `X` is the unique stabilizing solution, `K` contains the state-feedback gain, `L` contains the closed-loop eigenvalues, while `info` contains additional information about the solution.

For this example, solve the discrete-time algebraic Riccati equation considering the following set of matrices:

`$A=\left[\begin{array}{cc}-0.9& -3\\ 0.7& 0.1\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}B=\left[\begin{array}{c}1\\ 1\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}Q=\left[\begin{array}{cc}1& 0\\ 0& 3\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}R=0.1.$`

Find the anti-stabilizing solution using the `'anti'` option to solve for the above matrices with default values for `S` and `E`.

```A = [-0.9,-0.3;0.7,0.1]; B = [1;1]; Q = [1,0;0,3]; R = 0.1; [X,K,L] = idare(A,B,Q,R,[],[],'anti')```
```X = 2×2 -0.5423 0.4996 0.4996 -0.5569 ```
```K = 1×2 -118.0177 490.9023 ```
```L = 2×1 -371.4426 -2.2420 ```

Here, `X` is the unique anti-stabilizing solution, `K` contains the state-feedback gain, and `L` contains the closed-loop eigenvalues.

## Input Arguments

collapse all

Input matrices, specified as matrices.

The matrices `Q` and `R` must be Hermitian. A square matrix is Hermitian if it is equal to its complex conjugate transpose, that is, ${a}_{i,\text{\hspace{0.17em}}j}={\overline{a}}_{j,\text{\hspace{0.17em}}i}$.

For more information on Hermitian matrices, see `ishermitian`.

Matrix `E` must be non-singular.

When matrices `R`, `S` and `E` are omitted or set to `[]`, `idare` uses the following default values:

• `R = I`

• `S = 0`

• `E = I`

If the inputs `Q` and `R` are scalar-valued, `idare` interprets them as multiples of the identity matrix.

Option to turn off built-in scaling, specified as `'noscaling'`. When you turn off the built-in scaling, `idare` sets all entries in the scaling vectors `info.Sx` and `info.Sr` to 1. Turning off scaling speeds up computation but can be detrimental to accuracy when `A,B,Q,R,S,E` are poorly scaled.

Option to compute the anti-stabilizing solution, specified as `'anti'`. When you enable this option, `idare` computes the anti-stabilizing solution `X` that puts all eigenvalues of `(A-B*K,E)` outside the unit disk.

The unique stabilizing and anti-stabilizing are both needed to know the complete phase portrait of the Riccati differential equations.

## Output Arguments

collapse all

Unique solution to the discrete-time algebraic Riccati equation, returned as a matrix.

By default, `X` is the stabilizing solution of the discrete-time algebraic Riccati equation. When the `'anti'` option is used, `X` is the anti-stabilizing solution.

`idare` returns `[]` for `X` when there is no finite stabilizing solution.

State-feedback gain, returned as a matrix.

The state-feedback gain `K` is computed as:

`idare` returns `[]` for `K` when there is no finite stabilizing solution.

Closed-loop eigenvalues, returned as a matrix.

The closed-loop eigenvalues `L` is computed as:

`idare` returns `[]` for `X` and `K` when there is no finite stabilizing solution. `L` is non-empty even when `X` and `K` are empty matrices.

Information about the unique solution, returned as a structure with the following fields:

• `Sx` — Vector of values used to scale the states.

• `Sr` — Vector of values used to scale the `R` matrix.

• `U`, `V` and `W` — Vectors of values representing the basis of the stable invariant subspace of the associated scaled matrix pencil. For more information, see Algorithms.

• `Report` — A scalar with one of the following values:

• `0` — The unique solution is accurate.

• `1` — The solution accuracy is poor.

• `2` — The solution is not finite.

• `3` — No solution found since the Symplectic spectrum, denoted by `[L;1./L]`, has eigenvalues on the unit circle.

## Limitations

• `(A-zE,B)` must be stabilizable, `E` and `R` must be invertible, and `[B;S;R]` have full column rank for a finite stabilizing solution `X` to exist and be finite. While these conditions are not sufficient in general, they become sufficient when the following conditions are met:

• $\left[\begin{array}{cc}A-B{R}^{-1}{S}^{T}& Q-S{R}^{-1}{S}^{T}\end{array}\right]$ is detectible

## Algorithms

Basis of the invariant subspace

`idare` works with the following pencil, and computes a basis `[U;V;W]` of the invariant subspace associated with the stable or anti-stable finite eigenvalues of this pencil.

The data is automatically scaled to reduce the sensitivity of eigenvalues near the unit circle and increase separation between the stable and anti-stable invariant subspaces.

Relationship between the solution, the state-feedback gain, and the scaling vectors

The solution `X` and state-feedback gain `K` are related to the scaling vectors, and `U,V,W` by the following set of equations:

where,

## Version History

Introduced in R2019a