2

電気的スパイクの影響を受ける加速度データのデータセットがあります。

これらのデータでFFTのローリングウィンドウや尖度や歪度などの他の統計指標を計算する必要があるため、これらのスパイクを除外または削減するための良い方法を探しています。これらの外れ値を単純に削除したり、NaN に置き換えたりすることはできません。サンプリング 2000[hz]

今までMATLAB 2012bで試しました:

  • ウェーブレット ノイズ除去 (Haar ウェーブレット)
  • メディアン フィルター
  • Despike および反復アプローチ

これらのデータを処理するための適切なアプローチを提案できますか?

サンプル データセットのダウンロード

4

5 に答える 5

2

局所的な平滑化をお勧めします。しきい値を定義し、上下のすべての値を平均化します。

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 ループを使用して複数のステップで滑らかにする必要があります。

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回繰り返した後、次の結果が得られます。 ここに画像の説明を入力

于 2013-10-03T13:14:03.400 に答える
1

A moderator merged this question with this question - that's why it looks a little messy here. This answer considers additional issues in the second question!

The following is not an entirely clean solution, the code is adopted from my previous answer, but I added an exception for your case, so you don't need to delete values at the beginning and/or end of your data manually. It discards only these invalid values, that shouldn't cause problems.

Af = csvread(strcat('example_data_with_peak.txt'),5,0); 

% Thresholds
Tl = -0.04;
To = 0.04;

% initialisation
peaks = find( Af < Tl | Af > To);
counter = 0;

while ~isempty(peaks)
    peaks = find( Af < Tl | Af > To);
    try
        Af(peaks) = ( Af(peaks-1) + Af(peaks+1) ) / 2;
    catch
        if peaks(1) == 1
            Af(1) = 0;
        else
            Af(end) = 0;
        end
    end   
    counter=counter+1;
end

figure(2);
plot(Af)

enter image description here

For determining the threshold you could use somethink like this, but it's also quite brute-force:

thresh = 15*mean(abs(findpeaks(Af)));
于 2013-12-17T15:12:19.823 に答える
0

これを必要とする可能性のある他の人のために、私が最終的に使用したものを次に示します。ここにデータファイルのデータファイルリンクがあります

@thewaywewalk に感謝します

加速度データのMatlabフィルター電気スパイク

clear all, clc,clf,tic
aa=csvread(strcat('/tmp/example_data_with_peak.txt'),5,0); %will skip the first 5 rows that are text and zeros
figure(1);
plot(aa)
Af=aa;
% Thresholds
Tl = -mean(abs(aa))*10
To =mean(abs(aa))*10

% initialisation
[peaks_r,peaks_c] = find( Af < Tl | Af > To);
peaks = find( Af < Tl | Af > To);

counter = 0;

while ~isempty(peaks)
    peaks = find( Af < Tl | Af > To);
    try
        Af(peaks) = ( Af(peaks-1) + Af(peaks+1) ) / 2;
    catch
        if peaks(1) == 1
            Af(1) = 0;
        else
            Af(end) = 0;
        end
    end   
    counter=counter+1;
end
counter
figure(2);
plot(Af)

前後の画像がこちら。

前後

于 2013-12-17T16:57:36.120 に答える