control.bode_plot

control.bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None, Plot=True, omega_limits=None, omega_num=None, margins=None, *args, **kwargs)

Bode plot for a system

Plots a Bode plot for the system over a (optional) frequency range.

Parameters:
  • syslist (linsys) – List of linear input/output systems (single system is OK)
  • omega (list) – List of frequencies in rad/sec to be used for frequency response
  • dB (boolean) – If True, plot result in dB
  • Hz (boolean) – If True, plot frequency in Hz (omega must be provided in rad/sec)
  • deg (boolean) – If True, plot phase in degrees (else radians)
  • Plot (boolean) – If True, plot magnitude and phase
  • omega_limits (tuple, list, .. of two values) – Limits of the to generate frequency vector. If Hz=True the limits are in Hz otherwise in rad/s.
  • omega_num (int) – number of samples
  • margins (boolean) – If True, plot gain and phase margin
  • **kwargs (*args,) – Additional options to matplotlib (color, linestyle, etc)
Returns:

  • mag (array (list if len(syslist) > 1)) – magnitude
  • phase (array (list if len(syslist) > 1)) – phase in radians
  • omega (array (list if len(syslist) > 1)) – frequency in rad/sec

Notes

1. Alternatively, you may use the lower-level method (mag, phase, freq) = sys.freqresp(freq) to generate the frequency response for a system, but it returns a MIMO response.

2. If a discrete time model is given, the frequency response is plotted along the upper branch of the unit circle, using the mapping z = exp(j omega dt) where omega ranges from 0 to pi/dt and dt is the discrete timebase. If not timebase is specified (dt = True), dt is set to 1.

Examples

>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
>>> mag, phase, omega = bode(sys)