Cody

Solution 1185702

Submitted on 10 May 2017 by shahriar memaran
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
x = [1:8]'; n = 4; y_correct = [ 0 0 0 0 1; 0.2 0 0 0 2; 0.44 0.2 0 0 3; 0.728 0.44 0.2 0 4; 1.07360 0.728 0.44 0.2 5; 1.48832 1.07360 0.728 0.44 6; 1.945984 1.48832 1.07360 0.728 7; 2.4471808 1.945984 1.48832 1.07360 8]; y = fillMatrix2(x,n); assert(all(abs(y(:)-y_correct(:))<1e-4));

x = 0 0 0 0 1.0000 0.2000 0 0 0 2.0000 0 0 0 0 3.0000 0 0 0 0 4.0000 0 0 0 0 5.0000 0 0 0 0 6.0000 0 0 0 0 7.0000 0 0 0 0 8.0000 x = 0 0 0 0 1.0000 0.2000 0 0 0 2.0000 0.4400 0.2000 0 0 3.0000 0 0 0 0 4.0000 0 0 0 0 5.0000 0 0 0 0 6.0000 0 0 0 0 7.0000 0 0 0 0 8.0000 x = 0 0 0 0 1.0000 0.2000 0 0 0 2.0000 0.4400 0.2000 0 0 3.0000 0.7280 0.4400 0.2000 0 4.0000 0 0 0 0 5.0000 0 0 0 0 6.0000 0 0 0 0 7.0000 0 0 0 0 8.0000 x = 0 0 0 0 1.0000 0.2000 0 0 0 2.0000 0.4400 0.2000 0 0 3.0000 0.7280 0.4400 0.2000 0 4.0000 1.0736 0.7280 0.4400 0.2000 5.0000 0 0 0 0 6.0000 0 0 0 0 7.0000 0 0 0 0 8.0000 x = 0 0 0 0 1.0000 0.2000 0 0 0 2.0000 0.4400 0.2000 0 0 3.0000 0.7280 0.4400 0.2000 0 4.0000 1.0736 0.7280 0.4400 0.2000 5.0000 1.4883 1.0736 0.7280 0.4400 6.0000 0 0 0 0 7.0000 0 0 0 0 8.0000 x = 0 0 0 0 1.0000 0.2000 0 0 0 2.0000 0.4400 0.2000 0 0 3.0000 0.7280 0.4400 0.2000 0 4.0000 1.0736 0.7280 0.4400 0.2000 5.0000 1.4883 1.0736 0.7280 0.4400 6.0000 1.9460 1.4883 1.0736 0.7280 7.0000 0 0 0 0 8.0000 x = 0 0 0 0 1.0000 0.2000 0 0 0 2.0000 0.4400 0.2000 0 0 3.0000 0.7280 0.4400 0.2000 0 4.0000 1.0736 0.7280 0.4400 0.2000 5.0000 1.4883 1.0736 0.7280 0.4400 6.0000 1.9460 1.4883 1.0736 0.7280 7.0000 2.4472 1.9460 1.4883 1.0736 8.0000

2   Pass
x = [0.9649; 0.1576; 0.9706; 0.9572; 0.4854; 0.8003; 0.1419; 0.4218; 0.9157]; n = 10; y_correct = [0 0 0 0 0 0 0 0 0 0 0.9649;0.0877 0 0 0 0 0 0 0 0 0 0.1576;0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706;0.0982 0.0223 0.0877 0 0 0 0 0 0 0 0.9572;0.106 0.0982 0.0223 0.0877 0 0 0 0 0 0 0.4854;0.0727 0.106 0.0982 0.0223 0.0877 0 0 0 0 0 0.8003;0.1079 0.0727 0.106 0.0982 0.0223 0.0877 0 0 0 0 0.1419;0.0579 0.1079 0.0727 0.106 0.0982 0.0223 0.0877 0 0 0 0.4218;0.0886 0.0579 0.1079 0.0727 0.106 0.0982 0.0223 0.0877 0 0 0.9157;]; y = fillMatrix2(x,n); assert(all(abs(y(:)-y_correct(:))<1e-4));

