dimpulse — SciPy v1.16.0 Manual (original) (raw)

scipy.signal.

scipy.signal.dimpulse(system, x0=None, t=None, n=None)[source]#

Impulse response of discrete-time system.

Parameters:

systemdlti | tuple

An instance of the LTI class dlti or a tuple describing the system. The number of elements in the tuple determine the interpretation. I.e.:

x0array_like, optional

Initial state-vector. Defaults to zero.

tarray_like, optional

Time points. Computed if not given.

nint, optional

The number of time points to compute (if t is not given).

Returns:

toutndarray

Time values for the output, as a 1-D array.

youttuple of ndarray

Impulse response of system. Each element of the tuple represents the output of the system based on an impulse in each input.

Examples

import numpy as np from scipy import signal import matplotlib.pyplot as plt ... dt = 1 # sampling interval is one => time unit is sample number bb, aa = signal.butter(3, 0.25, fs=1/dt) t, y = signal.dimpulse((bb, aa, dt), n=25) ... fig0, ax0 = plt.subplots() ax0.step(t, np.squeeze(y), '.-', where='post') ax0.set_title(r"Impulse Response of a 3rd3^\text{rd}3rd Order Butterworth Filter") ax0.set(xlabel='Sample number', ylabel='Amplitude') ax0.grid() plt.show()

../../_images/scipy-signal-dimpulse-1.png