# why the number of filter coefficients in FIR filter has to be an odd number?

I calculated the order of the FIR filter to be 31(N). so, the number of coefficients has to be 32 (N+1). so, I have to increase it to 33 to make it an odd number.

Why the number of filter coefficients is required to be an odd number?

• There is no such requirement. One reason is about having a zero or nonzero gain at Nyquist frequency (Fs/2, or say $\pi$ in $\omega$ domain) for lowpass/highpass filters. To have zero gain at $\omega = \pi$ Number of coefficients is to be even. Reversely for odd number of coefficients gain is nonzero at $\omega = \pi$. For highpass filters you should have nonzero gain at $\omega =\pi$ Therefore if you define an ODD order highpass filter, its number of coefficients is incremented by 2 to ensure that it is still odd. – Fat32 Jan 25 '15 at 23:08

## 2 Answers

I think it is about having a linear phase. Having a linear phase is often what you want because it means the delay introduced by the filter will be the same across all the frequency. Then, if you want a linear phase filter, you need to have a symmetrical arrangement of coefficient around the centre coefficient. As for why you have to have a symmetrical number of coefficient around the centre to be of linear phase, I need to verify something then I will update the answer. :)

Edit: Jason R got the answer while I was looking for it! +1

• So for symmetrical filer design, I have o keep it odd , right? I mean if the order of the filter I get is 31, then number of coefficients I have to calculate is 33. Am I right? – Jayesh Parmar Sep 30 '14 at 13:54
• Yes. As said, you probably want to keep a linear phase for the filter. In this case, an odd number of coefficient is the way to go. – Doombot Sep 30 '14 at 13:57

There is no such requirement. However, for linear-phase (symmetric) FIR filters, the delay can be expressed as:

$$D = \frac{order}{2} = \frac{N_{taps} - 1}{2} \text{ samples}$$

If the number of taps is odd, then the delay of the filter is an integer number of samples, which is desirable for some applications. If you have an even number of taps, then you end up with a half-sample delay.

• Hi Jason, If I don't keep the number odd, I will not get the similar values around. for example, for 22 order fir filter c(1) and c(-1) will be equal. but for 23 order filer c(1) and c(-1) will not be equal. – Jayesh Parmar Sep 30 '14 at 13:44
• @JayeshP How are you generating the filter coefficients? – Jim Clay Sep 30 '14 at 14:04
• @JimClay using the window design method. and then multiplying the coeffs with hamming or hanning or any other window. – Jayesh Parmar Sep 30 '14 at 14:07