Cody

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

Solution 2073240

Submitted on 29 Dec 2019 by 2quack
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)

P1P2 = 1 P2P3 = 1 P1P3 = 1.4142 angle2 = 1.5708 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)

P1P2 = 1.1180 P2P3 = 1.1180 P1P3 = 1 angle2 = 0.9273 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)

P1P2 = 3.1623 P2P3 = 2.2361 P1P3 = 4.1231 angle2 = 1.7127 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)

P1P2 = 4.4721 P2P3 = 49.1935 P1P3 = 44.7214 angle2 = 0.0000e+00 + 2.9802e-08i y = 0.0000e+00 + 3.2783e-06i

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!