简体   繁体   English

matlab - 用冲浪在3d中绘制不平等

[英]matlab - plot inequality in 3d with surf

I want to plot an inequality in 3d using surf . 我想用surf在3d中绘制不等式。 My condition is 我的病情是

0<=x<=1    
0<=y<=1    
0<=z<=x/(1+y)

I can create a surface plot using the following commands 我可以使用以下命令创建表面图

[x y]=meshgrid(0:0.01:1);    
z=x./(1+y);    
surf(x,y,z);

This plot gives me regions where z=x/(1+y) but I am interested in regions where 0<=z<=x/(1+y) over all values of x and y . 该图给出了z=x/(1+y)区域,但我感兴趣的是在xy所有值上0<=z<=x/(1+y) However, I am unable to plot/color the region explicitly. 但是,我无法明确地绘制/着色该区域。 Can you please help. 你能帮忙吗?

A similar question has been asked but there was no acceptable answer and my question is also different. 有人问过类似的问题,但没有可接受的答案,我的问题也不同。

Using isosurface you can show the boundary. 使用isosurface可以显示边界。 There are two options, first create the points 有两个选项,首先创建点

[X,Y,Z]=meshgrid(0:.01:1);

then plot the boundaries in the z -direction (ie Z=0 and Z=X./(1+Y) ) 然后绘制z方向的边界(即Z=0Z=X./(1+Y)

isosurface(X,Y,Z,Z.*(X./(1+Y)-Z),0)

or plot all the boundaries (including X=0 , X=1 , Y=0 and Y=1 ) 或绘制所有边界(包括X=0X=1Y=0Y=1

isosurface(X,Y,Z,Z.*(X./(1+Y)-Z).*X.*(X-1).*Y.*(Y-1),0)

All you have to do is come up with a function that is constant on any boundary, its value inside or outside is irrelevant as long as it is not zero. 你所要做的就是提出一个在任何边界上都是常数的函数,只要它不是零,它的内部或外部值就无关紧要了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM