educational course/tutorialoutlet.com educational course/tutorialoutlet.com | Page 2

where xdata , ydata LPvalues : : vectors of the tpxk , yk quk0 datapoints the vector of values of Πn on the respective locations in xgrid n LPvalues must be computed using the Lagrange formulation Πnpxq ¸ y φ pxq , n k φkpxq k ¹ xx n j j 0 j k k 0 xkxj You may find the prod function useful here . ( a ) Consider the set of points tp1 , 4q , p2 , 3q , p3 , 5q , p4 , 7q , p5 , 2qu . Use your LagrangePoly function to find the values of the interpolating polynomial on the grid 1:0.01:5 . Plot on the same figure the datapoints with orange circles and the interpolating polynomial on the grid 1:0.01:5 with a solid line . ( b ) Repeat part ( a ) for the set of 11 , 21 , 31 uniformly distributed nodes xk in fRpxq 1 r1 , 1s and ykfRpxk q , where 1 25x2 is Runge ‘ s function on the grid -1:0.01:1 . Use different colors when plotting the interpolating polynomials for each of the three cases and add a legend . Use ylim to show the plots for 1 ¤ y ¤ 1 . Print on the screen a message for each case , stating the maximum absolute error between the function values and the interpolating polynomial values on the grid . 1 APMA0160 , Spring 2017 Homework 5 ( c ) Repeat part ( b ) for the set of 11 , 21 , 31 uniformly distributed nodes xk in rπ , πs and yk grid -pi : 0.01 : pi . ( d ) Repeat part ( b ) for the set of 11 , 21 , 31 Chebyshev-Gauss-Lobatto nodes xk in on the grid -1:0.01:1 . sinpxk q on the r1 , 1s and ykfRpxk q ( e ) Write in a block of comments at the end of your prob1 () function a few comments about the behavior