# care

Solves the continuous-time Algebraic Riccati Equation.

## Syntax

[X, L, G] = care(A, B, Q)

[X, L, G] = care(A, B, Q, R)

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

## Inputs

`A`- The state matrix (n x n), where n is the number of states.
`B`- The control matrix (n x p), where p is the number of inputs.
`Q`- The state cost matrix (n x n).
`R`- The control cost matrix (p x p).
`S`- Optional real matrix (n x p).
`E`- The descriptor matrix (n x n).

## Outputs

- X
- The unique stabilized solution of the Riccati equation (n x n) in continuous time.
- 1
- The closed-loop pole vector (n x 1).
- g
- The gain matrix (p x n).

## Example

```
A = [-15 1; 0.5 5];
B = [0; 5];
Q = [5, -0.5];
r = 1.5;
[X, L, G] = care(A, B, Q'*Q, r)
```

`X = [Matrix] 2 x 2
0.82854 -0.06766
-0.06766 0.61126
L = [Matrix] 2 x 1
-15.16316
-5.02446
G = [Matrix] 1 x 2
-0.22552 2.03752`

## Comments

[X, L, G] = care(A, B, Q) solves the continuous-time algebraic Riccati equation.

[X, L, G] = care(A, B, Q, R, S, E) solves the general continuous-time Riccati equation.

Based on the SLICOT library functions SB02OD and SG02AD.