How to generate a filter to remove outliers from a time series in Matlab?

Asked

Viewed 96 times

0

would like to create a low-pass filter to remove outliers from a time series.

Are sea surface temperature data (tsm), in this series there are some data that are outliers and do not know very well how to create a low-pass filter, someone could help me?

NOTE: The data of tsm are in vector form. The sampling frequency I think is 5 minutes.

I’m starting to move Matlab right now and I don’t really know how to do this.

Thank you.

1 answer

0

There are different techniques for different purposes, but in general the removal of Outliers are identified and removed from a vector in the following form:

X = 1:100;
X = X';
noise = randn(100,1);
noise2 = 10*randn(100,1);
noise(11:20:91) = noise2(11:20:91);
Y = 3*X + 2 + noise;
stats = regstats(Y,X,'linear');
potential_outlier = stats.cookd > 4/length(X);
X(potential_outlier)
scatter(X,Y, 'b.')
hold on
scatter(X(potential_outlier),Y(potential_outlier), 'r.')

You can double-check that code here with explanations

Browser other questions tagged

You are not signed in. Login or sign up in order to post.