harold.bode_plot

harold.bode_plot(sys, w=None, use_db=False, use_hz=True, use_degree=True, style=None, **kwargs)

Draw the Bode plot of State, Transfer model(s).

As the name implies, this only creates a plot. For the actual frequency response data use the frequency_response() which is also used internally.

Parameters:
  • sys ({State,Transfer}, iterable) – The system(s) for which the Bode plot will be drawn. For multiple plots, place the systems inside a list, tuples, etc. Generators will not work as they will be exhausted before the plotting is performed.
  • w (array_like) – Range of frequencies. For discrete systems the frequencies above the nyquist frequency is ignored. If sys is an iterable w is used for all systems.
  • use_db (bool, optional) – Uses the deciBell unit for the magnitude plots.
  • use_hz (bool, optional) – Uses Hz unit for the output frequencies. This also assumes the input frequencies are in Hz.
  • use_degree (bool, optional) – The phase angle is shown in degrees or in radians.
  • style (cycler.Cycler, optional) – Matplotlib cycler class instance for defining the properties of the plot artists. If not given, the current defaults will be used.
  • any, all remaining kwargs are passed to matplotlib.pyplot.subplots() (If) –
Returns:

plot (matplotlib.figure.Figure)

Notes

Every curve plotted in the Bode plot is labeled with the convention of sys_<number>_in_<number>_out_<number>_<mag or phase> where numbers are all 0-indexed. The first index is the model number given in the sys argument, and the other two are only nonzero when MIMO models are used. For discrete models the vertical lines are suffixed with _nyqline.