{ } Raw JSON

bundles / scipy 1.18.0 / scipy / signal / _ltisys / dlti / bode

function

scipy.signal._ltisys:dlti.bode

source: /scipy/signal/_ltisys.py:645

Signature

def bode(self, w = None, n = 100)

Summary

Calculate Bode magnitude and phase data of a discrete-time system.

Parameters

w : array_like, optional

Array of frequencies normalized to the Nyquist frequency being π, i.e., having unit radiant / sample. Magnitude and phase data is calculated for every value in this array. If not given, a reasonable set will be calculated.

n : int, optional

Number of frequency points to compute if w is not given. The n frequencies are logarithmically spaced in an interval chosen to include the influence of the poles and zeros of the system. Defaults to 100.

Returns

w : 1D ndarray

Array of frequencies normalized to the Nyquist frequency being np.pi/dt with dt being the sampling interval of the system parameter. The unit is rad/s assuming dt is in seconds.

mag : 1D ndarray

Magnitude array in dB

phase : 1D ndarray

Phase array in degrees

Examples

from scipy import signal
import matplotlib.pyplot as plt
✓
Construct the transfer function :math:`H(z) = \frac{1}{z^2 + 2z + 3}` with sampling time 0.5s:
sys = signal.TransferFunction([1], [1, 2, 3], dt=0.5)
✓
Equivalent: signal.dbode(sys)
w, mag, phase = sys.bode()
✓
plt.figure()
plt.semilogx(w, mag)    # Bode magnitude plot
plt.figure()
plt.semilogx(w, phase)  # Bode phase plot
✗
[<matplotlib.lines.Line2D object at 0x7fa8dd20f4d0>]
plt.show()
✓
fig-b5156d0871c60b46.png
fig-d3a87e6968b30934.png

See also

dbode

Bode plot data for discrete-time LTI systems.

Aliases

  • scipy.signal.dlti.bode