# 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)

Compare the spline fit with the original data (red curve with square symbols). The cubic spline interpolation is smoother.

## 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, lred);setsym(14, 2);setplotstyle(1, 2)

## 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)

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

DELTAX

INTERPOLATE

INTERP2

POLYFIT

RATE

RESAMPLE

SGRID

SPLINE2

XY

XYINTERP

XYLOOKUP