# lyap

## 语法

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

## 说明

`lyap ` 求解李雅普诺夫方程的特殊形式和一般形式。李雅普诺夫方程出现在多个控制领域，包括系统的稳定性理论和 RMS 行为研究。

`X = lyap(A,Q) ` 求解李雅普诺夫方程

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

`X = lyap(A,B,C) ` 求解西尔维斯特方程

`$AX+XB+C=0$`

`X = lyap(A,Q,[],E)` 求解广义李雅普诺夫方程

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

## 限制

`${\alpha }_{i}+{\beta }_{j}\ne 0$`

```Solution does not exist or is not unique. ```

## 示例

### 示例 1

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

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

A 矩阵是稳定矩阵，Q 矩阵是正定矩阵。

```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)`

```ans = 0.4359 8.7308```

### 示例 2

`$AX+XB+C=0$`

`$A=5\text{ }\text{ }B=\left[\begin{array}{cc}4& 3\\ 4& 3\end{array}\right]\text{ }\text{ }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)```

```X = -0.2000 -0.0500```

## 算法

`lyap` 对李雅普诺夫方程使用 SLICOT 例程 SB03MD 和 SG03AD，对西尔维斯特方程使用 SB04MD (SLICOT) 和 ZTRSYL (LAPACK)。

## 参考

[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.