How can I generate a 3D torus taking a function as the torus shape?

21 ビュー (過去 30 日間)
Marco Cordero
Marco Cordero 2023 年 10 月 17 日
コメント済み: Dyuman Joshi 2023 年 10 月 19 日
I'd like to graph a 3d surface with a torus like aspect from this function
This function generates the top half of an ellipse, I thought of an approach of revolving this function around the y-axis and then doing the same process with the same function multiplied by -1, but, I wouldn't know how to plot this inside Matlab.
Thanks.
  3 件のコメント
Marco Cordero
Marco Cordero 2023 年 10 月 17 日
Wouldn't it be possible with the provided function? At the end, it's one half of an ellipse, just make it negative to obtain the other half and then displace these halfs to have the additional ellipse
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 19 日
You can see that there are two rings (red color ones) that define a torus.
Generally, the inner ring, the one that revolves around, is a circle. You can use a non-circular ellipse in place of it.
So, you can use the same ellipse for both the rings, but the outcome might not be aesthetic (for the lack of a better word).

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2023 年 10 月 17 日
R1 = 3 ;
R2 = 1 ;
u = linspace(0,2*pi-eps) ;
v = linspace(0,2*pi-eps) ;
[u,v] = meshgrid(u,v) ;
X = (R1+R2*cos(v)).*cos(u) ;
Y = (R1+R2*cos(v)).*sin(u) ;
Z = R2*sin(v) ;
surf(X,Y,Z)
axis equal

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by