Given the scattered data in three dimensions, it is necessary to interpolate the data and find the functions at a specific point

It might be a high order, but here's what I need to do ... I will be presented with some scattered data in three dimensions (x, y, z). The ultimate goal is to have a function f (x, y) for every point on the surface. For example, given the coordinate (x, y) contained in the convex hull of the data, I would like the program to spit out f (x, y) = ax ^ 3 + bx ^ 2 + cx + dy ^ 3 + ey ^ 2 + fy + g, the bicubic function corresponding to the interpolated data at that point. This led me to study bicubic B-splines and splines in general.

I am using SmoothBivariateSpline in spicy.interpolate library to get interpolated data, but I don't know where to go from here. I would like to drop the final step all together and go straight to the intermediate step where the spline interpolation matches the functions of each interval. So ... I would write a program that, given a coordinate, finds out in which interval it is contained and returns a function f (x, y) that describes the surface in that interval. Is it possible?

Hooray!

+3


source to share


1 answer


My first thought is that you actually have scattered data (z) in two dimensions (x and y), if I understand you correctly.

I would write a program that, given a coordinate, finds out what interval it is contained in and returns a function f (x, y) that describes the surface in that interval. Is it possible?



Yes of course!

You could just do the math yourself (a 2D spline might not be the nicest interpolation relative to a formula, but it's still somewhat manageable), or you could just get a list of coefficients by calling get_coeffs()

in the generated one SmoothBivarianteSpline

. This will give you a set of coefficients describing the surface. I think the easiest way to understand the meaning of these questions is to point you to the source code, so here you go ; important ar tx

, ty

and c

.

0


source







All Articles