any faster implementation for 2D interpolation by column

Hello,
I have a 2d interpolation problem.
I have three 2D arrays, X,Y, and XI. They are all the same size, say m x n. I'd like to know any faster implementation to process the 2d interpolation by columns. I have a "for-loop solution to implement it as follows.
[m,n] = size(X); for k = 1:n YI(:,k) = interp1(X(:,k),Y(:,k),XI(:,k),'linear','extrap'); end
Any information will be highly appreciated.
Charles

回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 12 月 7 日

0 投票

Are all columns of X,Xi the same? If so, interp1 can handle the matrices directly:
x = (1:3).';
y = magic(3);
xi = [1.5;2.5];
yi = interp1(x,y,xi)

1 件のコメント

Charles Hsu
Charles Hsu 2012 年 12 月 7 日
Hi Sean,
Thanks.
All columns of X can be the same. But the columns of XI are different.
Charles

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

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

タグ

質問済み:

2012 年 12 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by