Evaluating a function with three variables
显示 更早的评论
Dear all, Since I am new in MatLab, I want to evaluate the following equation y=(1./((x.^2)+1))-(p./((x+w).^2+1))-(p./((x-w).^2+1)); I want to sweep the variables x,p and w as follows x from -5 to 5 with 100 steps ,p from 0 to 1 with 100 steps ,w from 0 to 3 with 100 steps and then I want to normalized the functiony and then I want to extract the specific values of x (lets name new variable r) which give me specific value of y (lets say y=0.5) for each combination of variables x,w,p. After that I want to make a surface graph of ( r,w and p)
thanks
1 个评论
Walter Roberson
2018-9-28
Please do not close questions that have an answer.
采纳的回答
更多回答(1 个)
Alin Brad
2018-9-26
4 个评论
KSSV
2018-9-26
p = patch(isosurface(x,p,w,y,val));
Walter Roberson
2018-9-26
You cannot use isosurface() for scattered points.
idx = abs(y-val)>=10^-3 ;
is creating a logical mask that talks about individual points inside the grid y . When you take x(idx) and so on you are extracting only those points -- scattered points.
Consider
yt = y;
yt(~idx) = nan;
p = patch(isosurface(x, y, w, yt, val));
You will probably want to do that in a different plot, or erase what you have drawn first: the values form a thin irregular sheet that is effectively hidden by the heavy point density of the scatter3()
Alin Brad
2018-9-26
Walter Roberson
2018-9-28
Notice in my call I did not select subsets of x and so on for the isosurface call: I left them the original size but assigned nan to locations in the grid that were not of interest.
类别
在 帮助中心 和 File Exchange 中查找有关 Volume Visualization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!