[ top | up ]

Interpolating Splines

Syntax

splinefun(x, y, method="fmm")

Arguments

x,y vectors giving the coordinates of the points to be interpolated. Alternatively a single plotting structure can be specified.
method this specifies the type of spline to be used. Possible values are "fmm", "natural" and "periodic".

Description

splinefun returns a function which will perform cubic spline interpolation of the given data points. This is often more useful than spline.

If method="fmm", the spline used is that of Forsythe, Malcolm and Moler (an exact cubic is fitted through the four points at each end of the data, and this is used to determine the end conditions). Natural splines are used when method="natural" and periodic splines when method="periodic".

References

Forsythe, G. E., M. A. Malcolm and C. B. Moler (1977). Computer Methods for Mathematical Computations.

See Also

approx, approxfun, spline.

Examples

x <- 1:10 y <- rnorm(10) f <- splinefun(x, y) curve(f(x), 1, 10)