custum filter for biosignal
显示 更早的评论
Dear all,
I have a custum made filter based on removing datapoints who are bigger than 3 times the std from the mean. I have to calculate the mean and over 30 datapoints. lets say n is the 35 value in a matrix, then I have to select the window from the 20 value till the 50 value. That does mean we don't can take our first 15 datapoints and have to start at the 15th point. How do I apply this in my code.
The code I have right now is:
parameter = y_day1;
s = 1800;
a = 1;
for k = 15:length(parameter)-s;
index = a:a+s;
Ytemp = parameter(index);
mean = mean(Ytemp);
stddev = std(Ytemp);
stddev = 3*stddev;
lowerbound = mean - stddev;
Ytemp(Ytemp < lowerbound) = NaN;
a = a+1;
y_day1_filtered(index) = Ytemp;
end
回答(1 个)
Star Strider
2018-10-25
0 个投票
If you have R2016a or later, you can use the movstd (link) function and its friends to calculate a sliding-window standard deviation.
To identify and remove the outliers, if you have R2015b (and the Signal Processing Toolbox), you can use the hampel (link) function, and in R2018b, the rmoutliers (link) function.
类别
在 帮助中心 和 File Exchange 中查找有关 Smoothing and Denoising 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!