Search code examples
javamathvectorinterpolationspatial-interpolation

Three-variable interpolation in java similar to matlab interpn() or interp3()


1. Consider six different vectors float[] xRef, yRef, zRef and float[] xTest, yTest, zTest, representing a positions grid. For each set of the Ref and Test vectors a vector dataRef and dataTest exist that hold data for the respective mesh.

2. My goal is to interpolate test data that are on a grid represented in the Test vectors onto the Ref vectors and currently I have a Matlab code in the form of

[ yMsh, xMsh, zMsh ] = meshgrid ( yRef, xRef, zRef );
finalTestMesh = interp3 ( yTest, xTest, zTest, origTestMesh, yMsh, xMsh, zMsh );

3. My questions: Are there any suitable java api's available? If not then I am asking for suggestions to a solution. So far my own attempts either fail and/or are too slow.


Solution

  • I have decided to give the Michael Thomas Flanagan's Java Scientific Library a chance. The TriCubicSpline Class page is found at http://www.ee.ucl.ac.uk/~mflanaga/java/TriCubicSpline.html