Skip to content

Butterworth filter design

butter_design(flp, fhi, delt, order)

Butterworth filter design.

Parameters:

Name Type Description Default
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

Filter design.

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

    Args:
        flp (float): Low-pass frequency.
        fhi (float): High-pass frequency.
        delt (int): Sampling interval.
        order (int): Filter order.

    Returns:
        double: Filter design.
    """

    fnq = 1 / (2 * delt)       # Nyquist frequency
    low = flp / fnq
    high = fhi / fnq
    b, a = butter(order, [low, high], btype='bandpass')
    return b, a