Matlab滤波加速度计数据中的电流尖峰 [英] Matlab filter electical spikes in accelerometric data
问题描述
我正在寻找一个很好的方法来滤除或减少这些尖峰,因为需要在这些数据上计算一个FFT窗口和其他统计指标,例如峰度和偏度。我不能简单地删除这些异常值或用NaN替换它们。
Sampling 2000 [hz]
直到现在我已经试过了MATLAB 2012b:
我会建议一些本地平滑。通过定义阈值并平均所有低于和高于其的值。
%阈值
Tl = -0.6;
To = 0.6;
peaks = find(Af< T1 | Af> To);
Af(峰值)=(Af(峰值-1)+Δf(峰值+1))/ 2;
这种方法的问题在于您的大纲有时最多包含6个样本。
所以你需要使用while循环在多个步骤中平滑:
Af = data.example1;
%阈值
Tl = -0.6;
To = 0.6;
初始化
peaks = find(Af counter = 0;
while〜isempty(peaks)
peaks = find(Af To);
Af(峰值)=(Af(峰值-1)+Δf(峰值+1))/ 2;
counter = counter + 1;
end
经过6次迭代,您将得到以下结果:
I have a dataset of accelerometric data that is affected by electical spikes.
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]
Until now I've tried on MATLAB 2012b:
- Wavelet denoising (Haar wavelet)
- Median Filter
- Despike and iterpolate approach
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;
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
after 6 iterations you get the following result:
这篇关于Matlab滤波加速度计数据中的电流尖峰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!