interpn griddata difference?

11 ビュー (過去 30 日間)
Tahariet Sharon
Tahariet Sharon 2020 年 4 月 14 日
コメント済み: Tahariet Sharon 2020 年 4 月 17 日
Hi,
What are the differences between interpn and griddata?
Thank you.

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2020 年 4 月 14 日
The interpn function requires input data on a plaid grid, i.e. as you would produce with meshgrid, or perhaps ndgrid, while griddata (and scatteredInterpolant and TriScatteredInterp) expects input data on irregular grids. GRIDDATA expects the inputs as 1-D vectors. See the help and documentation for the respective functions, there you should find "minimal" illustrating examples to look at.
HTH
  5 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2020 年 4 月 16 日
Yeah, that might very well be a slight performance-booster (check such things with the profiler-functionality if you need speed-ups...). I was too lazy to do that since my example was rather small and I only wanted to plot the data with the slice function, which used to expect the data to be in the meshgrid format.
The one advice when it comes to this meshgrid/ndgrid option is DOCUMENT YOUR CHOICE CLEARLY (and I'm shouting mainly for me to remember this...), the speed-up should be rather minor - typically, I think I've lost more time hunting down where I've done which choice than I've gained or lost due to this performance difference.
HTH
Tahariet Sharon
Tahariet Sharon 2020 年 4 月 17 日
Thanks for all your help. You have been really helpful! Stay safe.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by