Alternative to interp2
Afficher commentaires plus anciens
I am trying to interpolate values in a 2d space. But my code is very slow.
I used the tic toc and found that it is because of interp2 being called multiple times. Is there an alternate for it ? that would be faster ?
Réponses (2)
Ayush Modi
le 22 Juin 2024
Modifié(e) : Ayush Modi
le 10 Juil 2024
1 vote
Hi,
"griddedInterpolant" function will run faster and is recommended by MathWorks as an alternative to calling "interp2" multiple times.
Refer to the following documentation for more information on "griddedInterpolant" function:
1 commentaire
Magnate
le 17 Juil 2024
John D'Errico
le 22 Juin 2024
1 vote
Perhaps you are calling interp2 multiple times in a loop, when a single call with multiple points will be far faster. This would be true also with griddedInterpolant. Both tools will be internally optimized to perform much better in a vectorized way.
1 commentaire
Magnate
le 17 Juil 2024
Catégories
En savoir plus sur Resizing and Reshaping Matrices 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!