Language Reference


SPLINEV Function

SPLINEV (coeff <, delta> <, nout> );

The SPLINEV function evaluates a cubic spline at a set of points. The function returns a two-column matrix that contains the points of evaluation in the first column and the corresponding fitted values of the spline in the second column.

The arguments to the SPLINEV function are as follows:

coeff

is an $n \times 5$ (or $n \times 9$) matrix of spline coefficients, as returned by the SPLINEC call . The coeff argument should not contain missing values.

delta

is an optional vector that specifies evaluation points. If delta is a scalar, the spline is evaluated at equally spaced points delta apart. If delta is a vector arranged in ascending order, the spline is evaluated at each of these values. Evaluation at a point outside the support of the spline results in a missing value in the output. If you specify the delta argument, you cannot specify the nout argument.

nout

is an optional scalar that specifies the desired number of fitted points. The default is nout=200. If you specify the nout argument, you cannot specify the delta argument.

If you want to evaluate a spline at a single point, you need to use a trick. The trick is to evaluate the spline at two points but use only the fitted value at the first point. For example, if x is a scalar value, then the following statement evaluates the spline fit at x:

y = splinev(coeff, x//x)[1,2]; /* first row is (x, spline(x)) */

See the section SPLINE and SPLINEC Calls for details and examples.