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

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

 採用された回答

darova
darova 2021 年 5 月 27 日

1 投票

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)

4 件のコメント

Elliott Kitson
Elliott Kitson 2021 年 5 月 27 日
編集済み: Elliott Kitson 2021 年 5 月 27 日
For the 2D contour, I’ve used some loops to generate the values for x and r and save them into two arrays, x and r. Can the above code be altered to use the pre-calculated values in the arrays?
darova
darova 2021 年 5 月 28 日
I don't understand. You can use for loop or meshgrid as you wish
Elliott Kitson
Elliott Kitson 2021 年 5 月 29 日
Sorry, i was getting a little mixed up, this worked perfectly! thank you very much!
umberto somma
umberto somma 2023 年 2 月 7 日
Could you please show me how to get this 3D plot from your initial 2D countour line?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by