Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Wrongly computed NaN's when plotting a parametric surface with ezsurf

5 visualizaciones (últimos 30 días)
Roberto Ferrara
Roberto Ferrara el 1 de Dic. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
In the following code I use an anonymous fuction to plot a surface. The function uses if contitions and NaN's to plot over a non square domain. However, some points near the boundary, but inside the domain, that are computed correctly by the function (if called manually) are computed as NaN's by ezsurf.
What's wrong here?
Minimal code:
ezsurf(@(x,y) iff(1-x-y>=0, max([-1/2, -sqrt(x*y)-(1-x-y)]), nan), [0,1,0,1]) ;
hold on
ezplot3(@(x) x, @(x) 1-x , @(x) -sqrt(x*(1-x)),[0,1,0,1]);
tmp = @(x,y) iff(1-x-y>=0, max([-1/2, -sqrt(x*y)-(1-x-y)]));
tmp(0,1)
ans = 0
The second plot, prints the border (computed correctly), to where the surface should reach; The last two line show that the point x,y = 0,1 should be plotted according to the function.
where iff.m:
function x = iff( a, b, c )
if a
x = b;
else
x = c;
end
end
PS: yes, i could compute the data points myself and use surf, but then what's the point of having ezsurf if i cannot make it work properly.

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by