## AlgLib Spline Functions

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

Matrix Functions:

• 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.

This entry was posted in Excel, Maths, Newton, UDFs, VBA and tagged , , , , , , , , , , . Bookmark the permalink.

### 6 Responses to AlgLib Spline Functions

1. Athol says:

When I try to compile (Debug/Compile VBA Project) the AL_Spline_Matrix07 VBA code it reports that the functions AL_C_Power() and AL_C_Mul() are unknown. Is it possible that another module was left out of the zip file distribution? Thanks.

Like

• dougaj4 says:

Athol – thanks for pointing that out. There were actually four Alglib modules missing. The interlinking of the numerous modules can be a problem with the VBA version of the Alglib library (unless you include the whole thing in every application). This has been rationalised in the latest versions of the library, but unfortunately these have not been released in VBA versions, and it doesn’t look like VBA is a high priority for them.

I’m not sure what the missing modules do, it’s quite possible that they are never called by any of my functions (certainly all the examples included worked without them), but I have now added them and uploaded the latest file (version 1.32), so it should now compile without any problem.

Like

This site uses Akismet to reduce spam. Learn how your comment data is processed.