Faster 2D Interpolation?
13 views (last 30 days)
Show older comments
I need to interpolate 2D scattered data onto a fine grid. Below is what I am currently doing, and my question is whether there exists a faster a way? Currently my largest data sets (on the order of 3000 x 15000 after up-sampling) take upwards of 7 minutes to run. Preferably this would be a few seconds, but maybe that is asking too much...Similar to my other questions I am unable to provide the exact code for a variety of reasons, but I have listed the steps that I currently perform:
- User selects a subset of the input data to view, which is not unifornly spaced.
- Generate equally space points using Linspace (based on the max and min values of my input data set)
- Create the new grid using Meshgrid
- Generate interpolated data set using griddata(old_x,old_y,old_data,new_x,new_y,'nearest')
I have tried running this from a separate function file, from the command window, and as a private function inside my app designer app. They are all very very slow. Would another 2D interpolation technique be better for my appliciation?
Thank you so much!
0 Comments
Answers (1)
Steven Lord
on 2 May 2022
How many times are you performing this interpolation?
Are the old X and Y coordinates the same each time you perform the interpolation, with only the data and the new coordinates changing?
If so consider creating a griddedInterpolant, updating the Values property (but leaving the old coordinate data alone) when you get new data, and evaluating it at each set of new coordinates.
See Also
Categories
Find more on Interpolation 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!