Interpolation 9 data. help!
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jeong_evolution
am 14 Nov. 2016
Beantwortet: Gavriel Aminov
am 5 Apr. 2017
Data is figure.
I want to interpolation "NaN" data.
Please help me.
1 Kommentar
Akzeptierte Antwort
Gavriel Aminov
am 23 Mär. 2017
Please try the next code. The sample matrix M is simulated as random values, not as well-behaving function, therefore the ERROR is big. For smooth 2D function the ERROR should be reasonable. Please examine it.
m=5;
n=10;
M0=round(rand(m,n)*10)
M=M0;
M(M<3)=nan
[J, I]=meshgrid(1:n, 1:m);
all_inds=sub2ind([m,n], I, J);
good_inds=find(~isnan(M(all_inds)));
[I0, J0]=ind2sub([m,n], good_inds);
MM=round(griddata(I0, J0, M(good_inds), I, J, 'linear'))
ERROR=(MM(isnan(M))-M0(isnan(M)))'
0 Kommentare
Weitere Antworten (1)
Gavriel Aminov
am 5 Apr. 2017
https://www.mathworks.com/mat Interpolates (& extrapolates) NaN elements in a 2d array. (nan, inpainting, replace) labcentral/fileexchange/4551-inpaint-nans
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!