Upload
zahira-amody
View
221
Download
0
Embed Size (px)
Citation preview
8/13/2019 Chapter 6 f Inter
1/34
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
by
Dr. Ibrahim A. AssakkafSpring 2001
ENCE 203 - Computation Methods in Civil Engineering IIDepartment of Civil and Environmental Engineering
University of Maryland, College Park
CHAPTER 6f.
NUMERICAL
INTERPOLATION
Assakkaf
Slide No. 164
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Generally, the higher-order polynomial
gives higher accuracy.
However, this is not true in some
situations, especially when the data
points include local abrupt changes in
f(x) values for steady changes inx
values.
In these situations, the accuracy
decreases.
8/13/2019 Chapter 6 f Inter
2/34
Assakkaf
Slide No. 165
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
In these cases, the function can lead to
erroneous results because of round-off
error and overshoot.
An alternative approach is to use a
lower-order polynomial to subsets of the
data points.
Such connecting polynomials are calledsplines functions.
Assakkaf
Slide No. 166
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
The concept of spline came from the
drafting technique of using thin flexible
strip, called spline, to draw smooth
curves through a set of points as shown
in the figure of the viewgraph.
The drafter places paper over woodenboard and hammer nails into the paper
and the board at the locations of the
data points.
8/13/2019 Chapter 6 f Inter
3/34
Assakkaf
Slide No. 167
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Origin of Spline Concept
Assakkaf
Slide No. 168
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Need for Splines
f(x)
x
Abrupt change indicates oscillation in interpolating polynomial.
8/13/2019 Chapter 6 f Inter
4/34
Assakkaf
Slide No. 169
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Need for Splines
f(x)
x
Abrupt change indicates oscillation in interpolating polynomial.
Assakkaf
Slide No. 170
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Need for Splines
f(x)
x
Abrupt change indicates oscillation in interpolating polynomial.
8/13/2019 Chapter 6 f Inter
5/34
Assakkaf
Slide No. 171
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Need for Splines
f(x)
x
The spline provides a much more acceptable approximation.
Assakkaf
Slide No. 172
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Types of Splines
1. Linear (simplest),
2. Quadratic, and
3. Cubic (most popular)
8/13/2019 Chapter 6 f Inter
6/34
Assakkaf
Slide No. 173
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Linear or First-order Splines
f(x)
x
S1S2 S3
Assakkaf
Slide No. 174
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic or Second-order Splines
f(x)
x
S1
S2
S3
8/13/2019 Chapter 6 f Inter
7/34
Assakkaf
Slide No. 175
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic or Third-order Splines
f(x)
x
S1S2
S3
Assakkaf
Slide No. 176
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Linear Splines
Linear or first-order splines are the
simplest to construct.
They are straight lines connecting two pair
of the data points.
Therefore, an algorithm for straight lines
that connect each pair of the data points
can be developed very easily.
8/13/2019 Chapter 6 f Inter
8/34
Assakkaf
Slide No. 177
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Linear Splines The interpolation function can be expressed as
( ) ( ) ( ) ( )
( )
( ) ( ) ( ) ( )
( )
( ) ( ) ( ) ( )
( )
( ) ( ) ( ) ( )
( ) nnnnn
nnnn
iii
ii
iiii
xxxxxxx
xfxfxfxf
xxxxxxx
xfxfxfxf
xxxxxxx
xfxfxfxf
xxxxxxx
xfxfxfxf
+=
+=
+=
+=
+
+
+
11
1
111
1
1
1
322
23
2322
211
12
1211
for
for
for
for
!
(1)
Assakkaf
Slide No. 178
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Linear Splines
Requirements for Linear Splines:
The linear spline functions as presented by the
previous equations are to satisfy the following
condition:
( ) ( ) 1,,2,1For1 == + nixfxf iiii "
(2)
8/13/2019 Chapter 6 f Inter
9/34
Assakkaf
Slide No. 179
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 1 (Linear Splines)
Fit the following set of data with first-order
(linear) splines. Evaluate the function atx
= 5. Also plot the spline functions.
x 3 4.5 7 9
f(x) 2.5 1 2.5 0.5
Assakkaf
Slide No. 180
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 1 - Linear Splines
For the first pairs of data:
( ) ( ) ( ) ( )
( )
( ) ( )( )
( ) 5.43For5.5
)3(5.2
335.4
5.21
5.2
1
1
1
12
1211
=
=
+=
+=
xxxf
xxf
xxf
xxxx
xfxfxfxf 14.5
2.53
f(x)x
8/13/2019 Chapter 6 f Inter
10/34
Assakkaf
Slide No. 181
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 1 (contd) - Linear Splines
For the second pairs of data:
( ) ( ) ( ) ( )
( )
( ) ( )
( )
( ) 75.4For6.07.1
)5.4(6.01
5.45.47
15.21
1
2
2
23
2322
+=
+=
+=
+=
xxxf
xxf
xxf
xxxx
xfxfxfxf
2.57
14.5
f(x)x
Assakkaf
Slide No. 182
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 1 (contd) - Linear Splines
For the third pairs of data:
( ) ( ) ( ) ( )
( )
( ) ( )( )
( ) 97For5.9
)7(5.2
779
5.25.0
5.2
1
2
3
34
3433
=
=
+=
+=
xxxf
xxf
xxf
xxxx
xfxfxfxf
0.59
2.57
f(x)x
8/13/2019 Chapter 6 f Inter
11/34
Assakkaf
Slide No. 183
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 1 (contd) - Linear Splines
Finding the value of the function whenx = 5
Ifx = 5, then the following spline applies:
Thus,
( ) 75.4For6.07.1 += xxxf
( )
( )3.1
56.07.1
6.07.15
=+=
+= xf
Assakkaf
Slide No. 184
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 1 (contd) - Linear Splines
Plot of the linear spline functions:
0
0.5
1
1.5
2
2.5
3
0 2 4 6 8 10
x
f(x)
f1f2
f3
8/13/2019 Chapter 6 f Inter
12/34
Assakkaf
Slide No. 185
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic Splines
The quadratic splines provide a quadratic
equation connecting any two adjacent data
points within the data set of the type
( )[ ] nixfx ii ,,3,2,1for, "=
f(xn)f(x4)f(x3)f(x2)f(x1)f(x)
xnx4x3x2x1x
n4321i
Assakkaf
Slide No. 186
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic Splines
The general form of a quadratic equation
between point [xi,f(xi)] and [xi+1,f(xi+1)] is
( ) 1,,2,1For2 =++= nicxbxaxfiiii
"
(3)
8/13/2019 Chapter 6 f Inter
13/34
Assakkaf
Slide No. 187
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic Splines
Every two adjacent data points have an
interpolation equation given by Eq. 3, with
three constants ai, bi, andci.
As a result, there are 3(n 1)unknowns
that need to be determined using the data
set, requiring 3(n 1) conditions
Assakkaf
Slide No. 188
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic Splines
Conditions for Quadratic Splines:
1. The splines must pas through the data points.
For the ith spline, this condition can be
expressed as
( ) ( )
( ) ( ) 1,,3,2,1for
1,,3,2,1for
11
2
11
2
==++=
==++=
++++ nixfcxbxaxf
nixfcxbxaxf
iiiiiiii
iiiiiiii
"
" (4a)
(4b)
8/13/2019 Chapter 6 f Inter
14/34
Assakkaf
Slide No. 189
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic Splines
Conditions for Quadratic Splines:
2. The splines must be continuous at the interior
data points. This condition can be expressed
using the first derivatives of the quadratic
splines as
2,,3,2,1for22 1111 =+=+ ++++ nibxabxa iiiiii " (5)
Assakkaf
Slide No. 190
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic Splines
Conditions for Quadratic Splines:
3. The last condition can be arbitrary. The
second derivative for the spline between the
first two data points can be set equal to zero.
Since the second derivative for the first splineis 2a1, this condition can be written as
002 11 == aa (6)
8/13/2019 Chapter 6 f Inter
15/34
Assakkaf
Slide No. 191
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Quadratic Splines
Equations 4 to 6 provide the needed
3(n 1) conditions to solve for the 3(n 1)
unknowns ai, bi, and ci, i = 1,2,, n 1.
The resulting quadratic splines provide the
desired continuity while passing through
the data points.
Assakkaf
Slide No. 192
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 Quadratic Splines
Fit the following set of data with second-
order (quadratic) splines. Evaluate the
function atx = 5. Also plot the spline
functions.
0.52.512.5f(x)
974.53x
4321i
8/13/2019 Chapter 6 f Inter
16/34
Assakkaf
Slide No. 193
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
For the first data pairs, Eqs. 4a and 4b
apply as follows:
( )
( ) 1,,3,2,1for
1,,3,2,1for
11
2
1
2
==++
==++
+++ nixfcxbxa
nixfcxbxa
iiiiii
iiiiii
"
"
( ) ( )( ) ( ) 15.45.4
5.23311
2
1
11
2
1
=++
=++
cbacba
2
1
i
14.5
2.53
f(x)x
(7)
Assakkaf
Slide No. 194
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
For the second data pairs, Eqs. 4a and 4b
apply as follows:
( )
( ) 1,,3,2,1for
1,,3,2,1for
112
1
2
==++
==++
+++ nixfcxbxa
nixfcxbxa
iiiiii
iiiiii
"
"
( ) ( )
( ) ( ) 5.277
15.45.4
22
2
2
22
2
2
=++
=++
cba
cba
3
2
i
2.57
14.5
f(x)x
(8)
8/13/2019 Chapter 6 f Inter
17/34
Assakkaf
Slide No. 195
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
For the third data pairs, Eqs. 4a and 4b
apply as follows:
( )
( ) 1,,3,2,1for
1,,3,2,1for
11
2
1
2
==++
==++
+++ nixfcxbxa
nixfcxbxa
iiiiii
iiiiii
"
"
( ) ( )( ) ( ) 5.099
5.27733
2
3
33
2
3
=++
=++
cbacba
4
3
i
0.59
2.57
f(x)x
(9)
Assakkaf
Slide No. 196
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
For the first and second data pairs, Eqs. 5
applies as follows:
( ) ( )
( ) ( ) 3322
2211
7272
5.425.42
baba
baba
+=+
+=+
(10)
2,,3,2,1for22 1111 =+=+ ++++ nibxabxa iiiiii "
3
2
i
2.57
14.5
f(x)x
8/13/2019 Chapter 6 f Inter
18/34
Assakkaf
Slide No. 197
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
The last condition comes from Eq. 6 as
Since a1 = 0, the resulting system of 3(n-1)
- 1= 3(4 1)-1 = 8 equations can be
obtained as follows:
01=a
Assakkaf
Slide No. 198
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
01414
09
5.0981
5.2749
5.2749
15.425.20
15.4
5.23
3322
221
333
333
222
222
11
11
=+
=
=++
=++
=++
=++
=+
=+
baba
bab
cba
cba
cba
cba
cb
cb
(11)
8/13/2019 Chapter 6 f Inter
19/34
Assakkaf
Slide No. 199
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
Eq. 11 can be rewritten in a matrix form as
=
0
0
5.0
5.2
5.2
1
1
5.2
0114011400
00001901
198100000
174900000
000174900
00015.425.2000
00000015.4
00000013
3
3
3
2
2
2
1
1
c
b
a
c
b
a
c
b
(12)
Assakkaf
Slide No. 200
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) Quadratic Splines
Therefore,
=
3.91
6.24
6.1
46.18
76.6
64.0
5.5
1
3
3
3
2
2
2
1
1
c
b
a
c
b
a
c
b( )
( )
( ) 97for3.916.246.1
75.4for46.1876.664.0
5.43for5.5
2
3
2
2
1
+=
+=
+=
xxxxf
xxxxf
xxxf (13a)
(13b)
(13c)
8/13/2019 Chapter 6 f Inter
20/34
Assakkaf
Slide No. 201
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 1 (contd) - Quadratic Splines
Finding the value of the function whenx = 5
Ifx = 5, then the following spline of Eq. 13b
applies:
Thus,( ) ( ) ( )
66.0
46.18576.6564.052
=
+=f
( ) 75.4for46.1876.664.0 22 += xxxxf
Assakkaf
Slide No. 202
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 2 (contd) - Quadratic Splines
Plot of the quadratic spline functions:
0
0.5
1
1.5
2
2.5
3
3.5
0 2 4 6 8 10
x
f(x) f1 f2f3
8/13/2019 Chapter 6 f Inter
21/34
Assakkaf
Slide No. 203
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
The cubic splines provide a cubic equation
connecting any two adjacent data points
within the data set of the type
( )[ ] nixfx ii ,,3,2,1for, "=
f(xn)f(x4)f(x3)f(x2)f(x1)f(x)
xnx4x3x2x1x
n4321i
Assakkaf
Slide No. 204
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
The general form of a cubic equation
between point [xi,f(xi)] and [xi+1,f(xi+1)] is
( ) 1,,2,1For23 =+++= nidxcxbxaxf iiiii "
(14)
8/13/2019 Chapter 6 f Inter
22/34
Assakkaf
Slide No. 205
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
Every two adjacent data points have an
interpolation equation given by Eq. 14, with
three constants ai, bi, ci,anddi.
As a result, there are 4(n 1)unknowns
that need to be determined using the data
set, requiring 4(n 1) conditions
Assakkaf
Slide No. 206
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
Conditions for Cubic Splines:
1. The splines must pas through the data points.
For the ith spline, this condition can be
expressed as
( ) ( )
( ) ( ) 1,,3,2,1for
1,,3,2,1for
1
2
1
3
11
23
==+++=
==+++=
+=++ nixfdxcxbxaxf
nixfdxcxbxaxf
iiiiiiiiii
iiiiiiiiii
"
" (15a)
(15b)
8/13/2019 Chapter 6 f Inter
23/34
Assakkaf
Slide No. 207
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
Conditions for Quadratic Splines:
2. The splines must be continuous at the interior
data points. This condition can be expressed
using the first derivatives of the cubic splines
as
2,,3,2,1for
2323 1112
111
2
1
=
++=++ +++++++
ni
cxbxacxbxa iiiiiiiiii
"
(16)
Assakkaf
Slide No. 208
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
Conditions for Quadratic Splines:
3. The splines must satisfy the second
derivative continuity at the interior points.
This condition can expressed as
2,,3,2,1for
2626 1111
=
+=+ ++++ni
bxabxa iiiiii
"
(17)
8/13/2019 Chapter 6 f Inter
24/34
Assakkaf
Slide No. 209
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
Conditions for Quadratic Splines:
4. The last condition can be set as the second
derivative at the first and last data points to
be zero. This condition is as follows:
026
026
11
11
=+
=+
nnn
i
bxa
bxa(18)
Assakkaf
Slide No. 210
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Cubic Splines
Equations 15 to 18 provide the needed
4(n 1) conditions to solve for the 4(n 1)
unknowns ai, bi, ci,and di, i = 1,2,, n 1.
The resulting cubic splines provide the
desired continuity while passing through
the data points.
8/13/2019 Chapter 6 f Inter
25/34
Assakkaf
Slide No. 211
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 Cubic Splines
Fit the following set of data with third-order
(cubic) splines. Evaluate the function atx =
5. Also plot the spline functions.
0.52.512.5f(x)
974.53x
4321i
Assakkaf
Slide No. 212
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
For the first data pairs, Eqs. 15a and 15b
apply as follows:
( ) ( ) ( )
( ) ( ) ( ) 15.45.45.4
5.2333
11
2
1
3
1
11
2
1
3
1
=+++
=+++
dcba
dcba
2
1
i
14.5
2.53
f(x)x
(19)
( ) ( )
( ) ( ) 1,,3,2,1for
1,,3,2,1for
12 13 11
23
==+++=
==+++=
++++ nixfdxcxbxaxf
nixfdxcxbxaxf
iiiiiiiiii
iiiiiiiiii
"
"
8/13/2019 Chapter 6 f Inter
26/34
Assakkaf
Slide No. 213
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
For the second data pairs, Eqs. 15a and
15b apply as follows:
( ) ( ) ( )( ) ( ) ( ) 5.2777
15.45.45.422
2
2
3
2
22
2
2
3
2
=+++
=+++
dcbadcba
3
2
i
2.57
14.5
f(x)x
(20)
( ) ( )
( ) ( ) 1,,3,2,1for
1,,3,2,1for
1
2
1
3
11
23
==+++=
==+++=
++++ nixfdxcxbxaxf
nixfdxcxbxaxf
iiiiiiiiii
iiiiiiiiii
"
"
Assakkaf
Slide No. 214
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
For the third data pairs, Eqs. 15a and 15b
apply as follows:
( ) ( ) ( )
( ) ( ) ( ) 5.0999
5.2777
33
2
3
3
3
33
2
3
3
3
=+++
=+++
dcba
dcba
4
3
i
0.59
2.57
f(x)x
(21)
( ) ( )
( ) ( ) 1,,3,2,1for
1,,3,2,1for
12 13 11
23
==+++=
==+++=
++++ nixfdxcxbxaxf
nixfdxcxbxaxf
iiiiiiiiii
iiiiiiiiii
"
"
8/13/2019 Chapter 6 f Inter
27/34
Assakkaf
Slide No. 215
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
For the second and third data pairs, Eq. 16
applies as follows:
( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) 332
322
2
2
22
2
211
2
1
72737273
5.425.435.425.43
cbacba
cbacba
++=++
++=++
(22)
3
2
i
2.57
14.5
f(x)x
2,,3,2,1for
2323 1112
111
2
1
=
++=++ +++++++
ni
cxbxacxbxa iiiiiiiiii
"
Assakkaf
Slide No. 216
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
For the second and third data pairs, Eq. 17
applies as follows:
( ) ( )
( ) ( ) 3322
2211
276276
25.4625.46
baba
baba
+=+
+=+
(23)
2,,3,2,1for
2626 1111
=
+=+ ++++
ni
bxabxa iiiiii
" 3
2
i
2.57
14.5
f(x)x
8/13/2019 Chapter 6 f Inter
28/34
Assakkaf
Slide No. 217
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
The last condition comes from Eq. 18 as
Therefore, the 12 equations [4(4-1)] are as
follows:
026
026
11
11
=+
=+
nnn
i
bxa
bxa
( )
( ) 0296
0236
33
11
=+
=+
ba
ba(24)
4
3
i
0.59
2.57
f(x)x
Assakkaf
Slide No. 218
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
0254
0218
0242242
0227227
014147141470975.60975.60
5.0981729
5.2749343
5.2749343
15.425.20125.91
15.425.20125.91
5.23927
33
11
3322
2211
333222
222111
3333
3333
2222
2222
1111
1111
=+
=+
=+
=+
=++=++
=+++
=+++
=+++
=+++
=+++
=+++
ba
ba
baba
baba
cbacbacbacba
dcba
dcba
dcba
dcba
dcba
dcba
(25)
8/13/2019 Chapter 6 f Inter
29/34
Assakkaf
Slide No. 219
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
=
0
00
0
0
0
5.0
5.2
5.2
1
1
5.2
2540000000000
000000000021800242002420000
00000022700227
011414701141470000
000001975.6001975.60
198172900000000
174934300000000
000017493430000
000015.425.20125.910000
0000000015.425.20125.91
0000000013927
3
3
3
3
2
2
2
2
1
1
1
1
d
cb
a
d
c
b
a
d
c
b
a
Assakkaf
Slide No. 220
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
Therefore,
=
813.8
326.0
554.0
0528.0
813.33
941.17
163.3
177.0
020.2
253.3
547.1
172.0
3
3
3
3
2
2
2
2
1
1
1
1
d
c
b
a
d
c
b
a
d
c
b
a
( )
( )
( ) 97for813.8326.0554.00528.0
74.5for813.33941.17163.3177.0
5.43for02.2253.3547.1172.0
23
3
23
2
23
1
++=
++=
++=
xxxxxf
xxxxxf
xxxxxf
( )
058.1
813.33)5(941.17)5(163.3)5(177.05 23
=
++=f
8/13/2019 Chapter 6 f Inter
30/34
Assakkaf
Slide No. 221
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Example 3 (contd) Cubic Splines
0
0.5
1
1.5
2
2.5
3
0 2 4 6 8 10
x
f(x)
f1f2 f3
Assakkaf
Slide No. 222
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Comparison among Linear, Quadratic, and Cubic
Splines for Examples 1, 2, and 3
Splines
0
0.5
1
1.5
2
2.5
3
3.5
0 1 2 3 4 5 6 7 8 9 10
x
f(x)
Linear
Quadratic
Cubic
8/13/2019 Chapter 6 f Inter
31/34
Assakkaf
Slide No. 223
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Interpolation Using Splines
Comparison among Linear, Quadratic, and Cubic Splines for
Examples 1, 2, and 3 with Third-order Polynomial
0
0.5
1
1.5
2
2.5
3
3.5
2 3 4 5 6 7 8 9 10
x
f(x)
Linear
Quadratic
Cubic
3rd Degree
Assakkaf
Slide No. 224
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Multidimensional Interpolation
In general, the function of interest can
take the following form:
In most engineering applications, two-dimensional interpolation is required.
( )nxxxxf ,,,, 321 "
8/13/2019 Chapter 6 f Inter
32/34
Assakkaf
Slide No. 225
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Multidimensional Interpolation
The previously introduced methods for
one-dimensional case can be applied to
multidimensional interpolation.
However, with increased computational
difficulties.
To illustrate the concept, linear
interpolation is introduced for two-dimensional interpolation.
Assakkaf
Slide No. 226
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Multidimensional Interpolation
Two-dimensional Interpolation
Example 4
The following table gives the values of the
gravitational acceleration, g, in feet per second
squared as a function of altitude L (in degrees)
and elevation E(in feet). Find the value of gwhen L = 12.50 and E= 500 feet.
8/13/2019 Chapter 6 f Inter
33/34
Assakkaf
Slide No. 227
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Multidimensional Interpolation
Two-dimensional Interpolation
Example 4
32.101332.104432.1075L = 20032.092932.096032.0991L = 15
0
32.08632.089732.0928L = 100
32.082932.085932.0890L = 50
32.081632.084732.0877L = 00
E= 2000 ftE= 1000 ftE= 0 ft
Assakkaf
Slide No. 228
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Multidimensional Interpolation
Two-dimensional Interpolation
Example 4 (contd)
First, we interpolate for Eat L = 10 to obtain
g(100
, 500 feet).
( ) ( )ELgxxf ,, 21 =
09125.320928.320897.32
0928.32
01000
0500
0897.321000
500
0928.320
11
1
=
=
g
g
g
gE
8/13/2019 Chapter 6 f Inter
34/34
Assakkaf
Slide No. 229
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Multidimensional Interpolation
Two-dimensional Interpolation
Example 4 (contd)
Second, we interpolate for Eat L = 15 to obtain
g(150, 500 feet).
09755.320991.320960.32
0991.32
01000
0500
0960.321000
500
0991.320
22
1
=
=
g
g
g
gE
Assakkaf
Slide No. 230
A. J. Clark School of Engineering Department of Civil and Environmental Engineering
ENCE 203 CHAPTER 6f. NUMERICAL INTERPOLATION
Multidimensional Interpolation
Two-dimensional Interpolation
Example 4 (contd)
Using the values of g1 and g2, we interpolate for
L at E= 500 to obtain g(12.50, 500 feet).
Therefore, g(12.50, 500 feet) = g3 = 32.0944 ft/s2
0944.3209125.3209755.32
09125.32
1015
105.12
09755.3215
5.12
09125.3210
3
2
3
=
=
g
g
g
gL