Bode plot of discrete-time transfer function $H(z)$ $H(z)$ is the transfer function of a biquad filter as described here.

I would like to plot the Bode plot of the magnitude response of $H(z)$.

Scipy has a bode method (scipy.signal.bode) for continuous-time transfer functions. Is there an option I didn't see for discrete-time functions?

I found in this nice file formula 18. I tried plotting it with gnuplot directly, but that didn't look correct.


set samples 100000, 100000
set logscale x

b0= 0.2514
b1= 0.5028
b2= 0.2514
a1=-0.1712
a2= 0.1768

H(x) = sqrt((b0**2 + b1**2 + b2**2 + 2*(b0*b1+b1*b2)*cos(x) + 2*b0*b2*cos(2*x))/(1 + a1**2 + a2**2 + 2*(a1+a1*a2)*cos(x) + 2*a2*cos(2*x)))

plot [1:22050] H(x)


So, how do I do this? Is  it even possible to Bode plot the magnitude response of a discrete-time transfer function?
You can use the freqz command, available in Matlab/Octave and SciPy. In SciPy it is available as scipy.signal.freqz.

For your case it would be scipy.signal.freqz([b0, b1, b2], [a1, a2])

Here is the reference for more info:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.freqz.html