Cody

Solution 1983159

Submitted on 20 Oct 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
x = [1:8]'; n = 4; y_correct = [ 0 0 0 0 1 1 0 0 0 2 3 1 0 0 3 7 3 1 0 4 15 7 3 1 5 31 15 7 3 6 62 31 15 7 7 122 62 31 15 8 ]; y = fillMatrix(x,n) assert(all(abs(y(:)-y_correct(:))<1e-4));

m = 0 0 0 0 l = 0 0 0 0 1 l = 0 0 0 0 2 l = 2 0 0 0 2 l = 2 0 0 0 3 l = 5 0 0 0 3 l = 5 0 0 0 4 l = 9 0 0 0 4 l = 9 0 0 0 5 l = 14 0 0 0 5 l = 14 0 0 0 6 l = 20 0 0 0 6 l = 20 0 0 0 7 l = 27 0 0 0 7 l = 27 0 0 0 8 l = 35 0 0 0 8

Output argument "y" (and maybe others) not assigned during call to "fillMatrix". Error in Test1 (line 14) y = fillMatrix(x,n)

2   Fail
x = [1.584;-1.015;8.4587;6.0147;9.0258;-10.4785]; n = 4; y_correct = [ 0 0 0 0 1.584 1.584 0 0 0 -1.015 0.569 1.584 0 0 8.4587 10.6117 0.569 1.584 0 6.0147 18.7794 10.6117 0.569 1.584 9.0258 40.5699 18.7794 10.6117 0.569 -10.4785 ]; y = fillMatrix(x,n) assert(all(abs(y(:)-y_correct(:))<1e-4));

m = 0 0 0 0 l = 0 0 0 0 1.5840 l = 0 0 0 0 -1.0150 l = -1.0150 0 0 0 -1.0150 l = -1.0150 0 0 0 8.4587 l = 7.4437 0 0 0 8.4587 l = 7.4437 0 0 0 6.0147 l = 13.4584 0 0 0 6.0147 l = 13.4584 0 0 0 9.0258 l = 22.4842 0 0 0 9.0258 l = 22.4842 0 0 0 -10.4785 l = 12.0057 0 0 0 -10.4785

Output argument "y" (and maybe others) not assigned during call to "fillMatrix". Error in Test2 (line 12) y = fillMatrix(x,n)

3   Fail
x = [-2:10]'; n = 3; y_correct = [ 0 0 0 -2 -2 0 0 -1 -3 -2 0 0 -5 -3 -2 1 -9 -5 -3 2 -15 -9 -5 3 -26 -15 -9 4 -46 -26 -15 5 -82 -46 -26 6 -148 -82 -46 7 -269 -148 -82 8 -491 -269 -148 9 -899 -491 -269 10 ]; y = fillMatrix(x,n) assert(all(abs(y(:)-y_correct(:))<1e-4));

m = 0 0 0 l = 0 0 0 -2 l = 0 0 0 -1 l = -1 0 0 -1 l = -1 0 0 0 l = -1 0 0 0 l = -1 0 0 1 l = 0 0 0 1 l = 0 0 0 2 l = 2 0 0 2 l = 2 0 0 3 l = 5 0 0 3 l = 5 0 0 4 l = 9 0 0 4 l = 9 0 0 5 l = 14 0 0 5 l = 14 0 0 6 l = 20 0 0 6 l = 20 0 0 7 l = 27 0 0 7 l = 27 0 0 8 l = 35 0 0 8 l = 35 0 0 9 l = 44 0 0 9 l = 44 0 0 10 l = 54 0 0 10

Output argument "y" (and maybe others) not assigned during call to "fillMatrix". Error in Test3 (line 19) y = fillMatrix(x,n)

4   Fail
x = [-2:10]'; n = 0; y_correct = x; y = fillMatrix(x,n) assert(all(abs(y(:)-y_correct(:))<1e-4));

m = 1×0 empty double row vector l = -2 l = -1 l = -1 l = 0 l = 0 l = 1 l = 1 l = 2 l = 2 l = 3 l = 3 l = 4 l = 4 l = 5 l = 5 l = 6 l = 6 l = 7 l = 7 l = 8 l = 8 l = 9 l = 9 l = 10 l = 10

Output argument "y" (and maybe others) not assigned during call to "fillMatrix". Error in Test4 (line 5) y = fillMatrix(x,n)

5   Fail
x = [0.814723686393179;0.905791937075619;0.126986816293506;0.913375856139019;0.632359246225410;0.0975404049994095;0.278498218867048;0.546881519204984;0.957506835434298;0.964888535199277]; n = 8; y_correct = [0 0 0 0 0 0 0 0 0.814723686393179;0.814723686393179 0 0 0 0 0 0 0 0.905791937075619;1.72051562346880 0.814723686393179 0 0 0 0 0 0 0.126986816293506;2.66222612615548 1.72051562346880 0.814723686393179 0 0 0 0 0 0.913375856139019;6.11084129215648 2.66222612615548 1.72051562346880 0.814723686393179 0 0 0 0 0.632359246225410;11.9406659743994 6.11084129215648 2.66222612615548 1.72051562346880 0.814723686393179 0 0 0 0.0975404049994095;23.3465131075727 11.9406659743994 6.11084129215648 2.66222612615548 1.72051562346880 0.814723686393179 0 0 0.278498218867048;46.8739840290130 23.3465131075727 11.9406659743994 6.11084129215648 2.66222612615548 1.72051562346880 0.814723686393179 0 0.546881519204984;94.0163513583640 46.8739840290130 23.3465131075727 11.9406659743994 6.11084129215648 2.66222612615548 1.72051562346880 0.814723686393179 0.957506835434298;188.443328032957 94.0163513583640 46.8739840290130 23.3465131075727 11.9406659743994 6.11084129215648 2.66222612615548 1.72051562346880 0.964888535199277]; y = fillMatrix(x,n) assert(all(abs(y(:)-y_correct(:))<1e-4));

m = 0 0 0 0 0 0 0 0 l = 0 0 0 0 0 0 0 0 0.8147 l = 0 0 0 0 0 0 0 0 0.9058 l = 0.9058 0 0 0 0 0 0 0 0.9058 l = 0.9058 0 0 0 0 0 0 0 0.1270 l = 1.0328 0 0 0 0 0 0 0 0.1270 l = 1.0328 0 0 0 0 0 0 0 0.9134 l = 1.9462 0 0 0 0 0 0 0 0.9134 l = 1.9462 0 0 0 0 0 0 0 0.6324 l = 2.5785 0 0 0 0 0 0 0 0.6324 l = 2.5785 0 0 0 0 0 0 0 0.0975 l = 2.6761 0 0 0 0 0 0 0 0.0975 l = 2.6761 0 0 0 0 0 0 0 0.2785 l = 2.9546 0 0 0 0 0 0 0 0.2785 l = 2.9546 0 0 0 0 0 0 0 0.5469 l = 3.5014 0 0 0 0 0 0 0 0.5469 l = 3.5014 0 0 0 0 0 0 0 0.9575 l = 4.4589 0 0 0 0 0 0 0 0.9575 l = 4.4589 0 0 0 0 0 0 0 0.9649 l = 5.4238 0 0 0 0 0 0 0 0.9649

Output argument "y" (and maybe others) not assigned during call to "fillMatrix". Error in Test5 (line 5) y = fillMatrix(x,n)