lyap

Solves continuous Lyapunov or Sylvester equations.

Syntax

X = lyap(A, B) % Lyapunov Equation

X = lyap(A, B, C) % Sylvester Equation

X = lyap(A, B, [], E) % Generalized Lyapunov Equation

Inputs

A
Real square matrix.
B
Real matrix.
C
Real matrix.
E
Real matrix.

Outputs

X
Returns the solution to the continuous Lyapunov Equation. X is a real matrix.

Examples

Solve a Lyapunov equation:

A = [10  2;
    -3 -40];

B = [3  10;
     10  1];

X1 = lyap(A, B)
X1 = [Matrix] 2 x 2
-0.22090   0.35448
 0.35448  -0.01409
Solve a Sylvester equation:

A = [5];
B = [40 3;
     4 30];
C = [2 1];

X2 = lyap(A, B, C)
X2 = [Matrix] 1 x 2
-0.04223  -0.02495
Solve a Generalized Continuous Lyapunov equation:

A = [30  1  1;
     1  30  0;
     1  0  20];

E = [1  3  10;
     3  20  0;
     0  1  1];

B = [6.40   73.0   28.0;
     73.0   7.0   25.0;
     28.0   25.0   1.8];

X3 = lyap (A, B, [], E)
X3 = [Matrix] 3 x 3
 4.24365  -0.72106  -0.21641
-0.72106   0.10514  -0.02917
-0.21641  -0.02917   0.03104

Comments

X = lyap(A, B) solves the continuous Lyapunov equation AX + XA' = -B.

X = lyap(A, B, C) solves the Sylvester equation AX + XB = -C.

X = lyap(A, B, [], E) solves the generalized continuous Lyapunov equation AXE' + EXA' = - B.

Based on the SLICOT library functions SB03MD, SB04MD, and SG03AD.