2D Interpolation & Extrapolation with non linear Sample grid points and nan
Ältere Kommentare anzeigen
Hi,
I have this 2D map wich I would like to interpolate to make square but also extrapolate.

interp2 does seem to work with nan inputs as it just returns same nan as output.
V=[1.029 1.000 1.060 1.048 nan nan nan
1.049 1.014 1.038 1.092 1.075 nan nan
nan 1.039 1.079 1.036 1.029 1.003 nan
nan nan 1.042 1.072 1.000 0.998 1.028
nan nan nan 1.038 1.024 1.076 1.022
nan nan nan nan 1.082 0.997 1.011];
X=[8 10 15 25 35 45 52];
Y=[5 10 16.25 22.5 28.75 35];
Xq=ones(numel(Y),numel(X)).*X;
Yq=ones(numel(Y),numel(X)).*Y';
Z=interp2(X,Y,V,Xq,Yq)
I tried some inpaint functions from the community but none of them seems to be made to work with non linear sample grid points (0 2 7 17...).
I am open to suggestions
Thanks in Advance
Laurent
4 Kommentare
Jeffrey Clark
am 23 Jun. 2022
@Laurent Davenne, add ,'makima' to your interp2 which should cause extrapolation of available 2 or more points.
Torsten
am 23 Jun. 2022
interp2 does seem to work with nan inputs as it just returns same nan as output.
Everything else would have been a surprise. What do you expect ?
Laurent Davenne
am 24 Jun. 2022
Laurent Davenne
am 24 Jun. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Interpolation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
