I am trying to extract filter coefficients for a bandpass, using the "scipy.signal.iirfilter" function:

b, a = filt = iirfilter(
        Wn=np.array([3000, 4850]) / (12400 / 2),

b, a
(array([0.04008421, 0.04822953, 0.04776774, 0.04822953, 0.04008421]),
 array([1.        , 1.66028928, 2.34267679, 1.39001415, 0.70301997]))

Seems like the filter order is twice larger than expected. A similar task using Matlab's "designfilt" performs with the expected number of coefficients. What I am missing? is the filter order a fluid definition?

For lowpass, the number of the coefficients is as expected...

  • 1
    $\begingroup$ If the filter order argument is different for bandpasses and lowpasses, then I'd consider that a bug. You might want to report that (check before whether someone else already reported the bug). Warning: not all bugs can get solved – in this example, there might already be more software that relies on this behaviour than software that expects the "correct" behaviour. But the scipy community will have a better assessment of this than us! $\endgroup$ Commented May 15, 2021 at 14:24
  • $\begingroup$ (also: Almost certain that you don't want an order 2 chebychev bandpass filter unless you're explicitly modeling a very specific analog system. But this question isn't about filter choice!) $\endgroup$ Commented May 15, 2021 at 14:25

1 Answer 1


There is a bit of terminology confusion here.

Strictly speaking the order of the filter is the number of poles, so in your case you designed a 4th order filter.

Many software packages use the convention for bandpass/stop filters to specify the order of each slope to make it consistent with lowpass/highpass design calls. That results in a filter of twice the order.

Interestingly enough, even Matlab is inconsistent about that. designfilt('bandpassiir','FilterOrder',2, ...) will give a second order filter. butter(2,[w1 w2],...) will give you a 4th order filter.

  • $\begingroup$ Something that confused me for a while is that in Matlab 2022b Filter Designer Tool, a stable band pass Butterworth SOS IIR filter with order 128 and 64 sections, is equivalent to a Python scipy.signal butter(order, [low, high], btype='bandpass', analog=False, output='sos') filter if the order input in Python butter function is 64 (and not 128) $\endgroup$
    – VMMF
    Commented Nov 9, 2023 at 22:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.