Lecture 33

# Lecture 33 - Inverse Interpolation Given xs and f(x)s...

This preview shows pages 1–8. Sign up to view the full content.

Inverse Interpolation Given x ’s and f ( x )’s – interpolation let us get new f ( x ) from new x What about new x from new f ( x )? Example: f ( x ) = 1/x 1. Switch x and f ( x ) and do new interpolation. However, non-uniform spacing in [ x vs. f ( x )] often leads to oscillations in the resulting interpolating polynomial 2. Fit an n th -order polynomial to the original data [ f ( x ) vs. x ], then use root-finding techniques to find x .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Extrapolation Extrapolation should be avoided whenever possible. If you have to, extrapolate out just a little bit out.
Use of a seventh-order polynomial to make a prediction of U.S. population in 2000 based on data from 1920 through 1990 Reasonable to use interpolation, but not the extrapolation Dangers of Extrapolation

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Difficulties with Polynomial Interpolation Humped and Flat Data 2 x 25 1 1 ) x ( f + = Runge’s function
Runge’s function Runge’s function » x2=-1:0.2:1 x2 = Columns 1 through 7 -1.0000 -0.8000 -0.6000 -0.4000 -0.2000 0 0.2000 Columns 8 through 11 0.4000 0.6000 0.8000 1.0000 » y2=1./(1+25*x2.^2) y2 = Columns 1 through 7 0.0385 0.0588 0.1000 0.2000 0.5000 1.0000 0.5000 Columns 8 through 11 0.2000 0.1000 0.0588 0.0385 » c=Lagrange_coef(x2,y2) c = Columns 1 through 7 0.1035 -1.5830 12.1102 -64.5875 282.5702 -678.1684 282.5702 Columns 8 through 11 -64.5875 12.1102 -1.5830 0.1035 » x=-1:0.02:1; y=1./(1+25*x.^2); » t=x; p=Lagrange_eval(t,x2,c); » H=plot(x,y,'r',t,p,'b-',x2,y2,'mo'); » set(H,'LineWidth',2.5) » print -djpeg075 poly5.jpg

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Oscillations Oscillations 2 x 25 1 1 ) x ( f + =
MATLAB Functions : polyfit and polyval >> x = linspace(-1,1,5); y = 1./(1+25*x.^2) >> xx = linspace(-1,1); p = polyfit(x,y,4) p = 3.3156 0.0000 -4.2772 0.0000 1.0000 >> y4 = polyval(p,xx); >> yr = 1./(1+25*xx.^2); >> H=plot(x,y,'o',xx,y4,xx,yr,'--') >> x=linspace(-1,1,11); y = 1./(1+25*x.^2) y = Columns 1 through 8 0.0385 0.0588 0.1000 0.2000 0.5000 1.0000 0.5000 0.2000 Columns 9 through 11 0.1000 0.0588 0.0385 >> p = polyfit(x,y,10) p = Columns 1 through 8 -220.9417 0.0000 494.9095 -0.0000 -381.4338

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 34

Lecture 33 - Inverse Interpolation Given xs and f(x)s...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online