remove outliers form timeseries
7 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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
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 Center 和 File Exchange 中查找有关 Time Series 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!