mplsignal.freq_plots
#
Functions for plotting transfer functions.
- mplsignal.freq_plots.freqz(num=None, den=None, zeros=None, poles=None, gain=1.0, w=None, freq_unit='rad', phase_unit='rad', ax=None, style='stacked', magnitude_scale='log', frequency_scale='linear', whole=False, include_nyquist=False, fs=6.283185307179586, align_ylabels=True, **kwargs)#
Plot the frequency response of a discrete-time system.
- Parameters:
- numarray-like, optional
Numerator of transfer function.
- denarray-like, optional
Denominator of transfer function.
- zerosarray-like, optional
Zeros of transfer function.
- polesarray-like, optional
Poles of transfer function.
- gainfloat, default: 1.0
The gain of pole-zero-based transfer function.
- wint or array-like, optional
If a single integer, compute at that many frequency points in the range \([0, \pi]\), default: 512. If array-like, frequencies to determine transfer function at.
- freq_unit{‘rad’, ‘deg’, ‘norm’, ‘fs’, ‘normfs’}, default: ‘rad’
Unit for frequency axes.
- phase_unit{‘rad’, ‘deg’}, default: ‘rad’
Unit for phase.
- ax
Axes
or iterable ofAxes
, optional Axes or iterable of Axes to plot in. If None, create required Axes.
- style{‘stacked’, ‘twin’, ‘magnitude’, ‘phase’, ‘group_delay’, ‘tristacked’}, default: ‘stacked’
Plotting style.
- magnitude_scale{‘linear’, ‘log’}, default: ‘log’
Whether magnitude is plotted in linear or logarithmic (dB) scale.
- frequency_scale{‘linear’, ‘log’}, default: ‘linear’
Whether frequency is plotted in linear or logarithmic scale.
- wholebool, default: False
Plot from 0 to \(2\pi\) if True. Otherwise, plot from 0 to \(\pi\).
- include_nyquistbool, default: False
If whole is False and w is an integer, setting include_nyquist to True will include the last frequency (Nyquist frequency) and is otherwise ignored.
- fsfloat, optional
Sample frequency.
- align_ylabelsbool, default: True
Align the y-labels when style is ‘stacked’ or ‘tristacked’
- **kwargs
Additional arguments passed to
matplotlib.axes.Axes.plot()
.
- Returns:
- mplsignal.freq_plots.freqz_fir(num, **kwargs)#
Plot the frequency response of a discrete-time FIR filter.
- Parameters:
- numarray-like
Numerator of transfer function.
- **kwargs
Additional arguments passed to
freqz()
.
- Returns:
- None.
- mplsignal.freq_plots.freqz_tf(num, den, **kwargs)#
Plot the frequency response of a discrete-time system represented using a transfer function.
- Parameters:
- numarray-like
Numerator of transfer function.
- denarray-like
Denominator of transfer function.
- **kwargs
Additional arguments passed to
freqz()
.
- Returns:
- None.
- mplsignal.freq_plots.freqz_zpk(zeros, poles, gain=1.0, **kwargs)#
Plot the frequency response of a discrete-time system represented using zeros, poles and gain.
- Parameters:
- zerosarray-like
Zeros of system.
- polesarray-like
Poles of system.
- gainfloat, default: 1.0
Gain of system.
- **kwargs
Additional arguments passed to
freqz()
.
- Returns:
- None.