x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0 0 0 0 0 0 0 0 0 0 0.9706 0 0 0 0 0 0 0 0 0 0 0.9572 0 0 0 0 0 0 0 0 0 0 0.4854 0 0 0 0 0 0 0 0 0 0 0.8003 0 0 0 0 0 0 0 0 0 0 0.1419 0 0 0 0 0 0 0 0 0 0 0.4218 0 0 0 0 0 0 0 0 0 0 0.9157 x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706 0 0 0 0 0 0 0 0 0 0 0.9572 0 0 0 0 0 0 0 0 0 0 0.4854 0 0 0 0 0 0 0 0 0 0 0.8003 0 0 0 0 0 0 0 0 0 0 0.1419 0 0 0 0 0 0 0 0 0 0 0.4218 0 0 0 0 0 0 0 0 0 0 0.9157 x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706 0.0982 0.0223 0.0877 0 0 0 0 0 0 0 0.9572 0 0 0 0 0 0 0 0 0 0 0.4854 0 0 0 0 0 0 0 0 0 0 0.8003 0 0 0 0 0 0 0 0 0 0 0.1419 0 0 0 0 0 0 0 0 0 0 0.4218 0 0 0 0 0 0 0 0 0 0 0.9157 x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706 0.0982 0.0223 0.0877 0 0 0 0 0 0 0 0.9572 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0 0.4854 0 0 0 0 0 0 0 0 0 0 0.8003 0 0 0 0 0 0 0 0 0 0 0.1419 0 0 0 0 0 0 0 0 0 0 0.4218 0 0 0 0 0 0 0 0 0 0 0.9157 x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706 0.0982 0.0223 0.0877 0 0 0 0 0 0 0 0.9572 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0 0.4854 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0.8003 0 0 0 0 0 0 0 0 0 0 0.1419 0 0 0 0 0 0 0 0 0 0 0.4218 0 0 0 0 0 0 0 0 0 0 0.9157 x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706 0.0982 0.0223 0.0877 0 0 0 0 0 0 0 0.9572 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0 0.4854 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0.8003 0.1079 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0.1419 0 0 0 0 0 0 0 0 0 0 0.4218 0 0 0 0 0 0 0 0 0 0 0.9157 x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706 0.0982 0.0223 0.0877 0 0 0 0 0 0 0 0.9572 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0 0.4854 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0.8003 0.1079 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0.1419 0.0579 0.1079 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0.4218 0 0 0 0 0 0 0 0 0 0 0.9157 x = 0 0 0 0 0 0 0 0 0 0 0.9649 0.0877 0 0 0 0 0 0 0 0 0 0.1576 0.0223 0.0877 0 0 0 0 0 0 0 0 0.9706 0.0982 0.0223 0.0877 0 0 0 0 0 0 0 0.9572 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0 0.4854 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0 0.8003 0.1079 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0 0.1419 0.0579 0.1079 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0 0.4218 0.0886 0.0579 0.1079 0.0727 0.1060 0.0982 0.0223 0.0877 0 0 0.9157

3   Pass
x = [1:20]'; n = 0; y_correct = [1:20]'; y = fillMatrix2(x,n); assert(all(abs(y(:)-y_correct(:))<1e-4));

4   Pass
x = [0.7922;-0.9595;-0.6557;0.03570;0.8491;0.9340;0.6787;-0.7577;0.7431;0.3922;-0.6555;0.1712;0.7060;-0.03180;0.2769;-0.04620;0.09710;0.8235;-0.6948;0.3171]; n = 4; y_correct = [0 0 0 0 0.7922;0.1584 0 0 0 -0.9595;-0.1602 0.1584 0 0 -0.6557;-0.1315 -0.1602 0.1584 0 0.0357;-0.0195 -0.1315 -0.1602 0.1584 0.8491;0.1393 -0.0195 -0.1315 -0.1602 0.934;0.1524 0.1393 -0.0195 -0.1315 0.6787;0.1639 0.1524 0.1393 -0.0195 -0.7577;-0.0643 0.1639 0.1524 0.1393 0.7431;0.2269 -0.0643 0.1639 0.1524 0.3922;0.1742 0.2269 -0.0643 0.1639 -0.6555;-0.0310 0.1742 0.2269 -0.0643 0.1712;0.0954 -0.0310 0.1742 0.2269 0.706;0.2343 0.0954 -0.0310 0.1742 -0.0318;0.0882 0.2343 0.0954 -0.0310 0.2769;0.1328 0.0882 0.2343 0.0954 -0.0462;0.1009 0.1328 0.0882 0.2343 0.0971;0.1307 0.1009 0.1328 0.0882 0.8235;0.2552 0.1307 0.1009 0.1328 -0.6948;-0.0151 0.2552 0.1307 0.1009 0.3171]; y = fillMatrix2(x,n); assert(all(abs(y(:)-y_correct(:))<1e-4));

