注册 登录
编程论坛 Matlab

如何在Matlab中绘制z方向上有重叠的三维曲面

schoolcao 发布于 2007-11-16 20:14, 4143 次点击
比如球体,对于任意一组(x,y),最外边一圈除外,都有两个z与之对应。

这一类的曲面如何绘制?

请说明更加一般的情况。
8 回复
#2
hitzhang2007-11-17 20:35
可以先在球坐标内生成数据,再转换为直角坐标,再mesh
#3
schoolcao2007-11-18 14:32
回复:(hitzhang)可以先在球坐标内生成数据,再转换...
但如果在球坐标下也发生曲叠呢?
#4
hitzhang2007-11-20 19:55
mesh函数的画图过程我不是很熟
不过你可以通过画简单的图形了解一下它的画图过程
我知道这个函数可以画出任意形状的三维图形
#5
wmx6052007-11-22 19:39
DING
!!!!!!!!!!!!!!!!!!!
#6
matlabzql2008-02-21 22:39
请教高手一个问题:
在一个立方体中如何任意进行斜面分割???
[x,y,z] = meshgrid(-2:.2:2,-2:.25:2,-2:.16:2);
v = x.*exp(-x.^2-y.^2-z.^2);
xslice = [-2,2]; yslice = [-2,2]; zslice = [-2,2];
slice(x,y,z,v,xslice,yslice,zslice)%直角切割
colormap hsv
现在想对它进行任意的斜面切割
(用鼠标点击立体图中的几个点,或者手动输入几个点),根据这几个点位置不同来确定不同的平面),如果高手有好的方法,小弟更是感激不尽!!!!!!
qq:491242712
#7
chinasoul2008-03-14 21:05
对于不同的z,可以用hold on命令分开画嘛
#8
chinasoul2008-03-14 21:15
回复 5# 的帖子
Slicing At Arbitrary Angles


You can also create slices that are oriented in arbitrary planes. To do this, Create a slice surface in the domain of the volume (surf, linspace). Orient this surface with respect to the axes (rotate). Get the XData, YData, and ZData of the surface (get). Use this data to draw the slice plane within the volume.
#9
chinasoul2008-03-14 21:17
回复 6# 的帖子
For example, these statements slice the volume in the first example with a rotated plane. Placing these commands within a for loop "passes" the plane through the volume along the z-axis.
for i = -2:.5:2
    hsp = surf(linspace(-2,2,20),linspace(-2,2,20),zeros(20)+i);
    rotate(hsp,[1,-1,1],30)
    xd = get(hsp,'XData');
    yd = get(hsp,'YData');
    zd = get(hsp,'ZData');
    delete(hsp)
    slice(x,y,z,v,[-2,2],2,-2) % Draw some volume boundaries
    hold on
    slice(x,y,z,v,xd,yd,zd)
    hold off
    axis tight
    view(-5,10)
    drawnow
end
1