Cody

# Problem 44301. Find the mean of two vectors

Solution 1443833

Submitted on 19 Feb 2018 by GEORGIOS BEKAS
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 2 3 4 5]; y = [6 7 8 9 10]; out_mean = [3.5000 4.5000 5.5000 6.5000 7.5000]; assert(isequal(your_fcn_name(x,y),out_mean))

out_mean = [] out_mean = 3.5000 out_mean = 3.5000 4.5000 out_mean = 3.5000 4.5000 5.5000 out_mean = 3.5000 4.5000 5.5000 6.5000 out_mean = 3.5000 4.5000 5.5000 6.5000 7.5000

2   Pass
x = [1 1 2 3 5 8 13 21]; y = ones(1,8); out_mean = [1 1 1.5 2 3 4.5 7 11]; assert(isequal(your_fcn_name(x,y),out_mean))

out_mean = [] out_mean = 1 out_mean = 1 1 out_mean = 1.0000 1.0000 1.5000 out_mean = 1.0000 1.0000 1.5000 2.0000 out_mean = 1.0000 1.0000 1.5000 2.0000 3.0000 out_mean = 1.0000 1.0000 1.5000 2.0000 3.0000 4.5000 out_mean = 1.0000 1.0000 1.5000 2.0000 3.0000 4.5000 7.0000 out_mean = 1.0000 1.0000 1.5000 2.0000 3.0000 4.5000 7.0000 11.0000

3   Pass
x = ones(1,100); y = 7*ones(1,100); out_mean = 4*ones(1,100); assert(isequal(your_fcn_name(x,y),out_mean))

out_mean = [] out_mean = 4 out_mean = 4 4 out_mean = 4 4 4 out_mean = 4 4 4 4 out_mean = 4 4 4 4 4 out_mean = 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Column 30 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 31 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 32 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 33 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 34 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 35 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 36 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 37 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 38 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 39 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 40 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 41 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 42 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 43 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 44 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 45 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 46 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 47 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 48 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 49 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 50 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Columns 30 through 51 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 out_mean = Columns 1 through 29 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

4   Pass
x = [5 3 8 1 6 7 9 4 2]; y = [3 7 5 6 1 2 9 8 4]; out_mean = [4 5 6.5 3.5 3.5 4.5 9 6 3]; assert(isequal(your_fcn_name(x,y),out_mean))

out_mean = [] out_mean = 4 out_mean = 4 5 out_mean = 4.0000 5.0000 6.5000 out_mean = 4.0000 5.0000 6.5000 3.5000 out_mean = 4.0000 5.0000 6.5000 3.5000 3.5000 out_mean = 4.0000 5.0000 6.5000 3.5000 3.5000 4.5000 out_mean = 4.0000 5.0000 6.5000 3.5000 3.5000 4.5000 9.0000 out_mean = 4.0000 5.0000 6.5000 3.5000 3.5000 4.5000 9.0000 6.0000 out_mean = 4.0000 5.0000 6.5000 3.5000 3.5000 4.5000 9.0000 6.0000 3.0000

5   Pass
x = 5:-1:1; y = 1:5; out_mean = 3*ones(1,5); assert(isequal(your_fcn_name(x,y),out_mean))

out_mean = [] out_mean = 3 out_mean = 3 3 out_mean = 3 3 3 out_mean = 3 3 3 3 out_mean = 3 3 3 3 3

6   Pass
x = 42; y = -42; out_mean = 0; assert(isequal(your_fcn_name(x,y),out_mean))

out_mean = [] out_mean = 0

### Community Treasure Hunt

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

Start Hunting!