Bandpass butterworth filter frequencies in scipy

前端 未结 4 1506
面向向阳花
面向向阳花 2021-02-08 22:22

I\'m designing a bandpass filter in scipy following the cookbook. However, if I decrecrease the filtering frequencies too much I end up with garbage at high order filters. What

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-08 23:17

    1. Don't use b, a = butter for high-order filters, whether in Matlab or SciPy or Octave. Transfer function format has numerical stability problems, because some of the coefficients are very large while others are very small. This is why we changed the filter design functions to use zpk format internally. To see the benefits of this, you need to use z, p, k = butter(output='zpk') and then work with poles and zeros instead of numerator and denominator.
    2. Don't do high-order digital filters in a single stage. This is a bad idea no matter what software or hardware you're implementing them on. Typically it's best to break them up into second-order sections. In Matlab, you can use zp2sos to generate these automatically. In SciPy, you can use sos = butter(output='sos') and then filter using sosfilt() or sosfiltfilt(). This is the recommended way to filter for most applications.

提交回复
热议问题