3D interpolation in Julia

@JoshuaLampert, FYI, I tried your excellent package for interpolating the scattered points of the sin(x*y) function as in the example in this post, and got what appears to be excellent results for that type of input data:

KernelInterpolation code
using KernelInterpolation, Plots

# 1 - INPUT DATA:
n = 200
xs, ys = 2π*(rand(n) .- 0.5), 2π*(rand(n) .- 0.5)
zs =  100*sin.(xs .* ys)

# 2 - KERNEL INTERPOLATION:
nodes = NodeSet([xs ys])
values = zs
kernel = GaussKernel{dim(nodes)}(shape_parameter = 1.0)
itp = KernelInterpolation.interpolate(nodes, values, kernel)
N = 100
nodeset = homogeneous_hypercube(N, (-π, -π), (π, π))
itp_values = itp.(nodeset)

# 3 - PLOT RESULTS:
x = unique(values_along_dim(nodeset, 1))
y = unique(values_along_dim(nodeset, 2))
heatmap(x, y, reshape(itp_values, (N,N))', ratio=1, lims=(-π,π))
scatter!(xs, ys, marker_z = zs, ms=3, msw=0.5)
2 Likes