Professional Documents
Culture Documents
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM Undergraduates
http://numericalmethods.eng.usf.edu
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.
Interpolants
Polynomials are the most common choice of interpolants because they are easy to:
Evaluate Differentiate, and Integrate
http://numericalmethods.eng.usf.edu
Direct Method
Given n+1 data points (x0,y0), (x1,y1),.. (xn,yn), pass a polynomial of order n through the data as given below:
y = a0 + a1 x + .................... + an x .
n
where a0, a1,. an are real constants. Set up n+1 equations to find n+1 constants. To find the value y at a given value of x, simply substitute the value of x in the above polynomial.
5 http://numericalmethods.eng.usf.edu
Example 1
The upward velocity of a rocket is given as a function of time in Table 1. Find the velocity at t=16 seconds using the direct method for linear interpolation.
Table 1 Velocity as a function of time.
t , (s ) v(t ), (m/s )
0 10 15 20 22.5 30
6
0 227.04 362.78 517.35 602.97 901.67 Figure 2 Velocity vs. time data for the rocket example
http://numericalmethods.eng.usf.edu
Linear Interpolation
v(t ) = a0 + a1t
v(15) = a 0 + a1 (15) = 362.78
v(20 ) = a 0 + a1 (20 ) = 517.35
(x0 , y0 )
y
(x1 , y1 )
f1 ( x )
x
Example 2
The upward velocity of a rocket is given as a function of time in Table 2. Find the velocity at t=16 seconds using the direct method for quadratic interpolation.
Table 2 Velocity as a function of time.
t , (s ) v(t ), (m/s )
0 10 15 20 22.5 30
8
0 227.04 362.78 517.35 602.97 901.67 Figure 5 Velocity vs. time data for the rocket example
http://numericalmethods.eng.usf.edu
Quadratic Interpolation
v(10) = a0 + a1 (10) + a2 (10) = 227.04
2
(x1 , y1 )
( x2 , y 2 )
f 2 (x )
( x0 , y 0 )
x
500
350
= 392.19 m/s
227.04
300
250
200
10 10
12
14
16
18
20 20
x s , range , x desired
The absolute relative approximate error a obtained between the results from the first and second order polynomial is
a = 392.19 393.70 100 392.19 = 0.38410%
http://numericalmethods.eng.usf.edu
10
Example 3
The upward velocity of a rocket is given as a function of time in Table 3. Find the velocity at t=16 seconds using the direct method for cubic interpolation.
Table 3 Velocity as a function of time.
t , (s ) v(t ), (m/s )
0 10 15 20 22.5 30
11
0 227.04 362.78 517.35 602.97 901.67 Figure 6 Velocity vs. time data for the rocket example
http://numericalmethods.eng.usf.edu
Cubic Interpolation
y
(x3 , y3 ) (x1 , y1 ) ( x2 , y 2 )
f 3 (x )
(x0 , y0 )
a0 = 4.2540
12
a1 = 21.266
a2 = 0.13204
a3 = 0.0054347
http://numericalmethods.eng.usf.edu
600
ys f ( range) f x desired
500
The absolute percentage relative approximate error a between second and third order polynomial is
)
400
300
a =
10 10 12 14 16 18 20 22 24 22.5 x s , range , x desired
227.04
200
13
http://numericalmethods.eng.usf.edu
Comparison Table
Table 4 Comparison of different orders of the polynomial.
Order of Polynomial
1 393.7 ----------
2 392.19 0.38410 %
3 392.06 0.033269 %
v(t = 16 ) m/s
Absolute Relative Approximate Error
14
http://numericalmethods.eng.usf.edu
16
16
15
http://numericalmethods.eng.usf.edu
16
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/direct_met hod.html
THE END
http://numericalmethods.eng.usf.edu