I am trying to interpolate a 2d function that is defined only on a partial set of my parameters.
Where it is not defined, my 2d array has NaN
s. Note that in my example the range of where the function is defined is not a rectangle, but it is a function of x, y.
When I perform the interpolation, I get a function that has all NaN
s. Is there a way to overcome this issue?
I am using Interpolations.jl, and my code is like the example in the documentation.
Here is a minimal example which includes NaN
s:
A_x1 = 1:.1:10
A_x2 = 1:.5:20
f(x1, x2) = log(x1+x2)
A = [f(x1,x2) for x1 in A_x1, x2 in A_x2]
A[1:2, :] .= NaN
A[:, 1:2] .= NaN
itp = interpolate(A, BSpline(Cubic(Line(OnGrid()))))
The result of itp
is all NaN
.