3D plotting of given parametric equations

7 ビュー (過去 30 日間)
Ahmet Turan
Ahmet Turan 2022 年 6 月 21 日
コメント済み: Ahmet Turan 2022 年 6 月 22 日
Hi everyone, I need 3D plot of given parametric equations:
Here also R varies between [25 75], i tried to use meshgrid and ndgrid functions but had a problem using them with varying 3 variables U, V and R. How can i plot this? Also, 3D plot should look like this: (Don't mind numbers they are different in my case)
Thank you in advance

採用された回答

KSSV
KSSV 2022 年 6 月 21 日
m = 50 ; n = 50 ;
p = 5 ;
u = linspace(0,pi,m) ;
v = linspace(0,2*pi,n) ;
r = linspace(25,75,p) ;
[U,V,R] = meshgrid(u,v,r) ;
Z = R.*cos(U).*cos(V) ;
Y = R.*cos(U).*sin(V) ;
X = sqrt(R.^2-Z.^2-Y.^2);
figure
hold on
for i = 1:p
mesh(abs(X(:,:,i)),Y(:,:,i),Z(:,:,i))
end
view(3)
  4 件のコメント
Ahmet Turan
Ahmet Turan 2022 年 6 月 22 日
a = 0.0201; b = 0.0924;
alpha = 0.1063; beta = 0;
u = linspace(0,pi);
v = linspace(0,2*pi);
r = linspace(25,75);
[U V R] = meshgrid(u,v,r);
Z = -a*R.*cos(U).*cos(V);
Y = b*R.*cos(U).*sin(V);
X = sqrt((R.^2)-(Z.^2)-(Y.^2));
figure
hold on
for i = 1:100
s = surf(X(:,:,i),Y(:,:,i),Z(:,:,i));
direction = [0 1 0];
rotate(s,direction,-rad2deg(alpha));
direction = [0 0 1];
rotate(s,direction,rad2deg(beta));
end
view(3)
xlabel('x');
ylabel('y');
zlabel('z');
grid on
shading interp
colorbar
hold off
Ahmet Turan
Ahmet Turan 2022 年 6 月 22 日
I am trying to get rid of wiggly side surfaces now, any help would be appreciated.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by