3D Profile Extrude

6 ビュー (過去 30 日間)
Mahmoud Abbas
Mahmoud Abbas 2022 年 4 月 11 日
編集済み: Les Beckham 2022 年 4 月 11 日
Hello, could you help me make this code extrude this random profile into the z-axis and make the plot in 3D using mesh or surf?
x = [82,80,65,38,82]
y = [82,54,36,94,82]
plot(x,y)

採用された回答

Les Beckham
Les Beckham 2022 年 4 月 11 日
編集済み: Les Beckham 2022 年 4 月 11 日
x = [82, 80, 65, 38, 82];
y = [82, 54, 36, 94, 82];
x = repmat(x, 10, 1);
y = repmat(y, 10, 1);
z = (1:10)';
z = repmat(z, 1, 5);
surf(x, y, z)
  2 件のコメント
Mahmoud Abbas
Mahmoud Abbas 2022 年 4 月 11 日
Thanks for your help. However, I need the extrusion to be solid (i.e. filled with volume from the inside).
Les Beckham
Les Beckham 2022 年 4 月 11 日
編集済み: Les Beckham 2022 年 4 月 11 日
You can't really make it "solid" but you can make it look like it is by closing off the top and bottom so that you can't see inside.
x = [82, 80, 65, 38, 82];
y = [82, 54, 36, 94, 82];
X = repmat(x, 11, 1);
Y = repmat(y, 11, 1);
z = (0:10)';
Z = repmat(z, 1, 5);
surf(X, Y, Z)
patch(x, y, 10*ones(1, 5), 10*ones(1, 5)) % add "lid" on top
patch(x, y, zeros(1, 5), zeros(1, 5)) % add "lid" on bottom

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by