- class sdr.Integrator(sdr.IIR)
Implements an integrator IIR filter.
Notes¶
A discrete-time integrator is an IIR filter with the transfer function
\[H(z) = \frac{1}{1 - z^{-1}} .\]x[n] -->@---------------+--> y[n] ^ | -1 | +------+ | +---| z^-1 |<---+ +------+
Examples¶
Create an integrating IIR filter.
In [1]: iir = sdr.Integrator()
Integrate a Gaussian pulse.
In [2]: x = sdr.gaussian(0.3, 5, 10); \ ...: y = iir(x) ...: In [3]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.time_domain(x, label="Input"); \ ...: sdr.plot.time_domain(y, label="Integral"); \ ...: plt.title("Discrete-time integration of a Gaussian pulse"); \ ...: plt.tight_layout(); ...:
Integrate a raised cosine pulse.
In [4]: x = sdr.root_raised_cosine(0.1, 8, 10); \ ...: y = iir(x) ...: In [5]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.time_domain(x, label="Input"); \ ...: sdr.plot.time_domain(y, label="Integral"); \ ...: plt.title("Discrete-time integration of a raised cosine pulse"); \ ...: plt.tight_layout(); ...:
Plot the frequency response.
In [6]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.magnitude_response(iir); ...:
Constructors¶
-
Integrator(streaming: bool =
False
) Creates an integrating IIR filter.
- classmethod ZerosPoles(zeros: ArrayLike, poles, ...) Self
Creates an IIR filter from its zeros, poles, and gain.
Special methods¶
String representation¶
Streaming mode only¶
- reset()
Resets the filter state. Only useful when using streaming mode.
- property state : NDArray
The filter state.
Methods¶
-
impulse_response(N: int =
100
) NDArray Returns the impulse response \(h[n]\) of the IIR filter. The impulse response \(h[n]\) is the filter output when the input is an impulse \(\delta[n]\).
-
step_response(N: int =
100
) NDArray Returns the step response \(s[n]\) of the IIR filter. The step response \(s[n]\) is the filter output when the input is a unit step \(u[n]\).
- frequency_response(...) tuple[NDArray, NDArray]
Returns the frequency response \(H(\omega)\) of the IIR filter.
- frequency_response_log(...) tuple[NDArray, NDArray]
Returns the frequency response \(H(\omega)\) of the IIR filter on a logarithmic frequency axis.
Properties¶
- property b_taps : NDArray
The feedforward taps \(b_i\) for \(i = 0,...,M\).
- property a_taps : NDArray
The feedback taps \(a_j\) for \(j = 0,...,N\).
- property zeros : NDArray
The zeros of the IIR filter.
- property poles : NDArray
The poles of the IIR filter.
-
Integrator(streaming: bool =