Matlab 过滤加速度数据中的电尖峰 [英] Matlab filter electical spikes in accelerometric data
问题描述
我有一个受电尖峰影响的加速度数据数据集.
I have a dataset of accelerometric data that is affected by electical spikes.
我正在寻找一种很好的方法来过滤掉或减少这些尖峰,因为需要根据这些数据计算 FFT 的滚动窗口和其他统计指标,例如峰态和偏度.我不能简单地删除这些异常值或用 NaN 替换它们.采样 2000[hz]
I'm looking for a good method to filter out or reduce these spikes as need to calculate on these data a rolling window of FFT and other statistical indicators such as kurtosis and skewness. I can't simply delete these outliers or replace them with NaN. Sampling 2000[hz]
直到现在我都在 MATLAB 2012b 上试过:
Until now I've tried on MATLAB 2012b:
- 小波去噪(Haar小波)
- 中值过滤器
- Despike 和迭代方法
您能提出一种处理这些数据的适当方法吗?
Can you suggest a proper approach to deal with these data?
推荐答案
我建议进行一些局部平滑处理.通过定义阈值和平均所有低于和高于的值.
I would suggest some local smoothing. By defining thresholds and averaging all values below and above.
Af = data.example1;
% Thresholds
Tl = -0.6;
To = 0.6;
peaks = find( Af < Tl | Af > To);
Af(peaks) = ( Af(peaks-1) + Af(peaks+1) ) / 2;
这种方法的问题在于,您的大纲有时最多包含 6 个样本.因此,您需要使用 while 循环在多个步骤中进行平滑处理:
The problem with this approach is that your outliners sometimes consist of up to 6 samples. So you need to smooth in multiple steps using a while loop:
Af = data.example1;
% Thresholds
Tl = -0.6;
To = 0.6;
% initialisation
peaks = find( Af < Tl | Af > To);
counter = 0;
while ~isempty(peaks)
peaks = find( Af < Tl | Af > To);
Af(peaks) = ( Af(peaks-1) + Af(peaks+1) ) / 2;
counter=counter+1;
end
经过 6 次迭代后,您会得到以下结果:
after 6 iterations you get the following result:
这篇关于Matlab 过滤加速度数据中的电尖峰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!