データセットの雑音を除去したいのですが.
Mathematica 4には,実験データセットの雑音除去に関して幅広い選択肢があります.ここでは一般的なアプローチとして,フーリエ(Fourier)フィルタリングおよびウェーブレット(Wavelet)フィルタリングについて説明します.
フーリエフィルタリング
次の式はデータファイルの内容を読み込みます.
data = Get["Wavelets/Data/shocknoi.dat"];
データをプロットします.
noisy=ListPlot[data, PlotJoined -> True, AxesLabel -> {"x", "u(x)"}];
![[Graphics:Images/index_gr_1.gif]](Images/index_gr_1.gif)
適切なフィルタ関数を定義します.
![[Graphics:Images/index_gr_2.gif]](Images/index_gr_2.gif)
対応するフィルタ値のデータセットを生成します.
![[Graphics:Images/index_gr_3.gif]](Images/index_gr_3.gif)
![[Graphics:Images/index_gr_4.gif]](Images/index_gr_4.gif)
![[Graphics:Images/index_gr_5.gif]](Images/index_gr_5.gif)
データとフィルタをたたみ込みます.
![[Graphics:Images/index_gr_6.gif]](Images/index_gr_6.gif)
![[Graphics:Images/index_gr_7.gif]](Images/index_gr_7.gif)
ウェーブレットを使ったスプラインフィルタリング
アプリケーションパッケージWavelet Explorer をロードします.
Needs["Wavelets`Wavelets`"]
ファイルの内容を読み込みます.
data = Get["Wavelets/Data/shocknoi.dat"];
データをプロットします.
ListPlot[data, PlotJoined -> True, AxesLabel -> {"x", "u(x)"}]
![[Graphics:Images/index_gr_8.gif]](Images/index_gr_8.gif)
![[Graphics:Images/index_gr_9.gif]](Images/index_gr_9.gif)
4次のスプラインウェーブレットを使ってデータを変換します.
(s4 = SplineFilter[4, 8]; wtdata = WaveletTransform[data, s4];)
閾値1.5より小さい値を0に設定し,残りを圧縮します.残差の傾向は圧縮されないことにご注意ください.
Compress[Rest[wtdata], 1.5, Shrinking -> True];
次に逆変換を行うと,「雑音が除去された」データが得られます.
InverseWaveletTransform[ Join[{wtdata[[1]]}, %], s4];
雑音除去後のデータを示します.
waveletfilter=ListPlot[%, PlotJoined -> True, AxesLabel -> {"x", "u(x)"}];
![[Graphics:Images/index_gr_10.gif]](Images/index_gr_10.gif)
| |