Reply by baranov November 3, 20112011-11-03
>On Fri, 28 Oct 2011 16:50:24 -0500, baranov wrote: > >> 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 > >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 http://www.EmbeddedRelated.com
Reply by Tim Wescott October 29, 20112011-10-29
On Fri, 28 Oct 2011 16:50:24 -0500, baranov wrote:

> 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
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
Reply by Vladimir Vassilevsky October 29, 20112011-10-29

baranov wrote:

> 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?
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 http://www.abvolt.com
Reply by rickman October 29, 20112011-10-29
On Oct 29, 4:54=A0am, MK <m...@nospam.co.uk> wrote:
> On 29/10/2011 08:47, Tauno Voipio wrote: > > > > > > > > > On 29.10.11 12:50 , baranov wrote: > >> Hello. > >> I try to build 3Hz...300Hz bandpass FIR and see that it requires not l=
ess
> >> than 63 taps. As I have to use it on STM32 calculations might take mor=
e
> >> 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 throughhttp://www.EmbeddedRelated.com > > > 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. > > I tried your filter using MATLAB's filterbuilder from the filter design > toolbox. > Simplified spec: > Fs =3D 1000, fstop1 =3D 1.5, fpass1 =3D 3, fpass2 =3D 300, fstop2 =3D 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
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
Reply by MK October 29, 20112011-10-29
On 29/10/2011 08:47, Tauno Voipio wrote:
> On 29.10.11 12:50 , baranov wrote: >> 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 http://www.EmbeddedRelated.com > > > 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. >
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
Reply by Tauno Voipio October 29, 20112011-10-29
On 29.10.11 12:50 , baranov wrote:
> 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 http://www.EmbeddedRelated.com
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
Reply by Roberto Waltman October 28, 20112011-10-28
"baranov"  wrote:
>I try to build 3Hz...300Hz bandpass FIR and see that it requires not less >than 63 taps....
Try posting in comp.dsp also. -- Roberto Waltman [ Please reply to the group, return address is invalid ]
Reply by baranov October 28, 20112011-10-28
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 http://www.EmbeddedRelated.com