remove outliers form timeseries

16 visualizzazioni (ultimi 30 giorni)
Gaetano Pavone
Gaetano Pavone il 11 Nov 2019
Modificato: Gaetano Pavone il 12 Nov 2019
I have an original timeseries ts and I would like to apply a filter for removing the outliers. In particular I define a percentile criteria for filtering the original ts:
[B,TF]=rmoutliers(ts.Data,'percentiles',[5 95]);
Such operation returns two objects: a filtered ts.Data, that is B, and the logical vector Tf in which if the element is outlier the corresponding element is equal to 1, otherwise is equal to 0.
Now my question is:
how to build a timeseries with the filtered data B and the corresponding datetime vectors?

Risposta accettata

Daniel M
Daniel M il 11 Nov 2019
If timevector is the name of your datetime vector, then you can mask out the outliers using
timevector_good = timevector(~TF); % this is the "good" data points
  1 Commento
Adam Danz
Adam Danz il 11 Nov 2019
You can use the TF logical vector to identify non-outlier indices.
ts.Data(~TF)
dateTimeVector(~TF)
My answer moved here as a comment to supplement Daniel's answer.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Time Series Events in Help Center e File Exchange

Tag

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by