Triangle plotting help, area, perimeter
조회 수: 12 (최근 30일)
이전 댓글 표시
This is the problem, I have no idea how to do this. 1. Write a MATLAB script called Triangle to calculate the perimeter P of the triangle A-B-C defined by the x and y coordinates of points A, B, and C as listed below.
The length of triangle side a = sqrt( (Bx – Cx)2 + ( By– Cy)2 ),
Where Bx and Cx are the x-coordinates of points B and C, and By and Cy are the y-coordinates of points B and C.
Therefore for the points shown below, length of side a = sqrt( (220 – 480)2 + ( 320 – 230)2 )
x y Point coordinates in feet: A ( 90 , 130 ) B ( 220 , 320 ) C ( 480 , 230 )
2. Add to the script a formula for calculating the area of the triangle
댓글 수: 0
답변 (1개)
Roger Stafford
2014년 2월 17일
Hint: Once you have solved the first part, go here to see one way to solve 2.:
http://mathworld.wolfram.com/HeronsFormula.html
There are other formulas for finding the area, however, for which numerical computation is more accurate. One I am thinking of involves the cross product of two vectors. Another makes use of a certain determinant. (End of hints.)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!