フィルターのクリア

interp2 problem: input grid is not a valid meshgrid

10 ビュー (過去 30 日間)
Kim
Kim 2014 年 6 月 13 日
コメント済み: dpb 2014 年 6 月 13 日
I would like to interpolate, but I keep on getting the message: Error using interp2>makegriddedinterp (line 220) Input grid is not a valid MESHGRID.
Below is a simplified version of my data. Does anyone know how to solve this? Thank you!
Y=[30 29 27 20;32 31 29 22;35 34 32 25]
X=[0 2 5 10;0 2 5 10;0 2 5 10]
V=[1 2 3.5 4 ; 1.2 2.3 3.8 4.8; 1.4 2.6 4.2 5]
Yq=30
Xq=4
  1 件のコメント
dpb
dpb 2014 年 6 月 13 日
編集済み: dpb 2014 年 6 月 13 日
Well, show what you did that raised the error and what you want. The round, translucent orb is somewhat murky today...
ADDENDUM
OK, I didn't look at the posted data closely enough first time -- from the doc for interp2 one finds--
... All the interpolation methods require that X and Y be monotonic and plaid (as if they were created using MESHGRID).
Your X data are monotonic ok, but they're not regular (plaid) as must be.

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

回答 (1 件)

dpb
dpb 2014 年 6 月 13 日
編集済み: dpb 2014 年 6 月 13 日
As noted in the comment, your data set doesn't meet the requirements of *interp2* of a uniform mesh in both directions. Use *TriScatteredInterp* instead...
>> F = TriScatteredInterp(X(:),Y(:),V(:));
>> F(Xq,Yq)
ans =
3.3444
>>
  4 件のコメント
Matt J
Matt J 2014 年 6 月 13 日
編集済み: Matt J 2014 年 6 月 13 日
Time to upgrade! TriScatteredInterp will be removed eventually, see
dpb
dpb 2014 年 6 月 13 日
R2012b has brung my machine to about all it can do even after adding all the memory it can hold. Since I've retired from consulting, not much incentive to spend $$ on all the things I've become accustomed to besides Matlab so I'll probably just stand pat until the machine dies. Then it'll be a hard decision...

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

カテゴリ

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