有谁知道如何在MATLAB中绘制圆顶(又称半球)或任何其他编程语言?

dew*_*lla 1 matlab plot

我需要绘制一个圆顶或半个球体,并能够改变圆顶的尺寸.我认为MATLAB将是我的最佳选择.

有什么建议?

谢谢

gno*_*ice 6

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)