SPLINE_P

The SPLINE_P procedure performs parametric cubic spline interpolation with relaxed or clamped end conditions.

This routine is both more general and faster than the SPLINE function. One call to SPLINE_P is equivalent to two calls to SPLINE, as both the X and Y are interpolated with splines. It is suited for interpolating between randomly placed points, and the abscissa values need not be monotonic. In addition, the end conditions may be optionally specified via tangents.

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

Calling Sequence

SPLINE_P, X, Y, Xr, Yr

Arguments

X

The abscissa vector. X should be floating-point or double-precision.

Y

The vector of ordinate values corresponding to X. Y should be floating-point or double-precision.

Neither X or Y need be monotonic.

Xr

A named variable that will contain the abscissa values of the interpolated function.

Yr

A named variable that will contain the ordinate values of the interpolated function.

Keywords

INTERVAL

Set this keyword equal to the desired interval in XY space between interpolants. If omitted, approximately 8 interpolants per XY segment will result.

TAN0

The tangent to the spline curve at X[0], Y[0]. If omitted, the tangent is calculated to make the curvature of the result zero at the beginning. TAN0 is a two element vector, containing the X and Y components of the tangent.

TAN1

The tangent to the spline curve at X[ n -1], Y[ n -1]. If omitted, the tangent is calculated to make the curvature of the result zero at the end. TAN1 is a two element vector, containing the X and Y components of the tangent.

Example

The commands below show a typical use of SPLINE_P:

X = [0.,1,0,-1,0] ; Abscissas for square with a vertical diagonal

Y = [0.,1,2,1,0] ; Ordinates

SPLINE_P, X, Y, XR, YR ; Interpolate with relaxed end conditions

PLOT, XR, YR ; Show it

As above, but with setting both the beginning and end tangents:

SPLINE_P, X, Y, XR, YR, TAN0=[1,0], TAN1=[1,0]

This yields approximately 32 interpolants.

As above, but with setting the interval to 0.05, making more interpolants, closer together:

SPLINE_P, X, Y, XR, YR, TAN0=[1,0], TAN1=[1,0], INTERVAL=0.05

This yields 116 interpolants and looks close to a circle.

See Also

SPL_INIT , SPLINE