Band Stop Filter: Definition, How It Works, and Examples
band stop filter is a signal processing tool that blocks frequencies within a specific range while allowing frequencies outside that range to pass. It works like a gate that stops a band of unwanted frequencies and lets others through.How It Works
A band stop filter works by removing or reducing signals within a certain frequency range, called the stop band, while letting signals outside this range pass freely. Imagine it like a noise-cancelling window that blocks out a specific annoying sound frequency but lets all other sounds come through.
It combines the effects of a low-pass filter (which allows low frequencies) and a high-pass filter (which allows high frequencies) to create a gap where frequencies are blocked. This is useful when you want to remove a narrow range of frequencies, such as a hum or interference, without affecting the rest of the signal.
Example
This example shows how to create a band stop filter using Python's SciPy library to remove a frequency band from a signal.
import numpy as np import matplotlib.pyplot as plt from scipy.signal import butter, filtfilt # Create a sample signal with two frequencies: 5Hz and 50Hz fs = 500 # Sampling frequency T = 1.0 # seconds t = np.linspace(0, T, int(fs*T), endpoint=False) signal = np.sin(2*np.pi*5*t) + 0.5*np.sin(2*np.pi*50*t) # Design a band stop filter to remove frequencies between 45Hz and 55Hz lowcut = 45.0 highcut = 55.0 order = 4 nyq = 0.5 * fs low = lowcut / nyq high = highcut / nyq b, a = butter(order, [low, high], btype='bandstop') # Apply the filter filtered_signal = filtfilt(b, a, signal) # Plot original and filtered signals plt.figure(figsize=(10, 6)) plt.plot(t, signal, label='Original Signal') plt.plot(t, filtered_signal, label='Filtered Signal (Band Stop)') plt.xlabel('Time [seconds]') plt.ylabel('Amplitude') plt.legend() plt.title('Band Stop Filter Example') plt.show()
When to Use
Use a band stop filter when you want to remove a specific range of unwanted frequencies from a signal without affecting others. For example:
- Removing electrical hum noise at 50Hz or 60Hz from audio recordings.
- Filtering out narrowband interference in communication signals.
- Cleaning sensor data by blocking known frequency disturbances.
It is especially helpful when the unwanted noise is confined to a small frequency band.
Key Points
- A band stop filter blocks frequencies within a specific range (stop band).
- It passes frequencies outside the stop band.
- It is useful for removing narrowband noise or interference.
- It combines low-pass and high-pass filtering effects.
- Commonly used in audio, communications, and sensor data processing.