Low Pass Filter: Definition, How It Works, and Examples
low pass filter is a tool that lets low-frequency signals pass through while blocking or reducing high-frequency signals. It works like a smooth gate that removes sharp changes or noise from data or sound.How It Works
A low pass filter works by allowing signals with frequencies lower than a certain cutoff frequency to pass through unchanged, while it reduces or blocks signals with frequencies higher than that cutoff. Imagine it like a sieve that only lets small grains through and stops the bigger ones.
Think of listening to music with a low pass filter: it removes the sharp, high-pitched sounds and keeps the smooth, deep sounds. This helps to clean up noisy signals or smooth out data that changes too quickly.
Example
This example shows how to create a simple low pass filter using Python and the SciPy library to smooth a noisy signal.
import numpy as np import matplotlib.pyplot as plt from scipy.signal import butter, filtfilt # Create a noisy signal fs = 500 # Sampling frequency t = np.linspace(0, 1, fs, endpoint=False) signal = np.sin(2 * np.pi * 5 * t) + 0.5 * np.sin(2 * np.pi * 50 * t) # Define low pass filter cutoff = 10 # cutoff frequency in Hz order = 4 # Butterworth filter design b, a = butter(order, cutoff / (0.5 * fs), btype='low', analog=False) filtered_signal = filtfilt(b, a, signal) # Plot original and filtered signals plt.figure(figsize=(10, 4)) plt.plot(t, signal, label='Noisy Signal') plt.plot(t, filtered_signal, label='Filtered Signal', linewidth=2) plt.xlabel('Time [seconds]') plt.ylabel('Amplitude') plt.title('Low Pass Filter Example') plt.legend() plt.tight_layout() plt.show()
When to Use
Use a low pass filter when you want to remove high-frequency noise or sudden changes from data or signals. For example:
- Cleaning audio recordings by removing hiss or sharp sounds.
- Smoothing sensor data in devices like heart rate monitors or temperature sensors.
- Reducing rapid fluctuations in stock price data to see overall trends.
It helps to focus on the important slow changes and ignore quick, unwanted noise.
Key Points
- A low pass filter passes signals below a cutoff frequency and blocks higher ones.
- It smooths data by removing fast changes or noise.
- Commonly used in audio processing, sensor data cleaning, and trend analysis.
- Can be implemented with simple mathematical filters like Butterworth.