登录论坛

查看完整版本 : 如何在带有不同半径的MATLAB中绘制圆顶?


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

[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 ...或任何其他编程语言中绘制圆顶(又称半球形)? (https://stackoverflow.com/questions/3603178/does-anyone-know-how-to-plot-a-dome-aka-half-sphere-in-matlab-or-anyother-pro)

但是我需要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

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