Standard Library function that performs a cubicspline interpolation.
y A vector containing the dependent coordinates of the dataset.
t A vector containing the independent coordinates for which the ordinates are desired. Must be monotonic and increasing.
tension (optional) The amount of tension to be put on the spline curve. The default value is 1.0 (see Discussion).
A tension curve always passes through each known data point. The optional tension parameter controls the smoothness of the fitted curve. The higher the tension, the more closely the curve approximates the set of line segments that connect the data points. A lower tension produces a smoother curve that may deviate considerably from the straight-line path between points.
When tension is set close to zero (e.g., 0.01), the curve is virtually a cubic spline fit. When tension is set to a large value (e.g., 10.0), then the fitted curve will be similar to that obtained from a polynomial interpolation, such as POLY_FIT or POLYFITW.
The SPLINE function can be useful for those applications where you need to fit the data with a smoother or stiffer curve than that obtained with an interpolating polynomial. Splines also tend to be more stable than polynomials, with less possibility of wild oscillation between the data points.
x = FINDGEN(10) y = RANDOMN(seed, 10)
t = FINDGEN(100)/11.
PLOT, y
PLOT, t, SPLINE(x, y, t), Xstyle=4, Ystyle=4,$ /Noerase, linestyle=2
PLOT, t, SPLINE(x, y, t, 8.), Xstyle=4, $ Ystyle=4, /Noerase, Linestyle=3
x = [2.0, 3.0, 4.0]
y = (x - 3)^2
t = FINDGEN(20) / 10. + 2
z = SPLINE(x, y, t)