我想绘制条件-1<=x<=1, 0<=y<=1, 0<=z<=1-x^2
给出的三维空间区域(积分)区域,基本上是“线框”中的半透明单色面。
我的解决方案基本上分别绘制了区域的四个边界面。我使用surf()
作为位于x-y平面和顶面的底面;但surf()
似乎无法使用两个垂直面。因此,我想必须有一种更简单的方法来绘制这个......
Cludgiest代码:
figure
hold on
x = linspace(-1,1,30);
y = linspace(0,1,30);
[X,Y] = meshgrid(x,y);
Z = 1-X.^2;
h = surf(X,Y,Z);
set(h,'edgecolor','none','FaceColor','r','FaceAlpha',0.5);
Z = zeros(30);
h = surf(X,Y,Z);
set(h,'edgecolor','none','FaceColor','r','FaceAlpha',0.5);
Y = ones(30);
z = 1-x.^2;
y = x.*0;
h = fill3(x,y,z,'r');
alpha(h,0.5);
y = y+1;
h = fill3(x,y,z,'r');
alpha(h,0.5);
y = linspace(0,1,30);
x = y.*0+1;
z = y.*0
plot3(x,y,z,'k')