I Want to convert 2D profile into 3D profile
1 回表示 (過去 30 日間)
古いコメントを表示
clc
close all
clear all
zv = linspace(-20,20);
phiv = linspace(0,2*pi,size(zv,2));
rv = ones(1,100,size(zv,1))* 1;
rv2 = -0.9*exp(-1.2*(phiv-4).^2)+1;
%[Theta, R] = meshgrid(phiv,rv);
for i = 0 : 0.9
zb1 = -(i).*exp(-1.2*(phiv-4).^2)+1;
end
%mesh(Theta,R,zv)
figure(1)
plot3(phiv,rv,zv)
hold on
plot3(phiv,rv2,zv)
hold on
plot3(phiv,rv,zb1(1,:))
axis equal
[x,y,z] = pol2cart(phiv,rv,zv);
[x2,y2,z2] = pol2cart(phiv,rv2,zv);
[x3,y3,z3] = pol2cart(phiv,rv,zb1);
figure(2)
plot3(x,y,z)
hold on
plot3(x2,y2,z3)
hold on
plot3(x3,y3,z3(1,:))
axis equal
0 件のコメント
採用された回答
KSSV
2021 年 5 月 19 日
m = 100 ; n = 100 ;
zv = linspace(-20,20,m);
phiv = linspace(0,2*pi,n);
[zv, phiv] = meshgrid(zv,phiv) ;
rv = ones(size(zv))*1;
rv2 = -0.9*exp(-1.2*(phiv-4).^2)+1;
%[Theta, R] = meshgrid(phiv,rv);
L = 0 : 0.9 ;
zb1 = zeros(m,n,length(L)) ;
for i = 1:length(L)
zb1(:,:,i) = -L(i).*exp(-1.2*(phiv-4).^2)+1;
end
%mesh(Theta,R,zv)
figure(1)
plot3(phiv,rv,zv)
hold on
plot3(phiv,rv2,zv)
hold on
plot3(phiv,rv,zb1(:,:,1))
axis equal
[x,y,z] = pol2cart(phiv,rv,zv);
[x2,y2,z2] = pol2cart(phiv,rv2,zv);
[x3,y3,z3] = pol2cart(phiv,rv,zb1);
figure(2)
plot3(x,y,z)
hold on
plot3(x2,y2,z3)
hold on
plot3(x3,y3,z3(1,:))
axis equal
3 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!