Triangle plotting help, area, perimeter

11 views (last 30 days)
Dylan
Dylan on 17 Feb 2014
Answered: Roger Stafford on 17 Feb 2014
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

Answers (1)

Roger Stafford
Roger Stafford on 17 Feb 2014
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.)

Categories

Find more on Computational Geometry in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!