0
votes

I have H and G and Am matrix. All are 4x4. Both H and G are symmetrical and next equation: HAm+AmH=-G. How can I solve this in matlab? Am I right about this: 2HAm=-G and 2AmH=-G?

But when I use H=linsolve(Am,-G/2) gives me nonsymmetrical matrix

H=linsolve(Am,-G/2)
1
Can you provide values of H, G and Am? Also AxB is not equal BxA - madbitloman
You should note that matrix multiplication is not commutative: en.wikipedia.org/wiki/…. AB is usually not the same as BA, so combining the terms above like you see in your post is not valid matrix mathematics. Also using linsolve assumes that your problem is of the form AX = B. X is implicitly a N x 1 matrix. If you're saying that H is 4 x 4, then you can't use linsolve. Please update your problem to include more information. This is unsolvable in its current state. - rayryeng
It's a special kind of equation and called Lyapunov' equation.(see Control System). You can solve it use function lyap() in matlab. See more in help. - Robert
Have you resolved your problem? This question is strange since you seem to have found an answer (use lyap) but in the original post you use linsolve and suggest that you don't really understand the required linear algebra manipulations? - Buck Thorn
You may want to check wikipedia lyapunov as well unless you want to use the matlab function lyap() which would be recommended. - patrik

1 Answers

0
votes

use syms if variable Y is not known

for example:

 syms y
 solve(2*y-4==0)

 ans= 2

to specify the matrix eq you should define the size of y:

 y=sym('y',[2,1]);
 A=[1 0;0 1];
 c=[1;2];
 z=[0;0];
 B=solve(A*y-c==z);

B is a structure which stores value of y1 and y2

 B.y1
 ans= 
      1

for this question:

H=sym('H',[4,4]);
B=solve(H*Am+Am*H==G)
B.H11 % to retrieve H11