Initial and end artifacts after applying digital filter (filtfilt)
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marta Agusti Alcalde
am 23 Okt. 2020
Beantwortet: Star Strider
am 23 Okt. 2020
I need to filter highly noisy signals (at a sample rate of 2000 Hz).
When applying the code:
[b,a]=butter(order,Fcutoff/(2*Fs),'low');
f_signal=filtfilt(b,a,x);
Where:
order = 2; Fcutoff = 4Hz; Fs = 2000 Hz; x = Non filtered signal as a double vector;
The output filtered signals appear to have (only for some cases) and initial and end artifact, where they tend to deviate upwards or downwards (only at the edges of the filtered signal).
What is the data that is being processed by the filter at the edges?
How can I know how many data points are being used in this process?
Is there a clean way to tackle this problem?
1 Kommentar
Mathieu NOE
am 23 Okt. 2020
hi
these artifacts are sometimes caused by the filtfilt function that do filtering in both direct and reverse time axis (so no phase lag)
try filter instead (this runs the signal only in the causal time direction, but you will get phase alg according to the low pass filter)
i see also that you are focusing on the very low frequency range , while your signal is sampled at 2000 Hz
I woud recommend to decimate your signal (this also apply a low pass filter) so if you have very long data, this will help you speed up your post processing
help decimate
DECIMATE Resample data at a lower rate after lowpass filtering.
Y = DECIMATE(X,R) resamples the sequence in vector X at 1/R times the
original sample rate. The resulting resampled vector Y is R times shorter,
LENGTH(Y) = LENGTH(X)/R.
DECIMATE filters the data with an eighth order Chebyshev Type I lowpass
filter with cutoff frequency .8*(Fs/2)/R, before resampling.
Akzeptierte Antwort
Star Strider
am 23 Okt. 2020
In many situations that is caused by the signal having a significant d-c (constant) offset. There are two general ways to deal with it:
(1.) concatenate a constant value vector equal to the mean of the signal of about 10% of the signal length to each end
(2.) subtract the mean of the signal from the signal, and then filter it, then add the mean value of the original signal to the filtered output
Those have both worked for me in the past when I had similar problems.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!