SPLINE

Purpose:

Performs cubic spline interpolation.

Syntax:

SPLINE(series, n)

series

-

A series or table, the input to interpolate.

n

-

An integer. The interpolation factor.

Returns:

A series or table, the cubic spline interpolated result.

Example:

W1: {6, 5, 8, 11, 6}

W2: spline(W1, 10)

W3: W2;overplot(W1, RED);setsymbol(square, 2)

 

image\spline1.png

 

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.

 

Example:

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)

 

image\spline2.png

Example:

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)

 

image\spline3.png

Remarks:

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.

See Also:

DELTAX

INTERPOLATE

INTERP2

POLYFIT

RATE

RESAMPLE

SGRID

SPLINE2

XY

XYINTERP

XYLOOKUP