matlab - 用冲浪在 3d 中绘制不等式 [英] matlab - plot inequality in 3d with surf

查看:34
本文介绍了matlab - 用冲浪在 3d 中绘制不等式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 surf 在 3d 中绘制不等式.我的情况是

I want to plot an inequality in 3d using surf. 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);

这个图给了我 z=x/(1+y) 的区域,但我对 0<=z<=x/(1+y) 的区域感兴趣code> 覆盖 xy 的所有值.但是,我无法明确地绘制/着色该区域.你能帮忙吗.

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. 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.

推荐答案

使用 isosurface 可以显示边界.有两个选项,先创建点

Using isosurface you can show the boundary. There are two options, first create the points

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

然后在 z 方向绘制边界(即 Z=0Z=X./(1+Y))

then plot the boundaries in the z-direction (i.e. Z=0 and Z=X./(1+Y))

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

或绘制所有边界(包括X=0X=1Y=0Y=1)

or plot all the boundaries (including X=0, X=1, Y=0 and Y=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.

这篇关于matlab - 用冲浪在 3d 中绘制不等式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