How to solve a 2nd degree equation of matrix ?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
Pretty new with matlab, I'd like to know how to solve a second-degree equation of matrix : P*B0-P²*C=B1 All of the variables are 7*7 matrix, and I'm looking for P.
I used
temp=solve('P*B0-(P^2)*C=B1')
subs(temp)
I get a result, but it's mainly with NaN and Inf. As it shouldn't be the case, I guess my method isn't the right one, but I've no clue how to do it, and google doesn't really help.
So I'm counting on you !
Thanks !
댓글 수: 0
답변 (3개)
Stephan M. H.
2013년 5월 26일
Hi,
Unfortunately you didn't specify what you have and how you defined it but...
the function solve needs symbolic arguments, i.e., you need to create all matrices with the commands sym or syms
The values of B and C matrices should be given to you. The unkown P you could define by (e.g., 2x2 matrix)
syms p1 p2 p3 p4
P_s = sym([p1 p2; p3 p4])
B0_s = sym(B0)
...
Then use
RES = solve(P*B0-P^2*C==B1) % (without '...')
The command subs is only needed if you don't have values for the B and C matrices.
Hope this helps,
Stephan
댓글 수: 0
Tahn
2013년 5월 26일
댓글 수: 1
Stephan M. H.
2013년 5월 27일
I can't help with the first warning, and for the second problem I can only guess what you are writing there in French, but you might want to try
RES.p1
if you used
syms p1 ....
to define everything, p1 etc. still contain only symbolic values. the results is stored in the structure RES
best, Stephan
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!