Effacer les filtres
Effacer les filtres

Matrix is singular to working precision.

1 vue (au cours des 30 derniers jours)
jack knipler
jack knipler le 13 Avr 2016
Hi
I entered some code to produce to 3d graphs side by side.
When running, the graphs are shown with one of them not having anything on them. "Matrix is singular to working precision." is shown in the command window. If anyone could help with this problem, this is my code.
Thanks
x = -10:0.5:10;
y = -10:0.5:10;
[xx,yy] = meshgrid(x,y);
subplot(1,2,1)
zz = xx.^2 - yy.^2;
mesh(xx,yy,zz);
subplot(1,2,2)
zz = (xx * yy)*(xx.^2 - yy.^2 / xx.^2 + yy.^2);
mesh(xx,yy,zz);

Réponse acceptée

Roger Stafford
Roger Stafford le 13 Avr 2016
Modifié(e) : Roger Stafford le 13 Avr 2016
The matrix xx.^2 is indeed singular by its very nature, since its rows are all alike. When you write yy.^2 / xx.^2 you are asking for the inverse of xx.^2, and hence get the error message. I believe you meant to have a dot in the division rather than matrix division, and perhaps a dot in the multiplication:
zz = (xx .* yy) .* (xx.^2 - yy.^2 ./ xx.^2 + yy.^2);
or perhaps you meant this:
zz = (xx .* yy) .* (xx.^2 - yy.^2) ./ (xx.^2 + yy.^2);
  1 commentaire
jack knipler
jack knipler le 13 Avr 2016
That did the trick. Thank you so much

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by