# dare

Solves the Discrete-time Algebraic Riccati Equations.

## Syntax

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

[X, L, G] = dare(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 discrete-time Riccati equation (n x n).
L
The closed-loop pole vector (n x 1).
G
The gain matrix (p x n).

## Example

Example including the function dare:
A = [4.0 1.7; 0.9 38];
B = [8; 21];
Q = [10, -1];
r = 3;
[X, L, G] = dare(A, B, Q'*Q, r)
X = [Matrix] 2 x 2
1704.70115  -5616.08147
-5616.08147  19597.56409
L = [Matrix] 2 x 1
0.00296
0.02222
G = [Matrix] 1 x 2
-0.01271  2.00364


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

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

Based on the SLICOT library functions SB02OD and SG02AD.