Filtering
Filters let you selectively keep, remove, or reshape parts of a signal's frequency content. They're at the heart of noise reduction, audio equalization, image sharpening, and communications. This lesson covers the essential concepts.
What Is a Filter?
A filter is a system that modifies a signal, typically by amplifying or attenuating certain frequency components while leaving others unchanged. In the frequency domain, filtering is remarkably simple:
Where:
- X(f) — The input signal's spectrum (what you start with).
- H(f) — The filter's frequency response (what the filter does at each frequency).
- Y(f) — The output signal's spectrum (the filtered result).
At any given frequency, if |H(f)| = 1, that frequency passes through unchanged. If |H(f)| = 0, that frequency is completely removed. Values in between partially attenuate it.
Common Filter Types
Filters are named by which frequencies they let through (the passband) and which they block (the stopband):
- Low-pass filter (LPF) — Passes frequencies below a cutoff f_c and attenuates those above. Used for smoothing, anti-aliasing, and removing high-frequency noise. Think of it as keeping the "bass" and cutting the "treble."
- High-pass filter (HPF) — The opposite: passes frequencies above f_c and removes those below. Useful for removing DC offset, low-frequency hum, or baseline drift.
- Band-pass filter (BPF) — Passes a range of frequencies between a lower cutoff f_L and an upper cutoff f_H, blocking everything else. Radio receivers use band-pass filters to isolate one station's frequency from all others.
- Notch (band-stop) filter — The opposite of band-pass: it removes a narrow band of frequencies while passing everything else. The classic example is a 50/60 Hz notch filter to eliminate power-line hum from an audio recording.
Design and visualize all four types in our Filter Designer.
Frequency Response
The frequency response H(f) is a complex-valued function that completely characterizes a linear filter. It has two components:
- Magnitude response |H(f)| — How much each frequency is amplified or attenuated. Usually plotted in decibels (dB): 20 \log_{10} |H(f)|.
- Phase response \angle H(f) — How much each frequency is delayed (shifted in time). A filter with constant phase delay across all frequencies is called linear phase and preserves the signal's shape.
No real filter has a perfectly sharp cutoff. There is always a transition band between the passband and stopband where the magnitude response rolls off. Sharper transitions require more complex (higher-order) filters.
Convolution: Filtering in the Time Domain
In the frequency domain, filtering is multiplication: Y(f) = H(f) \cdot X(f). In the time domain, the equivalent operation is convolution:
Here h[m] is the filter's impulse response — what comes out when you feed in a single spike (impulse). The filter slides its impulse response along the signal, multiplying and summing at each position.
This duality — multiplication in frequency ↔ convolution in time — is one of the most powerful results in signal processing. It means you can design a filter by specifying either its frequency response or its impulse response, and the math connects them via the Fourier Transform.
See convolution in action with our Convolution Demo.
FIR vs. IIR Filters
Digital filters come in two main families:
- FIR (Finite Impulse Response) — The impulse response has a finite number of non-zero samples. FIR filters are always stable, easy to design for linear phase, and straightforward to implement. The downside: achieving a sharp cutoff may require many coefficients (a long filter), which means more computation and more delay.
- IIR (Infinite Impulse Response) — The impulse response theoretically goes on forever because the filter uses feedback (its output feeds back into its input). IIR filters can achieve sharp cutoffs with far fewer coefficients than FIR filters, making them computationally cheaper. The trade-offs: they can be unstable if designed carelessly, and achieving linear phase is generally not possible.
| Property | FIR | IIR |
|---|---|---|
| Stability | Always stable | Can be unstable |
| Linear phase | Easy to achieve | Generally not possible |
| Coefficients needed | Many (for sharp cutoff) | Few |
| Computation | Higher | Lower |
| Design | Simpler | More complex |
In practice, both types are widely used. FIR filters dominate when linear phase matters (e.g., audio production). IIR filters are preferred when computational resources are tight or real-time latency must be minimized.
Putting It All Together
Filtering connects everything from the previous lessons:
- You start with a signal (Lesson 1) — a waveform in the time domain.
- You compute its spectrum using the FFT (Lesson 2) to see which frequencies are present.
- You design a filter to keep desired frequencies and remove unwanted ones.
- You apply the filter — either by multiplying spectra or convolving in the time domain.
- The result is a cleaner, shaped, or transformed signal ready for use.
This pipeline — sample → transform → filter → inverse transform — is the backbone of audio processing, telecommunications, medical imaging, radar, and countless other fields.
Key Takeaways
- Filtering in the frequency domain is multiplication: Y(f) = H(f) \cdot X(f).
- The four main filter types are low-pass, high-pass, band-pass, and notch (band-stop).
- The frequency response H(f) describes what a filter does at each frequency.
- Convolution in time ↔ multiplication in frequency — two sides of the same coin.
- FIR filters are simple and stable; IIR filters are efficient but require careful design.
Filter Designer
Design low-pass, high-pass, band-pass, and notch filters. See the frequency response and apply to signals.
Open Designer →Convolution Demo
Visualize how convolution works step by step. Convolve signals with different kernels.
Open Demo →