Drawing a trapezium in matlab

17 ビュー (過去 30 日間)
Darren Koh
Darren Koh 2018 年 2 月 23 日
コメント済み: Thomas Di Dio 2023 年 8 月 19 日
Is there a quick way, apart from using vertices, to draw an isosceles trapezium given the height and the length of both parallel sides? Thank you.

採用された回答

KSSV
KSSV 2018 年 2 月 23 日
編集済み: KSSV 2018 年 2 月 23 日
h = 1 ; % height
a = 2 ; % top side
b = 4 ; % base
%%Frame vertices
A = [0 0] ;
B = [b 0] ;
C = [0.5*(b-a)+a h] ;
D = [0.5*(b-a) h] ;
coor = [A ; B; C; D] ;
patch(coor(:,1), coor(:,2),'r')
Refer here how the coordinates are formed: http://mathworld.wolfram.com/IsoscelesTrapezoid.html
  4 件のコメント
DGM
DGM 2023 年 8 月 17 日
See patch().
The argument list are x-coordinates, y-coordinates, and the line color.
A,B,C,D are [x y] pairs. They're simply concatenated to form the 4x2 matrix coor, from which the x,y vectors are taken in the call to patch().
Thomas Di Dio
Thomas Di Dio 2023 年 8 月 19 日
thank you , I see it now.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by