remove outliers form timeseries

조회 수: 7 (최근 30일)
Gaetano Pavone
Gaetano Pavone 2019년 11월 11일
편집: Gaetano Pavone 2019년 11월 12일
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?

채택된 답변

Daniel M
Daniel M 2019년 11월 11일
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
Adam Danz
Adam Danz 2019년 11월 11일
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.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by