登录论坛

查看完整版本 : 有谁知道如何在MATLAB ...或任何其他编程语言中绘制圆顶(又称半球形)?


poster
2019-12-10, 20:48
我需要绘制一个圆顶或半球形,并能够更改圆顶的尺寸。我认为MATLAB是我的最佳选择。

有什么建议么?

谢谢



回答:

SPHERE (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/sphere.html)函数生成球面的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

更多&回答... (https://stackoverflow.com/questions/3603178)