FIR filter question

Hi,

When using a lowpass FIR filter, with 100kHz sampling and 1kHz -3dB cutoff frequency, is there a minimum number of coefficients required for the filter to operate properly similar to a Nyquist minimum? I was thinking that there would be 100 or even 200 coefficients required since the cutoff frequency is 100 times lower than the sampling frequency so that the low frequency data can remain in the coefficient data long enough, but I am not sure if this is correct..

cheers, Jamie

Reply to
Jamie Morken
Loading thread data ...

Yes there is a minimum. "Properly" turns out to be a fuzzy concept, which reflects back to the number of filter taps.

But you should start with 100 taps, and go up from there as you demand a sharper transition, less amplitude ripple in the passband, and better attenuation in the stop band.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
Reply to
Tim Wescott

Jamie: A first pass estimate says you need about 3 points across the required transition band to define the desired attenuation curve in the frequency domain. Typically place one point in the middle of the transition region, and the next two go between that point and the edges of the transition band. Determine the spacing of those 3 points ('X', in Hz), and divide that spacing into the 100 kHz bandwidth(fs). The result is an approximate number of taps required to create that filter shape. In effect you are placing points every X Hz from -50 kHz to +50 kHz, which can then be converted to an equivalent number of taps. The transition band is where the curve changes fastest, so you let that region define the spacing. The rest of the curve is typically "over-sampled" in terms of number of points required to approximate the shape.

To be very specific about your question, there is no theoretical minimum number of taps to have the filter work, regardless of your ratio of desired passband to sample band. Its a matter of how well the coefficients/sample points can approximate the desired attenuation curve when spaced X Hz apart. The method above shows that too few taps will allow the transition band to be sloppy because the approximation of the attenuation curve has too few constraints.

You raise an interesting point that if the passband itself is too narrow (relative to fs), the method above would need to concern itself with the number of points in the passband as well as the number of points in the transition band. If you need to start rolling off at 1 kHz, but don't need to be in the stop band until 10 kHz, then the method above may only result in plotting one point in the passband - so the approximation will not look like a flat-top filter at all. Its going to look Gaussian or some other shape that's not constant loss. In that case, two filters with decimation would probably provide better precision with fewer overall taps.

Good luck, Steve

** Posted from
formatting link
**
Reply to
Steve

the number of taps you need is related to the ratio of cutoff freq to sampling freq just the way you say....but it is also related to the STEPPNESS of the transition band. a steeper cutoff needs more taps...

so to use the least number of taps you want the Fs as low as possible and you want the cutoff as gradual as possible...

get a filter design program and play with it

these guys

formatting link
used to have a free eval version... QED lite..

looks ike they want $99 for it now..maybe you can find another free program...experimnet with the number of taps and the type of window...

Mark

Reply to
Mark

First, having a FIR filter with 100kHz sampling and 1kHz cutoff doesn't look like a good idea. For the cases like that, you should use IIR and/or make the sampling rate lower.

Very roughly, the required length of the FIR LPF can be estimated as a period of the cutoff frequency. There are more exact formulae for the FIR length depending on the passband flatness and stopband attenuation.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

To the OP:

Do you need some specific property of a FIR filter, e.g. perfectly flat group delay (for symmetric filters) or an impulse response that goes to exactly 0?

If not, you can probably do this with a few-tap IIR design.

Cheers,

Phil Hobbs

Reply to
Phil Hobbs

I have a website that allows you to buils and see simple FIR filters. It is located here. Perhaps this will help you get some insight.

formatting link

Reply to
bulegoge

Thanks Brent, cool site! :)

cheers, Jamie

Reply to
Jamie Morken

Hi,

I've used IIR filters before, but for this project I have an FPGA so am trying out FIR, also Altera Quartus has a neat built in FIR filter builder. Someone told me IIR can have a problem with oscillation, not sure if it is a problem in reality for most projects or just a theoretical idea from the infinite impulse response.. I guess this is what you mean by "impulse response goes to exactly zero".

Quartus doesn't have an IIR filter builder, probably because they don't use enough FPGA resources :)

cheers, Jamie

Reply to
Jamie Morken

An N-sample FIR filter has an impulse response that really goes to 0 after N samples.

Besides the long exponential tail that we expect, IIR filters also have roundoff and limit cycles. For instance, with integer valued data, if you have a 1-pole lowpass with a time constant of N samples, once the filtered value drops to N-1 (with truncation) or N/2-1 (with rounding), the decrement goes to 0 so the value stops changing. That can lead to 'unexpected results' as they say in compiler manuals.

Longer IIR filters have more complicated limit cycles.

Cheers,

Phil Hobbs

Reply to
Phil Hobbs

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.