neurodsp.plts.plot_frequency_response

neurodsp.plts.plot_frequency_response(f_db, db, ax=None, **kwargs)[source]

Plot the frequency response of a filter.

Parameters
f_db1d array

Frequency vector corresponding to attenuation decibels, in Hz.

db1d array

Degree of attenuation for each frequency specified in f_db, in dB.

axmatplotlib.Axes, optional

Figure axes upon which to plot.

**kwargs

Keyword arguments for customizing the plot.

Examples

Plot the frequency response of an FIR bandpass filter:

>>> from neurodsp.filt import design_fir_filter
>>> from neurodsp.filt.utils import compute_frequency_response
>>> filter_coefs = design_fir_filter(fs=500, pass_type='bandpass', f_range=(1, 40))
>>> f_db, db = compute_frequency_response(filter_coefs, 1, fs=500)
>>> plot_frequency_response(f_db, db)