简体   繁体   中英

Analog vs digital version of Butterworth filter in SciPy

I have a question about the analog and digital versions of the Butterworth filter in SciPy. I tried two things to get a digital Butterworth filter:

  • Getting an analog filter by scipy.signal.butter with analog=True , and then using scipy.signal.bilinear to transform it into a digital filter.
  • Directly getting from the function scipy.signal.butter with analog=False .

I got different results from the two methods. Should I expect same result from these two approaches? My code:

from scipy import signal

b1, a1 = signal.butter(1, 1, 'high', analog=True)
print("analog filter: ", [b1, a1])

fs = 100

b2, a2 = signal.bilinear(b1, a1, fs)
print("digital filter from bilinear transformation of analog filter: ", [b2, a2])


b, a = signal.butter(1, 1*2/fs, 'high', analog=False)
print("digital filter: ", [b, a])

Output:

analog filter:  [array([1., 0.]), array([1., 1.])]
digital filter from bilinear transformation of analog filter:  [array([ 0.99502488, -0.99502488]), array([ 1.        , -0.99004975])]
digital filter:  [array([ 0.96953125, -0.96953125]), array([ 1.        , -0.93906251])]

I just get the answer to this question by reading some materials about digital filters a note about digital filter

The bilinear transformation公式 between analogue filter and digital filter gives us a non-linear relationship between the analogue frequency公式and digital frequency公式as introduced in the material.

公式

Thus, if a digital filter is needed, directly design it from scipy.signal.butter is better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM