如何在 MATLAB 中绘制具有不同半径的圆顶?

发布于 2024-09-17 17:49:30 字数 674 浏览 3 评论 0原文

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

[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 分量都不同。

如何更改代码?

I need to plot a dome (or half sphere) that have different radii. I was told how to plot the shpere on a previous question:

[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 

Does anyone know how to plot a dome (aka half sphere) in MATLAB...or anyother programming language?

But I need the height of the x, y, and z components to all be different.

How do I change the code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剩余の解释 2024-09-24 17:49:30

我们将 x、y 和 z 的半径分别称为 rxryrz

然后你像这样调用该函数

[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 

Let's call the radius in x, y, and z rx, ry, and rz, respectively.

Then you call the function like this

[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 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文