Cody

Solution 1742231

Submitted on 4 Mar 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.000000000000 2.000000000000 3.000000000000 4.000000000000 5.000000000000 6.000000000000 7.000000000000 8.000000000000 9.000000000000 10.000000000000 ]; y=sol(x); yref=-5.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 y = 1 2 3 4 5 6 7 8 9 10 y = 55 yref = -5

Assertion failed.

2   Fail
x=[ 2.000000000000 4.000000000000 8.000000000000 16.000000000000 32.000000000000 64.000000000000 128.000000000000 256.000000000000 512.000000000000 1024.000000000000 ]; y=sol(x); yref=-682.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 -1

Matrix dimensions must agree. Error in sol (line 4) y = x.*m Error in Test2 (line 2) y=sol(x);

3   Fail
x=[ 1.000000000000 4.000000000000 9.000000000000 16.000000000000 25.000000000000 36.000000000000 49.000000000000 64.000000000000 81.000000000000 100.000000000000 ]; y=sol(x); yref=-55.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 y = 1 4 9 16 25 36 49 64 81 100 y = 385 yref = -55

Assertion failed.

4   Fail
x=[ 1.000000000000 8.000000000000 27.000000000000 64.000000000000 125.000000000000 216.000000000000 343.000000000000 512.000000000000 729.000000000000 1000.000000000000 ]; y=sol(x); yref=-575.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 y = 1 8 27 64 125 216 343 512 729 1000 y = 3025 yref = -575

Assertion failed.

5   Fail
x=[ 1.000000000000 0.500000000000 0.333333333333 0.250000000000 0.200000000000 0.166666666667 0.142857142857 0.125000000000 0.111111111111 0.100000000000 ]; y=sol(x); yref=0.645634920635 assert(abs(y-yref)<1e-6);

le = 10 m = 1 y = 1.0000 0.5000 0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 y = 2.9290 yref = 0.6456

Assertion failed.

6   Fail
x=[ 0.243132468125 -0.107772980466 0.155477890178 -0.328813312188 0.206046088020 -0.468167153623 -0.223077015039 -0.453828609369 -0.402868218764 0.323457828327 ]; y=sol(x); yref=1.013835439837 assert(abs(y-yref)<1e-6);

le = 10 m = 1×0 empty double row vector

Error using .* Matrix dimensions must agree. Error in sol (line 4) y = x.*m Error in Test6 (line 2) y=sol(x);

Suggested Problems

More from this Author1