![](/profiles/wavemetrics/themes/wavemetrics/logo.png)
linear interpolation of 4D waves
![](/sites/default/files/styles/thumbnail/public/default_images/Artboard%201_1.png?itok=jeHOCIXy)
fabrizio
Is there an equivalent to interp2D and interp3D for 4D waves?
More specifically:
A function that returns an interpolated value for location P=(x, y, z, t) in a 4D scalar distribution srcWave.
I currently use code that extracts two adjacent chunks of a 4D wave, used interp3d on both chunks followed by linear interpolation between the two interp3d results. However, this is slow (the majority of time is spent in the chunk extraction).
NB: I'm only interested in linear interpolation of a 4D wave containing a scalar distribution sampled on a regular lattice
September 28, 2021 at 09:45 am - Permalink
Hello Fabrizio,
This is the first time in my recollection that this feature request has come up. I will look into implementing it internally.
I'm not sure what you mean by "chunk extraction". If you actually copy two chunks into some local arrays and apply 3D interpolation to each one you be running inefficiently. I would consider direct element addressing in the formula for 4D interpolation.
A.G.
September 29, 2021 at 03:43 pm - Permalink
Here is an Igor procedure to perform the interpolation. Note comments about improving efficiency if you need to call this function many times in a loop.
September 30, 2021 at 12:52 pm - Permalink
Thanks A.G.!
I hope to do some benchmarking later today.
- Fabrizio
October 4, 2021 at 10:17 am - Permalink