Better method to interpn when one grid is fixed?
Afficher commentaires plus anciens
I currently have a n-D sized database, and I'm using interpn to interpolate values from it. However, I do not interpolate on the last dimension, as I'm using the database to interpolate between 1xn solutions. The database is very large, and I am interpolating on it many times, so I'm looking for a faster solution. I believe there should be a faster solution since I'm not necessarily "interpolating" between values on the last dimension. Below is an example of my current method that I am looking to improve:
Example:
database=rand([4,4,2,3,8,6,2,6,5500]);
interpGrids={[1000 2000 4000 7000],[-5 -2 2 5],[0 1],[-5 0 5],[-20 -15 -5 0 5 10 15 20],[10 20 30 40 50 60],[-5 0],[.1 .2 .3 .4 .5 1],1:5500};
ngGriddedData=cell(1,9);
[ngGriddedData{:}]=ndgrid(interpGrids{:});
tic
solution=interpn(ngGriddedData{:},database,3000,1,1,2,-17,35,-4,.35,1:5500);
toc
Many many thanks for any suggestions. I'll be sure to send some good computing karma your way.
- Sean
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!