Interpolation
What is Interpolation ? Given (x0,y0), (x1,y1), …… (xn,yn), find the value of ‘y’ at a value of ‘x’ that is not given. Figure 1 Interpolation of discrete. http://numericalmethods.eng.usf.edu
Interpolants Evaluate Differentiate, and Integrate Polynomials are the most common choice of interpolants because they are easy to: Evaluate Differentiate, and Integrate http://numericalmethods.eng.usf.edu
1. Direct method
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: 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. 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. 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure 2 Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu
Linear Interpolation Solving the above two equations gives, Hence Figure 3 Linear interpolation. Hence http://numericalmethods.eng.usf.edu
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. 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure 5 Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu
Quadratic Interpolation Figure 6 Quadratic interpolation. Solving the above three equations gives http://numericalmethods.eng.usf.edu
Quadratic Interpolation (cont.) The absolute relative approximate error obtained between the results from the first and second order polynomial is http://numericalmethods.eng.usf.edu
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. 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure 6 Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu
Cubic Interpolation Figure 7 Cubic interpolation. http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd) The absolute percentage relative approximate error between second and third order polynomial is http://numericalmethods.eng.usf.edu
Comparison Table Table 4 Comparison of different orders of the polynomial. http://numericalmethods.eng.usf.edu
Distance from Velocity Profile Find the distance covered by the rocket from t=11s to t=16s ? http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile Find the acceleration of the rocket at t=16s given that http://numericalmethods.eng.usf.edu
2. Spline Method
Why Splines ? http://numericalmethods.eng.usf.edu
Figure : Higher order polynomial interpolation is a bad idea Why Splines ? Figure : Higher order polynomial interpolation is a bad idea http://numericalmethods.eng.usf.edu
Linear Interpolation http://numericalmethods.eng.usf.edu
Linear Interpolation (contd) http://numericalmethods.eng.usf.edu
Figure. Velocity vs. time data Example The upward velocity of a rocket is given as a function of time in Table 1. Find the velocity at t=16 seconds using linear splines. Table Velocity as a function of time (s) (m/s) 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure. Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu
Linear Interpolation http://numericalmethods.eng.usf.edu
Quadratic Interpolation http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd) http://numericalmethods.eng.usf.edu
Quadratic Splines (contd) http://numericalmethods.eng.usf.edu
Quadratic Splines (contd) http://numericalmethods.eng.usf.edu
Quadratic Splines (contd) http://numericalmethods.eng.usf.edu
Quadratic Spline Example The upward velocity of a rocket is given as a function of time. Using quadratic splines Find the velocity at t=16 seconds Find the acceleration at t=16 seconds Find the distance covered between t=11 and t=16 seconds Table Velocity as a function of time (s) (m/s) 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure. Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu 29
Solution Let us set up the equations http://numericalmethods.eng.usf.edu 30
Each Spline Goes Through Two Consecutive Data Points http://numericalmethods.eng.usf.edu 31
Each Spline Goes Through Two Consecutive Data Points v(t) s m/s 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 http://numericalmethods.eng.usf.edu 32
Derivatives are Continuous at Interior Data Points http://numericalmethods.eng.usf.edu 33
Derivatives are continuous at Interior Data Points At t=10 At t=15 At t=20 At t=22.5 http://numericalmethods.eng.usf.edu 34
Last Equation http://numericalmethods.eng.usf.edu
Final Set of Equations http://numericalmethods.eng.usf.edu 36
Coefficients of Spline ai bi ci 1 22.704 2 0.8888 4.928 88.88 3 −0.1356 35.66 −141.61 4 1.6048 −33.956 554.55 5 0.20889 28.86 −152.13 http://numericalmethods.eng.usf.edu 37
Final Solution http://numericalmethods.eng.usf.edu 38
Velocity at a Particular Point a) Velocity at t=16 http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile b) The quadratic spline valid at t=16 is given by http://numericalmethods.eng.usf.edu
Distance from Velocity Profile c) Find the distance covered by the rocket from t=11s to t=16s. http://numericalmethods.eng.usf.edu 41
3. Newton’s Divided Differences
Newton’s Divided Difference Method Linear interpolation: Given pass a linear interpolant through the data where
Figure 2: Velocity vs. time data Example 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 Newton Divided Difference method for linear interpolation. t v(t) s m/s 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure 2: Velocity vs. time data for the rocket example Table 1: Velocity as a function of time
Linear Interpolation
Linear Interpolation (contd)
Quadratic Interpolation
Figure 2: Velocity vs. time data Example 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 Newton Divided Difference method for quadratic interpolation. t v(t) s m/s 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure 2: Velocity vs. time data for the rocket example Table 1: Velocity as a function of time
Quadratic Interpolation (contd)
Quadratic Interpolation (contd)
Quadratic Interpolation (contd)
General Form where Rewriting
General Form
General form
Figure 2: Velocity vs. time data Example 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 Newton Divided Difference method for cubic interpolation. t v(t) s m/s 10 227.04 15 362.78 20 517.35 22.5 602.97 30 901.67 Figure 2: Velocity vs. time data for the rocket example Table 1: Velocity as a function of time
Example The velocity profile is chosen as we need to choose four data points that are closest to
Example
Example
Comparison Table
Distance from Velocity Profile Find the distance covered by the rocket from t=11s to t=16s ?
Acceleration from Velocity Profile Find the acceleration of the rocket at t=16s given that