Lagrangian Method Power Point Interpolation

Download Report

Transcript Lagrangian Method Power Point Interpolation

Lagrangian Interpolation
Electrical 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
Lagrange 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
Lagrangian Interpolation
Lagrangian interpolating polynomial is given by
n
f n ( x)   Li ( x) f ( xi )
i 0
where ‘ n ’ in f n (x) stands for the n th order polynomial that approximates the function y  f (x)
given at (n  1) data points as x0 , y 0 , x1 , y1 ,......,  x n 1 , y n 1 ,  x n , y n  , and
n
Li ( x)  
j 0
j i
x  xj
xi  x j
Li (x) is a weighting function that includes a product of (n  1) terms with terms of j  i
omitted.
5
http://numericalmethods.eng.usf.edu
Example
Thermistors are based on materials’ change in resistance with
temperature. A manufacturer of thermistors makes the following
observations on a thermistor. Determine the temperature
corresponding to 754.8 ohms using the Lagrangian method for
linear interpolation.
6
R (Ω)
T(°C)
1101.0
911.3
636.0
451.1
25.113
30.131
40.120
50.128
http://numericalmethods.eng.usf.edu
Linear Interpolation
1
T ( R)   Li ( R)T ( Ri )
40.12
i 0
 L0 ( R)T ( R0 )  L1 ( R)T ( R1 )
42
40
38
ys
f ( range)
R0  911.3, T R0   30.131
R1  636.0, T R1   40.120


36
f x desired
34
32
30.131
30
946
x s  10
0
7
896
846
796
746
696
x s  range x desired
http://numericalmethods.eng.usf.edu
646
x s  10
1
Linear Interpolation (contd)
1
L0 ( R)  
j 0
j 0
1
L1 ( R)  
j 0
j 1
T ( R) 
R  Rj

R0  R j
R  Rj
R1  R j

R  R1
R0  R1
R  R0
R1  R0
R  R0
R  R1
T ( R0 ) 
T ( R1 )
R0  R1
R1  R0
R  636 .0
R  911 .3
(30.131) 
(40.120 ) , 636.0 ≤ R ≤ 911.3
911 .3  636 .0
636 .0  911 .3
754 .8  636 .0
754 .8  911 .3
T (754 .8) 
(30.131) 
(40.120 )
911 .3  636 .0
636 .0  911 .3

 0.43153(30.131)  0.56847(40.120)
8
 35.809 C
http://numericalmethods.eng.usf.edu
Quadratic Interpolation
For the second order polynomial interpolation (also called quadratic interpolation), we
choose the velocity given by
2
v (t )   Li ( t ) v(t i )
i 0
 L0 (t )v (t 0 )  L1 (t ) v( t1 )  L2 (t ) v( t 2 )
9
http://numericalmethods.eng.usf.edu
Example
Thermistors are based on materials’ change in resistance with
temperature. A manufacturer of thermistors makes the following
observations on a thermistor. Determine the temperature
corresponding to 754.8 ohms using the Lagrangian method for
quadratic interpolation.
10
R (Ω)
T(°C)
1101.0
911.3
636.0
451.1
25.113
30.131
40.120
50.128
http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
Ro  911.3, T Ro   30.131
50.128
R1  636.0, T R1   40.120
55
50
R2  451.1, T R2   50.128
ys
45
f ( range)

R  Rj
 R  R1  R  R2

L0 ( R)  
 
R

R
R

R
j 0
0
j
1  R0  R2
 0
j 0
2
2
L1 ( R)  
j 0
j 1
2
L2 ( R)  
j 0
j 2
11
R  Rj
 R  R0
 
R1  R j  R1  R0
R  Rj

f x desired
 R  R2

 R1  R2
 R  R0
 
R2  R j  R2  R0






40
35
30.131
30
400
451.1
500
600
700
800
900
x s  range x desired
 R  R1 


R

R
1 
 2
http://numericalmethods.eng.usf.edu
1000
911.3
Quadratic Interpolation (contd)
 R  R1  R  R2 
 R  R0  R  R2 
 R  R0  R  R1 

T ( R0 )  


T ( R1 )  
T ( R2 )
T ( R)  
R

R
R

R
R

R
R

R
R

R
R

R
1  0
2 
0  1
2 
0  2
1 
 0
 1
 2
(754.8  636.0)(754.8  451.1)
(754.8  911.3)(754.8  451.1)
(30.131) 
(40.120)
(911.3  636.0)(911.3  451.1)
(636.0  911.3)(636.0  451.1)
(754.8  911.3)(754.8  636.0)

(50.128)
(451.1  911.3)(451.1  636.0)
T (754.8) 
 (0.28478)(30.131)  (0.93372)(40.120)  (0.21850)(50.128)
 35.089 C
The absolute relative approximate error a obtained between the results from the first and
second order polynomial is
a 
12
35.089  35.809
 100
35.089
 2.0543 %
http://numericalmethods.eng.usf.edu
Cubic Interpolation
For the third order polynomial (also called cubic interpolation), we choose the velocity given by
3
v (t )   Li ( t ) v(t i )
i 0
 L0 (t ) v( t 0 )  L1 ( t ) v(t 1 )  L2 ( t ) v(t 2 )  L3 ( t ) v(t 3 )
602.97
700
600
ys
500
f ( range)


f x desired
400
300
227.04
13
200
10
10
12
14
16
18
x s  range x desired
20
22
24
22.5
http://numericalmethods.eng.usf.edu
Example
Thermistors are based on materials’ change in resistance with
temperature. A manufacturer of thermistors makes the following
observations on a thermistor. Determine the temperature
corresponding to 754.8 ohms using the Lagrangian method for
cubic interpolation.
14
R (Ω)
T(°C)
1101.0
911.3
636.0
451.1
25.113
30.131
40.120
50.128
http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd)
Ro  1101.0, T Ro   25.113
R1  911.3, T R1   30.131
R2  636.0, T R2   40.120
R3  451.1, T R3   50.128
50.128
3
L0 ( R)  
j 0
j 0
3
L1 ( R)  
j 0
j 1
3
L2 ( R)  
j 0
j 2
R  Rj
 R  R1  R  R2  R  R3 



 
R0  R j  R0  R1  R0  R2  R0  R3 
15
50
45
R  Rj
 R  R0
 
R1  R j  R1  R0
 R  R2

 R1  R2
ys
 R  R3 


R

R
3 
 1
f ( range)

40

f x desired
35
R  Rj
 R  R0
 
R2  R j  R2  R0
R  Rj
 R  R0
L3 ( R)  
 
j 0 R3  R j
 R3  R0
j 3
3
55
 R  R1  R  R3 



R

R
R

R
1  2
3 
 2
 R  R1  R  R2


 R  R  R  R
1  3
2
 3




30
25.113
25
400
451.1
500
600
700
800
900
x s  range x desired
1000
1100
1200
1.10110
55
50
http://numericalmethods.eng.usf.edu
3
Cubic Interpolation (contd)
 R  R1  R  R2  R  R3 
 R  R0  R  R2  R  R3 


T ( R0 )  

T ( R1 )

T ( R)  
 R0  R1  R0  R2  R0  R3 
 R1  R0  R1  R2  R1  R3 
 R  R0  R  R1  R  R3 
 R  R0  R  R1  R  R2 

T ( R2 )  


T ( R3 )

 
 R2  R0  R2  R1  R2  R3 
 R3  R0  R3  R1  R3  R2 
R0  R  R0
(754.8  911.3)(754.8  636.0)(754.8  451.1)
(25.113)
(1101.0  911.3)(1101.0  636.0)(1101.0  451.1)
(754.8  1101.0)(754.8  636.0)(754.8  451.1)

(30.131)
(911.3  1101.0)(911.3  636.0)(911.3  451.1)
(754.8  1101.0)(754.8  911.3)(754.8  451.1)

(40.120)
(636.0  1101.0)(636.0  911.3)(636.0  451.1)
(754.8  1101.0)(754.8  911.3)(754.8  636.0)

(50.128)
(451.1  1101.0)(451.1  911.3)(451.1  636.0)
 (0.098494)(25.113)  (0.51972)(30.131)  (0.69517)(40.120)  (0.11639)(50.128)
 35.242C
T (754.8) 
16
http://numericalmethods.eng.usf.edu
Cubic Interpolation
The absolute percentage relative approximate error, a between second
and third order polynomial is
35.242 35.089
100
a 
35.242
 0.43458%
17
http://numericalmethods.eng.usf.edu
Comparison Table
18
Order of
Polynomial
1
2
3
Temperature C
35.809
35.089
35.242
Absolute Relative
Approximate Error
----------
2.0543%
0.43458%
http://numericalmethods.eng.usf.edu
Actual Calibration
The actual calibration curve used by industry is given by
3
1
1
1
1
1
1
 L0 (ln R)
 L1 (ln R)
 L2 (ln R)
 L3 (ln R)
  Li (ln R)
T (ln R0 )
T (ln R1 )
T (ln R2 )
T (ln R3 )
T i 0
T (ln Ri )
substituting y 
1
, and x  ln R, the calibration curve is given by
T
y( x)  L0 ( x) y( x0 )  L1 ( x) y( x1 )  L2 ( x) y( x2 )  L3 ( x) y( x3 )
Find the calibration curve and find the temperature corresponding to 754.8 ohms. What is the difference
between the results from cubic interpolation? In which method is the difference larger, if the actual
measured value at 754.8 ohms is 35.285 C ?
R (Ω)
1101.0
911.3
636.0
451.1
19
T (°C)
25.113
30.131
40.120
50.128
x (ln R)
7.0040
6.8149
6.4552
6.1117
y (1/T)
0.039820
0.033188
0.024925
0.019949
http://numericalmethods.eng.usf.edu
Actual Calibration
y( x)  L0 ( x) y( x0 )  L1 ( x) y( x1 )  L2 ( x) y( x2 )  L3 ( x) y( x3 )
xo  7.0040, yxo   0.039820
x1  6.8149, yx1   0.033188
x2  6.4552, yx2   0.024925
x3  6.1117, yx3   0.019949
x  xj
 x  x1  x  x 2  x  x3 



L0 ( x)  
 
x

x
j 0 0
j
 x0  x1  x0  x 2  x0  x3 
j 0
3
x  xj
 x  x0  x  x1  x  x3 



L2 ( x)  
 
x

x
x

x
x

x
x

x
j 0 2
j
0  2
1  2
3 
 2
j 2
3
20
3
L1 ( x)  
j 0
j 1
3
L3 ( x)  
j 0
j 3
x  xj
 x  x0  x  x2  x  x3 



 
x1  x j  x1  x0  x1  x2  x1  x3 
x  xj
 x  x0  x  x1  x  x2 



 
x3  x j  x3  x0  x3  x1  x3  x2 
http://numericalmethods.eng.usf.edu
Actual Calibration
 x  x1  x  x 2  x  x3 
 x  x0  x  x 2  x  x3 


 y ( x0 )  

 y ( x1 )

y ( x)  
x

x
x

x
x

x
x

x
x

x
x

x
1  0
2  0
3 
0  1
2  1
3 
 0
 1
, xo ≤ x ≤ x3
 x  x0  x  x1  x  x3 
 x  x0  x  x1  x  x 2 

 y ( x 2 )  


 y ( x3 )

 
x

x
x

x
x

x
x

x
x

x
x

x
0  2
1  2
3 
0  3
1  3
2 
 2
 3
x  ln754.8  6.6265
(6.6265 6.8149)(6.6265 6.4552)(6.6265 6.1117)
(0.039820)
(7.0040 6.8149)(7.0040 6.4552)(7.0040 6.1117)
(6.6265 7.0040)(6.6265 6.4552)(6.6265 6.1117)

(0.033188)
(6.8149 7.0040)(6.8149 6.4552)(6.8149 6.1117)
(6.6265 7.0040)(6.6265 6.8149)(6.6265 6.1117)

(0.024925)
(6.4552 7.0040)(6.4552 6.8149)(6.4552 6.1117)
(6.6265 7.0040)(6.6265 6.8149)(6.6265 6.4552)

(0.019949)
(6.1117 7.0040)(6.1117 6.8149)(6.1117 6.4552)
y (6.6265) 
 (0.17938)(0.039820)  (0.69585)(0.033188)  (0.54005)(0.024925)
 (0.056519)(0.019949)
21
 0.028285
http://numericalmethods.eng.usf.edu
Finally, since y 
Actual
Calibration
1
1
1
T
, T
y

 35.355C
0.028285
Since the actual measured value at 754.8 ohms is 35.285°C, the
absolute relative true error for the third order polynomial
approximation is
35.285 35.242
t 
35.285
 0.12253%
100
and for the calibration curve used by industry is
35.285 35.355
t 
100
35.285
 0.19825%
Therefore, a cubic polynomial interpolant given by Lagrangian
method obtained more accurate results than the calibration curve.
22
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/lagrange_
method.html
THE END
http://numericalmethods.eng.usf.edu