Digital High Pass Butterworth Filter in Python
In this article, we are going to discuss how to design a Digital High Pass Butterworth Filter using Python. The Butterworth filter is a type of signal processing filter designed to have a frequency response as flat as possible in the pass band. Let us take the below specifications to design the filter and observe the Magnitude, Phase & Impulse Response of the Digital Butterworth Filter.
What is a High Pass Filter?
A high-pass filter is an electronic filter that passes signals with a frequency higher than a certain cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency. The attenuation for each frequency depends on the filter design.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Difference between a Digital High Pass Filter & Digital Low Pass Filter:
The most striking difference is in the amplitude response of the filters, we can clearly observe that in case of High Pass Filter the filter passes signals with a frequency higher than a certain cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency while in case of Low Pass Filter the filter passes signals with a frequency lower than a certain cutoff frequency and attenuates all signals with frequencies higher than the specified cutoff value.
The specifications are as follows:
- Sampling rate of 3.5 kHz
- Pass band edge frequency of 1050 Hz
- Stop band edge frequency of 600Hz
- Pass band ripple of 1 dB
- Minimum stop band attenuation of 50 dB
We will plot the magnitude, phase, and impulse response of the filter.
Step 1: Importing all the necessary libraries.
Step 2: Define variables with the given specifications of the filter.
Step3: Building the filter using signal.buttord() method.
Step 4: Plotting the Magnitude Response.
Step 5: Plotting the Impulse Response.
Step 6: Plotting the Phase Response.
Below is the complete program based on the above approach: