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}} .\]

IIR Integrator Block Diagram
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();
   ...: 
../../_images/sdr_Integrator_1.png

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();
   ...: 
../../_images/sdr_Integrator_2.png

Plot the frequency response.

In [6]: plt.figure(figsize=(8, 4)); \
   ...: sdr.plot.magnitude_response(iir);
   ...: 
../../_images/sdr_Integrator_3.png

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

__call__(x: ArrayLike) NDArray

Filters the input signal \(x[n]\) with the IIR filter.

String representation

__repr__() str

Returns a code-styled string representation of the object.

__str__() str

Returns a human-readable string representation of the object.

Streaming mode only

reset()

Resets the filter state. Only useful when using streaming mode.

property streaming : bool

Indicates whether the filter is in 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 order : int

The order of the IIR filter \(N\).

property zeros : NDArray

The zeros of the IIR filter.

property poles : NDArray

The poles of the IIR filter.

property gain : float

The gain of the IIR filter.