Matrix manipulation and interpolation

1 vue (au cours des 30 derniers jours)
MSP
MSP le 19 Nov 2017
Commenté : Jan le 20 Nov 2017
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)

Réponse acceptée

Jan
Jan le 20 Nov 2017
Modifié(e) : Jan le 20 Nov 2017
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 commentaires
MSP
MSP le 20 Nov 2017
Oh thanks but do you know any function that will extrapolate all the Nans at the top and left part
Jan
Jan le 20 Nov 2017
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by