How do I plot this set as 3d region in matlab?
12 次查看(过去 30 天)
显示 更早的评论
This is the set I need to plot-
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1120805/image.png)
My main purpose is to see how this set is convex, so I am trying to plot this graph in MATLAB, but don't know how to. I tried using surf but couldn't plot it correctly.
1 个评论
Bruno Luong
2022-9-9
编辑:Bruno Luong
2022-9-9
From the equation, the set Q(x,y) is intersection of paraboloid and 4 half spaces, all are convex so it must be convex.
采纳的回答
更多回答(1 个)
Bruno Luong
2022-9-9
编辑:Bruno Luong
2022-9-9
Code that plot ALL the boundaries of the domain
x = 0;
y = 0;
c = 1+x^2+y^2;
f1 = @(u,v,z) z - (u.^2 + v.^2 + c);
f2 = @(u,v,z) 1 - abs(u);
f3 = @(u,v,z) 1 - abs(v);
d = @(u,v,z) min(abs(cat(4,f1(u,v,z),...
f2(u,v,z),...
f3(u,v,z))),[],4);
s = @(u,v,z) f1(u,v,z)>=0 & ...
f2(u,v,z)>=0 & ...
f3(u,v,z)>=0;
f = @(u,v,z) d(u,v,z).*(2*s(u,v,z)-1);
fimplicit3(f,[-2 2 -2 2 0 5])
xlabel('u')
ylabel('v')
zlabel('z');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!