フィルターのクリア

Alternative to interp2

31 ビュー (過去 30 日間)
Magnate
Magnate 2024 年 6 月 22 日 18:25
コメント済み: Magnate 2024 年 7 月 17 日 13:02
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 ?

回答 (2 件)

Ayush Modi
Ayush Modi 2024 年 6 月 22 日 18:28
編集済み: Ayush Modi 2024 年 7 月 10 日 11:34
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 件のコメント
Magnate
Magnate 2024 年 7 月 17 日 12:58
Thanks Ayush, griddedInterpolant got the run time to the acceptable range.

サインインしてコメントする。


John D'Errico
John D'Errico 2024 年 6 月 22 日 18:34
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 件のコメント
Magnate
Magnate 2024 年 7 月 17 日 13:02
It is not inside a loop. but I will read about vectorized way. thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by