%% 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)

% The result is a 3-by-3 matrix.
% Copyright 2012 The MathWorks, Inc.