Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Non-uniform bi-linear interpolation

  1. Aug 6, 2009 #1
    I have a non-uniform grid within which velocity data is known at each grid point. This velocity data is to be interpolated to allow for evaluation of velocity at an arbitrary point inside the grid.

    I am wondering about the correct approach to this problem. In actuality I want to evaluate the velocity using tri-cubic interpolation but considering the grid is non-uniform I would start with basics.

    In the image you can sort of see what the grid looks like. I have for example points [1 2 3 4] and I want to evaluate the velocity at point X (x, y). dx is constant but dy is different between (x) and (x+1) therefore two different dy exist to account for this; dy1 and dy2.

    So bilinear interpolation:
    interpolate normally between 1 and 2 using dy1, interpolate between 3 and 4 using dy2, here comes the problem. I assume simply interpolating between the two found values using dx is enough? Possibly dx could be extended by the fact that it is now somewhat tilted (simple trigonometry). But then again the same tilt would apply to the position of X, i.e. the distance it is in x from point 1 and 2.

    What is the correct way of doing this? I suppose if I figure out this it should not be too hard to extend to tri-cubic.
     

    Attached Files:

  2. jcsd
  3. Aug 7, 2009 #2
    I am not sure if you understand what tricubic means and I am not sure if I understand your grid.

    I assume you have something like this, a set of coordinate points each consisting of three floating point numbers and a corresponding set of velocity vectors also consisting of three floating point numbers. We are talking about a velocity field, not the path of a single particle.

    The first thing you do is splitting the interpolation into three parts one for each velocity component.

    0) If it's physics alway try to fit a working theoretical model fist
    otherwise:
    1) I assume you have found the myriad of 1-d interpolation routines that are out there.
    2) 2D is more tricky. And it depends a lot on your data. If your data is not really on any kind of grid, you can use RBFs radial basis functions, there are fit routines for that out there. They don't seem very popular.
    You can force your data onto a grid. The grid is defined by the ticks on each axis. For that you can do some kind of nearest neighbor interpolation. Be warned: linear interpolation with nearest neighbors sucks. What you want to do is interpolation with natural neighbors. For that you need the Delaunay tesselation of the data. On a real grid you can then do bicubic b-splines or c-splines. There are routines for that.
    3) Tricubic and n dimensional interpolation. It is very similar to 2d but this case is harder, because getting the nearest neighbors is harder, getting a Delaunay triangulation is much harder because some 2d tricks cannot be used. RBFs still work. I don't trust consecutive b-splining that much... but that is probably the way to go. I rolled my own cspline routine for this stuff about which I am not yet confident enough to share but it looks promising.

    This might help:
    http://www.scipy.org/Cookbook/Interpolation
     
  4. Aug 21, 2009 #3
    I have a perfectly good understanding of tri-linear interpolation although my question might have seemed unclear. Here I was simply trying to find a solution for the bi-linear problem which I would the extrapolate to the tri-cubic one.

    In any case I found a solution to the problem and it is "inverse bi-linear interpolation/transformation". This returns the ratios alpha and beta which describe how far along the x and y axis respectively the point can be considered to be. Naturally these ratios can be used in place of the normal ratio (x_point-x_grid)/dx to conduct bi-linear interpolation.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Non-uniform bi-linear interpolation
Loading...