akimaInterp(x, y = NULL, z = NULL, gridPoints = 21,
xo = seq(min(x), max(x), length = gridPoints),
yo = seq(min(y), max(y), length = gridPoints), extrap = FALSE)
akimaInterpp(x, y = NULL, z = NULL, xo, yo, extrap = FALSE)
akimaInterp
the arguments x
and y
are
two numeric vectors of grid pounts, and z
is a numeric
matrix or any other rectangular object which can be transformed
by the functionx
and y
direction.akimaInterp
two numeric vectors of data points spanning the grid, and
for akimaInterpp
two numeric vectors of data points building pairs for pointwise
interpolation.TRUE
then the data points are extrapolated.akimaInterp
returns a list with at least three entries, x
, y
and z
. Note, that the returned values, can be directly
used by the persp
and contour
3D plotting methods.
akimaInterpp
returns a data.frame with columns "x"
, "y"
,
and "z"
.akimaInterp
is a function wrapper to the interp
function provided by the contributed R package akima
.
The Fortran code of the Akima spline interpolation routine was
written by H. Akima.
Linear surface fitting and krige surface fitting are provided by
the functions linearInterp
and krigeInterp
.Akima H., 1996, Algorithm 761: Scattered-Data Surface Fitting that has the Accuracy of a Cubic Polynomial, ACM Transactions on Mathematical Software 22, 362-371.
linearInterp
,
krigeInterp
.## akimaInterp -
# Akima Interpolation:
if (require(akima)) {
set.seed(1953)
x = runif(999) - 0.5
y = runif(999) - 0.5
z = cos(2*pi*(x^2+y^2))
ans = akimaInterp(x, y, z, gridPoints = 41, extrap = FALSE)
persp(ans, theta = -40, phi = 30, col = "steelblue",
xlab = "x", ylab = "y", zlab = "z")
contour(ans)
}
Run the code above in your browser using DataLab