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

采纳的回答

KSSV
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 个评论
vilas math
vilas math 2021-5-19
  • I am trying create 3d plot for that curve which is in the middle instead of circle's 3D profile
  • whose variation can be done by using gaussian formula (rv2).
  • But i am unable to create 3D profile of it

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by