Cody

# Problem 42818. center of mass

Solution 2100942

Submitted on 21 Jan 2020 by malues
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
R=[0,0]; X_correct = 0; Y_correct = 0; [X,Y]=center_of_mass(R); assert(X==X_correct&Y==Y_correct);

m = 1 X = 0 Y = 0

2   Pass
R=[0,0;1,1]; X_correct = 2/3; Y_correct = 2/3; [X,Y]=center_of_mass(R); assert(X==X_correct&Y==Y_correct);

m = 1 2 X = 0.6667 Y = 0.6667

3   Pass
R=[0,0;0,4]; X_correct = 0; Y_correct = 8/3; [X,Y]=center_of_mass(R); assert(X==X_correct&Y==Y_correct);

m = 1 2 X = 0 Y = 2.6667

4   Pass
R=[1:10;1:10]'; X_correct = 7; Y_correct = 7; [X,Y]=center_of_mass(R); assert(X==X_correct&Y==Y_correct);

m = 1 2 3 4 5 6 7 8 9 10 X = 7 Y = 7

5   Pass
R=[10:(-1):1;0:9]' X_correct = 4; Y_correct = 6; [X,Y]=center_of_mass(R); assert(X==X_correct&Y==Y_correct);

R = 10 0 9 1 8 2 7 3 6 4 5 5 4 6 3 7 2 8 1 9 m = 1 2 3 4 5 6 7 8 9 10 X = 4 Y = 6