bode_plot¶
MATLAB equivalent:
sidBodePlot
bode_plot ¶
Bode diagram with confidence bands.
bode_plot ¶
bode_plot(result: FreqResult, *, confidence: float = 3.0, frequency_unit: str = 'rad/s', color: str | tuple = None, line_width: float = 1.5, ax: tuple | None = None) -> dict
Bode diagram (magnitude and phase) with shaded confidence bands.
This is the Python port of sidBodePlot.m.
Plots the magnitude (dB) and phase (degrees) of the estimated frequency response. When uncertainty information is available, a shaded region shows the +/- confidence-sigma band.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
FreqResult
|
Result struct returned by :func: |
required |
confidence
|
float
|
Number of standard deviations for the shaded confidence band.
Set to |
3.0
|
frequency_unit
|
str
|
|
'rad/s'
|
color
|
str or tuple
|
Line and fill colour. Default is |
None
|
line_width
|
float
|
Line width. Default is |
1.5
|
ax
|
tuple of (ax_mag, ax_phase) or None
|
Existing matplotlib axes to plot into. If |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with the following keys:
|
Raises:
| Type | Description |
|---|---|
SidError
|
If |
Examples:
>>> import numpy as np
>>> import sid
>>> N = 1000; u = np.random.randn(N)
>>> y = np.convolve(u, [1, -0.9])[:N] + 0.1 * np.random.randn(N)
>>> result = sid.freq_bt(y, u)
>>> h = sid.bode_plot(result, confidence=3)
Notes
Specification: (Bode plotting -- not yet in SPEC.md)
For MIMO systems only the first SISO channel pair (0, 0) is
plotted.
See Also
sid.freq_bt : Blackman-Tukey spectral analysis. sid.spectrum_plot : Noise / output spectrum plot.
Changelog
2026-04-09 : First version (Python port) by Pedro Lourenco.