write a program either in Matlab or C language to calculate
write a program, either in Matlab or C language, to calculate the area embraced by the following points: (2.4, 16), (3.6, 28), (4, 20.3), (5.5, 36.2), (8, 30.2), (9.8, 25), (11.8, 32), (12.3, 22.2), (10.5, 18), (9.5, 12.8), (7.8, 12.3), (6.2, 17), (4.3, 15.2), (3.2, 12), and (2.4, 16).
Solution
Convert the points into a matrix form
M =
[2.4 16
3.6 28
4 20.3
5.5 36.2
8 30.2
9.8 25
11.8 32
12.3 22.2
10.5 18
9.5 12.8
7.8 12.3
6.2 17
4.3 15.2
3.2 12
2.4 16
]
Matrix would be of dimension 15*2.
To calculate the area of the polygon in Matlab, we can use the library \"polyarea\".
Area = polyarea(M (:, 1), M (:, 2)); where M is the matrix constructed using the input data points.
