def freqz(b, a=<NUM_LIT:1>, worN=None, whole=<NUM_LIT:0>, plot=None):
b, a = map(atleast_1d, (b, a))<EOL>if whole:<EOL><INDENT>lastpoint = <NUM_LIT:2> * pi<EOL><DEDENT>else:<EOL><INDENT>lastpoint = pi<EOL><DEDENT>if worN is None:<EOL><INDENT>N = <NUM_LIT><EOL>w = numpy.linspace(<NUM_LIT:0>, lastpoint, N, endpoint=False)<EOL><DEDENT>elif isinstance(worN, int):<EOL><INDENT>N = worN<EOL>w = numpy.linspace(<NUM_LIT:0>, lastpoint, N, endpoint=False)<EOL><DEDENT>else:<EOL><INDENT>w = worN<EOL><DEDENT>w = atleast_1d(w)<EOL>zm1 = exp(-<NUM_LIT> * w)<EOL>h = polyval(b[::-<NUM_LIT:1>], zm1) / polyval(a[::-<NUM_LIT:1>], zm1)<EOL>if plot is not None:<EOL><INDENT>plot(w, h)<EOL><DEDENT>return w, h<EOL>
Compute the frequency response of a digital filter.

Given the numerator `b` and denominator `a` of a digital filter,
compute its frequency response::

           jw               -jw            -jmw
    jw  B(e)    b[0] + b[1]e + .... + b[m]e
 H(e) = ---- = ------------------------------------
           jw               -jw            -jnw
        A(e)    a[0] + a[1]e + .... + a[n]e

Parameters
----------
b : ndarray
    numerator of a linear filter
a : ndarray
    denominator of a linear filter
worN : {None, int, array_like}, optional
    If None (default), then compute at 512 frequencies equally spaced
    around the unit circle.
    If a single integer, then compute at that many frequencies.
    If an array_like, compute the response at the frequencies given (in
    radians/sample).
whole : bool, optional
    Normally, frequencies are computed from 0 to the Nyquist frequency,
    pi radians/sample (upper-half of unit-circle).  If `whole` is True,
    compute frequencies from 0 to 2*pi radians/sample.
plot : callable
    A callable that takes two arguments. If given, the return parameters
    `w` and `h` are passed to plot. Useful for plotting the frequency
    response inside `freqz`.

Returns
-------
w : ndarray
    The normalized frequencies at which h was computed, in radians/sample.
h : ndarray
    The frequency response.

Notes
-----
Using Matplotlib's "plot" function as the callable for `plot` produces
unexpected results,  this plots the real part of the complex transfer
function, not the magnitude.  Try ``lambda w, h: plot(w, abs(h))``.

Examples
--------
>>> from scipy import signal
>>> b = signal.firwin(80, 0.5, window=('kaiser', 8))
>>> w, h = signal.freqz(b)

>>> import matplotlib.pyplot as plt
>>> fig = plt.figure()
>>> plt.title('Digital filter frequency response')
>>> ax1 = fig.add_subplot(111)

>>> plt.plot(w, 20 * np.log10(abs(h)), 'b')
>>> plt.ylabel('Amplitude [dB]', color='b')
>>> plt.xlabel('Frequency [rad/sample]')

>>> ax2 = ax1.twinx()
>>> angles = np.unwrap(np.angle(h))
>>> plt.plot(w, angles, 'g')
>>> plt.ylabel('Angle (radians)', color='g')
>>> plt.grid()
>>> plt.axis('tight')
>>> plt.show()