Cody

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

Solution 3272948

Submitted on 19 Oct 2020 by Svyatoslav Golousov
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
X=[1 0 0]; Y=[0 0 1]; y_correct = 0.5; assert(abs(your_fcn_name(X,Y)-y_correct)<1e-3)

vectors = 1 0 -1 0 -1 1 sides = 1.0000 1.0000 1.4142 p = 1.7071 y = 0.5000

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

vectors = -0.5000 -0.5000 1.0000 -1.0000 1.0000 0 sides = 1.1180 1.1180 1.0000 p = 1.6180 y = 0.5000

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

vectors = -1 2 -1 -3 -1 4 sides = 3.1623 2.2361 4.1231 p = 4.7607 y = 3.5000

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

vectors = -2 22 -20 -4 44 -40 sides = 4.4721 49.1935 44.7214 p = 49.1935 y = 0

Suggested Problems

More from this Author11

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!