Spline Interpolation Method Power Point

Download Report

Transcript Spline Interpolation Method Power Point

Spline Interpolation Method
Mechanical Engineering Majors
Authors: Autar Kaw, Jai Paul
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
http://numericalmethods.eng.usf.edu
1
Spline Method of
Interpolation
http://numericalmethods.eng.usf.edu
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the
value of ‘y’ at a value of ‘x’ that is not given.
3
http://numericalmethods.eng.usf.edu
Interpolants
Polynomials are the most common
choice of interpolants because they
are easy to:
Evaluate
Differentiate, and
Integrate.
4
http://numericalmethods.eng.usf.edu
Why Splines ?
1
f ( x) 
1  25 x 2
Table : Six equidistantly spaced points in [-1, 1]
x
1
1  25 x 2
-1.0
0.038461
-0.6
0.1
-0.2
0.5
0.2
0.5
0.6
0.1
1.0
5
y
0.038461
Figure : 5th order polynomial vs. exact function
http://numericalmethods.eng.usf.edu
Why Splines ?
1.2
0.8
y
0.4
0
-1
-0.5
0
0.5
1
-0.4
-0.8
x
19th Order Polynomial
f (x)
5th Order Polynomial
Figure : Higher order polynomial interpolation is a bad idea
6
http://numericalmethods.eng.usf.edu
Linear Interpolation
Given  x0 , y0 , x1 , y1 ,......, x n1 , y n 1  x n , y n  , fit linear splines to the data. This simply involves
forming the consecutive data through straight lines. So if the above data is given in an ascending
order, the linear splines are given by  yi  f ( xi ) 
Figure : Linear splines
7
http://numericalmethods.eng.usf.edu
Linear Interpolation (contd)
f ( x )  f ( x0 ) 
f ( x1 )  f ( x 0 )
( x  x 0 ),
x1  x 0
x 0  x  x1
 f ( x1 ) 
f ( x 2 )  f ( x1 )
( x  x1 ),
x2  x1
x1  x  x 2
.
.
.
 f ( x n 1 ) 
f ( x n )  f ( x n 1 )
( x  x n 1 ), x n 1  x  x n
x n  x n 1
Note the terms of
f ( xi )  f ( x i 1 )
xi  x i 1
in the above function are simply slopes between xi 1 and x i .
8
http://numericalmethods.eng.usf.edu
Example
A trunnion is cooled 80°F to − 108°F. Given below is the table of
the coefficient of thermal expansion vs. temperature. Determine
the value of the coefficient of thermal expansion at T=−14°F using
linear spline interpolation.
9
Temperature
(oF)
Thermal Expansion
Coefficient (in/in/oF)
80
6.47 × 10−6
0
6.00 × 10−6
−60
5.58 × 10−6
−160
4.72 × 10−6
−260
3.58 × 10−6
−340
2.45 × 10−6
http://numericalmethods.eng.usf.edu
Linear Interpolation
T0  0,
αT0   6.00106
T1  60,
αT1   5.58106
 (T )   (T0 ) 
 (T1 )   (T0 )
T1  T0
6
5
y
flin ear( range)
(T  T0 )


flin ear xd esired
5.58106  6.00106
T  0
 6.0010 
 60  0
6
αT   6.00106  0.007106 T  0
4
3
300
200
100
0
x range xd esired
 60  T  0
At T  14,
α 14  6.00106  0.007106  14  0
 5.902106 in/in/F
10
http://numericalmethods.eng.usf.edu
100
Quadratic Interpolation
Given  x0 , y0 ,  x1 , y1 ,......, x n 1 , y n 1 ,  x n , y n  , fit quadratic splines through the data. The splines
are given by
f ( x )  a1 x 2  b1 x  c1 ,
 a 2 x 2  b2 x  c2 ,
x 0  x  x1
x1  x  x 2
.
.
.
 a n x 2  bn x  cn ,
