- #1
StephvsEinst
- 41
- 1
Homework Statement
H[/B]ow to create a function to determine the area of a polynomial that has N vertexes in MATLAB?
Homework Equations
p = input('Introduce the number of vertexes of the polynomial:')
n=p-2;
The polynomial can be devided by N-2 triangles and the area of each triangle is given by A=(1/2)*det(B) where B=[x1 x2 x3 ... xn; y1 y2 y3 ... yn; 1 1 1 1 1 ... 1(last row is filled with n ones)]
The Attempt at a Solution
p = input('Introduce the number of vertexes of the polynomial:')
n=p-2;
if n<3:
fprintf('error')
else
(...) - I tried 'if cicles' and sums but I don't know know how to ask for all x and y of the polynomial vertexes (because the size of the matrix varies with the number of vertexes of the polynomial).
Would apreciate any kind of help :D