FIR filter design by the Fourier transform method

I am having some problems understanding how the Fourier transform method is used to determine the FIR filter.

As far as i have understood, you start by using the ideal impulse reponse for the specific filter design you want to have. Those are given in this table

As the the ideal impulse reponse contains infinite impulses, we truncate the infinite to finite a number by $m$, (which is confusing how this is done).

But my question is how do predetermine the order of the filter, without having to try randomly, using this method?

• there are multiple issues. first you are using the rectangular window, which is the worst one. second, if you are designing an FIR using a good window (like Kaiser), there are heuristic formulae that give you and idea of what M to use for a given width of the transition region and a given stopband attenuation. – robert bristow-johnson Dec 23 '13 at 14:31
• how do you determine M.. ? how do you determine which window should be used? – user7277 Dec 23 '13 at 17:03
• user, i just now saw this on top of the list. sorry about the month-long delay. i have no idea where this table came from but, in my opinion, it's a little bit misleading. the determination of how big M must be is, in this case, heuristic, although i imagine that some approximate formula might pop up. for the Kaiser window, there are well-established formulae. – robert bristow-johnson Jan 22 '14 at 18:31
• Check Julius Smith books: Mathematics of the DFT with Audio applications and Introduction to digital filters. – Danijel Oct 17 '15 at 19:28
• If I understand correctly M is the length of the impulse. How is the truncation done? Simply by setting every value outside the window 0 (this is so called rectangular window), or perhaps by using a other windowing function, thus altering values inside the window. This is equivalent to convolution by the frequency response of the windowing function in the frequency domain. The design aspects depends on the application. I can tell you that longer window always gives you more freedom with regards to the frequency and phase response (unless the data has a sample constraint). Windowing a specific – Dole Feb 13 '16 at 20:18

Some papers provide rule-of-thumb formula for the filter length (and coefficient quantization), for instance:

The one I generally use in lectures is borrowed from the second paper, for a low-pass filter with the following design:

Then, the estimated filter length $N$ (apparently $2M+1$ for you) is, with sampling frequency $f_s$:

$$N = \frac{2 f_s}{3(f_2-f_1)}\log_{10} \left(\frac{1}{10\delta_1\delta_2}\right)$$

There are three main characteristics of the filters that are affected by the filter length

1. Passband Ripple
2. Transition Width (from passband to stop band, or stop band to passband)
3. Stopband attenuation and roll-off of sidelobes

Unfortunately, there aren't any formulas for how the length of the window and the type of window used affect all of these 3 aspects of the filter. So you may need to increase the filter length to meet your passband ripple requirement, but it may not meet your required attenuation and/or roll-off requirement, so you'll need an even longer filter. This will need to be done by trial and error.

I believe there were some articles in the IEEE that gave some length formulas when using the Kaiser window, but I don't have the references at hand.

Even the length formulas for using the Parks–McClellan design (Remez exchange) are just a heuristic and were developed after performing a lot of experiments. Even these formulas can fail, often when a corner frequency is near 0 Hz or Fs/2. Most of the time these formulas are a good first estimate you may need a few extra coefficients to meet your exact requirements. Using the estimate of the filter order for the PM algorithm is a good first estimate for the minimum length of your filter using a windowing filter design technique.

• David, for the Kaiser window and stop-band attenuation of more than 50 dB, there is this heuristic: $$L \ = \ \frac{A-8}{2.285 \ \Delta\omega} + 1$$ where $A$ is the stopband attenuation in dB (and directly related to the passband ripple, they're not independent), $\Delta \omega$ is the transition width in normalized frequency, and $L$ is the FIR length in number of taps. – robert bristow-johnson May 24 '14 at 0:53

The higher the filter order is, the steeper or less rippled (,,smoother''?) a filter approximating a certain prototype can be. So you would select the highest order feasible. Often the desired order may be specified. Common window functions will ,,smear out'' ripples (averaging them out) and make the filter less steep. Windowing and Filtering are acutally dual to each other, you could think of a window as a low pass filter for the frequency domain.

• So there is no way to determine M, and thereby the order??? – user7277 Dec 24 '13 at 10:22
• If other parameters are known, then maybe one could determine m. But generally, like that, almost every answer is likely to be vague. There are somewhat obvious rules of thumb, as in that you'd have to "catch" at least a significant fraction of the energy of the sinc. This is easier if the band edge is near the Nyquist frequency, and harder if it's close to 0. Often, however, parameters are so tight that you need to go further than just a sampled sinc. – user7358 Dec 25 '13 at 22:37
• Imagine you want to make an highpass filter with an cutoff freq at 8000 hz, fs = 20000 hz. Would you be able to make FIR filter out from these information, or do have to know how many taps it includes.. Those few rules of thump, what are those?? – user7277 Dec 26 '13 at 1:17
• The more coefficients you use, the better your filter will "cut off". It's a trade-off. What attenuation are you trying to achieve? – user7358 Dec 26 '13 at 1:26
• More coeffiecient => Higher order => sharper roll off.. I am just trying to come up with an random example, when designing IIR filter you would usually use the attenuation to determine the order, but is the formula for IIR the same for FIR?? Let's say we want it to be - 50dB at the stopband.. – user7277 Dec 26 '13 at 16:07

You design a filter with the desired frequency in mind that you whish to extract. So by designing such a filter you will elimnate undesired frequencies.