MATH 446 / OR 481SAUERSPRING 2010Project 5Approximating Functionsby Polynomial InterpolationYou will use Newton’s divided differences to build an interpolating polynomial that approximatesthe functionf(x) = sinecos 4x.Since the function is periodic with periodπ/2, it would besufficient to approximate it on its fundamental domain[0, π/2].1. First, let’s try using the slightly larger domain[0,2]. Use the Matlab commandx0=2*(0:(n-1))/(n-1);to definenequally-spaced base points in the interval[0,2]. Takey0values from the func-tionf(x)at thesex0coordinates, using correct values from Matlab’s library functions.Then the Matlab m-filesnest.mandnewtdd.mcan be used to find the degreen-1interpolating polynomialPn-1(x)that passes through thenpoints. Plot the actualf(x)versusPn-1(x)on[0,2]forn= 10. Use a grid size of0.01or smaller to make the plot. In-clude the interpolating points, plotted as circles. In a separate figure, plot the interpolationerror ofP9(x)on[0,2]forn= 10, using Matlab’ssemilogycommand.2. Can you find annthat makes the maximum interpolation error on
This is the end of the preview.
access the rest of the document.