How do you design your ECG bandpass?

75 views (last 30 days)
Hallo,
currently i'am working on a ecg bandpass. To design my filter i use mostly "filterDesigner"-Tool by Matlab.
What are the specifications?
  • Band of choice is 0.05 Hz - 150 Hz (recommended by American Hearth Association)
  • sample rate = 500 Hz
  • Take a stopband between 40 dB - 60 dB
  • group delay has to be minimal
What filter would i choose?
  • Because of minimal group delay i would choose a FIR-Filter, BUT the first cut-off is 0.05 Hz (the transition band has to be very sharp for example 0.01 Hz- 0.05 Hz) -> the filter order is about 15.000 i think with Equiripple design
  • Lets take IIR-Filter -> here Butterworth Bandpass because it has the best phase response and a smooth passband
  • But huge group delay at cut-off frequencies
FilterDesign Example
  • Method: IIR-Butterworth Bandpass
  • Minimum Order
  • Fs = 500
  • Fstop 1 [0.01] - Fpass1 [0.05]
  • Fpass2 [150] - Fstop2 [200]
  • Astop [40] , Apass [1], Astop [60]
My question to the experts, can you recommend a better design? The result is okay but the huge group delay looks very bad.
Best regards!
  5 Comments
Stephan Lallinger
Stephan Lallinger on 5 Dec 2019
I never used elliptic filters because they have the worst "phase" i think.
I really never thought about bi-directional filtering. I have to work with that more.
Star Strider
Star Strider on 5 Dec 2019
The filtfilt function creates all digital filters as phase-neutral.
The only phase-neutral hardware filter is the bessel filter. It is not possible to create a digital filter from it, unlinke other FIR and IIR filter designs, so it is only useful in a hardware implementation. This is the reason that Bessel filters are used as anti-aliasing filters in instrumentation inputs prior to the ADC stage.

Sign in to comment.

Accepted Answer

Daniel M
Daniel M on 29 Nov 2019
Edited: Daniel M on 29 Nov 2019
Hi Stephan, here is a script that creates some filters and view them. You may often find that creating filters using the transfer function approach (e.g [B,A] = ...) can lead to unstable filters. This is usually cleared up with the functions tf2sos or zp2sos (after using the [z,p,k] approach for filters). I don't know enough to explain the difference between the approaches, so maybe Star Strider can comment. But here is a starting point for you. Run them on your data and see how they work for you.
clearvars
close all
clc
Np = 2^14;
Rp = 1; % passband ripple
Rs = 40; % stopband ripple
Fs = 500; % sampling frequency
Fn = Fs/2; % nyquist frequency
Fpass = [0.05 150]; % passband
Fstop = [0.01 200]; % stopband
Wp = Fpass/Fn; % normalized
Ws = Fstop/Fn;
% Create a butterworth filter using several methods
[N,Wn] = buttord(Wp,Ws,Rp,Rs);
[B,A] = butter(N,Wn);
[sos1,g1] = tf2sos(B,A);
[z,p,k] = butter(N,Wn);
[sos2,g2] = zp2sos(z,p,k);
% View the filters
figure
freqz(B,A,Np,Fs)
title('Non-stable tf butterworth')
figure
freqz(sos1,Np,Fs)
title('butterworth tf2sos')
figure
freqz(sos2,Np,Fs)
title('butterworth zp2sos')
% Create an elliptic filter using several methods
Rs2 = 150; % all filters stable at Rs2 = 40. Try sharper cutoff.
[N,Wp] = ellipord(Wp,Ws,Rp,Rs2)
[B,A] = ellip(N,Rp,Rs2,Wp);
[sos1,g1] = tf2sos(B,A);
[z,p,k] = ellip(N,Rp,Rs2,Wp);
[sos2,g2] = zp2sos(z,p,k);
% View the filters
figure
freqz(B,A,Np,Fs)
title('Non-stable tf ellipse')
figure
freqz(sos1,Np,Fs)
title('ellipse tf2sos')
figure
freqz(sos2,Np,Fs)
title('ellipse zp2sos')
  2 Comments
Daniel M
Daniel M on 29 Nov 2019
Edited: Daniel M on 29 Nov 2019
Note I just ran this on some sample data and found that 0.05 was not effective to remove baseline wander, but 0.5 was. This will vary per the data.
Stephan Lallinger
Stephan Lallinger on 5 Dec 2019
You are right 0.05 is not enough to get rid off baseline wander.
I will look at your filters closer.
Thank you for your response.

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!