You can use the function lyap to compute the solution to the Lyapunov equation. See the following example:
A = [0 1 0; -1 -2 0; 0 1 -1]
D = 2*eye(3)
X = lyap(A, D)
A*X + X*A' % check: should be the same as –D
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!