查看单个帖子
旧 2019-12-10, 20:48   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 如何在带有不同半径的MATLAB中绘制圆顶?

我需要绘制一个半径不同的圆顶(或半球形)。有人告诉我如何在上一个问题上画图:

[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 有谁知道如何在MATLAB ...或任何其他编程语言中绘制圆顶(又称半球形)?

但是我需要x,y和z分量的高度都不同。

如何更改代码?



回答:

让我们分别以x,y和z rx , ry和rz表示半径。

然后你这样调用函数

[x,y,z] = sphere; %# Makes a 21-by-21 point unit 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 rx = 3;ry = 4;rz = 9; %# Define rx, ry, rz surf(rx*x,ry*y,rz*z); %# Plot the surface, multiplying unit coordinates with radii axis equal; %# Make the scaling on the x, y, and z axes equal

更多&回答...
poster 当前离线   回复时引用此帖