Only abnormally large outlier values are removed, not small ones
3 views (last 30 days)
I used the rmoutlier function to remove outliers from a dataset but it only removed the abnormally large value, not the abnormally small one. Please see figure for reference. Also I used the following line of code:
How can I remove both???
AndresVar on 26 Mar 2022
your data has zeros that make the mean closer to the small peak.
you should ignore the zeros, maybe you can throw them away OR you can try setting them equal to the non-zero data mean.
ind0 = y==0; % where are the zeros
meannz = mean(y(~ind0)); % mean of non-zero data
yline(mean(y),'k',Label='mean (close to bottom!)')
yline(meannz,'k',Label='mean ingnore zeros')
y(ind0)=meannz; % make zeros equal to the non-zero data mean
y(ind0)=0; % restore zeros