MATLAB Answers

Filling data gaps in a periodic timeseries in MATLAB

34 views (last 30 days)
Donald John
Donald John on 23 Oct 2014
Answered: Donald John on 30 Oct 2014
I am looking for a method to fill in data gaps in a time-series that contains periodic data (in this case with a frequency equal to a tidal frequency, so both semi-diurnal and spring/neap frequencies) using MATLAB. The data series also contains noise which I would like to superimpose on top of the artificial data that fills the time gap. The data has a certain trend that I want to preserve. Ideally I would be looking at a method that uses the recorded data on either side of the time gap. The data files are too large to post here. However the sampling rate is 5 mins and there is approximately a week worth of data missing.
<<
>>
Is there anyway of doing this in Matlab?
Thank you.
Donald John

  2 Comments

Yona
Yona on 23 Oct 2014
how this gap is in the data? It is a NaN value in voltage or every time that 2 consecutive data have difference of more that X time, it a gap or something else?
when this gap will define, you just need to find it and plot separated data set.
To help you remove noise, we need your definition of noise. if you just what to smooth your data, take a look on figure "tools"-> "basic fitting"
Donald John
Donald John on 23 Oct 2014
Thank you for your response. The gap is represented by NaN values in the voltage. Can you explain what you mean when you say, 'you just need to find it and plot separated data set', how would I go about doing this?

Sign in to comment.

Answers (2)

Bruno Pop-Stefanov
Bruno Pop-Stefanov on 24 Oct 2014
Edited: Bruno Pop-Stefanov on 24 Oct 2014
This is definitely not an easy problem. There are several ways you can go about this.
1) Curve Fitting
The easiest method would be to try to fit a curve to the data you have. Curve Fitting Toolbox has an app that allows you to quickly try different models, adjust parameters, and immediately see whether you found a good fit or not. The downside of this method would be that it only estimates the parameters of a curve. It won't estimate the noise. You'll get a smooth curve for the week of missing points, instead of noisy measurements.
Read more here:
There are also numerous other examples listed here:
2) Time Series Regression
A better approach would be to estimate your time series as an auto-regressive model (AR, MA, ARMA, ARMAX, GARCH, or others). Econometrics Toolbox provides tools for estimation, simulation and forecasting of time series.
Take a look at the examples on this page and see if you could adapt something your problem:
I am not sure whether you can use the left and right ends of your data to estimate a model at once, or if you can only use once at a time.

  0 Comments

Sign in to comment.


Donald John
Donald John on 30 Oct 2014
Thanks for your response. I am going to give both of these methods a try. I'll report back here once I have had a chance to do so. In the meantime any further input is much appreciated!! Thanks again.

  0 Comments

Sign in to comment.

Sign in to answer this question.