Interpolation problem with NaN numbers

조회 수: 7 (최근 30일)
JAYESH RAVAL
JAYESH RAVAL 2016년 8월 22일
댓글: Guillaume 2016년 8월 23일
I have emission matrix of 512 x 101 and for that i have corresponding X0 and Y0 value matrix. matrix x contains number varies from (-25 to 25) and along with NaN numbers same with matrix y which varies from (-25 to 25) and having NaN.
now i want to interpolate emission data using interp2 command but i could not perform interpolation. for this i have attached the matfile name inversion0.mat
please help me in this regard.

답변 (1개)

Guillaume
Guillaume 2016년 8월 22일
Use John D'Errico's excellent inpaint-nans.
  댓글 수: 2
JAYESH RAVAL
JAYESH RAVAL 2016년 8월 23일
Dear Guillaume
Thank you for your help
i have tried this option but it is not fulfilling my requirement. since the NaN in x0 and Yo value are the values which are not require to be plot. and i just only want to interpolate the emission data between real points of X0 and Y0 matrix respectively. please suggest another option..
Thank you very much
jayesh
Guillaume
Guillaume 2016년 8월 23일
Having now looked at your mat file, you certainly are not going to be interpolating that with interp2 which requires the x and y to be gridded.
Possibly, this is what you want:
%build interpolant:
tokeep = ~(isnan(X0) | isnan(Y0));
interpolant = scatteredInterpolant(X0(tokeep), Y0(tokeep), Emission(tokeep))
%query interpolant at x = 5.5, y = 25:
interpolant(5.5, 25)

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

카테고리

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