inverse of complex matrix
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ben Marinberg
am 27 Aug. 2020
Kommentiert: Stephen23
am 31 Aug. 2020
I'm trying to invert a complex matrix using inv() function.
turns out A*inv(A)≠I and inv(A)*A≠I .
Of course I'm aware of precision errors, but here I got elements greater than 100 off the main diagonal.
Is there any reason for that?
1 Kommentar
Stephen23
am 27 Aug. 2020
"Is there any reason for that?"
Matrix inversion is inhernently numeric unstable. It is also seldom required:
Akzeptierte Antwort
Bruno Luong
am 27 Aug. 2020
Bearbeitet: Bruno Luong
am 27 Aug. 2020
Yes if you have badly conditioned (or badly scaled), or practically singular matrix. Usualy you get a warning message when computing the inverse.
This happens with real matrix as well, such as
>> M=magic(6)
M =
35 1 6 26 19 24
3 32 7 21 23 25
31 9 2 22 27 20
8 28 33 17 10 15
30 5 34 12 14 16
4 36 29 13 18 11
>> iM=inv(M)
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.001607e-19.
iM =
1.0e+15 *
2.251799813685250 -0.000000000000000 -2.251799813685250 -2.251799813685250 -0.000000000000000 2.251799813685250
2.251799813685250 -0.000000000000000 -2.251799813685250 -2.251799813685250 -0.000000000000000 2.251799813685250
-1.125899906842625 0.000000000000000 1.125899906842625 1.125899906842625 0.000000000000000 -1.125899906842625
-2.251799813685250 0.000000000000000 2.251799813685250 2.251799813685250 0.000000000000000 -2.251799813685250
-2.251799813685250 0.000000000000000 2.251799813685250 2.251799813685250 0.000000000000000 -2.251799813685250
1.125899906842624 0 -1.125899906842624 -1.125899906842624 0 1.125899906842624
>> M*iM
ans =
-8.000000000000000 0 8.000000000000000 8.000000000000000 -1.125000000000000 0
0 1.000000000000000 0 0 -0.962843041164940 0.500000000000000
8.000000000000000 -0.000000000000001 -8.000000000000000 -8.000000000000000 -1.773627835340241 8.000000000000000
8.000000000000000 0 -8.000000000000000 -8.000000000000000 0.249352422290674 12.000000000000000
4.000000000000000 0.000000000000000 -4.000000000000000 -4.000000000000000 0.411509381125735 12.000000000000000
8.000000000000000 0 -8.000000000000000 -8.000000000000000 -0.399275413049567 20.000000000000000
>> iM*M
ans =
0 16 9 -2 4 -2
0 20 9 -2 4 0
4 -2 -2 -1 2 1
2 8 6 0 8 6
0 -4 -9 -2 0 0
0 0 0 0 0 0
>> cond(M)
ans =
4.700154791029550e+16
>>
2 Kommentare
Stephen23
am 31 Aug. 2020
@Ben Marinberg : please save your matrix in a .mat file and upload it by clicking the paperclip button.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!