フィルターのクリア

3d Plotting a decagonal pyramid

3 ビュー (過去 30 日間)
Matthew
Matthew 2023 年 10 月 22 日
コメント済み: Matthew 2023 年 10 月 22 日
what i have so far
r = linspace(0,2*pi);
th = 0:pi/6:2*pi ;
[R,T] = meshgrid(r,th) ;
X = R.*cos(T) ;
Y = R.*sin(T) ;
Z = R ;
surf(X,Y,Z)
What i'm wondering is, how do i make the length of each side of the base a user input,
and how do i make the height of the decagonal pyramid a user input as well.
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 22 日
Use input
Though, with the given method of generating the pyramid, the lenght of each side of the base is the same.

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

採用された回答

Matt J
Matt J 2023 年 10 月 22 日
編集済み: Matt J 2023 年 10 月 22 日
sidelength=10; height=8; %User inputs
V=nsidedpoly(10,'Side',sidelength).Vertices;
V(end+1,3)=-height;
trisurf( delaunay(V(:,1:2)), V(:,1), V(:,2), V(:,3),'FaceColor','c')
  3 件のコメント
Matt J
Matt J 2023 年 10 月 22 日
There's nothing wrong with asking more questions, but please Accept-click the answer to this question and post your new one in a new thread.
Matthew
Matthew 2023 年 10 月 22 日
ok will do, thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by