How can invert a complex matrix?!
조회 수: 19 (최근 30일)
이전 댓글 표시
Hi, I did use this syntax but for complex numbers it didn't work correctly: "inverseK=inv(K)" what is the correct form of syntax for inverting a complex matrix?!
댓글 수: 0
답변 (1개)
James Tursa
2015년 5월 18일
편집: James Tursa
2015년 5월 18일
The inv function works for complex matrices as well as real matrices. What do you mean by "didn't work correctly"? Did you get an error or warning message (if so, please post it)? Did the inverse * original not exactly equal the identity (which is the natural result of floating point arithmetic and NOT an error btw)? Or what?
Is there a specific reason you are using inv instead of e.g. slash (/) or backslash (\) or svd etc for the problem you are solving?
E.g.,
>> a = [1 2;3 4] + [5 6;7 8]*1i
a =
Column 1
1 + 5i
3 + 7i
Column 2
2 + 6i
4 + 8i
>> inva = inv(a)
inva =
Column 1
-2 + 1i
1.75 - 0.75i
Column 2
1.5 - 0.5i
-1.25 + 0.25i
>> a*inva
ans =
0.999999999999999 4.44089209850063e-16
-8.88178419700125e-16 1
>> inva*a
ans =
Column 1
1 + 4.44089209850063e-16i
0 - 2.22044604925031e-16i
Column 2
0 + 2.22044604925031e-16i
1 - 2.22044604925031e-16i
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!