Clear Filters
Clear Filters

How to filter out multiple outliers from a gradually changing dataset?

2 views (last 30 days)
I have a set of arrays which should show a gradually increasying pattern. However, there are some instances where the gradual increase is not observed. I used filloutliers command with linear but it was found that there were multiple outliers. I will demonstrate a few instances of them in the figure below: Figure 1 shows a gradual increasing data. However, in Figure 2 and 3, there are multiple points that are outliers. Figure 4 has multiple instances of outliers. And, in figure 5 and 6, there are 7 points (out of 15) that are out of the trend.
I tried findchangepts but it also works only for a single point. I would appreciate if there can be a way to transform these lines to gradually changine lines. It should be noted that all the set of data points are always 15.
I am trying to reconstruct the rest of the data points similar to figure 1. I would appreciate if there is a possibility of achieving it.
Thanks in advance.
load("a_data.mat")
figure
tiledlayout(3,3)
for i = 1:9
nexttile
title(string(i))
hold on
adata = a(:,i);
plot(adata,'b-')
bdata = filloutliers(adata,"linear");
plot(bdata,'r.:')
box on; grid on
hold off
end

Accepted Answer

Chunru
Chunru on 13 Mar 2024
Adjust the threshold:
websave("a_data.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1641186/a_data.mat");
load("a_data.mat")
figure
tiledlayout(3,3)
for i = 1:9
nexttile
title(string(i))
hold on
adata = a(:,i);
plot(adata,'b-')
bdata = filloutliers(adata, "linear", "percentiles", [20 80]);
plot(bdata,'r.:')
box on; grid on
hold off
end

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!