sylvester
Solve Sylvester equation AX + XB = C for X
Syntax
Description
returns
the solution, X
= sylvester(A,B,C
)X
, to the Sylvester equation.
Input A
is an m-by-m matrix, input B
is
an n-by-n matrix, and both C
and X
are
m-by-n matrices.
Examples
Solve Sylvester Equation with 3-by-3 Output
Create the coefficient matrices A
and B
.
A = [1 -1 1; 1 1 -1; 1 1 1]; B = magic(3);
Define C
as the 3-by-3 identity matrix.
C = eye(3);
Use the sylvester
function to solve the Sylvester equation for these values of A
, B
, and C
.
X = sylvester(A,B,C)
X = 3×3
0.1223 -0.0725 0.0131
-0.0806 -0.0161 0.1587
-0.0164 0.1784 -0.1072
The result is a 3-by-3 matrix.
Solve Sylvester Equation with 4-by-2 Output
Create a 4-by-4 coefficient matrix, A
, and 2-by-2 coefficient matrix, B
.
A = [1 0 2 3; 4 1 0 2; 0 5 5 6; 1 7 9 0]; B = [0 -1; 1 0];
Define C
as a 4-by-2 matrix to match the corresponding sizes of A
and B
.
C = [1 0; 2 0; 0 3; 1 1]
C = 4×2
1 0
2 0
0 3
1 1
Use the sylvester
function to solve the Sylvester equation for these values of A
, B
, and C
.
X = sylvester(A,B,C)
X = 4×2
0.4732 -0.3664
-0.4006 0.3531
0.3305 -0.1142
0.0774 0.3560
The result is a 4-by-2 matrix.
Input Arguments
A,B,C
— Input matrices
matrices
Input matrices, specified as matrices. Input A
is
an m-by-m square matrix, input B
is an n-by-n square
matrix, and input C
is an m-by-n rectangular matrix.
The function returns an error if any input matrix is sparse.
Data Types: single
| double
Complex Number Support: Yes
Output Arguments
X
— Solution
matrix
Solution, returned as a matrix of the same size as C
.
The function returns an error if the eigenvalues of A
and -B
are
not distinct (in this case, the solution, X
, is
singular or not unique).
More About
Sylvester Equation
The Sylvester equation is
The equation has a unique solution when the eigenvalues of A
and -B
are
distinct. In terms of the Kronecker tensor product, ,
the equation is
where I
is the identity matrix, and X(:)
and C(:)
denote
the matrices X
and C
as single
column vectors.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
When either of the two input matrices
A
orB
contain a nonfinite value, the generated code does not issue an error. Instead, the output contains NaN values.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2014a
See Also
ctranspose
| kron
| eig
| mtimes
| mldivide
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)