approxfun2: Bilinear interpolation function of data on a regular grid

View source: R/approxfun2.R

approxfun2R Documentation

Bilinear interpolation function of data on a regular grid

Description

Generates a fast function f(x,y) that interpolates gridded data, based on the analogous subroutine approxfun in 1D.

Usage

approxfun2(x, y, z, outside = NA)

Arguments

x

n-vector of x-coordinates; must be strictly monotonically increasing, but not necessarily equally spaced

y

m-vector of y-coordinates; must be strictly monotonically increasing, but not necessarily equally spaced

z

n-by-m matrix containing the known function values at the (x,y)-coordinates

outside

value of the approximation function outside the grid (default is NA)

Value

Returns a fast and vectorized interpolation function f(x,y)

Author(s)

Danail Obreschkow

See Also

approxfun

Examples

x = seq(3)
y = seq(4)
z = array(c(x+1,x+2,x+3,x+4),c(3,4))
f = approxfun2(x,y,z)
print(f(1.7,2.4))


obreschkow/cooltools documentation built on Nov. 16, 2024, 2:46 a.m.