Error with pinv in MATLAB r2018a
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Steven Lord
le 4 Mai 2022
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 commentaire
Christine Tobler
le 5 Mai 2022
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Linear Algebra dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!