Cody

Solution 1022584

Submitted on 19 Oct 2016 by Binbin Qi
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 )

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

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

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