x n 1  x  x n
Find a i , bi , ci , i  1, 2, …, n
11
http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
Each quadratic spline goes through two consecutive data points
a1 x 0  b1 x 0  c1  f ( x0 )
2
a1 x1  b1 x1  c1  f ( x1 )
2
.
.
.
a i xi 1  bi xi 1  ci  f ( xi 1 )
2
a i xi  bi xi  c i  f ( xi )
2
.
.
.
a n x n 1  bn x n 1  c n  f ( xn 1 )
2
a n x n  bn xn  cn  f ( x n )
2
12
This condition gives 2n equations
http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)
The first derivatives of two quadratic splines are continuous at the interior points.
For example, the derivative of the first spline
a1 x 2  b1 x  c1 is
2 a1 x  b1
The derivative of the second spline
a 2 x 2  b2 x  c 2 is
2 a2 x  b2
and the two are equal at x  x1 giving
2 a1 x1  b1  2a 2 x1  b2
2 a1x1  b1  2a 2 x1  b2  0
13
http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)
Similarly at the other interior points,
2a 2 x 2  b2  2a3 x 2  b3  0
.
.
.
2ai xi  bi  2ai 1 xi  bi 1  0
.
.
.
2a n 1 x n 1  bn 1  2a n x n1  bn  0
We have (n-1) such equations. The total number of equations is (2n)  (n  1)  (3n  1) .
We can assume that the first spline is linear, that is a1  0
14
http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)
This gives us ‘3n’ equations and ‘3n’ unknowns. Once we find the ‘3n’ constants,
we can find the function at any value of ‘x’ using the splines,
f ( x)  a1 x 2  b1 x  c1 ,
 a 2 x 2  b2 x  c 2 ,
x0  x  x1
x1  x  x 2
.
.
.
 a n x 2  bn x  c n ,
15
x n 1  x  x n
http://numericalmethods.eng.usf.edu
Example
A trunnion is cooled 80°F to − 108°F. Given below is the table of
the coefficient of thermal expansion vs. temperature. Determine
the value of the coefficient of thermal expansion at T=−14°F using
quadratic spline interpolation.
16
Temperature
(oF)
Thermal Expansion
Coefficient (in/in/oF)
80
6.47 × 10−6
0
6.00 × 10−6
−60
5.58 × 10−6
−160
4.72 × 10−6
−260
3.58 × 10−6
−340
2.45 × 10−6
http://numericalmethods.eng.usf.edu
Solution
Since there are six data points,
five quadratic splines pass through them.
 (T )  a1T  b1T  c1 ,
 340  T  260
 a2T 2  b2T  c2 ,
 260  T  160
2
y l 0.05 h
6
5
y
 a3T 2  b3T  c3 ,
 160  T  60
f quadratic( range)


f quadratic x desired
4
 a4T 2  b4T  c4 ,
 60  T  0
3
 a5T  b5T  c5 ,
2
0  T  80
y 0 0.05 h
300
x0 0.05 w
17
200
100
x range x desired
0
100
xl 0.05 w
http://numericalmethods.eng.usf.edu
Solution (contd)
Setting up the equations
Each quadratic spline passes through two consecutive data points giving
a1T 2  b1T  c1 passes through T = −340 and T =−260,
a1  340  b1  340  c1  2.45106
(1)
a1  260  b1  260  c1  3.58106
(2)
a2  260  b2  260  c2  3.58106
(3)
a2 160  b2 160  c2  4.72106
(4)
a3 160  b3 160  c3  4.72106
(5)
a3  60  b3  60  c3  5.58106
(6)
a4  60  b4  60  c4  5.58106
(7)
a4 0  b4 0  c4  6.00106
(8)
a5 0  b5 0  c5  6.00106
(9)
2
2
Similarly,
2
2
2
2
2
2
2
a5 80  b5 80  c5  6.47106
2
18
(10)
http://numericalmethods.eng.usf.edu
Solution (contd)
Quadratic splines have continuous derivatives at the interior data points
At T = −260
2a1 (260)  b1  2a2 (260)  b2  0 (11)
At T = −160
2a2 (160)  b2  2a3 (160)  b3  0 (12)
At T = −60
2a3 (60)  b3  2a4 (60)  b4  0
(13)
2a4 (0)  b4  2a5 (0)  b5  0
(14)
At T = 0
Assuming the first spline a1T 2  b1T  c1 is linear,
a1  0
19
(15)
http://numericalmethods.eng.usf.edu
Solution (contd)
1.156 105  340 1 0
0

0
 67600  260 1 0
0
0
0 67600  260


0
0
0 25600  160

0
0
0
0
0

