Page 128 - Applied Numerical Methods Using MATLAB
P. 128
3
INTERPOLATION
AND CURVE FITTING
1
There are two topics to be dealt with in this chapter, namely, interpolation and
curve fitting. Interpolation is to connect discrete data points in a plausible way
so that one can get reasonable estimates of data points between the given points.
The interpolation curve goes through all data points. Curve fitting, on the other
hand, is to find a curve that could best indicate the trend of a given set of data.
The curve does not have to go through the data points. In some cases, the data
may have different accuracy/reliability/uncertainty and we need the weighted
least-squares curve fitting to process such data.
3.1 INTERPOLATION BY LAGRANGE POLYNOMIAL
For a given set of N + 1 data points {(x 0 ,y 0 ), (x 1 ,y 1 ), ...,(x N ,y N )},wewant
to find the coefficients of an Nth-degree polynomial function to match them:
2
p N (x) = a 0 + a 1 x + a 2 x +· · · + a N x N (3.1.1)
The coefficients can be obtained by solving the following system of linear
equations.
2 N
a 0 + x 0 a 1 + x a 2 +· · · + x a N = y 0
0 0
2 N
a 0 + x 1 a 1 + x a 2 +· · · + x a N = y 1
1 1
(3.1.2)
··· ··· ··· ··· ··· ··· ··· ··· ·
2 N
a 0 + x N a 1 + x a 2 +· · · + x a N = y N
N N
1 If we estimate the values of the unknown function at the points that are inside/outside the range
of collected data points, we call it the interpolation/extrapolation.
Applied Numerical Methods Using MATLAB , by Yang, Cao, Chung, and Morris
Copyright 2005 John Wiley & Sons, I nc., ISBN 0-471-69833-4
117