Singular matrix and MATLAB inversion

조회 수: 39 (최근 30일)
Mehdi Chahine AMROUCHE
Mehdi Chahine AMROUCHE 2019년 6월 11일
댓글: Bruno Luong 2020년 9월 26일
How come that det(A) = 0, and yet MATLAB computes the inverse of A (i.e inv(A) is computed without any warnings).
Where A is a square symmetric matrix.
Thanks !
  댓글 수: 3
Shivam Sharma
Shivam Sharma 2020년 9월 26일
let's say A = [1 2 3; 4 5 6; 7 8 9]
Bruno Luong
Bruno Luong 2020년 9월 26일
@Sharma I get the warning wth your matrix, so it's not a valide example
>> A = [1 2 3; 4 5 6; 7 8 9]:
>> inv(A)
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.202823e-18.
ans =
1.0e+16 *
0.3153 -0.6305 0.3153
-0.6305 1.2610 -0.6305
0.3153 -0.6305 0.3153

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

채택된 답변

Steven Lord
Steven Lord 2019년 6월 11일
DON'T use det to determine if a matrix is singular!
A non-zero multiple of the identity matrix isn't singular, right?
A = 0.1*eye(400);
det(A)
The determinant of A underflowed to 0.
Can multiplying a singular (or nearly singular) matrix by a non-zero scalar make it no longer singular?
B = [1 1; 1 1+eps];
C = 1e8*B;
det(B)
det(C)
A number with a determinant on the order of 1 can't be singular, can it?
Use the cond or rcond functions instead. Matrices with condition numbers closer to 1 are better behaved.
cond(A)
cond(B)
cond(C)
If you're calling inv to try to solve a system of linear equations, DON'T. Use the backslash operator (\) instead. Even if your textbook told you to multiply by the inverse matrix, well, in theory there is no difference between theory and practice ...
  댓글 수: 1
Bjorn Gustavsson
Bjorn Gustavsson 2019년 6월 12일
If you have to solve a system of equations where the matrix is singular or ill-conditioned don't use backslash either. To "give" a solution in that case one should know what has been done and what has not been done. The best way to do that is to SVD-based Moore-Penrose inverse, with suitable (zeroth- second-order Tikhonov ) regularization, inspection of the singular-values, and the model-space eigenvectors etc. A great utility for this is:

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

추가 답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2019년 6월 11일
Are you absolutely sure you haven't turned off the warnings, in your startup.m or elsewhere?

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by