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));
|
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));
|
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));
|
4 | Fail |
x = [-2:10]';
n = 0;
y_correct = x;
y = fillMatrix(x,n)
assert(all(abs(y(:)-y_correct(:))<1e-4));
|
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));
|
894 Solvers
573 Solvers
525 Solvers
Solving Quadratic Equations (Version 1)
427 Solvers
218 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!