Skip to content

Butterworth filter

butter_bandpass_filter(x, flp, fhi, delt, order)

Butterworth filter design.

Parameters:

Name Type Description Default
x array_like

Signal to be filtered.

required
flp float

Low-pass frequency.

required
fhi float

High-pass frequency.

required
delt int

Sampling interval.

required
order int

Filter order.

required

Returns:

Name Type Description
double

Filtered signal.

Source code in dynfc/butter_bandpass_filter.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def butter_bandpass_filter(x, flp, fhi, delt, order):
    """Butterworth filter design.

    Args:
        x (array_like): Signal to be filtered.
        flp (float): Low-pass frequency.
        fhi (float): High-pass frequency.
        delt (int): Sampling interval.
        order (int): Filter order.

    Returns:
        double: Filtered signal.
    """

    b, a = butter_design(flp, fhi, delt, order)
    y = filtfilt(b, a, x)

    return y