フィルターのクリア

How to do 2D array interpolation

28 ビュー (過去 30 日間)
Pranjal Pathak
Pranjal Pathak 2013 年 5 月 26 日
編集済み: Bruno Luong 2019 年 9 月 13 日
Hi, I have a 2d array of values of dimension 4x4, and I would like to do a bilinear interpolation upto a dimension of 1024x1024. I would be very grateful, if anyone helps me in this regard.
The 2d array is:
A=[0.0169 0.5876 0.4689 1.0000;
0.5989 0.6525 0.3475 0.3559;
0.5706 0.6525 0.3814 0.3616;
0 0.5537 0.4011 0.8644];
Thanking You!

回答 (1 件)

Matt J
Matt J 2013 年 5 月 26 日
x=linspace(1,4,1024);
F=griddedInterpolant(A);
result=F({x,x});
  5 件のコメント
Walter Roberson
Walter Roberson 2019 年 9 月 13 日
griddedInterpolant() itself needs at least R2011b.
In particularly old versions of MATLAB it might be necessary to use meshgrid() to construct the arrays of query locations.
[X, Y] = meshgrid(x, x);
result = interp2(A, X, Y);
Bruno Luong
Bruno Luong 2019 年 9 月 13 日
編集済み: Bruno Luong 2019 年 9 月 13 日
Yes. Quite obscure, it took me few seconds to figure it out Matt's compact code, but it works
x = linspace(1,4,1024);
result = interp2(A,x(:),x)

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by