Detect and remove outliers in signals

조회 수: 7 (최근 30일)
payam samadi
payam samadi 2022년 8월 5일
댓글: payam samadi 2022년 8월 5일
Hi there,
I have a signal, which is attached, and I want to remove outliers, which are shown in the figure, in datasets, or just replaced them with 0.
I try to use the rmoutliers function but it reduces the length of datasets while I want to get the same length of original datasets as a result.
Any suggestion would be appreciated.

답변 (2개)

Bjorn Gustavsson
Bjorn Gustavsson 2022년 8월 5일
Be very cautious when changing bad-data-values to some default-value - that will eventually lead to (since we all know that the exact procedure one takes to do this will be forgotten far too soon) bad errors in some statistical measures of that data-set. If you really want the same-side of the out-lier-removed data I suggest you plug in nan instead of zeros. If you use rmoutliers you could do this:
[~,idx_outliers] = rmoutliers(Data);
Data(idx_outliers) = nan;
Then you can still do the statistics on the signal - this way you will have to correctly handle the nan-s in the data, which isn't too tricky.
HTH
  댓글 수: 3
Bjorn Gustavsson
Bjorn Gustavsson 2022년 8월 5일
Don't you get a rejection of the 3 spikes in the ECMestimatedPos? Or what is the problem? Outlier-rejection in these cases (the third spike isn't that far out relative to the other local minimas) starts to become a difficult problem.
payam samadi
payam samadi 2022년 8월 5일
Yes, I didnt get a rejection of the 3 spikes in the ECMestimatedPos.
I agree with you.

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


Steven Lord
Steven Lord 2022년 8월 5일
You could try filling the outliers with NaN values (or some other method) using the filloutliers function.
x = [1 2 99 4 5]
x = 1×5
1 2 99 4 5
filloutliers(x, NaN)
ans = 1×5
1 2 NaN 4 5
filloutliers(x, 'linear')
ans = 1×5
1 2 3 4 5

카테고리

Help CenterFile Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by