필터 지우기
필터 지우기

Interpolation 9 data. help!

조회 수: 1 (최근 30일)
Jeong_evolution
Jeong_evolution 2016년 11월 14일
답변: Gavriel Aminov 2017년 4월 5일
Data is figure.
I want to interpolation "NaN" data.
Please help me.
  댓글 수: 1
Jan
Jan 2016년 11월 14일
Columnwise, rowwise, in 2D, linear, cubic or how else?

댓글을 달려면 로그인하십시오.

채택된 답변

Gavriel Aminov
Gavriel Aminov 2017년 3월 23일
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)))'

추가 답변 (1개)

Gavriel Aminov
Gavriel Aminov 2017년 4월 5일
https://www.mathworks.com/mat Interpolates (& extrapolates) NaN elements in a 2d array. (nan, inpainting, replace) labcentral/fileexchange/4551-inpaint-nans

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by