Spline Method of Interpolation
2003 Nathan Collier, Autar Kaw, Jai Paul , Michael Keteltas, University of South Florida , kaw@eng.usf.edu , http://numericalmethods.eng.usf.edu/mws
NOTE: This worksheet demonstrates the use of Maple to illustrate the spline method of interpolation. We limit this worksheet to linear and quadratic spline interpolation.
Introduction
The Spline me thod of interpolation (for detailed explanation, you can read the textbook notes and examples, and see a Power Point Presentation) is illustrated . Given 'n' data points of 'y' versus 'x', it is required to find the value of y at a particular value of x using linear and quadratic splines.
Section I : Data.
The following is the array of x-y data which is used to interpolate. It is obtained from the physical problem of velocity of a rocket (y-values) vs. time (x-values) data. We are asked to find the velocity at an intermediate point of x=16.
Value of x at which y is desired
Section II : Big scary functions.
This function will sort the data matrix into ascending order and puts them into a new matrix.
Plotting the given values of X and Y.
Section III: Linear spline interpolation
Given , fit linear splines to the data. This simply involves forming the consecutive data through straight lines. So the data is sorted into an ascending order; the linear splines are given by
..........
Value of function at desired value of X is
Plotting the linear spline interpolant and the value of Y for the desired X
Section IV: Quadratic interpolation
In these splines, a quadratic polynomial approximates the data between two consecutive data points. Given , fit quadratic splines through the data. The splines are given by ......
There are 3n such coefficients 1, 2, , n; 1, 2, , n; 1, 2, , n To find '3n' unknowns, one needs to set up '3n' equations and then simultaneously solve them.
To know more about how to setup these '3n' equations, please click on textbook notes. After setting up these equations, they are solved using the matrix method. The following function assembles the matrix whose inverse is needed to solve for the coefficients of the polynomial splines that fits the data.
The following gives the matrix which is required to solve for the coefficients of the quadratic splines A;
This assembles the Y matrix also needed to determine the coefficients of the quadratic splines.
Solving for the coefficients, we get
Plotting the quadratic spline interpolant and the value of Y for the desired X
Section V: Cubic spline interpolation
The algorithm of cubic spline interpolation is not shown. However, we are using the Maple function to conduct the cubic spline interpolation,
Computing the value of the function at the desired value of X,
Plotting the cubic spline interpolant and the value of Y at the desired calue of X,
Section VI: Conclusion.
Maple helped us to apply our knowledge of numerical methods of interpolation to find the value of y at a particular value of x using linear and quadratic spline interpolation. Using Maple functions and plotting routines made it easy to illustrate this method.
References
[1] Nathan Collier, Autar Kaw, Jai Paul , Michael Keteltas, Holistic Numerical Methods Institute, See http://numericalmethods.eng.usf.edu/mws/gen/05inp/mws_gen_inp_sim_spline.mws
http://numericalmethods.eng.usf.edu/mws/gen/05inp/mws_gen_inp_txt_spline.pdf
Disclaimer : While every effort has been made to validate the solutions in this worksheet, University of South Florida and the contributors are not responsible for any errors contained and are not liable for any damages resulting from the use of this material.