Cody

# Problem 769. Calculate the area of a triangle between three points

Solution 1944319

Submitted on 20 Sep 2019
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   Fail
X=[1 0 0]; Y=[0 0 1]; y_correct = 0.5; assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

Unrecognized function or variable 'x2'. Error in your_fcn_name (line 4) y = 1/2*abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)); Error in Test1 (line 4) assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

2   Fail
X=[1 1.5 2]; Y=[0 1 0]; y_correct = 0.5; assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

Unrecognized function or variable 'x2'. Error in your_fcn_name (line 4) y = 1/2*abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)); Error in Test2 (line 4) assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

3   Fail
X=[2 3 1]; Y=[0 3 4]; y_correct = 3.500; assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

Unrecognized function or variable 'x2'. Error in your_fcn_name (line 4) y = 1/2*abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)); Error in Test3 (line 4) assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

4   Fail
X=[10 12 -10]; Y=[-7 -3 -47]; y_correct = 0; assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

Unrecognized function or variable 'x2'. Error in your_fcn_name (line 4) y = 1/2*abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)); Error in Test4 (line 4) assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)