Drawing a trapezium in matlab

조회 수: 14 (최근 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 CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by