Cody

# Problem 3103. Find out Harmonic mean.

Solution 1914142

Submitted on 28 Aug 2019
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:10; y_correct = 3.4142; assert(abs(h_mean(x)-y_correct)<0.0001)

Undefined function 'harmmean' for input arguments of type 'double'. Error in h_mean (line 2) y = harmmean(x); Error in Test1 (line 3) assert(abs(h_mean(x)-y_correct)<0.0001)

2   Fail
x = 1:5; y_correct = 2.1898; assert(abs(h_mean(x)-y_correct)<0.0001)

Undefined function 'harmmean' for input arguments of type 'double'. Error in h_mean (line 2) y = harmmean(x); Error in Test2 (line 3) assert(abs(h_mean(x)-y_correct)<0.0001)

3   Fail
x = 10; y_correct = 10; assert(abs(h_mean(x)-y_correct)<0.0001)

Undefined function 'harmmean' for input arguments of type 'double'. Error in h_mean (line 2) y = harmmean(x); Error in Test3 (line 3) assert(abs(h_mean(x)-y_correct)<0.0001)

4   Fail
x = 1:50; y_correct = 11.1131; assert(abs(h_mean(x)-y_correct)<0.0001)

Undefined function 'harmmean' for input arguments of type 'double'. Error in h_mean (line 2) y = harmmean(x); Error in Test4 (line 3) assert(abs(h_mean(x)-y_correct)<0.0001)

5   Fail
x = 1:100; y_correct = 19.2776; assert(abs(h_mean(x)-y_correct)<0.0001)

Undefined function 'harmmean' for input arguments of type 'double'. Error in h_mean (line 2) y = harmmean(x); Error in Test5 (line 3) assert(abs(h_mean(x)-y_correct)<0.0001)

### Community Treasure Hunt

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

Start Hunting!