Cody

Problem 45273. Find the centroid of triangle

Solution 3344943

Submitted on 23 Oct 2020 by Dyuman Joshi
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
coords=[0 0;1 0; 1 1; 0 1]; lnods=[ 1 2 4; 2 3 4]; y_correct =[1/3 1/3;2/3 2/3]; assert(isequal(your_fcn_name(coords,lnods),y_correct))

2   Pass
coords=[0 0;1 0; 1 1; 0 1; 0.5 0.5]; lnods=[ 1 2 5; 2 3 5;3 4 5;4 1 5]; y_correct =[1/2 1/6; 5/6 1/2 ;1/2 5/6;1/6 1/2]; assert(isequal(your_fcn_name(coords,lnods),y_correct))

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!