Cody

Solution 376502

Submitted on 30 Dec 2013 by Selvaraaju Murugesan
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
%% y=[4 4 4 3 3 3 5 5 5 2 9 7 12 6 6 5 1 3 3 3 21 ]; x_correct = [ 4 4 4 3 3 3 5 5 5 6 6 6 8 8 8 3 3 3 9 9 9 ]; assert(isequal(moving_average(y),x_correct))
ans = Columns 1 through 10 4.0000 3.6667 3.3333 3.0000 3.6667 4.3333 5.0000 4.0000 5.3333 6.0000 Columns 11 through 19 9.3333 8.3333 8.0000 5.6667 4.0000 3.0000 2.3333 3.0000 9.0000
2   Pass
%% y=[4 13 4 3 3 6 5 6 4 ]; x_correct = [ 7 7 7 4 4 4 5 5 5]; assert(isequal(moving_average(y),x_correct))
ans = 7.0000 6.6667 3.3333 4.0000 4.6667 5.6667 5.0000