What is a High Pass Filter: Definition and Usage
high pass filter is a tool that lets signals with frequencies higher than a certain cutoff pass through while blocking lower frequencies. It is used to remove slow or unwanted signals and keep fast changes in data.How It Works
A high pass filter works like a gate that only opens for fast signals. Imagine you are listening to music and want to hear only the high notes, not the deep bass. The filter blocks the low sounds and lets the high sounds pass.
Technically, it removes or reduces parts of a signal that change slowly (low frequencies) and keeps parts that change quickly (high frequencies). This helps in focusing on sharp changes or details in the data.
Example
This example shows how to create a simple high pass filter using Python and the SciPy library. It filters a signal to keep frequencies above 0.1 Hz.
import numpy as np import matplotlib.pyplot as plt from scipy.signal import butter, filtfilt # Create a sample signal with low and high frequency parts t = np.linspace(0, 1, 500, endpoint=False) signal = np.sin(2 * np.pi * 1 * t) + 0.5 * np.sin(2 * np.pi * 0.05 * t) # Design a high pass Butterworth filter order = 3 cutoff = 0.1 # cutoff frequency in Hz b, a = butter(order, cutoff, btype='high', fs=500) # Apply the filter y = filtfilt(b, a, signal) # Plot original and filtered signals plt.plot(t, signal, label='Original Signal') plt.plot(t, y, label='Filtered Signal (High Pass)') plt.legend() plt.xlabel('Time [seconds]') plt.ylabel('Amplitude') plt.title('High Pass Filter Example') plt.show()
When to Use
Use a high pass filter when you want to remove slow or steady parts of a signal and keep fast changes. For example:
- Removing background noise or hum in audio recordings
- Highlighting edges in images or signals
- Analyzing fast-changing sensor data like heartbeats or vibrations
It helps focus on important details by ignoring slow trends or drifts.
Key Points
- A high pass filter blocks low frequencies and passes high frequencies.
- It helps remove slow or unwanted signals.
- Commonly used in audio, image, and sensor data processing.
- Can be implemented with simple code using libraries like SciPy.