Cody

# Problem 1011. Newton Interpolation

Solution 157548

Submitted on 4 Nov 2012
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
%% Check linear interpolation 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)

```Error: Assertion failed. ```

2   Fail
%% Check Newton polynomial coefficients 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)

```Error: Output argument "b" (and maybe others) not assigned during call to "/users/msssystem17/Newton_Interp.m>Newton_Interp". ```

3   Fail
%% Check quadratic interpolation 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)

```Error: Output argument "b" (and maybe others) not assigned during call to "/users/msssystem17/Newton_Interp.m>Newton_Interp". ```

4   Fail
%% Check quadratic interpolation for log 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)

```Error: Output argument "b" (and maybe others) not assigned during call to "/users/msssystem17/Newton_Interp.m>Newton_Interp". ```