Why do I get warning message 'Matrix is close to singular or badly scaled. ' ?
132 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 27 Feb. 2012
Bearbeitet: MathWorks Support Team
am 19 Apr. 2023
Why do I get the following warning message:
ERROR: Warning: Matrix is close to singular or badly scaled.
Akzeptierte Antwort
MathWorks Support Team
am 18 Apr. 2023
Bearbeitet: MathWorks Support Team
am 19 Apr. 2023
Explanation:
A matrix used in a computation is singular or is very close to being singular (ill conditioned). Trying to solve a system of linear equations whose coefficient matrix is singular can lead to incorrect answers.
Common causes:
A program you called is using a matrix that is badly conditioned as one of the arguments to the backslash (\) or forward slash (/) operators, which are commonly used to solve systems of linear equations.
Solution:
Stop MATLAB on the line where the warning occurs. Examine the line for instances of the two slash operators. If you find one, determine the condition number of the coefficient matrix (the matrix on the left side of the backslash (\) or on the right side of the forward slash (/) using the COND function. Large results for the condition number indicate the matrix is extremely ill-conditioned. You should verify (using the matrix multiplication operator (*)) that the result of solving the system is numerically reliable. For more information about condition numbers of matrices, see Chapter 2: Linear Equations of the Cleve Moler's Numerical Computing with MATLAB book, which discusses solving systems of linear equations.
Cleve's Book:
COND function:
Example demonstrating this error:
CloseToSingular.m
0 Kommentare
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!