Skip to main content
`Ctrl`+`K`
scipy.signal.

# tf2zpk

scipy.signal.tf2zpk(b, a)

  Return zero, pole, gain (z, p, k) representation from a numerator, denominator representation of a linear filter.

  Parameters:
    b array_like

      Numerator polynomial coefficients.

    a array_like

      Denominator polynomial coefficients.

  Returns:
    z ndarray

      Zeros of the transfer function.

    p ndarray

      Poles of the transfer function.

    k float

      System gain.

  Notes

  If some values of b are too close to 0, they are removed. In that case, a BadCoefficients warning is emitted.

  The b and a arrays are interpreted as coefficients for positive, descending powers of the transfer function variable. So the inputs \(b = [b_0, b_1, ..., b_M]\) and \(a =[a_0, a_1, ..., a_N]\) can represent an analog filter of the form:

  \[H(s) = \frac {b_0 s^M + b_1 s^{(M-1)} + \cdots + b_M} {a_0 s^N + a_1 s^{(N-1)} + \cdots + a_N}\]

  or a discrete-time filter of the form:

  \[H(z) = \frac {b_0 z^M + b_1 z^{(M-1)} + \cdots + b_M} {a_0 z^N + a_1 z^{(N-1)} + \cdots + a_N}\]

  This “positive powers” form is found more commonly in controls engineering. If M and N are equal (which is true for all filters generated by the bilinear transform), then this happens to be equivalent to the “negative powers” discrete-time form preferred in DSP:

  \[H(z) = \frac {b_0 + b_1 z^{-1} + \cdots + b_M z^{-M}} {a_0 + a_1 z^{-1} + \cdots + a_N z^{-N}}\]

  Although this is true for common filters, remember that this is not true in the general case. If M and N are not equal, the discrete-time transfer function coefficients must first be converted to the “positive powers” form before finding the poles and zeros.

  Array API Standard Support

  `tf2zpk` has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable `SCIPY_ARRAY_API=1` and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

  Library | CPU | GPU
  --- | --- | ---
  NumPy | ✅ | n/a
  CuPy | n/a | ✅
  PyTorch | ✅ | ⛔
  JAX | ⚠️ no JIT | ⛔
  Dask | ⚠️ computes graph | n/a

  > See Support for the array API standard for more information.

  Examples

  Find the zeroes, poles and gain of a filter with the transfer function

  \[H(s) = \frac{3s^2}{s^2 + 5s + 13}\]

      >>> from scipy.signal import tf2zpk
      >>> tf2zpk([3, 0, 0], [1, 5, 13])
      (   array([ 0.               ,  0.              ]),
          array([ -2.5+2.59807621j ,  -2.5-2.59807621j]),
          3.0)