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 Kommentare

Daniel M
Daniel M am 28 Nov. 2019
Bearbeitet: Daniel M am 28 Nov. 2019
If you use filtfilt there should be no phase distortion in the filtered signal.
By the way, you mean 0.5 Hz for the lower limit, not 0.05 Hz right? (That seems extreme). Can you point to some literature?
Star Strider
Star Strider am 28 Nov. 2019
The standard EKG spectrum is about 0 - 100 Hz, and to eliminate baseline wander, either 0.05 or 0.5 Hz would be an acceptable lower limit for the passband of a bandpass filter. The upper limit is variable, and while 150 Hz will allow for complex arrhythmias, with a healthy heart, the EKG upper passband can be as low as 45 Hz without losing detail. At least that has been my experience.
As for filter design, I prefer elliptic filters because they are short and therefore computationally very efficient (and using zp2sos), and with filtfilt (as you mentioned) produce a phase-neutral output.
Stephan Lallinger
Stephan Lallinger am 5 Dez. 2019
Sorry for my late answer.
I know the 0.05 Hz sounds extrem, but i have problems with 0.5/0.67 because the ST-Segment gets distorted.
I rather take the baseline wander then the distorten.
Here are some papers and links which refer to 0.05 Hz - 150 Hz
Advanced Journal ofVascular Medicine: https://www.scireslit.com/VascularMedicine/AJVM-ID18.pdf
International Scholarly Research Network: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3388307/
Iam not sure if iam allowed to link here.
Stephan Lallinger
Stephan Lallinger am 5 Dez. 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 am 5 Dez. 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.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Daniel M
Daniel M am 29 Nov. 2019
Bearbeitet: Daniel M am 29 Nov. 2019

0 Stimmen

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 Kommentare

Daniel M
Daniel M am 29 Nov. 2019
Bearbeitet: Daniel M am 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 am 5 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by