Cody

Solution 1951346

Submitted on 28 Sep 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   Pass
X = [4800; 5100]; Y = [7.5247; 7.2851]*1e-1; x = 5000; y = Newton_Interp(X,Y,x) y_correct = 0.73650; assert(abs(y-y_correct)<1e-4)

y = 0.736496666666667

2   Fail
X = [4800; 5100]; Y = [7.5247; 7.2851]; x = 5000; y_correct = 7.3650; b_correct = [7.5247, -0.00079867]; [y,b] = Newton_Interp(X,Y,x) assert(abs(y-y_correct)<1e-4) assert(norm(b-b_correct)<1e-3)

y = 7.364966666666667 b = 7.524700000000000 -0.000798666666667

Assertion failed.

3   Fail
X = [300, 400, 500]; Y = [0.616, 0.525, 0.457]; x = 350; [y,b] = Newton_Interp(X,Y,x) y_correct = 0.567625; b_correct = [0.616, -0.00091, 0.00000115]; assert(abs(y-y_correct)<1e-4) assert(norm(b-b_correct)<1e-3)

y = 0.567625000000000 b = 0.616000000000000 -0.000910000000000 0.000001150000000

Assertion failed.

4   Fail
X = [1, 4 6]; Y = log(X); x = 2; [y,b] = Newton_Interp(X,Y,x) y_correct = 0.5658; b_correct = [0, 0.4620981, -0.0518731]; assert(abs(y-y_correct)<1e-4) assert(norm(b-b_correct)<1e-3)

y = 0.565844346900983 b = 0 0.462098120373297 -0.051873113263843

Assertion failed.