define x and y for interpolation of scattered data

2 ビュー (過去 30 日間)
Yu Heng Lee
Yu Heng Lee 2020 年 1 月 20 日
回答済み: KSSV 2020 年 1 月 20 日
I have the following data in excel, which is a 20*20 table. I need to interpolate base on available data for the whole table. So, I wanna know how to define x and y of the data in the following code.
numdata = xlsread ('basic file');
x=
y=
[xq,yq] = meshgrid(1:1:20, 1:1:20);
vq = griddata(x,y,v,xq,yq,'nearest');

回答 (1 件)

KSSV
KSSV 2020 年 1 月 20 日
Let A be the matrix, which is of size m*n
x = 1:n ;
y = 1:m ;
[X,Y] = meshgrid(x,y) ;
xq = 1:0.5:n ;
yq = 1:0.5:m ;
[Xq,Yq] = meshgrid(xq,yq) ;
Ai = interp2(X,Y,A,Xq,Yq) ;
Alrernatively, you can also use
Ai = imresize(A,[100,100]) ;

カテゴリ

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