Revolving a curve about the y-axis to generate a 3D surface
107 ビュー (過去 30 日間)
古いコメントを表示
Asser Abdelgawad
2022 年 5 月 11 日
コメント済み: Asser Abdelgawad
2022 年 6 月 13 日
I'm aware that the cylinder() functiond does this for revolutions about the x-axis. But is there a way to do this about the y-axis?
0 件のコメント
採用された回答
John D'Errico
2022 年 5 月 11 日
Certainly. Just write the code yourself. Seriously, it is not difficult.
Consider the function y = f(x).
f = @(x) x.*(1-x);
fplot(f,[0,1])
We want to rotate this around the Y axis.
n = 100;
theta = linspace(0,2*pi,n).';
x0 = linspace(0,1,n);
y0 = f(x0);
x = x0.*cos(theta);
z = x0.*sin(theta);
y = repmat(y0,[n,1]);
surf(x,y,z)
xlabel x
ylabel y
zlabel z
view(20,30)
So the y axis lives at (x,z) = (0,0). The curve drawn in the original figure has been rotated around the y axis, producing this sideways cup, with a cusp at the center.
参考
カテゴリ
Help Center および File Exchange で Computational Geometry についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!