spectrum_plot¶
MATLAB equivalent:
sidSpectrumPlot
spectrum_plot ¶
Power spectrum plot with confidence bands.
spectrum_plot ¶
spectrum_plot(result: FreqResult, *, confidence: float = 3.0, frequency_unit: str = 'rad/s', color: str | tuple = None, line_width: float = 1.5, ax=None) -> dict
Power spectrum plot with shaded confidence bands.
This is the Python port of sidSpectrumPlot.m.
Plots the noise spectrum (or output spectrum in time-series mode) in dB with an optional shaded +/- 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
|
matplotlib Axes or None
|
Existing axes to plot into. If |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with the following keys:
|
Examples:
>>> import numpy as np
>>> import sid
>>> y = np.random.randn(500)
>>> result = sid.freq_bt(y, None)
>>> h = sid.spectrum_plot(result, confidence=3)
Notes
Specification: (Spectrum plotting -- not yet in SPEC.md)
For MIMO systems only the first output channel is plotted.
See Also
sid.freq_bt : Blackman-Tukey spectral analysis. sid.bode_plot : Bode diagram for frequency-response data.
Changelog
2026-04-09 : First version (Python port) by Pedro Lourenco.