I frequently need to perform interpolations on an unstructured grid. Mostly, with the purpose of filling grid holes and then later continue with regular grid interpolations.

Mathematica V9 and V10 supports linear Interpolation on an unstructured grid up to 3D:

In[4]:= if = 
 Interpolation[RandomReal[1, {2000, 2}], InterpolationOrder -> 1]; if[.5]

Out[4]= 0.61608

In[5]:= if = 
 Interpolation[RandomReal[1, {2000, 3}], InterpolationOrder -> 1]; if[.5, .5]

Out[5]= 0.41285

In[6]:= if = 
 Interpolation[RandomReal[1, {2000, 4}], InterpolationOrder -> 1]; if[.5, .5, .5]

Out[6]= 0.496552

In V8 however, it was possible to apply the same to even higher dimensions. On my present machine I can get up to 5D (higher dimensions apparently require more than the 16GB RAM that I have):

In[2]:= if = 
 Interpolation[RandomReal[1, {2000, 5}], InterpolationOrder -> 1]; if[.5, .5, .5, .3]

Out[2]= 4.82823

In[3]:= if = 
 Interpolation[RandomReal[1, {2000, 6}], InterpolationOrder -> 1]; if[.5, .5, .5, .3, .6]

Out[3]= 0.119046

To compensate I used the Imtek Mathematica Supplement. However, this accumulated some incompatibilities with the recent Versions of Mathematica and the performance for higher dimensions is not sufficient for my applications. I am about to switch to Ingolf Dahl's Obtuse package which adds five interpolation methods to the Mathematica Interpolation command. Alternatively, there in this Mathematica Stackexchange post one can find a Radial Basis Function based Interpolation command.

Follow Up: I ended up using a RBF Interpolation code from this article

Now my question(s) are:

  1. Why has this functionality been removed for V8+ and is there are work-around to this new limitations?

  2. What other possibilities are there to perform unstructured grid interpolations in 4D+ with reasonable Performance and some control over the applied methods?

  3. Unfortunately I often need to interpolate missing grid points at the edges of the N-dim grid. For this reason I need to prevent/suppress divergent behavior, similar to the divergent extrapolation Problems when using higher order spline/polynomial inter/extrapolation methods. I know that the data cube is reasonably well behaved and would be content with linear Interpolation/Extrapolation behavior - any tips for that?

  • $\begingroup$ Would you please add this behavior, in your own words, to this post?: (56729) $\endgroup$
    – Mr.Wizard
    Sep 18, 2014 at 9:21
  • $\begingroup$ Another option is using MATLink to call MATLAB. This is practical only if you do not need to make many calls, i.e. if computing the interpolation function value in many points in a single step is acceptable. Otherwise the overhead is too much. And of course you need to have MATLAB. To do simple linear interpolation we need to construct a Delaunay tesselation first. The program qhull can do this. There are a number of posts on this site about how to use qhull from within Mathematica. Are you still interested in this? $\endgroup$
    – Szabolcs
    Feb 12, 2015 at 17:16
  • $\begingroup$ @Szabolcs I don't have access to MATLAB. But I am still interested in the topic even though the RBF Interpolation works for the moment. $\endgroup$ Feb 13, 2015 at 9:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.