Cody

Solution 1684547

Submitted on 1 Dec 2018 by Martin C.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
L=linspace(0,2.*pi,9); x = 1.2*cos(L)'; y = 1.2*sin(L)'; a_correct = 4.072935; assert( abs(polygon_area(x,y)-a_correct) < 1e-04 )

A = 0 A = 1.0182 A = 2.0365 A = 3.0547 A = 4.0729 A = 5.0912 A = 6.1094 A = 7.1276 A = 8.1459 A = 8.1459 A = 4.0729

2   Pass
x = (1:10)'; y = [0,ones(1,9)]'; a_correct = 4; assert( isequal(polygon_area(x,y),a_correct) )

A = 0 A = 1 A = 0 A = -1 A = -2.0000 A = -3.0000 A = -4 A = -5 A = -6 A = -7 A = -8 A = 4

3   Pass
x=[0,5,3]'; y=[0,0,9]'; a_correct = 22.5; assert( abs(polygon_area(x,y)-a_correct) < 1e-04 )

A = 0 A = 0 A = 45 A = 45 A = 22.5000

4   Pass
x=[0,5,3,11]'; y=[0,0,9,126]'; a_correct = 162; assert( isequal(polygon_area(x,y),a_correct) )

A = 162