bundles / scipy latest / scipy / signal / _filter_design / freqs_zpk
function
scipy.signal._filter_design:freqs_zpk
Signature
def freqs_zpk ( z , p , k , worN = 200 ) Summary
Compute frequency response of analog filter.
Extended Summary
Given the zeros z, poles p, and gain k of a filter, compute its frequency response
(jw-z[0]) * (jw-z[1]) * ... * (jw-z[-1]) H(w) = k * ---------------------------------------- (jw-p[0]) * (jw-p[1]) * ... * (jw-p[-1])
Parameters
z: array_likeZeroes of a linear filter
p: array_likePoles of a linear filter
k: scalarGain of a linear filter
worN: {None, int, array_like}, optionalIf None, then compute at 200 frequencies around the interesting parts of the response curve (determined by pole-zero locations). If a single integer, then compute at that many frequencies. Otherwise, compute the response at the angular frequencies (e.g., rad/s) given in
worN.
Returns
w: ndarrayThe angular frequencies at which h was computed.
h: ndarrayThe frequency response.
Notes
Array API Standard Support
freqs_zpk 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
dev-arrayapifor more information.
Examples
import numpy as np from scipy.signal import freqs_zpk, iirfilter✓
z, p, k = iirfilter(4, [1, 10], 1, 60, analog=True, ftype='cheby1', output='zpk')✓
w, h = freqs_zpk(z, p, k, worN=np.logspace(-1, 2, 1000))
✓import matplotlib.pyplot as plt
✓plt.semilogx(w, 20 * np.log10(abs(h))) plt.xlabel('Frequency [rad/s]') plt.ylabel('Amplitude response [dB]')✗
plt.grid(True) plt.show()✓

See also
Aliases
-
scipy.signal.freqs_zpk