Cody

Problem 42801. means

Solution 3878153

Submitted on 27 Nov 2020
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]; y_correct = [1,1,1]; assert(isequal(means(x),y_correct))

Undefined function 'geomean' for input arguments of type 'double'. Error in means (line 2) y = [mean(x) geomean(x) harmmean(x)] Error in Test1 (line 3) assert(isequal(means(x),y_correct))

2   Fail
x = [1,4]; y_correct = [2.5,2,8/5]; assert(isequal(means(x),y_correct))

Undefined function 'geomean' for input arguments of type 'double'. Error in means (line 2) y = [mean(x) geomean(x) harmmean(x)] Error in Test2 (line 3) assert(isequal(means(x),y_correct))

3   Fail
x = 1:10; y = means(x); y_correct = [5.5,nthroot(3628800,10),25200/7381]; for i = 1:3 assert(abs(y(i)-y_correct(i))<1e-4) end

Undefined function 'geomean' for input arguments of type 'double'. Error in means (line 2) y = [mean(x) geomean(x) harmmean(x)] Error in Test3 (line 2) y = means(x);

Suggested Problems

More from this Author9

Community Treasure Hunt

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

Start Hunting!