Performs cubic spline interpolation.
SPLINE(series, n)
series |
- |
A series or table, the input to interpolate. |
n |
- |
An integer. The interpolation factor. |
A series or table, the cubic spline interpolated result.
W1: {6, 5, 8, 11, 6}
W2: spline(W1, 10)
W3: W2;overplot(W1, RED);setsymbol(square, 2)

W1 contains the source series with 5 samples and a sample rate of 1.
W2 linterpolates W1 by a factor of 3 using cubic spline interpolation. The time duration of W2 is the same as W1.
W3 displays the interpolated series with the original values overplotted as red circles.
SPLINE is also useful for XY plots with monotonic X values. For example:
W1: {1, 5, 8, 10, 15}
W2: {2, 6, 4, 8, 10}
W3: xy(W1, W2)
W4: spline(W3, 10);overp(w3);setsym(14, 2);setplotstyle(1, 2)

SPLINE can be used on XY plots with non-monotonic X values. For example:
W1: {1, 5, 8, 10, 7}
W2: {2, 6, 4, 8, 10}
W3: xy(W1, W2)
W4: xy(spline(xvals(W3), 10), spline(yvals(w3), 10));overp(w3, lred);setsym(14, 2);setplotstyle(1, 2)

SPLINE effectively fits a third order polynomial between adjacent samples and uses the polynomial equation to calculate the interpolated values.
SPLINE automatically adjusts the sample rate (1/DELTAX) of the resulting series.
See XYLOOKUP to find a Y value from an arbitrary X value with possible spline interpolation.