Show all scripts

Fast Cubic Spline

Category: Fit/Interpolate/Extrapolate
Description: Parameterised (fast) cubic spline calculates the series of constatnts A, B, C and D in the equation y=A + Bx + cx^2 + dx^3. The array of constants are calculated in a single slow step by calculatesplineconstants(). They are then passed to a second function (fastcubicspline()) which uses them in a loop for quick calculation a series of interpolated values. The option to extrapolate values outside the range of the data is also provided - otherwise the function returns zero. This example script creates some test data - plots it, then fits the fast cubic spline to it.
Comments: There is a limitation (or conflict) in User Defined Language with DM script. The operation "/" and "*" cannot be defined as operators in Notepad++ once we define "/*" and "*/" as comment block markers. So I have left "/" and "*" out from the operator list
Acknowledgements: Derived from 'Numerical Analysis', 6th Edition, R. L. Burden and J. Douglas Faires, Brooks/Cole Publishing Co.
Script version: 1.1
DM/GMS version: 3.11
Script written as a function: Yes
Source: Show code
Download Source Code: Download
Download Zip File: Download