inverse of complex matrix

조회 수: 11 (최근 30일)
Ben Marinberg
Ben Marinberg 2020년 8월 27일
댓글: Stephen23 2020년 8월 31일
I'm trying to invert a complex matrix using inv() function.
turns out A*inv(A)I and inv(A)*AI .
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
Stephen23
Stephen23 2020년 8월 27일
"Is there any reason for that?"
Matrix inversion is inhernently numeric unstable. It is also seldom required:

댓글을 달려면 로그인하십시오.

채택된 답변

Bruno Luong
Bruno Luong 2020년 8월 27일
편집: Bruno Luong 2020년 8월 27일
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
Ben Marinberg
Ben Marinberg 2020년 8월 31일
My matrix didn't had that high of a condition number, also it didn't gave any warning..
Stephen23
Stephen23 2020년 8월 31일
@Ben Marinberg : please save your matrix in a .mat file and upload it by clicking the paperclip button.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by