# interp_ceschino: Ceschino cubic interpolation In smint: Smooth Multivariate Interpolation for Gridded and Scattered Data

## Description

Cubic Ceschino interpolation.

## Usage

 `1` ```interp_ceschino(x, y = NULL, xout, deriv = 0) ```

## Arguments

 `x` Numeric vector of design abscissas. `y` Numeric vector of ordinates. `xout` Numeric vector of new points where interpolation must be done. `deriv` Logical or binary integer. Compute the (first order) derivative?

## Details

Cubic Ceschino interpolation

## Value

A list with the following elements.

 `x, y` Coordinates of interpolated points, thus `x` is a copy of the input `xout`. `CB` A matrix with `length(xout)` rows and `length(x)` columns as returned by `cardinalBasis_ceschino`. The columns are the values or `xout` of the n Cardinal Basis functions where n is the length of `x`. `deriv` Derivation order used. `knots` The knots used in the interpolation. This is a sorted copy of the input `x`.

## Author(s)

Fortran code by Alain Hebert.

## References

A. Hebert (2013) Revisiting the Ceschino Interpolation Method. link.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37``` ```set.seed(12345) n <- 6; nout <- 300L x <- sort(runif(n)) xout <- sort(runif(nout, min = x[1], max = x[n])) y <- sin(2 * pi * x) cI0 <- interp_ceschino(x = x, xout = xout, y = y) ## compare with a natural spline require(splines) spI <- interpSpline(x, y) spPred0 <- predict(spI, xout) plot(xout, sin(2 * pi * xout), type = "l", col = "black", lwd = 2, xlab = "x", ylab = "f(x)", main = "Interpolations") abline(v = x, col = "gray") lines(cI0, type = "l", col = "SpringGreen3", lty = 2, lwd = 2) lines(spPred0, type = "l", col = "SteelBlue2", lty = 3, lwd = 2) points(x, y, type = "p", pch = 21, col = "red", bg = "yellow", lwd = 2) legend("topright", legend = c("true", "Ceschino", "nat. spline"), col = c("black", "SpringGreen3", "SteelBlue2"), lty = 1:3, lwd = rep(2, 3)) ## derivative estimation cI1 <- interp_ceschino(x =x, xout = xout, y = y, deriv = 1) spPred1 <- predict(spI, xout, deriv = 1) plot(xout, 2 * pi * cos(2 * pi * xout), type = "l", col = "black", lwd = 2, xlab = "x", ylab = "fprime(x)", main = "Derivatives") abline(v = x, col = "gray") lines(cI1, type = "l", col = "SpringGreen3", lty = 2, lwd = 2) lines(spPred1, type = "l", col = "SteelBlue2", lty = 3, lwd = 2) points(x, 2 * pi * cos(2 * pi * x), type = "p", pch = 21, col = "red", bg = "yellow", lwd = 2) legend("bottomright", legend = c("true", "Ceschino", "nat. spline"), col = c("black", "SpringGreen3", "SteelBlue2"), lty = 1:3, lwd = rep(2, 3)) ```

smint documentation built on April 14, 2017, 1:49 p.m.