Smooth a grid horizontally using interp2

24 ビュー (過去 30 日間)
K G
K G 2016 年 10 月 24 日
コメント済み: K G 2016 年 10 月 25 日
I have a grid - bRMS - of Sound Speed values. The x dimension is distance, sampled in km every 0.00625 km.
vbx=[0.00625:0.00625:35]';
The y dimension is depth (in time), sampled every 0.001 s.
vby=[0:0.001:0.5]';
I would like to smooth the grid in the horizontal direction only, apply a conversion, then smooth in the vertical direction.
My code to smooth the grid horizontally is:
vbx_smooth=[0.00625:0.00625*100:35]';
[Xq,Yq]=meshgrid(vbx_smooth,vby);
Vq=interp2(vX,vY,bRMS,Xq,Yq);
This is producing an error
Error using griddedInterpolant
The grid vectors do not define a grid of points that match the given values.
Error in interp2>makegriddedinterp (line 228)
F = griddedInterpolant(varargin{:});
Error in interp2 (line 136)
F = makegriddedinterp(X, Y, V, method,extrap);
Any help with this problem would be appreciated.
  1 件のコメント
KSSV
KSSV 2016 年 10 月 24 日
編集済み: KSSV 2016 年 10 月 24 日
Check the dimensions of input's to interp2...they are not of same dimension, that's why error throwing out..

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

採用された回答

Guillaume
Guillaume 2016 年 10 月 24 日
Did you make a mistake in the names of the input to interp2. I would have thought the correct call would be:
Vq = interp2(vbx, vby, bRMS, Xq, Yq);
If not, you need to explain what vX and vY are as they clearly are not what interp2 expects.
  1 件のコメント
K G
K G 2016 年 10 月 25 日
Hi, yes I did, sorry. I have sorted that issue by using the correct inputs. Thank you for the help

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by