View source: R/interpolators.R
| cubic_hermite | R Documentation |
Constructs a cubic Hermite interpolator given the vectors of abscissas, ordinates, and derivatives.
cubic_hermite(x, y, dydx)
x |
Numeric vector of abscissas (x-coordinates). |
y |
Numeric vector of ordinates (y-coordinates). |
dydx |
Numeric vector of derivatives (slopes) at each point. |
An object of class cubic_hermite with methods:
interpolate(xi): Evaluate the interpolator at point xi.
prime(xi): Evaluate the derivative of the interpolator at point xi.
push_back(x, y, dydx): Add a new control point to the interpolator.
domain(): Get the domain of the interpolator.
x <- c(0, 1, 2)
y <- c(0, 1, 0)
dydx <- c(1, 0, -1)
interpolator <- cubic_hermite(x, y, dydx)
xi <- 0.5
interpolator$interpolate(xi)
interpolator$prime(xi)
interpolator$push_back(3, 0, 1)
interpolator$domain()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.