I have a 4x4 matrix given and I have to solve this lyapnov equation and find the unknown matrix which satisfies the below equation .
a = [0 1 0 0;0 0 -1 0;0 0 0 1;0 0 5 0];
f = [-1 1 0 0;-1 -1 0 0;0 0 -1.5 0.5;0 0 -0.5 -1.5];
b = [0;1;0;-2];
k = [1 0 1 0];
The equation is given at - tf = bk.
a*t - t*f = b*k ;
where t = 4x4 unknown matrix . Can you help me find matrix t ?
You could also use symbolic math to create a system of linear equation and then solve this system:
% Your variables
a = [0 1 0 0;0 0 -1 0;0 0 0 1;0 0 5 0];
f = [-1 1 0 0;-1 -1 0 0;0 0 -1.5 0.5;0 0 -0.5 -1.5];
b = [0;1;0;-2];
k = [1 0 1 0];
% The unknows:
t = sym('t', [4 4]);
% Create the symbolic system of linear equation
eq = a*t - t*f == b*k;
% Equation to matrix
[A,b] = equationsToMatrix(eq);
% Solve the system and get a numeric solution
sol = double(reshape(A\b,[4,4])).'
% sol =
%
% 0.0690 -0.3276 -0.0853 -0.1973
% 0.2586 0.3966 0.2267 0.2533
% -0.3448 0.1379 -0.5333 0.2667
% 0.2069 -0.4828 0.6667 -0.6667
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With