how to do interpolation?

1 view (last 30 days)
Lilya
Lilya on 28 Jul 2016
Commented: Lilya on 29 Jul 2016
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.

Accepted Answer

Kelly Kearney
Kelly Kearney on 28 Jul 2016
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 Comments
Kelly Kearney
Kelly Kearney on 29 Jul 2016
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 on 29 Jul 2016
THANKX a lot.

Sign in to comment.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!