Following earlier posts on cubic splines I have collected the Alglib interpolation routines, and the necessary supporting routines, and written interface functions to allow most of the 1Dspline routines to be called from the spreadsheet. Since there is a large measure of overlap in the supporting routines, I have also included the VBA versions of the basic matrix routines. The spreadsheet (including full open source code) can be downloaded from AL-Spline-Matrix07.zip (Excel 2007 version) or AL-Spline-Matrix03.zip (pre 2007 versions).
The included functions are; Spline Functions:
- Cspline1DA: Cubic spline interpolation
- Akimspline1DA: Akima spline interpolation
- CRspline1DA: Catmull-Rom spline interpolation
- Hspline1DA: Hermite spline interpolation
- Csplinefit1DA: Least squares fit of cubic spline
- Csplinefitcw1DA: Weighted and constrained least squares fit of cubic spline
- CSplineint1D: Integration of a cubic spline
- AkimSplineint1D: Integration of an Akima spline
- CRSplineint1D: Integration of a Catmull-Rom spline
- HSplineint1D: Integration of a Hermite spline
- Csplinediff1D: Differentiation of a cubic spline
- Akimsplinediff1D: Differentiation of an Akima spline
- CRsplinediff1D: Differentiation of a Catmull-Rom spline
- Hsplinediff1D: Differentiation of a Hermite spline
- RMatInv: Inverse of real matrix
- CMatInv: Inverse of complex matrix
- EigenVR: Eigen values and Eigen vectors of a real matrix
- EigenVS: Eigen values and Eigen vectors of a symmetric matrix
The main differences from the spline functions presented previously are:
- The Hermite Spline function requires user input first derivative values for each point.
- The Akima Spline function was not previously included
- The cubic spline and Catmull-Rom spline functions allow the end segments to be specified as quadratic or cyclic
- Data may be listed in any order, and is sorted by increasing X value by the function
- Functions are included to perform least-squares fitting of curves (with or without weighting and or constraints), as well as exact fit.
- Integration functions are provided for each spline type.
Further details of the interface functions, and the required Alglib modules, will be provided in a later post.