Matrix manipulation and interpolation

1 回表示 (過去 30 日間)
MSP
MSP 2017 年 11 月 19 日
コメント済み: Jan 2017 年 11 月 20 日
Hello here is my problem,Pls see the image for a simple understanding And thanks in advance
I have a matrix M (for easy visualization purpose a 3*3). I need to use this values to get a bigger matrix whose size is not neccessarily multiples of 3 (like 6*6)>It might be any number for example 11*11>Pls refer to image 2(matrix). So I want the the values to be interpolated and extapolated at the grey cells whereas the pink are my data points M. I have done upto this, where my input values can start from only index (1,1) which I dont want
m=magic(3)
S=size(m)
[Xi,Yi] = meshgrid(1:1:S(2),1:1:S(1));
[Xo,Yo] = meshgrid(1:0.5:S(2)+1,1:0.5:S(1)+1);
out = interp2(Xi,Yi,m, Xo,Yo)

採用された回答

Jan
Jan 2017 年 11 月 20 日
編集済み: Jan 2017 年 11 月 20 日
Maybe you want to shifft the output one element to the right and bottom:
[Xo,Yo] = meshgrid(0.5:0.5:S(2)+0.5, 0.5:0.5:S(1)+0.5);
  2 件のコメント
MSP
MSP 2017 年 11 月 20 日
Oh thanks but do you know any function that will extrapolate all the Nans at the top and left part
Jan
Jan 2017 年 11 月 20 日
There is no unique method for extrapolating the values. You have to define at first, which model you want to use. Perhaps you want to repeat the existing marginal numbers, or fit a spline or B-spline to the data. Maybe you want a linear extrapolation or there is a fixed value on the edge.

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

その他の回答 (0 件)

カテゴリ

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