Matlab lookup table interpolation
Show older comments
Hello Everyone,
I have a set of tables as shown in the figure. This is the dummy data.
I would like to interpolate these tables at some inbetween value k2 under two circumstances:
- When rows and columns coloured in brown have same steps.
- When rows and columns coloured in brown may have some intermediate values for the table k2.
I was looking at the griddedInterpolant as the potential solution, but I don't know how to make interpolant with two matrices (coloured in green). Any leads would be highly appreciated.
Thanks

1 Comment
dpb
on 13 Jul 2022
You've described interpolating between planes of a 3D array but not given any values for the "k" dimension not the value to which to interpolate. Given the first condition that the X/Y coordinates of the tables are consistent, it's simply linear interpolation across each cell location from 1 to 3 via the fractional value of 2. But, we dunno what those are.
Handling the second case simply means not interpolating a given row/column if the output array contains a value.
You could set up interp3 for this, but since the first two variables aren't being interpolated over, it's overkill; I think I'd just use arrayfun and interp1 as the guts of an anonymous function...or, given you can only use linear, probably just straight-ahead compute and apply the fraction to the entire array with logical addressing to handle the already-present locations. With that reflection, looks like it might be only a one-liner, or maybe two.
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!