Upload
adhitya-rama-jr
View
221
Download
0
Embed Size (px)
Citation preview
8/13/2019 Chapter17rev1(Polinomial Interpolation)
1/19
Part 4Chapter 17
Polynomial Interpolation
PowerPoints organized by Dr. Michael R. Gustafson II, Duke UniversityAll images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
8/13/2019 Chapter17rev1(Polinomial Interpolation)
2/19
Chapter Objectives
Recognizing that evaluating polynomial coefficients withsimultaneous equations is an ill-conditioned problem.
Knowing how to evaluate polynomial coefficients andinterpolate with MATLABs polyfit and polyval functions.
Knowing how to perform an interpolation with Newtonspolynomial.
Knowing how to perform an interpolation with a Lagrangepolynomial.
Knowing how to solve an inverse interpolation problem by
recasting it as a roots problem. Appreciating the dangers of extrapolation.
Recognizing that higher-order polynomials can manifest
large oscillations.
8/13/2019 Chapter17rev1(Polinomial Interpolation)
3/19
Polynomial Interpolation
You will frequently have occasions to estimateintermediate values between precise data points.
The function you use to interpolate must pass
through the actual data points - this makes
interpolation more restrictive than fitting.
The most common method for this purpose is
polynomial interpolation, where an (n-1)thorder
polynomial is solved that passes through ndatapoints: f(x) a1 a2x a3x
2 anxn1
MATLAB version :
f(x) p1xn1
p2xn2
pn1x pn
8/13/2019 Chapter17rev1(Polinomial Interpolation)
4/19
Determining Coefficients
Since polynomial interpolation provides asmany basis functions as there are data
points (n), the polynomial coefficients can be
found exactly using linear algebra. MATLABs built in polyfit and polyval
commands can also be used - all that is
required is making sure the order of the fit forndata points is n-1.
8/13/2019 Chapter17rev1(Polinomial Interpolation)
5/19
Polynomial Interpolation Problems
One problem that can occur with solving for the coefficientsof a polynomial is that the system to be inverted is in theform:
Matrices such as that on the left are known asVandermonde matrices, and they are very ill-conditioned -meaning their solutions are very sensitive to round-offerrors.
The issue can be minimized by scaling and shifting the data.
x1n1 x1
n2 x1 1
x2n1 x2
n2 x2 1
xn1n1
xn1n2
xn1 1xn
n1 xnn2 xn 1
p1p2
pn1pn
f x1 f x2
f xn1 f xn
8/13/2019 Chapter17rev1(Polinomial Interpolation)
6/19
Newton Interpolating Polynomials
Another way to express a polynomialinterpolation is to use Newtons interpolating
polynomial.
The differences between a simple polynomialand Newtons interpolating polynomial for
first and second order interpolations are:
Order Simple Newton1st f1(x) a1 a2x f1(x) b1 b2(x x1)2nd f2(x) a1 a2x a3x
2 f2(x) b1 b2(x x1) b3(x x1)(x x2 )
8/13/2019 Chapter17rev1(Polinomial Interpolation)
7/19
Newton Interpolating Polynomials
(cont) The first-order Newton
interpolating polynomial
may be obtained from
linear interpolation and
similar triangles, as shown. The resulting formula
based on known pointsx1
andx2and the values of
the dependent function at
those points is:
f1 x f x1 f x2 f x1
x2x1x x1
8/13/2019 Chapter17rev1(Polinomial Interpolation)
8/19
Newton Interpolating Polynomials
(cont) The second-order Newton
interpolating polynomial
introduces some curvature to
the line connecting the points,
but still goes through the firsttwo points.
The resulting formula based
on known pointsx1,x2, andx3
and the values of the
dependent function at those
points is:
f2 x f x1 f x2 f x1
x2x1x x1
f x3 f x2 x3x2
f x2 f x1
x2x1x3x1
x x1 x x2
8/13/2019 Chapter17rev1(Polinomial Interpolation)
9/19
Newton Interpolating Polynomials
(cont)
In general, an (n-1)thNewton interpolatingpolynomial has all the terms of the (n-2)thpolynomial plus one extra.
The general formula is:
where
and the f[] represent divided differences.
fn1 x b1 b2 x x1 bn x x1 x x2 x xn1
b1 f x1 b2 f x2,x1
b3 f x3,x2,x1
bn f xn,xn1, ,x2 ,x1
8/13/2019 Chapter17rev1(Polinomial Interpolation)
10/19
Divided Differences
Divided difference are calculated as follows:
Divided differences are calculated using divided
difference of a smaller number of terms:
f xi,xj f xi f xj
xixj
f xi,xj ,xk f xi ,xj f xj ,xk
xixk
f xn,xn1, ,x2 ,x1 f xn,xn1, ,x2 f xn1,xn2, ,x1
xnx1
8/13/2019 Chapter17rev1(Polinomial Interpolation)
11/19
MATLAB Implementation
8/13/2019 Chapter17rev1(Polinomial Interpolation)
12/19
Lagrange Interpolating Polynomials
Another method that uses shifted value to expressan interpolating polynomial is the Lagrange
interpolating polynomial.
The differences between a simply polynomial and
Lagrange interpolating polynomials for first and
second order polynomials is:
where the Liare weighting coefficients that are
functions ofx.
Order Simple Lagrange
1st f1
(x) a1
a2
x f1
(x) L1
f x1
L
2
f x2
2nd f2(x) a1 a2x a3x2 f2(x) L1f x1 L2f x2 L3f x3
8/13/2019 Chapter17rev1(Polinomial Interpolation)
13/19
Lagrange Interpolating Polynomials
(cont) The first-order Lagrange
interpolating polynomial may
be obtained from a weighted
combination of two linear
interpolations, as shown.
The resulting formula basedon known pointsx1andx2
and the values of the
dependent function at those
points is:
f1(x) L1f x1 L2f x2
L1 x x2x1x2
,L2 x x1x2x1
f1(x)
x x2x1x2 f x1
x x1x2x1 f x2
8/13/2019 Chapter17rev1(Polinomial Interpolation)
14/19
Lagrange Interpolating Polynomials
(cont)
In general, the Lagrange polynomialinterpolation for npoints is:
where Liis given by:
fn1 xi Li x f xi i1
n
Li x x xj
xixjj1ji
n
8/13/2019 Chapter17rev1(Polinomial Interpolation)
15/19
MATLAB Implementation
8/13/2019 Chapter17rev1(Polinomial Interpolation)
16/19
Inverse Interpolation
Interpolation general means finding some value f(x)for somexthat is between given independent data
points.
Sometimes, it will be useful to find thexfor which
f(x) is a certain value - this is inverse interpolation.
Rather than finding an interpolation ofxas a
function of f(x), it may be useful to find an equation
for f(x) as a function ofxusing interpolation andthen solve the corresponding roots problem:
f(x)-fdesired=0 forx.
8/13/2019 Chapter17rev1(Polinomial Interpolation)
17/19
Extrapolation
Extrapolationis theprocess of estimating a
value of f(x) that lies
outside the range of the
known base pointsx1,x2,,xn.
Extrapolation represents
a step into the unknown,
and extreme care should
be exercised when
extrapolating!
8/13/2019 Chapter17rev1(Polinomial Interpolation)
18/19
Extrapolation Hazards
The following shows the results ofextrapolating a seventh-order population
data set:
8/13/2019 Chapter17rev1(Polinomial Interpolation)
19/19