singular matrix inverse using svd in 2016 and 2013 version of a matlab
3 views (last 30 days)
Show older comments
vani chaturvedi
on 16 Dec 2017
Answered: Christine Tobler
on 18 Dec 2017
I am trying to solve the inverse of a singular matrix using svd in a matlab R2016a but is giving warning Warning: Matrix is singular to working precision.But while doing the same thing in matlab R2013a inverse is solvable with a warning : Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.252981e-18. Help it out...
2 Comments
Matt J
on 16 Dec 2017
But what help could we give? You've posted no code that we can comment on, nor attached any .mat file that we can run the code with.
John D'Errico
on 16 Dec 2017
The difference is not relevant. In both cases, the inverse you will obtain is complete garbage.
If you show enough about what you are doing, it is possible that someone might be able to offer an alternative, or they might be able to explain why your matrix was generated incorrectly.
Accepted Answer
Walter Roberson
on 16 Dec 2017
The math library has been updated since R2013b, and the high performance math libraries have been updated (but it might have been R2016b that that happened). The results in the newer version are more likely to be mathematically justifiable—that is, the older releases were more likely to return results that were garbage and the newer versions are more likely to complain.
Sometimes it gets to be a pain in the current releases, especially when code is used that sure looks like it should create a positive definite matrix but due to multiple threads and round off error issues comes out slightly nonsymmetric.
0 Comments
More Answers (1)
Christine Tobler
on 18 Dec 2017
Take a look at the code of PINV ( edit pinv ), which is using the SVD to compute the pseudo-inverse of a matrix. x = pinv(A)*b computes the minimum-norm least-squares solution of A*x = b. Is this the operation you are doing?
In that case, I'd expect the warning is happening when you solve a linear system with the diagonal matrix D. You could either increase the tolerance so that the matrix is not singular anymore, or you could use implicit expansion:
x = D \ b;
x = diag(D) .\ b; % Equivalent but this is not a matrix operation, so will not check the condition and warn
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!