Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Wrongly computed NaN's when plotting a parametric surface with ezsurf
5 ビュー (過去 30 日間)
古いコメントを表示
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.
1 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!