0
0
0
0
0


0
0
0
0
0

0
0
0
0
0

0
0
0
0
0


0
0
0
0
0
  520
1
0 520
1

0
0
0  320
1


0
0
0
0
0

0
0
0
0
0

1
0
0
0
0

20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0 0  a1 
 
0 0 b1
c 
0 0 1
1
0
0
0
0 25600  160 1
0 3600  60 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 3600  60 1
0 0
0 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 320
0  120
0
0
1
1
0
0
0
0
0
0
0
0
0
0 0
0 0
0 0
0 120
0
0
0
1
0 6400 80
0 0
0
0 0
0
0 0
0
0
0
1
0
0
0
0
0
0
0
1
0
 2.45  106 
 3.58  106 

6 
3
.
58

10

  
6

a
0  2   4.72  10 
6

0  b2   4.72  10 
  
6 
0  c2   5.58  10 
6
0  a3   5.58  10 
6

0  b3    6.00  10 
  
6 
1   c3   6.00  10 
6
1   a 4  6.47  10 

0
0  b4  
  

0
0 c4

  
a
0
0  5  

0

0  b5  
c  

0
0  5  

http://numericalmethods.eng.usf.edu
Solution (contd)
Solving the above 15 equations gives the 15 unknowns as
21
i
ai
bi
ci
1
0
0.014125×10−6
7.2525×10−6
2
−2.725×10−11
−4.5×10−11
5.4104×10−6
3
−7.5×10−13
0.008435×10−6
6.0888×10−6
4
−2.5417×10−11
0.005475×10−6
6×10−6
5
5×10−12
0.005475×10−6
6×10−6
http://numericalmethods.eng.usf.edu
Solution (contd)
Therefore, the splines are given by
αT   0.014125106 T  7.2525106 ,
 340  T  260
 2.7251011T 2  4.5 1011T  5.4104106 ,
 260  T  160
 7.5 1013 T 2  0.008435106 T  6.0888106 ,
 160  T  60
 2.54171011T 2  0.005475106 T  6 106 ,
 60  T  0
 5 1012 T 2  0.005475106 T  6 106 ,
0  T  80
At T = −14
α 14  2.54171011  14  0.005475106  14  6 106
2
 5.9184106 in/in/F
The absolute relative approximate error a obtained between the first order and second order
polynomial is
5.9184106  5.902106
a 
100
5.9184106
 0.27657%
22
http://numericalmethods.eng.usf.edu
Reduction in Diameter
The actual reduction in diameter is given by
Tf
D  D  dT
Tr
where Tr = room temperature (°F)
Tf = temperature of cooling medium (°F)
108
Since Tr = 80 °F and Tr = −108 °F, D  D
 dT
80
Find out the percentage difference in the reduction in the
diameter by the above integral formula and the result
using the thermal expansion coefficient from the cubic
interpolation.
23
http://numericalmethods.eng.usf.edu
Tf
Reduction in Diameter
108
108
60
0
80
60
0
80
 αdT   αT dT   αT dT   αT dT   αT dT
Tr
108
  7.5 10

13

T 2  0.008435106 T  6.0888106 dT
 60
 60

  2.541710
11

T 2  0.005475106 T  6 106 dT
0
0


  5 1012 T 2  0.005475106 T  6 106 dT
80
108
3
2


13 T
6 T
  7.5  10
 0.008435 10
 6.0888106 T 
3
2

 60
 60
3
2


11 T
6 T
  2.541710
 0.00547510
 6 106 T 
3
2

0
0
3
2


12 T
6 T
 5  10
 0.00547510
 6 106 T 
3
2

 80
24
http://numericalmethods.eng.usf.edu
Reduction in diameter
  257.99106   348.32106   498.373106
Tf
6
αdT


1104
.
7

10
in/in

Tr
Taking the average coefficient of thermal expansion over this interval, given by:
Tf
 αdT
αavg
 1104.7 106


 5.8760106 in/in/F
T f  Tr
 108 80
Tr
The absolute relative approximate error
results from the 2nd methods is
a obtained between the
5.8760106  5.9184106
a 
100
5.8760106
 0.72178%
25
http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit
http://numericalmethods.eng.usf.edu/topics/spline_met
hod.html
THE END
http://numericalmethods.eng.usf.edu