How can invert a complex matrix?!
Afficher commentaires plus anciens
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?!
Réponses (1)
James Tursa
le 18 Mai 2015
Modifié(e) : James Tursa
le 18 Mai 2015
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
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!