Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab problem help plz! Develop a function in Matlab that implements Newton\'s

ID: 3689220 • Letter: M

Question

Matlab problem help plz!

Develop a function in Matlab that implements Newton's polynomial interpolation technique. The function should take three arguments: x, y, and xx, where x is a vector of nodes, y is a vector of function values at those nodes (i.e. x and y are the known points from which to construct the polynomial), and xx is a scalar or vector containing points to be interpolated. Have the code display the polynomial coefficients as they are built (i.e. display the information that would be obtained from a divided difference table). The function should return yy, the interpolated function values. Use this function to interpolate the values at x = 0, 2, and 4. Submit the code, the code run (with coefficient values), and the interpolated values.

Explanation / Answer

Function yy=NewtonInter(x,y,xx)

X=[-1 ,1, 3, 5, 6, 7]

Y= [10 ,8 2/3,11 1/3,36,35 23/24,52 2/3]

a= Newton-Interpolation(x,y,6)

N=length(x);

a(1)=y(1);

for k=1 : n-1

d(k,1)=(y(k+1)-y(k))/(x(k+1)-x(k));

end

for j=2 : n-1

for k = 1 : n-j

d(k-j)=(d(k+1),j-1)-d(k,j-1))/(x(k+j)-x(k));

end

end

d

for j = 2 : n

a(j)=d(1,j-1);

end

df(1)=1;

c(1)=a(1);

for j = 2 : n

df(j)=(xx-x(j-1))*df(j-1);

c(j)=a(j)*df(j);

end

yy =sum(c);