的SPHERE函数生成的x,y,和用于球面Z坐标.您只需要移除与球体底部对应的点以制作圆顶.例如:
[x,y,z] = sphere; %# Makes a 21-by-21 point sphere
x = x(11:end,:); %# Keep top 11 x points
y = y(11:end,:); %# Keep top 11 y points
z = z(11:end,:); %# Keep top 11 z points
r = 3; %# A radius value
surf(r.*x,r.*y,r.*z); %# Plot the surface
axis equal; %# Make the scaling on the x, y, and z axes equal
Run Code Online (Sandbox Code Playgroud)