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
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.
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
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
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
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
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.
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)