electricpy.sim.digifiltersim

electricpy.sim.digifiltersim(fin, filter, freqs, NN=1000, dt=0.01, title='', legend=True, xlim=False, xmxscale=None, figsize=None)[source]

Digital Filter Simulator.

Given an input function and filter parameters (specified in the z-domain) this function will plot the input function over NN time-steps of an unspecified size (the step-size must be specified outside the scope of this function). This function will also plot the resultant (output) function over the NN time-steps after having been filtered by that filter which is specified.

The applied filter should be of the form:

\[\frac{b_0+b_1z^{-1}+b_2z^{-2}}{1-a_1z^{-1}-a_2z^{-2}}\]

Where each row corresponds to a 1- or 2-pole filter.

Parameters:
fin : function

The input function, must be callable with specified step-size.

filter : array_like

The filter parameter set as shown here:

[[ a11, a12, b10, b11, b12],
[ a21, a22, b20, b21, b22],
[           ...          ],
[ an1, an2, bn0, bn1, bn2]]

freqs : list of float

The set of frequencies to plot the input and output for.

NN : int, optional

The number of time-steps to be plotted; default=1000

dt : float, optional

The time-step size; default=0.01

title : str, optional

The title presented on each plot; default=””

xlim : list, optional

Limit in x-axis for graph plot. Accepts tuple of: (xmin, xmax). default=False.

xmxscale : float, optional

Scaling limit of the x-axis, will set the maximum of the x-axis to xmxscale/(dt*freq) where freq is the current frequency being plotted.

legend : str, optional

An argument to control whether the legend is shown, default=True.

figsize : tuple, optional

The figure dimensions for each subplot, default=None