I'm always confused that scipy has
According to the documentation they all compute the frequency response. Surprisingly, the convention for the
b coefficients are exactly opposite (as pointed out in this answer as well), and they use a different default of sample points. Other than that, my interpretation of the documentation is that
scipy.signal.freqz should be yield the same as
scipy.signal.dlti.freqresp. However I can't get the same results trying it out on a small example:
import scipy import matplotlib.pyplot as plt filter_coef = [0.2, 0.8] w1, h1 = scipy.signal.freqz(filter_coef) dlti = scipy.signal.dlti(filter_coef[::-1], ) # accounting for flipped convention w2, h2 = dlti.freqresp(n=len(w1)) fig, axes = plt.subplots(2, 1) axes.plot(w1, np.abs(h1), label="freqz") axes.plot(w2, np.abs(h2), label="dlti.freqresp") axes.plot(w1, np.angle(h1), label="freqz") axes.plot(w2, np.angle(h2), label="dlti.freqresp") plt.legend() plt.show()
It looks like they match in terms of magnitude, but for some reason the phase is flipped.
Any ideas what is the difference here? And more generally, when should I use which version of