How to remove baseline wander from ECG?

31 次查看(过去 30 天)
I'm trying to apply a low filter at 0.5 but it removes part of the signal. I'm using a plain Hanning window as in : Bz=fir1(N,0.5,'high'); and then filter for the signal. Maybe a IIR filter would do better?

回答(1 个)

Star Strider
Star Strider 2016-5-21
I would use a Butterworth or Chebyshev Type II filter with a passband of [1 100] Hz and a stopband of [0.5 120] Hz, a passband ripple of 10 dB and a stopband ripple of 40 db. (Both of these filters have a flat passband, so the value of the passband ripple is in practice irrelevant.)
Remember that you have to normalise the passband and stopband frequencies by the Nyquist frequency, the reason you are likely filtering out much of your signal now:
Fs = ...; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [1 100]/Fn; % Normalised Passband
Ws = [0.5 120]/Fn; % Normalised Stopband
This is my typical filter for EKGs. It may be necessary to tweak it depending on the sampling frequency, since a sampling frequency ‘Fs’ >200 Hz is best, and 250 Hz is usually the most efficient. If your sampling frequency is lower than 200 Hz, you will have to reduce the upper passband and stopband frequencies of the filter accordingly.
  2 个评论
Sara Cooper
Sara Cooper 2016-5-21
I'm trying to do that but it still erases a big part of the signal, perhaps because it has components between 0.5 and 120 Hz. Isn't there any way to just remove the noise?
Star Strider
Star Strider 2016-5-21
编辑:Star Strider 2016-5-21
Of course it has components between 0.5 and 120 Hz! That is where all the EKG power is!
This filter will pass all the frequencies in its passband.
What do you believe my filter is doing?
Remember, your filter passband does not start at 0.5 Hz, it starts at the normalised value of 0.5/Fn. (The normalised units are Hz/Hz, or dimensionless.)
-----------------------------------------------------------------------------------------------------------------------------------
EDIT Now that I have your sampling frequency (from your other Question: Powerline interference in ECG), I designed the perfect filter for you:
Fs = 300; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
Wp = [1 100]/Fn; % Passband (Normalised)
Ws = [0.5 110]/Fn; % Stopband (Normalised)
Rp = 10; % Passband Ripple (dB)
Rs = 30; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp, Ws, Rp, Rs); % Chebyshev Type II Order
[b,a] = cheby2(n, Rs, Ws); % Transfer Function Coefficients
[sos,g] = tf2sos(b,a); % SEcond-Order-Section For STability
figure(1)
freqz(sos, 4096, Fs) % Filter Bode Plot
Run it, and you’ll see how it works.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Digital Filter Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by