Cody

Solution 412033

Submitted on 2 Mar 2014 by Abdullah Caliskan
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
%% n=4 x=[2 1 2 3 4 5 -3 4 -1 2 2 2] y_correct = [2 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 -3 0 0 0 4 0 0 0 -1 0 0 0 2 0 0 0 2 0 0 0 2]; assert(isequal(time_expansion(x,n),y_correct))

n = 4 x = 2 1 2 3 4 5 -3 4 -1 2 2 2 p = 45 nn = 1 5 9 13 17 21 25 29 33 37 41 45 k = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 45 0 0 0 0 0 0 0 0 0 0 0 0 0 k = Columns 1 through 16 2 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 Columns 17 through 32 4 0 0 0 5 0 0 0 -3 0 0 0 4 0 0 0 Columns 33 through 45 -1 0 0 0 2 0 0 0 2 0 0 0 2

2   Pass
%% n=1 x=[2 1 2 3 4 5 -3 4 -1 2 2 2] y_correct=x; assert(isequal(time_expansion(x,n),y_correct))

n = 1 x = 2 1 2 3 4 5 -3 4 -1 2 2 2 p = 12 nn = 1 2 3 4 5 6 7 8 9 10 11 12 k = 0 0 0 0 0 0 0 0 0 0 0 0 k = 2 1 2 3 4 5 -3 4 -1 2 2 2

3   Pass
%% n=5 x=[2 1 2 3 4] y_correct=[2 0 0 0 0 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4]; assert(isequal(time_expansion(x,n),y_correct))

n = 5 x = 2 1 2 3 4 p = 21 nn = 1 6 11 16 21 k = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 21 0 0 0 0 0 k = Columns 1 through 16 2 0 0 0 0 1 0 0 0 0 2 0 0 0 0 3 Columns 17 through 21 0 0 0 0 4

4   Pass
%%

Suggested Problems

More from this Author22