Triangle plotting help, area, perimeter

3 次查看(过去 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

回答(1 个)

Roger Stafford
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.)

类别

Help CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by