1 curve-fitting spline interpolation. 2 curve fitting regression linear regression polynomial...
TRANSCRIPT
![Page 1: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/1.jpg)
1
Curve-Fitting
Spline Interpolation
![Page 2: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/2.jpg)
2
Curve FittingRegression
Linear RegressionPolynomial RegressionMultiple Linear RegressionNon-linear Regression
InterpolationNewton's Divided-Difference InterpolationLagrange Interpolating PolynomialsSpline Interpolation
![Page 3: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/3.jpg)
3
Spline Interpolation
• For some cases, polynomials can lead to erroneous results because of round off error and overshoot.
• Alternative approach is to apply lower-order polynomials to subsets of data points. Such connecting polynomials are called spline functions.
![Page 4: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/4.jpg)
4
![Page 5: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/5.jpg)
5
(a)Linear spline– Derivatives are not
continuous– Not smooth
(b) Quadratic spline – Continuous 1st
derivatives
(c) Cubic spline– Continuous 1st & 2nd
derivatives – Smoother
![Page 6: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/6.jpg)
6
Quadratic Spline
![Page 7: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/7.jpg)
7
Quadratic Spline• Spline of Degree 2
• A function Q is called a spline of degree 2 if– The domain of Q is an interval [a, b].– Q and Q' are continuous functions on [a, b].– There are points xi (called knots) such that
a = x0 < x1 < … < xn = b and Q is a polynomial of degree at most 2 on each subinterval [xi, xi+1].
• A quadratic spline is a continuously differentiable piecewise quadratic function.
![Page 8: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/8.jpg)
8
Exercise• Which of the following is a quadratic spline?
]2,1[21
]1,0[
]0,2[
)( 2
2
xx
xx
xx
xB
]2,1[1
]1,0[2
]0,2[
)(2
2
2
xxx
xxx
xx
xA
![Page 9: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/9.jpg)
9
Exercise (Solution)
]2,1[1
]1,0[2
]0,2[
)(2
2
2
xxx
xxx
xx
xA
spline quadratica not is )( Thus
).()( 0, At
22)(
2)(
'1
'0
'1
'0
xA
xAxAx
xxA
xxA
]2,1[21
]1,0[
]0,2[
)( 2
2
xx
xx
xx
xB
spline. quadratica is
2, degree of polynomial all are
s' since and [-2,2], in allfor
continuous are and Since
)1(2)1(
)0(0)0(
)1(1)1(
)0(0)0(
'2
'1
'1
'0
21
10
B
Bx
B'B
BB
BB
BB
BB
i
![Page 10: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/10.jpg)
10
Observations• n+1 points
• n intervals
• Each interval is connected by a 2nd-order polynomial Qi(x) = aix2 + bix + ci, i = 0, …, n–1 .
• Each polynomial has 3 unknowns
• Altogether there are 3n unknowns
• Need 3n equations (or conditions) to solve for 3n unknowns
Quadratic Interpolation
![Page 11: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/11.jpg)
11
1. Interpolating conditions– On each sub interval [xi, xi+1], the function Qi(x) must
satisfy the conditions
Qi(xi) = f(xi) and Qi(xi+1) = f(xi+1)
– These conditions yield 2n equations
Quadratic Interpolation (3n conditions)
1...,,0
)(
)(
112
1
2
ni
xfcxbxa
xfcxbxa
iiiiii
iiiiii
![Page 12: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/12.jpg)
12
Quadratic Interpolation (3n conditions)
2. Continuous first derivatives– The first derivatives at the interior knots must be
equal.– This adds n-1 more equations:
1...,,122 11 nibxabxa iiiiii
We now have 2n + (n – 1) = 3n – 1 equations. We need one more equation.
![Page 13: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/13.jpg)
13
3. Assume the 2nd derivatives is zero at the first point.– This gives us the last condition as
Quadratic Interpolation (3n conditions)
002 11 aa
– With this condition selected, the first two points are connected by a straight line.
– Note: This is not the only possible choice or assumption we can make.
![Page 14: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/14.jpg)
14
Example
• Fit quadratic splines to the given data points.
i 0 1 2 3
xi 3 4.5 7 9
f(xi) 2.5 1 2.5 0.5
![Page 15: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/15.jpg)
15
Example (Solution)
1. Interpolating conditions
5.0981
5.2749
5.2749
0.15.425.20
0.15.425.20
5.239
333
333
222
222
111
111
cba
cba
cba
cba
cba
cba
2. Continuous first derivatives
3322
2211
1414
99
baba
baba
3. Assume the 2nd derivatives is zero at the first point.
01 a
![Page 16: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/16.jpg)
16
0
0
0
5.0
5.2
5.2
1
1
5.2
000000001
01140114000
000019019
1981000000
1749000000
0001749000
00015.425.20000
00000015.425.20
000000139
3
3
3
2
2
2
1
1
1
c
b
a
c
b
a
c
b
a
Example (Solution)
We can write the system of equations in matrix form as
Notice that the coefficient matrix is sparse.
![Page 17: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/17.jpg)
17
Example (Solution)The system of equations can be solved to
yield
3.916.246.1
46.1876.664.0
5.510
333
222
111
cba
cba
cba
]9,7[3.916.246.1
]7,5.4[46.1876.664.0
]5.4,3[5.5
)(2
2
xxx
xxx
xx
xQ
Thus the quadratic spline that interpolates the given points is
![Page 18: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/18.jpg)
18
Efficient way to derive quadratic spline
2
1
1
1
11
1
11
)()(2
)()()(
as )( form to
rearranged and resolved, ,integrated be turnin can which
)('
as form Lagrangein )(' writecan We
).,( and ) ,( throughpassing linestraight a is )('
hatimpliest t condition sderivativefirst continuous The
line.straingt a is )(' function quadratica is )(
).('Let
iii
iiiiii
i
iii
ii
ii
ii
i
iiiii
ii
iii
xxxx
zzxxzxfxQ
xQ
zxx
xxz
xx
xxxQ
xQ
zxzxxQ
xQxQ
xQz
![Page 19: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/19.jpg)
19
Efficient way to derive quadratic spline
2
1
1 )()(2
)()()( iii
iiiiii xx
xx
zzxxzxfxQ
11)(' and
)('),()( verify correct, is that thissee To
iii
iiiiii
zxQ
zxQxfxQ
s.' of value thedetermine toneed still We iz
ii
iiii
iii
xx
xfxfzz
nxfxQ
1
11
11
)()(2
:equations following the
obtain can weequations, resulting esimpify th and
1,- ..., 0, ifor )( )( settingBy
![Page 20: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/20.jpg)
20
Efficient way to derive quadratic spline
nixx
xfxfzz
xf"z
xxxx
zzxxzxfxQ
ii
iiii
iii
iiiiii
..., 1, 0, )()(
2
0) )( assume weif(0
where
)()(2
)()()(
1
11
00
2
1
1
![Page 21: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/21.jpg)
21
Cubic Spline
• Spline of Degree 3
• A function S is called a spline of degree 3 if– The domain of S is an interval [a, b].– S, S' and S" are continuous functions on [a, b].
– There are points ti (called knots) such that
a = t0 < t1 < … < tn = b and Q is a polynomial of degree at most 3 on each subinterval [ti, ti+1].
![Page 22: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/22.jpg)
22
Cubic Spline (4n conditions)1. Interpolating conditions (2n conditoins).
2. Continuous 1st derivatives (n-1 conditions)• The 1st derivatives at the interior knots must be equal.
3. Continuous 2nd derivatives (n-1 conditions)• The 2nd derivatives at the interior knots must be equal.
4. Assume the 2nd derivatives at the end points are zero (2 conditions).
• This condition makes the spline a "natural spline".
![Page 23: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/23.jpg)
23
Efficient way to derive cubic spline
1,...,1for
)()()()(6)(2
0,0
solving from obtained be can s' unknown theand
where
)(6
)()(
6
)(
)(6
)(6
)(
1
111111
0
1
111
31
31
ni
h
xfxf
h
xfxfzhzhhzh
zz
z
xxh
xxzh
h
xfxxz
h
h
xf
xxh
zxx
h
zxS
i
ii
i
iiiiiiiii
n
i
iii
iii
i
iii
i
i
i
ii
ii
i
ii
![Page 24: 1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression](https://reader033.vdocument.in/reader033/viewer/2022061319/56649d095503460f949dae82/html5/thumbnails/24.jpg)
24
Summary• Advantages of spline interpolation over
polynomial interpolation
• The conditions that are used to derive the quadratic and cubic spline functions
• Characteristics of cubic spline – Overcome the problem of "overshoot"– Easier to derive (than high-order polynomial)– Smooth (continuous 2nd-order derivatives)