Hi everybody,
I have a sample of points for a multivariate function that I would like to approximate with interpolation, where all arguments are on a grid. I would like to get a value for that function for other (interior) arguments but I get something wrong in the syntax.
I am open to using Dierckx or other packages. Quadratic interpolation would be nice but I would already be happy with linear.
Here is a minimal example:
using Interpolations
grid = 0:7
fun(a,b) = sin(b) + 0.1a^2
y = [fun.(a,b) for a in grid, b in grid]
Following the syntax for univariate functions: LinearInterpolation(grid, sin.(grid))
, I tried LinearInterpolation(grid, grid, y)
and LinearInterpolation(y)
but I get a MethodError.
Then I tried :
itp = interpolate(y, BSpline(Linear()))
extrapolate(itp, [0.3, 0.8]) #returns a extrapolate(interpolate(Matrix))
#expected result: approximation of the true function at (0.3, 0.8)
julia> fun(0.3, 0.8)
0.7263560908995228
Thank you in advance for any tip !