Cody

Solution 1437478

Submitted on 9 Feb 2018 by Mehmet OZC
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
v = 1:10; n = 5; stats_correct = [1 1 1 1 1 1]; stats = move_mad(v, n); assert(isequal(stats, stats_correct));

stats = 1 stats = 1 1 stats = 1 1 1 stats = 1 1 1 1 stats = 1 1 1 1 1 stats = 1 1 1 1 1 1

2   Pass
v = logspace(0, 1, 10); n = 3; stats_correct = [0.292 0.377 0.486 0.628 0.811 1.048 1.353 1.748]; stats = move_mad(v, n); assert(isequal(stats, stats_correct));

stats = 0.2920 stats = 0.2920 0.3770 stats = 0.2920 0.3770 0.4860 stats = 0.2920 0.3770 0.4860 0.6280 stats = 0.2920 0.3770 0.4860 0.6280 0.8110 stats = 0.2920 0.3770 0.4860 0.6280 0.8110 1.0480 stats = 0.2920 0.3770 0.4860 0.6280 0.8110 1.0480 1.3530 stats = 0.2920 0.3770 0.4860 0.6280 0.8110 1.0480 1.3530 1.7480

3   Pass
rng('default'); v = randn(1000, 1); n = 990; stats_correct = 0.660*ones(1, 11); stats = move_mad(v, n); assert(isequal(stats, stats_correct));

stats = 0.6600 stats = 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 stats = 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600 0.6600