x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 0 0 0 0 -0.6557 0 0 0 0 0.0357 0 0 0 0 0.8491 0 0 0 0 0.9340 0 0 0 0 0.6787 0 0 0 0 -0.7577 0 0 0 0 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 0 0 0 0 0.0357 0 0 0 0 0.8491 0 0 0 0 0.9340 0 0 0 0 0.6787 0 0 0 0 -0.7577 0 0 0 0 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 0 0 0 0 0.8491 0 0 0 0 0.9340 0 0 0 0 0.6787 0 0 0 0 -0.7577 0 0 0 0 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 -0.0195 -0.1315 -0.1602 0.1584 0.8491 0 0 0 0 0.9340 0 0 0 0 0.6787 0 0 0 0 -0.7577 0 0 0 0 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 -0.0195 -0.1315 -0.1602 0.1584 0.8491 0.1393 -0.0195 -0.1315 -0.1602 0.9340 0 0 0 0 0.6787 0 0 0 0 -0.7577 0 0 0 0 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 -0.0195 -0.1315 -0.1602 0.1584 0.8491 0.1393 -0.0195 -0.1315 -0.1602 0.9340 0.1524 0.1393 -0.0195 -0.1315 0.6787 0 0 0 0 -0.7577 0 0 0 0 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 -0.0195 -0.1315 -0.1602 0.1584 0.8491 0.1393 -0.0195 -0.1315 -0.1602 0.9340 0.1524 0.1393 -0.0195 -0.1315 0.6787 0.1639 0.1524 0.1393 -0.0195 -0.7577 0 0 0 0 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 -0.0195 -0.1315 -0.1602 0.1584 0.8491 0.1393 -0.0195 -0.1315 -0.1602 0.9340 0.1524 0.1393 -0.0195 -0.1315 0.6787 0.1639 0.1524 0.1393 -0.0195 -0.7577 -0.0643 0.1639 0.1524 0.1393 0.7431 0 0 0 0 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 -0.0195 -0.1315 -0.1602 0.1584 0.8491 0.1393 -0.0195 -0.1315 -0.1602 0.9340 0.1524 0.1393 -0.0195 -0.1315 0.6787 0.1639 0.1524 0.1393 -0.0195 -0.7577 -0.0643 0.1639 0.1524 0.1393 0.7431 0.2269 -0.0643 0.1639 0.1524 0.3922 0 0 0 0 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 0 0.2769 0 0 0 0 -0.0462 0 0 0 0 0.0971 0 0 0 0 0.8235 0 0 0 0 -0.6948 0 0 0 0 0.3171 x = 0 0 0 0 0.7922 0.1584 0 0 0 -0.9595 -0.1602 0.1584 0 0 -0.6557 -0.1315 -0.1602 0.1584 0 0.0357 -0.0195 -0.1315 -0.1602 0.1584 0.8491 0.1393 -0.0195 -0.1315 -0.1602 0.9340 0.1524 0.1393 -0.0195 -0.1315 0.6787 0.1639 0.1524 0.1393 -0.0195 -0.7577 -0.0643 0.1639 0.1524 0.1393 0.7431 0.2269 -0.0643 0.1639 0.1524 0.3922 0.1742 0.2269 -0.0643 0.1639 -0.6555 0 0 0 0 0.1712 0 0 0 0 0.7060 0 0 0 0 -0.0318 0 0 0 ...