MATLAB determine if matrices are invertible or not
조회 수: 128 (최근 30일)
이전 댓글 표시
I have two matrices that I am looking to find the determinants of and see if they are invertible or not.
I entered in my matrices and used det() to get the determinant for each.
P = [8, 11, 2, 8; 0, -7, 2, -1; -3, -7, 2, 1; 1, 1, 2, 4]
Q = [1, -2, 0, 5; 0, 7, 1, 5; 0, 4, 4, 0; 0, 0, 0, 2]
det(P+Q)
det(P-Q)
det(P*Q)
det(P^(-1))
If anyone can tell me why MATLAB is not giving me the determinant of 0 for the non invertible matrix that would be very helpful. Thank you
댓글 수: 0
답변 (2개)
David Goodmanson
2021년 11월 16일
편집: David Goodmanson
2021년 11월 16일
Hi SS
P+Q
ans =
9 9 2 13
0 0 3 4
-3 -3 6 1
1 1 2 6
det(P+Q)
ans = 4.4964e-15
cond(P+Q)
ans = 5.4780e+17
P+Q is clearly noninvertable since the first and second columns are identical. But you can't expect to get 0 for the determinant since there are computational precision issues. Something like e-15 is pretty typical.
Incidentally, to see if a matrix is noninvertable, cond(M) is much better than det(M). In this case you know that all the matrix entries are on the order of 1, so the determinant does tell you something, but in general det is not a good indication. For one thing, there is scaling. if you multiply the matrix by 100, then det becomes 4.4964e--7, eight orders of magnitude larger. But P+Q is just as noninverable as before. Meanwhile cond does change a bit, which I found surprising, but in both cases it is up above 10^17, showing that P+Q is likely noninvertable.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!