# How can to obtain the hughcut, lowcut and bode constant of a bandpass digital filter?

I need to create a bandpass filter amplifier in python; and determine the transfer function, graph the bode diagram, and print the highcut frequency, lowcut frequency, the bode constant and the transfer function.

So far, I've been able to create a bandpass filter, graph the bode diagram and print the transfer fuction, but I don't know how to obtain and print the highcut frequency, lowcut frequency, and the bode constant.

The code I'm using is below:

import numpy as np
import control
import matplotlib.pyplot as plt

# Low-pass Transfer Function

Tfl = 1/wl
num = np.array([1])
den = np.array([Tfl , 1])
HL = control.tf(num, den)

# High-pass Transfer Function

Tfh = 1/wh
num = np.array([Tfh, 0])
den = np.array([Tfh, 1])
HH = control.tf(num, den)

# Band-pass Transfer Function

HBP = control.series(HL, HH)

# Frequencies

w_start = 0.01
w_stop = 1000
step = 0.01
N = int ((w_stop-w_start )/step) + 1
w = np.linspace (w_start , w_stop , N)

# Frequency Response Plot

mag , phase_rad , w = control.bode_plot(HBP, w, dB=True,
plot=False)

# Convert to dB

mag_db = 20 * np.log10(mag)
plt.figure(1)
plt.semilogx(w, mag_db)
plt.title("Bandpass Filter")
plt.grid(b=None, which='major', axis='both')
plt.grid(b=None, which='minor', axis='both')
plt.ylabel("Magnitude (dB)")

plt.figure(2)
plt.title("Bandpass Filter")
plt.grid(b=None, which='major', axis='both')
plt.grid(b=None, which='minor', axis='both')
plt.ylabel("Phase (deg)")

print('H(s) = ', HBP)


If you can help me out I would REALLY appreciate it. Thanks.

• Hi! Welcome here and: thanks for the well-illustrated question. This might just be a language problem on my end (I didn't learn signal processing in English but in German), but what is the Bode constant? Mar 28, 2022 at 21:22
• The bode constant is what we usually name as: H (s) = H (jω) = K Mar 28, 2022 at 21:55
• nice job with the control library -- Same question as Marcus but I assume it is the gain? If so set s to mid band and compute |H(s)| which should match the -60dB when converted to dB using 20Log(). High pass corner and lowpass corner are likely the -3 dB points so frequency where magnitude crosses -63 dB, but sometimes at -6 dB so must be specified. You can just say the -3 dB points are... Mar 28, 2022 at 21:58
• (I'm not confident in that for K however; I could argue K is 0.01 just from the transfer function provided--- in other words K H(s)) Mar 29, 2022 at 1:38