MATLAB: Create 3D plot from 2D contour (length and radius)

3d plotsconverging-diverging nozzleMATLAB

I have a 2D axisymmetric contour of a converging-Diverging nozzle as shown below:
I want to turn this contour into a 3D plot, any ideas of what the best way of doing this is? I’ve tried using linspace and mesh grid but I’ve hit a brick wall.
Many thanks, Elliott

Best Answer

See this example
z = 0:.1:3;
r = sin(z);
t = linspace(0,2*pi,20);
[T,R] = meshgrid(t,r);
[~,Z] = meshgrid(t,z);
[X,Y] = pol2cart(T,R);
surf(X,Y,Z)