Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pchip

Piecewise cubic hermite interpolation


Description

Piecewise cubic hermite interpolation.

Usage

pchip(x, y, xi = NULL)

Arguments

x,y

vectors giving the coordinates of the points to be interpolated. x must be strictly monotonic (either increasing or decreasing).

xi

points at which to interpolate.

Details

In contrast to spline, pchip preserves the monotonicity of x and y.

Value

Normally, the interpolated signal, an array of length(xi).

if xi == NULL, a list of class pp, a piecewise polynomial representation with the following elements:

x

breaks between intervals.

P

a matrix with n times d rows and k columns. The ith row of P, P[i,], contains the coefficients for the polynomial over the ith interval, ordered from highest to lowest. There must be one row for each interval in x.

n

number of intervals (length(x) - 1).

k

polynomial order.

d

number of polynomials.

Author(s)

Original Octave version by Paul Kienzle pkienzle@user.sf.net. Conversion to R by Tom Short.

References

Fritsch, F. N. and Carlson, R. E., “Monotone Piecewise Cubic Interpolation”, SIAM Journal on Numerical Analysis, vol. 17, pp. 238-246, 1980.

Octave Forge http://octave.sf.net

See Also

Examples

xf <- seq(0, 11, length=500)
yf <- sin(2*pi*xf/5)
xp <- c(0:10)
yp <- sin(2*pi*xp/5)
pch  <- pchip(xp, yp, xf)
plot(xp, yp, xlim = c(0, 11))
lines(xf, pch, col = "orange")

signal

Signal Processing

v0.7-6
GPL-2
Authors
Uwe Ligges [aut, cre] (new maintainer), Tom Short [aut] (port to R), Paul Kienzle [aut] (majority of the original sources), Sarah Schnackenberg [ctb] (various test cases and bug fixes), David Billinghurst [ctb], Hans-Werner Borchers [ctb], Andre Carezia [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], E. Farhi [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Sebastian Krey [ctb], Bill Lash [ctb], Friedrich Leisch [ctb], Olaf Mersmann [ctb], Paulo Neis [ctb], Jaakko Ruohio [ctb], Julius O. Smith III [ctb], Doug Stewart [ctb], Andreas Weingessel [ctb]
Initial release
2015-07-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.