General form of Newtons interpolation polynomials is as foll

General form of Newton\'s interpolation polynomials is as follows f_n(x) = f(x_0) + (x - x_0) f [x_1, x_0] + (x - x_0) (x - x_1) f [x_2, x_1, x_0] +...+ (x- x_0) (x - x_1) ... (x - x_1) ... (x - x_n-1) f [x_n, x_n-1, ..., x_0] Where f[x_i, x_j] f(x_i) - f(x_j) / x_i - x_j f[x_i, x_j, x_k] = f[x_i, x_j] - f[x_j, x_k] / x_i - x_k f [x_n, x_n1, ..., x_1 , x_0] = f [x_n, x_n-1, ..., x_1] - f [x_n-1, x_n-2, ... x_0] For the data in the table, develop a Matlab code to estimate f(0.7) with 1^st order, 2^nd order, 3 order, and 4^th order Newton\'s interpolation According to the pseudo code provided below!. Also estimate errors for each case. INTERPOLATION SUBROUTINE Newton (x, y, n, xi, yint, ea) LOCAL fdd_n.n DOFOR i = 0, n fdd_i.0 = y_i END DO DOFOR j = 1. N DOFOR i - 0, n - j fdd_i, j = (fdd_i, j-, - fdd_iJ-1)/(x_i+j - x_i) END DO END DO xterm = 1 yint_0 = fdd_0.0 DOFOR order = 1, n xterm = xterm * (xi - X_order-1) yint2 = yint_order-1 yubt_order = yint2 END order END Newt Int An algorithm for Newton\'s interpolating polynomial written in pseudo code.

Solution

Newton interpolation polynomial:

as per the given values construct the table

x    0    1     2     3      4      5

f(x) 0.5 3.2   5.1   9.8   10.3    9.4

caliculate the diffrence on each

Fn(x) = f(x0)+(x-x0)f|x1,x0| + (x-x0)(x-x1)f|x2,x1,x0|+….+(x-x0)(x-x1)…(x-xn-1)f{xn,xn-1,….x0]

F[xi,xj]=f(xi) –f(xj)   / xi –xj

By constructing the table

And calculating the values

X                     0                    1                        2                           3                            4                            5

F(xi)                0.5                  3.2                        5.1                    9.8                        10.3                           9.4

F(xi,xi+1)       2.7                  1.9                        4.7                     0.5                        -0.9

F(xi..,xi+2)        -0.4                 1.4                        -2.1                   -0.7

F(xi,..xi+3)         0.6                  -1.167                   0.467              

F(xi,…xi+4)      -0.442               0.408

F(xi,…xi+5)    0.17

            

function fp=forward_interpolation(x,y,p)
n=length(x);
for i=1:n
diff(i,1)=y(i);
end
for j=2:n
for i=1:n-j+1
diff(i,j)=diff(i+1,j-1)-diff(i,j-1);
end
end
answer=y(1);
h=x(2)-x(1);
s=(p-x(1))/h;
for i=1:n-1
term=1;
for j=1:i
term=term*(s+j-1)/j;
end
answer=answer+term*diff(1,i+1);
end
fp=answer;

             

 General form of Newton\'s interpolation polynomials is as follows f_n(x) = f(x_0) + (x - x_0) f [x_1, x_0] + (x - x_0) (x - x_1) f [x_2, x_1, x_0] +...+ (x- x_
 General form of Newton\'s interpolation polynomials is as follows f_n(x) = f(x_0) + (x - x_0) f [x_1, x_0] + (x - x_0) (x - x_1) f [x_2, x_1, x_0] +...+ (x- x_

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site