Cardinal Basis for cubic Ceschino interpolation

Share:

Description

Cardinal Basis for cubic Ceschino interpolation.

Usage

1
cardinalBasis_ceschino(x, xout, cubic = TRUE, deriv = 0)

Arguments

x

Numeric vector of design points.

xout

Numeric vector giving new points.

cubic

Logical. Use cubic interpolation or basic linear?

deriv

Integer or logical. Compute the derivative?

Details

This is a simple and raw interface to alterp Fortran subroutine.

Value

A list with the following elements

x

Numeric vector of abscissas at which the basis is evaluated. This is a copy of xout.

CB

Matrix of the Cardinal Basis function values.

deriv, cubic

Copy of input.

method

Character description of the method involved in the CB determination.

Note

This function does not allow extrapolation, so an error will result when xout contains element outside of the range of x.

Author(s)

Alain Hebert for Fortran code.

Yves Deville for R interface.

See Also

interp_ceschino for the related interpolation function, cardinalBasis_natSpline and cardinalBasis_lagrange for other Cardinal Basis constructions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
set.seed(123)
n <- 16L; nout <- 300L
x <- sort(runif(n))

## let 'xout' contain n + nout points including nodes
xout <- sort(c(x, runif(nout, min = x[1], max = x[n])))
y <- sin(2 * pi * x)
res  <- cardinalBasis_ceschino(x, xout = xout, deriv = 0)

matplot(res$x, res$CB, type = "n", main = "Cardinal Basis")
abline(v = x, h = 1.0, col = "gray")
points(x = x, y = rep(0, n), pch = 21, col = "black",
       lwd = 2, bg = "white")
matlines(res$x, res$CB, type = "l")

## interpolation error should be fairly small
max(abs(sin(2 * pi * xout) - res$CB \%*\% y))