Question: Only need part b Please write code using matlab In Newton's form of the interpolation polynomial we need to compute the coefficients, co = flrol,
Please write code using matlab In Newton's form of the interpolation polynomial we need to compute the coefficients, co = flrol, c.-flro.r1], . . . ,c" = fFo, , . . ., . In the table of divided differences we proceed colmn by column and the needed coefficients are in the uppermost di- agonal. A simple 1D array, c of size n +1, can be used to store and compute these values. We just have to compute them from bottom to top to avoid losing values we have already computed. The following pseudocode does precisely this: for j =0.1 ,n end for k 1, n for j = n, n-1, k end end The evaluation of the interpolation polynmil in Newton's form can be then done with the Horner-like scheme seen in class: for J = n-1,n-2,-..,0 end (a) Write computer codes to connpute the coefficients co-ch-c" and to evaluate the corresponding interpolation polynomial at an arbitrary point r. Test your codes and turn in a run of your test. (b) Consider the function f(z)-e" for[-1, 1] and the nodes z.--1+j(2/10). j = 0.1 . . 10. Use your code(s) in (a) to evaluate P10(z) at the points =-1 + 3(2/100), j = 0.1, . . . , 100 and plot the error f(z)-P10(z)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
