sdr.plot.step_response(b: ArrayLike, a: ArrayLike = 1, N: int | None = None, **kwargs)

Plots the step response \(s[n]\) of a filter.

The step response \(s[n]\) is the filter output when the input is a unit step \(u[n]\).

Parameters:
b: ArrayLike

The feedforward coefficients \(b_i\).

a: ArrayLike = 1

The feedback coefficients \(a_j\). For FIR filters, this is set to 1.

N: int | None = None

The number of samples \(N\) to plot. If None, the length of b is used for FIR filters and 100 for IIR filters.

**kwargs

Additional keyword arguments to pass to matplotlib.pyplot.plot().

See also

sdr.FIR, sdr.IIR

Examples

See the FIR filters example.

In [1]: h_srrc = sdr.root_raised_cosine(0.5, 10, 10)

In [2]: plt.figure(figsize=(8, 4)); \
   ...: sdr.plot.step_response(h_srrc)
   ...: 
../../_images/sdr_plot_step_response_1.png

See the IIR filters example.

In [3]: zero = 0.6; \
   ...: pole = 0.8 * np.exp(1j * np.pi / 8); \
   ...: iir = sdr.IIR.ZerosPoles([zero], [pole, pole.conj()])
   ...: 

In [4]: plt.figure(figsize=(8, 4)); \
   ...: sdr.plot.step_response(iir.b_taps, iir.a_taps, N=30)
   ...: 
../../_images/sdr_plot_step_response_2.png