# gcare

(Not recommended) Generalized solver for continuous-time algebraic Riccati equation

`gcare` is not recommended. Use `icare` instead. For more information, see Compatibility Considerations.

## Syntax

```[X,L,report] = gcare(H,J,ns) [X1,X2,D,L] = gcare(H,...,'factor') ```

## Description

`[X,L,report] = gcare(H,J,ns)` computes the unique stabilizing solution X of the continuous-time algebraic Riccati equation associated with a Hamiltonian pencil of the form

`$H-tJ=\left[\begin{array}{ccc}A& F& S1\\ G& -{A}^{\prime }& -S2\\ S2\prime & S1\prime & R\end{array}\right]-\left[\begin{array}{ccc}E& 0& 0\\ 0& E\prime & 0\\ 0& 0& 0\end{array}\right]$`

The optional input `ns` is the row size of the A matrix. Default values for `J` and `ns` correspond to E = I and R = [ ].

Optionally, `gcare` returns the vector `L` of closed-loop eigenvalues and a diagnosis `report` with value:

• -1 if the Hamiltonian pencil has jw-axis eigenvalues

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

• 0 if a finite stabilizing solution `X` exists

This syntax does not issue any error message when `X` fails to exist.

`[X1,X2,D,L] = gcare(H,...,'factor')` returns two matrices `X1`, `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 Hamiltonian matrix has eigenvalues on the imaginary axis.

## Version History

Introduced before R2006a

collapse all

### R2019a: `gcare` is not recommended

Starting in R2019a, use the `icare` command to solve continuous-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 `gcare`. Furthermore, `icare` includes an optional `info` structure to gather the implicit solution data of the Riccati equation.

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

Not RecommendedRecommended

`[X,L] = gcare(H,J,NS)`

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

```[X,L,report] = gcare(H,J,NS)```

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

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