Routines (alphabetical) > Routines: S > SPLINE

# SPLINE

The SPLINE function performs cubic spline interpolation. It accepts single- or double-precision input.

This routine is written in the IDL language. Its source code can be found in the file `spline.pro` in the `lib` subdirectory of the IDL distribution.

## Examples

The commands below show a typical use of SPLINE:

; X values of original function:

X = [2.,3.,4.]

; Make a quadratic

Y = (X-3)^2

;Values for interpolated points:

T = FINDGEN(20)/10.+2

; Do the interpolation:

Z = SPLINE(X,Y,T)

## Syntax

Result = SPLINE( X, Y, T [, Sigma] [, /DOUBLE] )

## Return Value

Returns the result of the cubic spline interpolation. If X, Y, or T are of type double precision, then the computations will be done using double precision, and a double-precision result will be returned. Otherwise, single precision will be used, and a single-precision result will be returned.

## Arguments

### X

The abscissa vector. Values must be strictly increasing (no duplicate values). X must have three or more points.

### Y

The vector of ordinate values corresponding to X. Y should have the same number of elements as X.

### T

The vector of abscissa values for which the ordinate is desired. The values of T must be strictly increasing (no duplicate values).

### Sigma

The amount of “tension” that is applied to the curve. The default value is 1.0. If sigma is close to 0, (e.g., .01), then effectively there is a cubic spline fit. If sigma is large, (e.g., greater than 10), then the fit will be like a polynomial interpolation.

## Keywords

### DOUBLE

Set this keyword to perform computations using double-precision arithmetic and to return a double-precision result.

## Version History

Original | Introduced
6.1 | Added DOUBLE keyword

## See Also

SPL_INIT, SPLINE_P