Continuous Lyapunov equation solution

`lyap `

X = lyap(A,Q)

X = lyap(A,B,C)

X = lyap(A,Q,[],E)

`lyap `

solves the special
and general forms of the Lyapunov equation. Lyapunov equations arise
in several areas of control, including stability theory and the study
of the RMS behavior of systems.

`X = lyap(A,Q) `

solves the
Lyapunov equation

$$AX+X{A}^{T}+Q=0$$

where *A* and *Q* represent
square matrices of identical sizes. If *Q* is a symmetric
matrix, the solution `X`

is also a symmetric matrix.

`X = lyap(A,B,C) `

solves
the Sylvester equation

$$AX+XB+C=0$$

The matrices `A`

, `B`

, and `C`

must
have compatible dimensions but need not be square.

`X = lyap(A,Q,[],E)`

solves the generalized
Lyapunov equation

$$AX{E}^{T}+EX{A}^{T}+Q=0$$

where *Q* is a symmetric matrix. You must use
empty square brackets `[]`

for this function. If
you place any values inside the brackets, the function errors out.

The continuous Lyapunov equation has a unique solution if the
eigenvalues $${\alpha}_{1},{\alpha}_{2},\mathrm{...},{\alpha}_{n}$$ of *A* and $${\beta}_{1},{\beta}_{2},\mathrm{...},{\beta}_{n}$$ of *B* satisfy

$${\alpha}_{i}+{\beta}_{j}\ne 0\text{\hspace{1em}}for\text{\hspace{0.17em}}all\text{\hspace{0.17em}}pairs\text{\hspace{0.17em}}(i,j)$$

If this condition is violated, `lyap`

produces
the error message:

Solution does not exist or is not unique.

**Solve Lyapunov Equation**

Solve the Lyapunov equation

$$AX+X{A}^{T}+Q=0$$

where

$$A=\left[\begin{array}{cc}1& 2\\ -3& -4\end{array}\right]\text{\hspace{1em}}\text{\hspace{1em}}Q=\left[\begin{array}{cc}3& 1\\ 1& 1\end{array}\right]$$

The *A* matrix is stable, and the *Q* matrix
is positive definite.

A = [1 2; -3 -4]; Q = [3 1; 1 1]; X = lyap(A,Q)

X = 6.1667 -3.8333 -3.8333 3.0000

eig(X)

The command returns the following result:

ans = 0.4359 8.7308

**Solve Sylvester Equation**

Solve the Sylvester equation

$$AX+XB+C=0$$

where

$$A=5\text{\hspace{1em}}\text{\hspace{1em}}B=\left[\begin{array}{cc}4& 3\\ 4& 3\end{array}\right]\text{\hspace{1em}}\text{\hspace{1em}}C=\left[\begin{array}{cc}2& 1\end{array}\right]$$

A = 5; B = [4 3; 4 3]; C = [2 1]; X = lyap(A,B,C)

These commands return the following *X* matrix:

X = -0.2000 -0.0500

`lyap`

uses SLICOT routines SB03MD and SG03AD
for Lyapunov equations and SB04MD (SLICOT) and ZTRSYL (LAPACK) for
Sylvester equations.

[1] Bartels, R.H. and G.W. Stewart, "Solution
of the Matrix Equation AX + XB = C," *Comm. of the ACM*,
Vol. 15, No. 9, 1972.

[2] Barraud, A.Y., “A numerical algorithm
to solve A XA - X = Q,” *IEEE ^{®} Trans. Auto. Contr.*,
AC-22, pp. 883–885, 1977.

[3] Hammarling, S.J., “Numerical solution
of the stable, non-negative definite Lyapunov equation,” *IMA
J. Num. Anal.*, Vol. 2, pp. 303–325, 1982.

[4] Penzl, T., ”Numerical solution of
generalized Lyapunov equations,” *Advances in Comp.
Math.*, Vol. 8, pp. 33–48, 1998.

[5] Golub, G.H., Nash, S. and Van Loan, C.F.,
“A Hessenberg-Schur method for the problem AX + XB = C,”* IEEE Trans.
Auto. Contr.*, AC-24, pp. 909–913, 1979.