DON'T use det to determine if a matrix is singular!
A non-zero multiple of the identity matrix isn't singular, right?
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.
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 ...
Best Answer