Matrix is singular to working precision. Meshgrid

[x,y] = meshgrid(0.1:0.01:1,0.1:0.01:1);
z = ((1-x)*(cos(2*pi*y+(pi + atan((cos(2*pi*y)-1)/(2*pi*(1-y)+sin(2*pi*y)))))-...
cos(pi + atan((cos(2*pi*y)-1)/(2*pi*(1-y)+sin(2*pi*y))))))/((1-y)*(cos(2*pi*x...
+(pi + atan((cos(2*pi*x)-1)/(2*pi*(1-x)+sin(2*pi*x)))))-cos(pi + atan((cos(2*pi*x)-1)/(2*pi*(1-x)+sin(2*pi*x))))));

 Réponse acceptée

Rik
Rik le 18 Mar 2021
Modifié(e) : Rik le 18 Mar 2021
You aren't using elementwise operations anywhere. You should replace every * by .* and every / by ./, that way you will not be doing matrix operations.
[x,y] = meshgrid(0.1:0.01:1,0.1:0.01:1);
z = ((1-x).*(cos(2*pi*y+(pi + atan((cos(2*pi*y)-1)./(2*pi*(1-y)+sin(2*pi*y)))))-...
cos(pi + atan((cos(2*pi*y)-1)./(2*pi*(1-y)+sin(2*pi*y))))))./((1-y).*(cos(2*pi*x...
+(pi + atan((cos(2*pi*x)-1)./(2*pi*(1-x)+sin(2*pi*x)))))-cos(pi + atan((cos(2*pi*x)-1)./(2*pi*(1-x)+sin(2*pi*x))))));
surf(x,y,z),view(45,30)

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by