Filter design is mostly a matter of asking the right question first: where does the information in your signal live?
Some signals carry meaning in the time domain — an electrocardiogram, where a cardiologist reads the shape. There, overshoot is not an aesthetic complaint; a filter-induced peak is a feature that was never in the patient. Others carry meaning in the frequency domain — audio, where you can shift phases around substantially without a listener noticing, but frequency contamination is fatal.
Why the antialias filter choice depends on your signal
Figure
Illustrative second-order step responses. The Bessel-like curve (cyan) reaches its final value without overshoot but takes its time. The Butterworth-like curve (amber) is faster and overshoots slightly. The Chebyshev-like curve (violet) is fastest to the target and overshoots by roughly a quarter, then rings. On an electrocardiogram that overshoot is a peak the patient never had — which is why a sharp filter is the wrong answer when the waveform shape carries the meaning.
Decibels, since everything is quoted in them
Decibels, with the anchors worth memorising
Figure
A decibel is a ratio on a log scale, not a unit. For amplitude — which is what filter gains are — it is twenty times the base-ten logarithm; for power it is ten times. Using the wrong one gives you half the right answer, and it is a common slip. Six decibels is a factor of two, which is why each extra converter bit is worth about 6 dB. Twenty is a factor of ten. Three decibels is half the power, which is why the −3 dB point is the conventional cutoff.
Frequency-domain quality is measured by passband ripple, transition width, and stopband attenuation. Judge the stopband against the actual interference, not against a general sense of what sounds small: −40 dB against a neighbour a thousand times stronger still leaves it ten times your signal.
Why you cannot have everything
A sharper roll-off requires a longer impulse response — that is reciprocity, and it is not negotiable. A longer impulse response means slower step response, more latency, and more ringing. Excellent frequency performance and excellent time performance are in direct opposition, and the mathematics forbids having both.
So there is no best filter. One that is ideal for audio can be actively harmful for an ECG, and the reverse. Design one low-pass and convert: spectral inversion (negate every value, add one to the centre) gives high-pass; band-pass is a low-pass cascaded with a high-pass, so their kernels can be convolved into one; band-reject is the two in parallel, so theirs can be added.
Key points
Filters serve two purposes: separation of combined signals, and restoration of distorted ones. Restoration is the harder problem and is called deconvolution.
Separation is only possible when the components differ in some measurable property. If they overlap completely in every property, no filter can separate them, and the right response is to change the measurement rather than to try a better algorithm.
The impulse response, step response, and frequency response are three views of the same filter and are freely interconvertible. Each answers a different question: implementation, edge behavior, and frequency selectivity respectively.
The first question in any filter problem is where the information lives. Time domain information means waveform shape carries the meaning; frequency domain information means the frequency content carries it. The answer dictates everything else.
Time domain quality is measured on the step response: rise time from ten to ninety percent, overshoot, and symmetry. Overshoot invents features that were never in the data, which for a diagnostic signal is a wrong answer rather than an aesthetic flaw.
A symmetric step response means linear phase, which delays all frequencies equally and preserves waveform shape exactly.
A decibel expresses a ratio logarithmically. For amplitude ratios it is twenty times the base ten logarithm; for power ratios it is ten times. Filter gains are amplitudes, so twenty is the number to use, and confusing the two gives you half the right answer.
Memorize the anchors: six decibels is a factor of two in amplitude, twenty decibels is a factor of ten, and three decibels is half the power — which is why the minus three decibel point is the conventional cutoff. Each converter bit is worth about six decibels because it halves the quantization step.
Frequency domain quality is measured by passband ripple, transition band width, and stopband attenuation. Minus twenty decibels leaves ten percent through; minus sixty leaves one part in a thousand.
Group delay is the negative slope of phase against frequency, and it is the practical measurement of phase distortion. Flat group delay means undistorted waveform shape. Phase delay describes what happens to a carrier; group delay describes what happens to the envelope, which is where the information is.
Sharper roll-off requires a longer impulse response, which means slower step response, more latency, and more ringing. Excellent frequency performance and excellent time performance are in direct opposition, and the mathematics forbids having both.
There is no best filter. A filter that is ideal for audio can be actively harmful for an electrocardiogram, and the reverse.
Cascading two identical filters doubles every decibel figure — minus forty becomes minus eighty — but it also doubles the passband ripple in decibels, moves the effective cutoff, and roughly doubles the latency. Expect to re-tune the cutoff afterward.
Spectral inversion converts low pass to high pass: negate every kernel value and add one to the center sample. It works because a high pass filter is the original signal minus the low pass version, and adding one to the center is adding a delta function. It requires an odd-length symmetric kernel.
Spectral reversal also converts low pass to high pass, by negating every other sample. This multiplies the kernel by an alternating sequence, which is a sinusoid at the Nyquist frequency, so it shifts and reverses the frequency response rather than inverting it.
Band pass filters are a low pass cascaded with a high pass, so their kernels can be convolved into one. Band reject filters are a low pass added to a high pass, so their kernels can be added into one. All four filter types come from one low pass design.
FIR filters compute a weighted sum of inputs, have finite impulse responses, can achieve exactly linear phase, and are always stable. IIR filters feed back previous outputs, can achieve much sharper responses far more cheaply, but have nonlinear phase and can be unstable.
When interference is narrowband and at a known frequency, remove exactly it with a notch rather than filtering broadly — a narrow notch barely affects waveform shape. When rejecting a strong neighbouring channel, check the stopband requirement against how strong the neighbour actually is: minus forty decibels against an interferer a thousand times stronger still leaves it ten times your signal.
The map is a two by three grid: time domain, frequency domain, and custom purposes, each with an FIR and an IIR champion. Moving average and single pole for time domain; windowed-sinc and Chebyshev for frequency domain. Nearly every practical filter is in one of those six boxes.