Bandpass digital filter with band 3Hz...300Hz and Fs 1kHz

Oct 28, 2011 7 Replies

Hello. I try to build 3Hz...300Hz bandpass FIR and see that it requires not less than 63 taps. As I have to use it on STM32 calculations might take more time than I plan. Is it "a law of nature" and no trick would simplify filtering out 3Hz on 1kHz sampling frequency? Thanks Alex.



--------------------------------------- Posted through

formatting link


Try posting in comp.dsp also.

-- Roberto Waltman

[ Please reply to the group, return address is invalid ]

A cycle of 3 Hz is 333 samples at 1 kHz. To be effective, the total length of a FIR filter must be an appreciable part of the cycle time. 63 taps may be even too little, depending on your performance requirements.

When the rate of corner frequency is a small fraction of the sample rate, you should consider an IIR filter instead.

Tauno Voipio

I tried your filter using MATLAB's filterbuilder from the filter design toolbox. Simplified spec: Fs = 1000, fstop1 = 1.5, fpass1 = 3, fpass2 = 300, fstop2 = 500

40dB stop band, 1db passband ripple

FIR needs 954 multiplies and 953 additions per sample

IIR needs 34 multiplies and 24 additions per sample (Butterworth)

or 22 multiplies and 15 adds (Chebyshev).

I think the ST DSP library has an IIR function. You should be able to find soemthing free on the web to calculate the coefficients from your own filter spec and off you go.

Michael Kellett

ess

e

It risk of sounding like I'm asking a dumb question, I've not worked with IIR filters much, but I thought their structure was pretty simple, but with feedback. How can such a structure have more multiplies than adds? Am I missing something or is this just a difference in how it is being described?

Rick

s16 Filter(s16 x) { static s16 z0, z1; s16 y;

x -= z0; z0 += x >> 6; y = x >> 1; x = y + z1; z1 = y;

return x; }

Here we go.

:))))))

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

As mentioned -- use an IIR filter, at least for the low-pass portion. Sometimes you just need a more powerful processor, sometimes you need to get creative about how you're specifying your filter to reduce the computation load.

www.wescottdesign.com

Thanks to everybody! I used IIR for low-frequency part and FIR - for high.

--------------------------------------- Posted through

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required