# Filling data gaps in a periodic timeseries in MATLAB

10 Ansichten (letzte 30 Tage)
Donald John am 23 Okt. 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 KommentareKeine anzeigenKeine ausblenden
Yona am 23 Okt. 2014
Bearbeitet: Yona am 23 Okt. 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 am 23 Okt. 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?

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Bruno Pop-Stefanov am 24 Okt. 2014
Bearbeitet: Bruno Pop-Stefanov am 24 Okt. 2014
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.
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.
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.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Muhammad Usman Saleem am 17 Jun. 2022
any sample code to use timeseries regression in matlab

Melden Sie sich an, um zu kommentieren.

Donald John am 30 Okt. 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 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by