2
$\begingroup$

I want to build a band-reject filter for the 60 Hz noise. So, I tried to use Butterworth filter to implement this specification. However, when I chose an order of 8, I got the following response, which makes sense.

8th Order Filter Response

However when I chose an order of 30. I got this weird response. Why is that?

30th Order Filter Response

The code to get the coefficient for the 8 and 30 order respectively is shown below

# fs = 200 b, a = signal.butter(8, [58 / (fs / 2), 62 / (fs / 2)], btype='bandstop') b, a = signal.butter(30, [58 / (fs / 2), 62 / (fs / 2)], btype='bandstop')

$\endgroup$
  • 2
    $\begingroup$ Using a Butterworth design really only makes sense if you're planning to implement it in analog. And you won't be building a 30th order filter in discrete analog components. Not only because you couldn't even get the components with tolerances small enough that would allow for such high order to work, but also simply because that is going to be a hell of a schematic to design, lay out, fabricate, test and measure as well as to tune. $\endgroup$ – Marcus Müller Nov 4 '17 at 6:00
5
$\begingroup$

An order of 30 is way too high, especially for a band reject filter with such a narrow band as you want.

Your filter will have 15 poles in a very small semicircle between frequencies 58 and 62 Hz (and another 15 poles in the negative frequencies).

Your a coefficients correspond to an order 30 polynomial with the 30 roots corresponding to the poles of the filter.

Note that any minuscule numerical approximation (which you are not free from) will alter the position of all roots. You will very probably get roots ending up outside of the unit circle (which makes your filter unstable).

So the ugly frequency response for the high order filter is expected.

As a rule of thumb, do not try to implement IIR filters of order above 10.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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