# Filter Order Rule of Thumb

Is there a rule of thumb for calculating the approximate filter order of a FIR/IIR based on passband vs sample rate? I seem to remember reading about it once in Undergrad. I'd think you could make a rough estimate like scaler * passband/stopband.

I have been working on implementing different FIR/IIR filters and would like some rough formula that says if one variable is changed, this is approximately how many more taps you would need to get similar performance.

• For FIR filters there's a formula given in this answer. Commented Feb 15, 2017 at 18:28

My favorite "Rule of thumb" for the order of a low-pass FIR filter is the "fred harris rule of thumb":

$$N=\frac{f_s}{\Delta f}\cdot\frac{\rm atten_{dB}}{22}$$

where

• $$\Delta f$$ is the transition band, in same units of $$f_s$$
• $$f_s$$ is the sample rate of the filter
• $$\rm atten_{dB}$$ is the target rejection in dB

For example if you have a transition band of 100 Hz in a system sampled at 1 kHz, and your rejection requirement is 50 dB in the stop band then the order can be approximated by:

$$N = \frac{1\ \rm kHz}{100\ \rm Hz} \cdot\frac{50}{22} = 23\ \rm taps\tag{rounding up}$$

Thank you Fred Harris!

Note another more detailed formula that takes into account passband ripple is Kaiser's formula thanks to James Kaiser from Bell Labs, which I included in my graphic below.

For most applications I have done, the Fred Harris approach has been just fine, as given a certain rejection, the resulting filters using traditional filter design algorithms such as Parks-McClellan and Remez have exceeded my passband ripple requirements upon meeting the rejection requirement. (What I usually do is estimate the order, design the filter with that order, inspect the result and increase or decrease order from there to fine tune). The results from the estimates are just that: estimates, and can vary widely depending on overall design parameters and not to be assumed to be an exact solution.

For those familiar with filter design using window approaches, review of the boxcar or rectangular window (which is simple truncation) reveals why it takes $$f_s/\Delta f$$ taps (which is the same as $$2\pi/\Delta\omega$$ if the units for normalized frequency are radians/sample as is often done) to complete the transition band. See the images below that help explain this.

The top image below shows the expected Sinc in frequency for a rectangular window in time, in this case as a non-causal rectangular pulse centered on $$t=0$$. This is then repeated in discrete forms as a causal waveform starting at $$t=0$$, both with the Discrete Time Fourier Transform (DTFT) and Discrete Fourier Transform (DFT) where the difference is the samples in time extend to $$\pm \infty$$ for the DTFT resulting in a continuous waveform in the frequency domain. In both cases the result is an aliased Sinc function that is periodic over the interval $$f= [0,f_s)$$, with the key point that for $$N$$ samples in time of the rectangular function, the frequency response will have its first null at $$f = 1/N$$ (Where $$f$$ is the normalized frequency with 1 being the sampling rate).

This next image below shows the rectangular window approach to filter design (which I would never recommend but is informative). The first plot in the upper left hand corner shows the target frequency response for our filter as an ideal "brick wall" response. Please don't confuse that with the "boxcar window" (or "rectangular window") which is also a rectangular shape-- the window is in the time domain!

In order to realize such a filter, we would use the impulse response of the desired frequency response as the coefficients in our FIR filter (the coefficients of the filter are the impulse response---put an impulse in and out come all the coefficients!). The impulse response for a rectangular frequency (brickwall) response is the inverse FT which is a Sinc function, in the time domain, shown in the lower left hand corner as the "Required Impulse Response". A Sinc function extends to plus and minus infinity, so to actually realize such a filter we would need an infinitely long filter and it would have infinitely long delay. Obviously we can't do that, so we truncate the coefficients to something realizable. The longer the filter, the closer we approximate the ideal brickwall response, but also the longer the delay will be (and the more resources we would need in terms of the filter construction; more taps).

Truncating the impulse response in the time domain is mathematically identical to multiplying by a rectangular window in the time domain. (Note that the impulse response is also delayed by half the duration of the window in order for the system to be causal). Multiplying in the time domain is equivalent to convolution in the frequency domain. The frequency domain (FT) of the impulse response prior to truncation is our original desired brickwall frequency response. The frequency response for the rectangular window is a Sinc function in the frequency domain.

So when we truncate the desired impulse response (multiply in time by a rectangular window), we convolve the desired frequency response with a Sinc function, resulting in an approximation of our target frequency response as shown in the upper right-hand corner of the image below.

A key take-away for Sinc functions in general is the first null is $$1/T$$ where $$T$$ is the duration of the rectangular function. For a sampled system, the first null would be at $$2\pi/N$$ where $$N$$ represents the number of samples for the duration of the rectangular function. In the images a normalized radian frequency is used for the frequency axis- (if that confuses you just know the $$2 \pi$$ is the radian frequency for the sampling rate). So in the process of the convolution, the sharp brickwall transition spreads out and in this case goes to 0 (our $$\Delta \omega$$) over a frequency of $$2\pi/N$$! So here $$N = 2\pi/\Delta \omega$$ and of course the filter is poor with sidelobes etc. Note this: This transition from the Sinc function is the sharpest available for a given number of taps; it has the best resolution in frequency but the poorest dynamic range (rejection). Other window typologies (Blackman, Blackman-harris, Kaiser (my favorite), etc) will significantly improve dynamic range but always at the expense of the transition.

So from the above, we see the origin of the $$2\pi/\Delta\omega$$ that is used in the approximation formulas, and we also see why there is an additional multiplication factor increasing the number of taps above this for typical filter designs; the rectangular window would give us the best transition possible with $$N$$ taps where $$N = 2\pi/\Delta\omega$$ but have very poor rejection. More taps are used to smooth the time transition further beyond the sharp transition of the rectangular window, providing greater rejection at the expense of transition bandwidth.

• Just to avoid confusion, the formula you call "Kaiser's formula" is actually the formula for Parks McClellan optimal filters (indeed found by Kaiser), but not for the Kaiser window method. The latter doesn't have two different $\delta$ values but only one. Commented Feb 16, 2017 at 17:08
• Indeed, good clarification Matt since there is a Kaiser window method. This formula is however referred to and known as "Kaiser's Formula" in the literature, just so readers don't think it was my own use of that term. engold.ui.ac.ir/~sabahi/Advanced%20digital%20communication/… Commented Feb 16, 2017 at 17:12
• Awesome! Looks like that came from page 48 in Fred Harris' book: "Multirate Signal Processing for Communication Systems"? Commented Feb 16, 2017 at 19:08
• The rule of thumb or the pictures? The pictures are mine for a class I do. I don't have fred's book but I am a big fan and was introduced to his "rule of thumb" by him at a DSP World presentation he did back around 1996. (Note that he insists that his name be spelled with all lower case). Commented Feb 16, 2017 at 19:13
• @DanBoschen Is the formula for Parks McClellan also valid when designing bandpass FIR filters? If not, is there another "rule of thumb" that could be applied? Commented Aug 8, 2017 at 19:22

The length of a FIR filter or order of an IIR filter is very roughly inversely proportional to the ratio of the transition-band's width (narrowest one, if many) to the sample rate, other things being somewhat equivalent, except for very short or very low order filters.

• dunno why someone downvoted. i fixed it back to zero. Commented Feb 15, 2017 at 19:28
• other things being somewhat equivalent ?
– Ben
Commented Apr 27, 2019 at 14:41
• Passband ripple and stop band attenuation are also the other main factors that affect the filter length. Commented Jan 18, 2021 at 22:17