Error with pinv in MATLAB r2018a
조회 수: 1 (최근 30일)
이전 댓글 표시
I am taking the pseudoinverse of a matrix using pinv but get the following error:
Error using svd
SVD did not converge.
Error in pinv (line 18)
[U,S,V] = svd(A,'econ');
I cannot reproduce this error in r2021b on my laptop. It only shows up when I run the code on a cluster in r2018a. Is this a known issue? Is there an easy way around it? I'm not sure about the specific matrix / data that causes the code to terminate (I'm analyzing a lot of data with this code on the cluster) but I could look into this if it might narrow down what's going on.
댓글 수: 0
채택된 답변
Steven Lord
2022년 5월 4일
Are you using a particular Update of release R2018a? If so and if it's Update 1 or Update 2, or if you're using the general release R018a, try updating to Update 3.
댓글 수: 1
Christine Tobler
2022년 5월 5일
Short addition: The "SVD did not converge" error started being given for some rare matrices in R2018a. This was fixed in R2018a Update 3 for real matrices, and later for complex matrices too (R2018b Update 5, R2019a Update 5, R2019b).
So if your matrices are always real, updating R2018a release should fix this. Otherwise, perhaps you can get a newer release than R2018a?
Unfortunately apart from that, the only thing to do there is to wrap the SVD call into a try/catch, and add some minor disturbance to the matrix and try again - this should get you out of the rare case where this error happens.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!