# Warning: Matrix is close to singular or badly scaled. Results may be inaccurate.

6 views (last 30 days)
Mustafa Duran on 28 Apr 2022
Edited: Torsten on 28 Apr 2022
Hello everyone. I have a matrix that is:
0.004648380836025 0.002524412954424 -0.002524412954424 -0.000821180565226 0 0.002524412954424
-0.000626542578981 -0.001620906917604 0.001620906917604 0.002885422409162 0 -0.001620906917604
0.001282496896793 0.002524412954424 -0.002524412954424 0.000861761404389 0 0
0.001534666644492 -0.001620906917604 0.001620906917604 0.001804817797426 0 0
0 -0.002524412954424 0 0.001682941969616 0.002103677462020 -0.002524412954424
0 0.001620906917604 0 -0.001080604611736 -0.001350755764670 0.001620906917604
When i use inv command and take the inverse of this matrix Matlab gives this error:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.491115e-18.
And calculate as:
1.0e+18 *
0.527794489188861 0.821991214493020 -0.527794489188860 -0.821991214493019 -0.187357017765717 -0.291791266736634
0.546782553495766 0.851563372520838 -0.546782553495766 -0.851563372520838 2.167585396954012 3.375814241065342
0.634748301693909 0.988561908269674 -0.634748301693909 -0.988561908269674 2.136359227326393 3.327182363275903
-0.527794489188861 -0.821991214493020 0.527794489188861 0.821991214493020 0.187357017765717 0.291791266736634
-0.188332118507258 -0.293309896163827 0.188332118507258 0.293309896163826 2.900873704769964 4.517843116057024
-1.055588978377721 -1.643982428986040 1.055588978377721 1.643982428986039 0.374714035531435 0.583582533473268
When i write this matrix in a inverse matrix calculator, it gives solutions as:
99.1851027125306 -154.47164513524 -8.121274793333 4.80129825 0 0
0 -0.00000000000000002 0 -0.00000000000000001 -198.0658509629958424 -308.46928628023403707
16.5308504520 -25.7452741 -304.53443810 193.8958581 -198.0658 -308.46928628023403707
99.1851027125 154.471645 280.40804319741965166 129.260218 0 0
317.39232868 246.01702263966 -461.646908 -475.46055895 237.679 -370.163
198.3702054 307.99528228 -197.76706 -310.0436 0 0
I write the solutions badly, however i think it is understandable.
Why Matlab gives this error and calculates wrong? I didn't find any solutions to this.
Thanks for helps.

Bruno Luong on 28 Apr 2022
Edited: Bruno Luong on 28 Apr 2022
It's a warning (not really error)
It means your matrix is numerically not invertible (or almost not invertible)
Bruno Luong on 28 Apr 2022
No, MATLAB find inverse by QR factorization. Never with determinant.