How to make a solid of revolution along the y-axis for a function with complex parts?

19 ビュー (過去 30 日間)
Marco Cordero
Marco Cordero 2023 年 10 月 11 日
編集済み: Matt J 2023 年 10 月 11 日
Hi,
I'm trying to make a solid of revolution given the following function:
The graph would look like the upper part of an oval with major axis lenght of 9.
What I'm trying to do is to generate a solid of revolution that revolves around the y-axis rather than the x-axis.
I've tested the following code to no avail:
X = 0:0.1:pi;
R = real((9 - (1/2).*((X - 7).^(1/2))).^(1/2));
[z,x,y] = cylinder(R);
surf(x,y,z)
As it can be seen, it generates (evidently) a cylinder, so I'm guessing my approach isn't the right one for this problem.
My final goal is to generate the upper and lower surface of torus-like object. Any idea on how to do this?
Thanks :)

採用された回答

Matt J
Matt J 2023 年 10 月 11 日
編集済み: Matt J 2023 年 10 月 11 日
X = 0:0.1:pi;
R = sqrt(9-0.5*(X-7).^2); R(imag(R)~=0)=nan;
[z,x,y] = cylinder(R);
surf(x,y,z); xlabel X;ylabel Y; zlabel Z; axis equal

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBodies についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by