How to remove transient effect in the beginning of the filtered signal?

166 ビュー (過去 30 日間)
pietro
pietro 2014 年 11 月 4 日
コメント済み: Image Analyst 2019 年 1 月 10 日
Hi all,
I have to filter a signal with a low pass filter but the filtered data has strong spikes at its beginning and its end as you can see in the following plots.
The signal magnitude is around 15 for the whole time span, but it is not true for the filtered signal. Here my code:
Fs=1/data(2,1);
Fnorm=15/(Fs/2)
df = designfilt('lowpassfir','FilterOrder',70,'CutoffFrequency',Fnorm);
y=filter(df,data(:,3));
Why does this transient effect come from? How may I solve it?
Thank you
Best regards
Pietro

採用された回答

Keqin Xu
Keqin Xu 2018 年 7 月 11 日
Here is my trick of dealing with the edge effect, it works perfectly for me.
Prefixing AND Appending the original signal with a small number (10-100) of the beginning AND ending sections of the signal, respectively. The sections are flipped and shifted in order to maintain continuity in signal level and slope at the joining points. After filtering, the prefixed AND the appended portions of the filtered signal are removed. Below is the process for a column signal x:
R=0.1; % 10% of signal
Nr=50;
N=size(x,1);
NR=min(round(N*R),Nr); % At most 50 points
For i=1:size(x,2)
x1(:,i)=2*x(1,i)-flipud(x(2:NR+1,i)); % maintain continuity in level and slope
x2(:,i)=2*x(end,i)-flipud(x(end-NR:end-1,i));
end
x=[x1;x;x2];
% Do filtering
x=myfilter(x,...);
x=x(NR+1:end-NR,:)
  1 件のコメント
Jim Riggs
Jim Riggs 2018 年 7 月 11 日
Nice idea.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 11 月 4 日
It looks like an edge effect, which happens when the filter "runs past" the end of your signal and assumes the signal is zero there. It's totally normal and expected. You can just crop off the last few elements, usually half the filter window width.
  7 件のコメント
Image Analyst
Image Analyst 2019 年 1 月 10 日
I don't know - the poster took down the original image http://s27.postimg.org/adpqf54lv/filtered.jpg so I don't know what we're dealing with anymore.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by