Title: Curve fitting
1Curve fitting
- Usage
- Number of specified points is insufficient to
produce smooth curve - An analytical expression is required for further
manipulations - Basic methods
- Polynomial interpolation
- Spline interpolation
- Least Squares Method (LSM)
- Points to note
- Relative advantages and disadvantages of the
curve fitting methods - Stability with respect to errors in the data
points
2Polynomial interpolation
Given
Needs to be found
with the coefficients a0 ,..., an such that
If the interpolating nodes are different, the
interpolating polynomial exists and is unique.
3Direct solution of the system. Condition number
N3
N5
N10
Indirect solution auxiliary polynomials
4Example
Signal
400
200
0
1
2
Which are the intermediate values?
5Auxiliary polynomial 1
Method of Lagrange interpolation is based on
building auxiliary polynomials related to the
x-values.
6Auxiliary polynomials 2 and 3
7Lagrange polynomial
8Lagrange polynomial. General case
Auxiliary polynomials
Lagrange polynomial
9Example
Runge's function. Polynomial interpolation on the
interval -1,1 with equally spaced points
8
1
6
0.5
p15(x)
4
2
0
p5(x)
0
-2
0.5
-1
0
0.5
1
-1
0
0.5
1
-0.5
-0.5
5 nodes
15 nodes
10Spline interpolation
Piecewise linear approximation
f(x)
- Each segment is approximated by a linear
function. - The information stored in other points is not
used.
x
11Example
MathCad linterp(vx,vy,x)
12Natural cubic spline
yk
y2
y1
Sk(x)
y0
Sk1(x)
yn
...
...
xk
Passage through the given points
Smoothness
End conditions Natural cubic spline
13Example
Runge's function
15 nodes
Cubic spline
Polynomial
14Example. Derivatives of cubic spline
Runge's function
First derivative
Second derivative
15Least Squares Method (LSM)
- Best fit of a polynomial of given degree to the
given data points - Best for the case when the data points have
random (non-systematic) errors
16Example
Separating Signal and Noise. Fitting a line
through some given points, may give us a clean
view of the signal.
Gain of signal with respect to some evenly
spaced time values
Polynomial of 3rd degree
Polynomial of 2nd degree
Polynomial of 1st degree
17Example (Cont.)
p2(c)
p3(c)
p1(c)
Experimental data
18Summary
- Need for curve fitting - Number of data points is
insufficient to produce smooth curve - Polynomial interpolation
- Reduction to ill-conditioned system of equations
/ Lagrange polynomial - Polynomial, smooth
- Passes through all points
- High degree polynomial, degree is determined by
the number of points - Sensitive to errors
- Spline interpolation
- Different polynomial in each segment and
conditions of smoothness on the interfaces - Passes through all points
- Low sensitivity to errors
- Not sufficiently smooth
- Least Squares Method (LSM)
- Minimises the distance between the polynomial of
given degree and the data points - Does not pass through all points
- Polynomial - smooth
- Low sensitivity to errors