Cody

Solution 1918119

Submitted on 1 Sep 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
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 = 4 4 4 ans = 4 3 3 ans = 3 3 5 ans = 5 5 5 ans = 5 2 9 ans = 9 7 12 ans = 12 6 6 ans = 6 5 1 ans = 1 3 3 ans = 3 3 21

Index exceeds the number of array elements (21). Error in moving_average (line 4) y(i:i+2) Error in Test1 (line 28) assert(isequal(moving_average(y),x_correct))

2   Fail
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 = 4 13 4 ans = 4 3 3 ans = 3 6 5 ans = 5 6 4

Index exceeds the number of array elements (9). Error in moving_average (line 4) y(i:i+2) Error in Test2 (line 14) assert(isequal(moving_average(y),x_correct))

Suggested Problems

More from this Author1