{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

446proj5

446proj5 - MATH 446 OR 481 SAUER SPRING 2010 Project 5...

This preview shows page 1. Sign up to view the full content.

MATH 446 / OR 481 SAUER SPRING 2010 Project 5 Approximating Functions by Polynomial Interpolation You will use Newton’s divided differences to build an interpolating polynomial that approximates the function f ( x ) = sin e cos 4 x . Since the function is periodic with period π/ 2 , it would be sufficient to approximate it on its fundamental domain [0 , π/ 2] . 1. First, let’s try using the slightly larger domain [0 , 2] . Use the Matlab command x0=2 * (0:(n-1))/(n-1); to define n equally-spaced base points in the interval [0 , 2] . Take y0 values from the func- tion f ( x ) at these x0 coordinates, using correct values from Matlab’s library functions. Then the Matlab m-files nest.m and newtdd.m can be used to find the degree n - 1 interpolating polynomial P n - 1 ( x ) that passes through the n points. Plot the actual f ( x ) versus P n - 1 ( x ) on [0 , 2] for n = 10 . Use a grid size of 0 . 01 or smaller to make the plot. In- clude the interpolating points, plotted as circles. In a separate figure, plot the interpolation error of P 9 ( x ) on [0 , 2] for n = 10 , using Matlab’s semilogy command. 2. Can you find an n that makes the maximum interpolation error on
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}