Main Content


Solve discrete-time Lyapunov equations


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


X = dlyap(A,Q) solves the discrete-time Lyapunov equation AXATX + Q = 0,

where A and Q are n-by-n matrices.

The solution X is symmetric when Q is symmetric, and positive definite when Q is positive definite and A has all its eigenvalues inside the unit disk.

X = dlyap(A,B,C) solves the Sylvester equation AXBX + C = 0,

where A, B, and C must have compatible dimensions but need not be square.

X = dlyap(A,Q,[],E) solves the generalized discrete-time Lyapunov equation AXATEXET + Q = 0,

where Q is a symmetric matrix. The empty square brackets, [], are mandatory. If you place any values inside them, the function will error out.


The discrete-time Lyapunov equation has a (unique) solution if the eigenvalues α1, α2, …, αN of A satisfy αiαj ≠ 1 for all (i, j).

If this condition is violated, dlyap produces the error message

Solution does not exist or is not unique.


dlyap uses SLICOT routines SB03MD and SG03AD for Lyapunov equations and SB04QD (SLICOT) for Sylvester equations.


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

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

[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] Higham, N.J., ”FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation,” A.C.M. Trans. Math. Soft., Vol. 14, No. 4, pp. 381-396, 1988.

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

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

[7] Sima, V. C, “Algorithms for Linear-quadratic Optimization,” Marcel Dekker, Inc., New York, 1996.

Version History

Introduced before R2006a

See Also