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
更多回答(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!