I Want to convert 2D profile into 3D profile

1 view (last 30 days)
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

Accepted Answer

KSSV
KSSV on 19 May 2021
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 Comments
vilas math
vilas math on 19 May 2021
  • 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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!