Hi all,
I worked with the time series of the sea level data (non-tidal residual. thus, there is no periodicity in the time series. could you please help me to do interpolation because it contains some NaN values.
Thank you in advance.

 채택된 답변

Kelly Kearney
Kelly Kearney 2016년 7월 28일

0 개 추천

A little more explanation of what you're trying to do is needed here. Are you trying to interpolate from scattered data to a regular grid? If so, your best option is probably to drop the NANs prior to interpolation. Or do you want to fill in some of the missing spots in an already-gridded dataset? Or something else?

댓글 수: 6

John BG
John BG 2016년 7월 29일
I was about to write something, but found
does it work for your question? if it doesn't let know to see what can else be done.
John D'Errico
John D'Errico 2016년 7월 29일
Yes, inpaint_nans does work on 1-d data. So, given a vector of values as a time series, some of which are NaNs, it will interpolate the NaNs. It will also extrapolate if there are NaNs at one or both ends.
Lilya
Lilya 2016년 7월 29일
Kelly, yes. I have to fill the missing values in the array.
Lilya
Lilya 2016년 7월 29일
Johns', It does not work. I tried it already.
Again, can you give a little more detail? Just saying "it doesn't work" doesn't help us, since inpaint_nans should be exactly what you need:
% Some fake data with missing points
x = 1:100;
y = sin(x/pi);
y(rand(100,1)> 0.8) = NaN;
% Fill the NaNs
y2 = inpaint_nans(y);
% Plot
plot(x, y, '-x', x, y2, ':')
Lilya
Lilya 2016년 7월 29일
THANKX a lot.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

질문:

2016년 7월 28일

댓글:

2016년 7월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by