# Why must the order of a Band-Pass and Notch filter always be even?

My professor mentioned that the order of a band-pass and a notch filter must always be even, when showing an example of designing a digital filter using the bilinear transformation.

Then he also mentions that the MATLAB code ellipord returns half the actual order, so I figured the two statements must be connected somehow. I can't ask him since it's currently 3 AM and I couldn't find anything alone as to why these two statements are true.

Any thoughts? Thank you!

I believe your thinking is correct. For bandpass filters, for each z-plane pole in the positive-frequency range there's a conjugate pole in the z-plane's negative-frequency range. So for bandpass filters there will all be an even number of total z-plane poles (two poles, four poles, six poles, etc.). When using MATLAB's ellipord command for bandpass filters that command returns the number of poles in the z-plane's positive-frequency range which is half the actual number of z-plane poles.

Practical bandpass filters will be even-ordered. Below Matt L points out that modifying an even-ordered filter’s transfer function by placing a z-plane zero at DC can make a bandpass filter odd-ordered, which is true. But placing a z-plane zero at DC so badly distorts the original even-ordered filter’s frequency response that the new odd-ordered filter becomes unusable.

• Omg the man himself - what an honor! It's a lot clearer now; I wasn't putting two and two together but I wasn't aware of MATLAB doing that for the ellipord command. Thank you! Btw, I love your website. It's perfect for a quick reference or even refreshing my memory Apr 25 '21 at 16:21
• @Kevin KZ. Thanks for your kind words. MATLAB’s ‘ellipord’ command uses a lowpass -to- bandpass “frequency transformation” algorithm whose reference is the book Theory and Application of Digital Signal Processing by Rabiner and Gold. (A VERY good, but out-of-print, DSP book.) Shockingly, MATLAB’s ellipord documentation does NOT tell you where in the 760 page book to look for more information!! I believe the algorithm they’re referring to is given as Transformation# 3 on the book's page 260. (I’ve added another paragraph to my “Answer” to your question.) Good Luck with your DSP studies Kevin. Apr 25 '21 at 21:43
• The claim in your last paragraph is wrong. You're overlooking the fact that a bandpass filter could have a zero at DC but none at Nyquist, or the other way around. So it's perfectly possible to have a bandpass filter with an odd filter order. Apr 26 '21 at 9:10
• @Matt L. In the special case where infinite attenuation at DC is mandatory then, yes, you could place a z-plane zero at z = 0. Apr 26 '21 at 17:22
• So wouldn't it then be appropriate to modify the sentence "For a bandpass filter to have real-valued coefficients [...] the filter’s z-domain transfer function must be even-ordered", since it is clearly wrong? Apr 26 '21 at 17:25

In principle there is no reason why the filter order of a general bandpass or bandstop filter must be even. Such a restriction is a consequence of a specific design procedure. In classic IIR filter design (Butterworth, Chebyshev, Cauer) you start with an analog prototype lowpass filter. Bandpass or bandstop filters are then obtained by a frequency transformation. And it is this frequency transformation that doubles the order of the prototype lowpass filter, hence the even filter order for that specific design method. Note that the bilinear transform has nothing to do with that restriction on the filter order.

Of course, there are specific designs for which an odd filter order doesn't make much sense. E.g., for a notch filter (with a notch frequency greater than zero) you want exactly one zero at the notch frequency plus its mirror image at the negative notch frequency. So for each notch frequency you get two zeros, and, consequently, two poles.

• I understand now. I thought he said it as an absolute way and I had never heard of such a principle before but like you said, it's a consequence of the design itself. Thank you! Apr 25 '21 at 16:23

Maybe that's a just a matter of semantics. You can certainly cascade an even order high pass with an odd order lowpass and you get something that's an odd order filter that sure looks like a bandpass.

%% odd order bandpass
fs = 44100;
fc = 1000;
[z,p,k] = butter(2,fc/sqrt(2)/fs*2,'high');
sos = zp2sos(z,p,k);
[z,p,k] = butter(3,fc*sqrt(2)/fs*2);
sos = [sos; zp2sos(z,p,k)];
nx = 8192;
f = logspace(log10(20),log10(20000),1000);
h = freqz(sos,f,fs);
semilogx(f,20*log10(abs(h)));
xlabel('Frequency in Hz'); ylabel('Level in dB'); title('odd order bandpass');
grid('on');
set(gca,'xlim',[f(1) f(end)]); set(gca,'ylim',[-60 3]);

• The above code crashes when run using MATLAB. Is it OCTAVE code? Apr 25 '21 at 10:32
• that's interesting; good to know. Thanks Apr 25 '21 at 16:24
• This is true. Strange looking filters exist. I vaguely remember something about an LC for an ECG (or EKG?), and which had different slopes. The code in Octave says: freqz: B must be a vector. Apr 25 '21 at 22:28
• @RichardLyons: sorry, this runs fine on my machine running ('9.8.0.1396136 (R2020a) Update 3'). I don't see anything remotely offensive in there. What line does it bomb on ? Apr 26 '21 at 11:50
• @Hilmar. Hi. I'm running MATLAB 2019b. The command semilogx(f,20*log10(abs(h))); crashes because vectors 'f' and 'h' have different lengths. Apr 26 '21 at 16:48