Converting From One Grid To Another, interpolation

Hi, I have tried a couple different approaches to this, but I am running into memory limits on Interp3 and would like to get some advice about the best method.
I a grid of data, about 1300 points of X,Y,Z, and variable V. I would like to interpolate this onto another grid X2, Y2, Z2 with about 7500 points.
What would be the best way to approach this? I only have to do this operation occasionally, not repeatedly.

 Accepted Answer

If the original grid of points is regular, then interp3() should be fine. If the grid is irregular and scattered, then TriScatteredInterp() will likely be better suited.
I see no reason why your grids of 1300 and 7500 points should be problematic (unless you mean an extent of 7500 points per dimension). Can you share your code?

4 Comments

is there a way to load .mat files? I import the data sets as a part of the code.
Otherwise, here is how I am calling it:
temp_model = interp3(centers(:,1),centers(:,2),centers(:,3),v,centers_model(:,1),centers_model(:,2),centers_model(:,3));
where centers is a 1320x3 matrix of XYZ points, v is 1320x1, and centers model is 7656x3 XYZ points.
Although the grid is rectangular, not all of the grid spacings are the same, so maybe I should try TriScatteredInterp()
It certainly sounds like you want TriScatteredInterp(). It accepts column vectors, the way you're calling interp3. interp3, for this case, would expect 7 three dimensional matrices the first four all the same size and the last three all the same size. You have the number of elements correct but are passing it one dimensional vectors not 3d matrices.
If you could reshape() your index vectors to be monotonically spaced in all three dimensions then interp3 could have a chance.
Yep, I just got TriScatteredInterp working.
Thanks so much.
Great. Glad to hear it. By the way, I think the reason that interp3() ran into memory issues is that it was implicitly using meshgrid() to expand each of those vectors into a 3D grid, making it huge.

Sign in to comment.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Asked:

on 16 Dec 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!