This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture 19 Polynomial and Spline Interpolation A Chemical Reaction In a chemical reaction the concentration level y of the product at time t was measured every half hour. The following results were found: t .5 1.0 1.5 2.0 y .19 .26 .29 .31 We can input this data into Matlab as: > t1 = 0:.5:2 > y1 = [ 0 .19 .26 .29 .31 ] and plot the data with: > plot(t1,y1) Matlab automatically connects the data with line segments. This is the simplest form of interpo lation , meaning fitting a graph (of a function) between data points. What if we want a smoother graph? Try: > plot(t1,y1,*) which will produce just asterisks at the data points. Next click on Tools , then click on the Basic Fitting option. This should produce a small window with several fitting options. Begin clicking them one at a time, clicking them off before clicking the next. Which ones produce a good looking fit? You should note that the spline, the shapepreserving interpolant and the 4th degree polynomial produce very good curves. The others do not. We will discuss polynomial interpolation and spline interpolation in this lecture. Polynomial Fitting The most general degree n polynomial is: p n ( x ) = a n x n + a n 1 x n 1 + . . . + a 1 x + a . If we have exactly n + 1 data points, that is enough to exactly determine the n + 1 coefficients of p n ( x ) (as long as the data does not have repeated x values). If there are more data points, that would give us an overdetermined system (more equations than unknowns) and if there is less data the system would be undetermined. Conversely, if we have n data points, then an n 1 degree polynomial has exactly enough coefficients to fit the data. This is the case in the example above; there are 5 data points so there is exactly one 4th degree polynomial that fits the data. When we tried to use a 5th or higher degree polynomial Matlab returned a warning that the polynomial is not unique since degree > = number of data points....
View
Full
Document
This note was uploaded on 02/09/2012 for the course MATH 344 taught by Professor Young,t during the Fall '08 term at Ohio University Athens.
 Fall '08
 Young,T

Click to edit the document details