isosurface函数MATLAB用法

smi*_*dha 3 3d matlab plot

嗨,任何人都可以给我一个如何在MATLAB中使用isosurface函数的简单例子.键入的示例help isosurface非常令人困惑.在谷歌搜索并没有帮助,因为没有人在任何地方给出简单的例子.所有这些都使用预定义的函数 flow.

对于初学者,假设我有(x,y,z)z = 0的点,并且在每个点我定义一个常数函数f(x,y,z)=6.因此,如果我在isovalue上使用isosurface函数,6我希望MATLAB给我一个3d绘图,XY平面以某种颜色突出显示,比如绿色.

Jon*_*nas 7

我不太明白你的例子,但这里是你isosurface用来绘制球体的方法:

%# create coordinates
[xx,yy,zz] = meshgrid(-15:15,-15:15,-15:15);
%# calculate distance from center of the cube
rr = sqrt(xx.^2 + yy.^2 + zz.^2);

%# create the isosurface by thresholding at a iso-value of 10
isosurface(xx,yy,zz,rr,10);

%# make sure it will look like a sphere
axis equal 
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述