How do I solve the Sylvester equation AX+XB=Q in MATLAB?

18 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
There are three ways to do this in MATLAB:
1. Starting with R2014a, the sylvester function for solving this kind of problem is contained within base MATLAB.
2. The Sylvester equation is a special form of the Lyapunov equation. The LYAP function in Control Systems Toolbox solves the Lyapunov equation and therefore can be used to solve the Sylvester equation.
3. Alternatively, It is also possible to rearrange the equation in a linear form using the KRON function as follows:
AX + XB + Q = 0 is equivalent to the linear equation:
(KRON(I, A)+KRON(B',I))x: = -q:
where x: and q: contain the concatenated columns of X and Q.
The following lines of code provides an example in MATLAB:
A=[1 1;2 3];
B=[1 2;3 4];
Q=[1 3;1 1];
K=kron(eye(2),A)+kron(B',eye(2));
Qb=reshape(Q,4,1);
X=K\-Qb;
X=reshape(X,2,2)
X2 = lyap(A,B,Q)

More Answers (0)

Categories

Find more on Matrix Computations in Help Center and File Exchange

Products


Release

R2006b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!