Prev: How to generate 15 consecutive
Next: Allpass phase-matching
From: Lane on 14 Jan 2010 14:46 I'm implementing an algorithm for detecting heartbeats within an EKG signal. There is an initial filtering pass that is described in the paper like this: "In our implementation a 27 tap linear phase FIR filter is used. The cut-off frequencies are 18 Hz and 35 Hz." Our data is sampled at 256 Hz. I know this should be simple for a DSP expert, but I don't have the first clue how to compute the coefficients for such a filter. Can someone tell me what they are? And then tell me what formula you used so I don't have to bother this group again? Thanks a million.
From: Clay on 14 Jan 2010 15:02 On Jan 14, 2:46 pm, Lane <lanephill...(a)gmail.com> wrote: > I'm implementing an algorithm for detecting heartbeats within an EKG > signal. There is an initial filtering pass that is described in the > paper like this: "In our implementation a 27 tap linear phase FIR > filter is used. The cut-off frequencies are 18 Hz and 35 Hz." Our > data is sampled at 256 Hz. I know this should be simple for a DSP > expert, but I don't have the first clue how to compute the > coefficients for such a filter. Can someone tell me what they are? > And then tell me what formula you used so I don't have to bother this > group again? Thanks a million. Here is a set with the follow parameters: f_s =256 Hz pass band 18 to 35 Hz stop band1 0 to 8Hz stop band2 45 to 128Hz number of taps = 27 This was designed with the Parks McClellan Algorithm I wrote a program for this years ago. Here is a free version http://www.claysturner.com/dsp/fir.zip /* FIR filter data */ double coef[]={ 0.03110403794773, /* h( 0) */ -0.01103182570135, /* h( 1) */ -0.00649094708366, /* h( 2) */ 0.00586008912681, /* h( 3) */ 0.02024624454860, /* h( 4) */ 0.01940961712880, /* h( 5) */ -0.01267936948363, /* h( 6) */ -0.07153760012540, /* h( 7) */ -0.12558821602372, /* h( 8) */ -0.13204348636214, /* h( 9) */ -0.06750310295363, /* h( 10) */ 0.04904337671889, /* h( 11) */ 0.16091135304829, /* h( 12) */ 0.20693635729176, /* h( 13) */ 0.16091135304829, /* h( 14) */ 0.04904337671889, /* h( 15) */ -0.06750310295363, /* h( 16) */ -0.13204348636214, /* h( 17) */ -0.12558821602372, /* h( 18) */ -0.07153760012540, /* h( 19) */ -0.01267936948363, /* h( 20) */ 0.01940961712880, /* h( 21) */ 0.02024624454860, /* h( 22) */ 0.00586008912681, /* h( 23) */ -0.00649094708366, /* h( 24) */ -0.01103182570135, /* h( 25) */ 0.03110403794773 /* h( 26) */ }; Enjoy, Clay
From: Rune Allnor on 14 Jan 2010 15:10 On 14 Jan, 20:46, Lane <lanephill...(a)gmail.com> wrote: > I'm implementing an algorithm for detecting heartbeats within an EKG > signal. There is an initial filtering pass that is described in the > paper like this: "In our implementation a 27 tap linear phase FIR > filter is used. The cut-off frequencies are 18 Hz and 35 Hz." Our > data is sampled at 256 Hz. I know this should be simple for a DSP > expert, but I don't have the first clue how to compute the > coefficients for such a filter. Can someone tell me what they are? There is too little information. There are several ways to compute such coeffcients, and one would need to know exactky what method was used by the authors of the paper to come up with a near-exact match. Terms to look for are 'window', 'hanning', 'hann', 'von hann', 'hamming', 'kaiser', 'blackman', 'parks-mcclellan', 'remez'. If you can find any of these terms (or other terms you don't understand) near the description of the filter, they might be of help to find out exactly what kind of filter was used. > And then tell me what formula you used so I don't have to bother this > group again? Hmmm... learning how to compute the coefficients of a filter from a spec like the one you gave, is one key goal for a first course on DSP. A bit more than one would expect people to get merely by reading a couple of usenet posts... Rune
From: Jerry Avins on 14 Jan 2010 15:20 Lane wrote: > I'm implementing an algorithm for detecting heartbeats within an EKG > signal. There is an initial filtering pass that is described in the > paper like this: "In our implementation a 27 tap linear phase FIR > filter is used. The cut-off frequencies are 18 Hz and 35 Hz." Our > data is sampled at 256 Hz. I know this should be simple for a DSP > expert, but I don't have the first clue how to compute the > coefficients for such a filter. Can someone tell me what they are? > And then tell me what formula you used so I don't have to bother this > group again? Thanks a million. From the two cutoff frequencies, I assume that what is described is a band-pass filter. It is nevertheless a description, not a specification. Even knowing the number of taps, trade-offs can be made between the sharpness of cutoff, the attenuation in the stop band, and the ripple in the passband. For these, I suggest that you ask the authors of the paper. For coefficient calculation, you might like http://www.dsptutor.freeuk.com/FIRFilterDesign/FIRFilterDesign.html. It assumes a 8,000 Hz sample rate, so you must scale your band edges by 8000:250, or 32:1. The silly Java program does only even taps. 26 or 28 ought to work fine. There are better programs, but this one is to hand. A quick look tells me that the stopband attenuation with fewer than 40 taps will be poor with this windowed-sinc design. You might want to download a free trial copy of ScopeFIR from http://www.iowegian.com. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
From: Clay on 14 Jan 2010 15:35
On Jan 14, 3:20 pm, Jerry Avins <j...(a)ieee.org> wrote: > Lane wrote: > > I'm implementing an algorithm for detecting heartbeats within an EKG > > signal. There is an initial filtering pass that is described in the > > paper like this: "In our implementation a 27 tap linear phase FIR > > filter is used. The cut-off frequencies are 18 Hz and 35 Hz." Our > > data is sampled at 256 Hz. I know this should be simple for a DSP > > expert, but I don't have the first clue how to compute the > > coefficients for such a filter. Can someone tell me what they are? > > And then tell me what formula you used so I don't have to bother this > > group again? Thanks a million. > > From the two cutoff frequencies, I assume that what is described is a > band-pass filter. It is nevertheless a description, not a specification. > Even knowing the number of taps, trade-offs can be made between the > sharpness of cutoff, the attenuation in the stop band, and the ripple in > the passband. For these, I suggest that you ask the authors of the paper. > > For coefficient calculation, you might likehttp://www.dsptutor.freeuk.com/FIRFilterDesign/FIRFilterDesign.html. It > assumes a 8,000 Hz sample rate, so you must scale your band edges by > 8000:250, or 32:1. The silly Java program does only even taps. 26 or 28 > ought to work fine. There are better programs, but this one is to hand. > A quick look tells me that the stopband attenuation with fewer than 40 > taps will be poor with this windowed-sinc design. You might want to > download a free trial copy of ScopeFIR fromhttp://www.iowegian.com. > > Jerry > -- > Engineering is the art of making what you want from things you can get. Hey Jerry, try out my program - it is free and will certainly let you do even or odd numbers of taps. http://www.claysturner.com/dsp/fir.zip Clay |