Finds a bilinear interpolation bounded by four points

bilinear(x, y, z, newx, newy)

Arguments

x

vector of two x values representing x_1 and x_2

y

vector of two y values representing y_1 and y_2

z

2x2 matrix if z values

newx

vector of new x values to interpolate

newy

vector of new y values to interpolate

Value

a vector of interpolated z values at (x, y)

Details

bilinear finds a bilinear interpolation bounded by four corners

See also

Examples

x <- c(2, 4)
y <- c(4, 7)
z <- matrix(c(81, 84, 85, 89), nrow = 2)
newx <- c(2.5, 3, 3.5)
newy <- c(5, 5.5, 6)
bilinear(x, y, z, newx, newy)
#> [1] 83.08333 84.75000 86.50000