This interactive tutorial demonstrates Finite Impulse Response (FIR) Filters, one of the fundamental building blocks of digital signal processing. FIR filters use a weighted sum of past input samples (the convolution operation) to shape the frequency content of a signal. Unlike IIR filters, FIR filters are always stable and can achieve perfectly linear phase response.
The simulation visualizes the core concept of Convolution—showing how the filter's coefficients (called "taps") slide across the input signal, multiply overlapping values, and sum them to create each output sample. You can drag the coefficient bars to design your own filter, or use the dual dropdown system to select from various filter types (Low Pass, High Pass, Band Pass, Band Stop) and design methods (Moving Average, Windowed Sinc, Butterworth, Chebyshev, Elliptic) to see
how different approaches produce different frequency responses.
How FIR Filters Work
An FIR filter processes a signal by computing a weighted sum of the current and past input samples:
h[k] are the filter coefficients (also called "taps" or the "impulse response")
N is the number of taps (filter order + 1)
Mathematical Foundation
Convolution: The FIR filter equation is a discrete convolution:
y[n] = (x * h)[n] = Σk=0N-1 h[k] · x[n-k]
This is the "Multiply and Accumulate" (MAC) operation that DSP processors optimize. For each output sample, we multiply N input samples by N coefficients and sum the results.
Frequency Response: The filter's frequency response is the Fourier Transform of its impulse response:
H(ejω) = Σk=0N-1 h[k] · e-jωk
The magnitude |H(ejω)| tells us how much the filter amplifies or attenuates each frequency. The phase � H(ejω) tells us how much the filter delays each frequency.
Windowed-Sinc Method: To design a low-pass filter with cutoff ωc:
h[k] = sinc(ωc(k - M/2)) · window[k]
where sinc(x) = sin(πx)/(πx), M = N-1, and window[k] is a tapering function (like Hamming) that reduces spectral leakage.
High-Pass via Spectral Inversion: Given a low-pass filter hLP[k], we create a high-pass filter by:
hHP[k] = δ[k - M/2] - hLP[k]
This flips the frequency response, converting a low-pass into a high-pass.
FIR Filter Controls
0.15π16
1x35%
Filter Coefficients h[k] — Click & Drag to Edit
Input Signal x[n]
Filter Kernel h[k]
Output Signal y[n]
TIME DOMAIN: Input Signal (with high-frequency noise)
TIME DOMAIN: Filtered Output (noise removed)
FREQUENCY DOMAIN: Magnitude Response |H(ω)|
Z-PLANE: Poles & Zeros
Filter Information
Filter Type:Low Pass (Windowed Sinc)
Number of Taps:16
Sum of Coefficients:1.0000
DC Gain:1.0000
Usage Example
Follow these steps to explore the FIR Filter visualization:
Initial View: When you first load the simulation, you'll see:
Three dropdown menus for selecting Filter Type, Design Method, and Signal Type
A coefficient editor showing the filter's impulse response as draggable bars
An input signal canvas showing the selected test signal (default: sine wave with high-frequency noise)
An output signal canvas showing the filtered result
A frequency response plot showing the filter's magnitude response in dB scale (toggle Linear/dB with the button)
A Z-plane plot showing poles at the origin and zeros calculated from coefficients
A convolution window (dashed box) overlaid on both input and output showing the sliding multiply-accumulate operation
Observe the Convolution: Watch the input signal scroll from right to left. The dashed box shows which samples are currently being processed. The stem plot inside shows the filter coefficients h[k], and cyan dots mark the signal samples x[n-k] being multiplied.
Select Filter Type, Design Method, and Signal: Use the three dropdown menus to customize your experiment:
Filter Types: Low Pass, High Pass, Band Pass, Band Stop (Notch)
Signal Types: Sine+Noise, Multi-tone, Square+Multi, Chirp, Square Wave, White Noise
Each combination produces different coefficient patterns and frequency response characteristics. Try using "Multi-tone" or "Square+Multi" signals to better visualize Band Pass filter effects!
Adjust Parameters: Use the sliders to experiment:
Cutoff (ω): Move this slider to change where the filter begins attenuating. Watch the frequency response curve shift in real-time!
Taps (N): Increase the number of taps to see sharper frequency transitions. More taps = better frequency selectivity but more computation.
Noise: Increase noise to see how well the filter removes it. Different design methods have different noise rejection characteristics.
Design Your Own Filter: Click and drag on the coefficient bars to create custom filters! Try:
Setting all to zero except one (creates a delay)
Alternating positive and negative values (high-pass effect)
A triangular envelope (smoother than rectangular window)
Step Through Animation: Use "◀ Step" and "Step ▶" buttons to advance the animation one sample at a time. This is excellent for understanding how each input sample contributes to the output.
Toggle Frequency Scale: Click the "dB" button on the frequency plot to switch between Linear and dB scale. dB scale reveals stopband attenuation details that are invisible in linear scale.
Tip: The key insight is that the frequency response is the Fourier Transform of the coefficients. When you drag the coefficient bars, you're literally shaping the frequency response! A flat coefficient pattern (Moving Average) has a sinc-like frequency response. A sinc-shaped coefficient pattern has a flat (ideal brick-wall) frequency response. This duality is fundamental to understanding FIR filter design.
Filter Types
The Filter Type dropdown selects what frequency bands to pass or reject:
Low Pass: Passes low frequencies, attenuates high frequencies. Used for smoothing, anti-aliasing, and removing high-frequency noise.
High Pass: Passes high frequencies, attenuates low frequencies. Used for edge detection, DC removal, and extracting rapid changes.
Band Pass: Passes only frequencies within a specific band around the cutoff frequency. Used for isolating specific frequency components like carriers in communication systems. Note: For bandpass to work effectively, set the cutoff to mid-spectrum (0.2-0.3) rather than near DC.
Band Stop (Notch): Rejects frequencies within a specific band, passes everything else. Used for removing interference like 50/60Hz hum.
Signal Types
The Signal dropdown selects the input test signal to demonstrate filter effects:
Sine+Noise: A low-frequency sine wave with added high-frequency noise. Ideal for demonstrating Low Pass filters—watch the noise get removed while the sine wave passes through.
Multi-tone: Three sine waves at different frequencies (low, mid, high). Perfect for demonstrating Band Pass filters—you can see which frequency components are passed or rejected.
Square+Multi: A square wave combined with multiple sine tones. Great for seeing filter effects on both harmonics (from the square wave's sharp edges) and distinct frequency components. The square wave's step transitions clearly show the filter's smoothing effect.
Chirp: A sine wave with linearly increasing frequency (frequency sweep). Excellent for visualizing the filter's frequency response in the time domain—watch where the signal gets attenuated as frequency increases.
Square Wave: A pure square wave with sharp transitions. Contains odd harmonics at 1×, 3×, 5×, 7×... the fundamental frequency. Great for seeing how filters affect harmonic content and edge sharpness.
White Noise: Random signal with equal energy at all frequencies. Useful for seeing the filter's overall frequency response directly in the time domain output.
Design Methods
The Design Method dropdown selects the mathematical approach used to calculate the filter coefficients:
Moving Average: Simplest filter—all coefficients equal to 1/N. Provides basic smoothing but has poor frequency selectivity with significant ripples in the stopband. Best for simple noise reduction when sharp cutoff isn't needed.
Windowed Sinc: The classic FIR design method. Uses a sinc function (ideal brick-wall response) multiplied by a Hamming window. Provides excellent frequency selectivity with controlled ripples. Good general-purpose choice.
Butterworth: "Maximally flat" in the passband—no ripples at all. The smoothest possible frequency response but has a gradual rolloff (slower transition from passband to stopband). Best when passband flatness is critical.
Chebyshev Type I: Allows equiripple (controlled ripples) in the passband to achieve a steeper rolloff than Butterworth. The tradeoff is small amplitude variations in frequencies you want to pass.
Chebyshev Type II: Equiripple in the stopband instead of the passband. Provides monotonic passband (no ripples) with steeper rolloff than Butterworth, at the cost of ripples in the stopband.
Elliptic (Cauer): Equiripple in both passband and stopband. Achieves the steepest possible rolloff for a given filter order, but has ripples everywhere. Best when transition width must be minimized.
Parameters
Descriptions of each parameter:
Filter Coefficients h[k]: The heart of the FIR filter. These N values determine how past input samples are weighted when computing each output sample. The coefficients are also called "taps" or the "impulse response" (because if you input an impulse [1, 0, 0, 0, ...], the output will be exactly h[k]).
Number of Taps (N): The filter order plus one. More taps allow for sharper frequency transitions but require more computation. Typical values range from 8 (simple smoothing) to 256+ (high-quality audio processing).
Cutoff Frequency (ω): The frequency at which the filter begins attenuating signals. Expressed in normalized form (0 to π, where π corresponds to the Nyquist frequency, half the sampling rate). A cutoff of 0.15π means the filter passes frequencies below 15% of Nyquist.
Windowing: The simulation uses Hamming window for Windowed Sinc, and Kaiser window for Butterworth/Chebyshev/Elliptic methods. Windowing reduces the ripples (Gibbs phenomenon) in the frequency response at the cost of a slightly wider transition band.
DC Gain: The sum of all coefficients. For a low-pass filter, this should be 1.0 (unity gain at DC/0 Hz). For a high-pass filter, DC gain is near 0. For a properly normalized Moving Average, DC gain is 1.0.
Magnitude Response |H(ω)|: The filter's gain as a function of frequency. Computed as the magnitude of the Discrete Fourier Transform of the coefficients. The -3dB line (shown in red on dB scale) marks where the filter attenuates to ~70.7% of its passband level—the conventional "cutoff" point.
Controls
Type Dropdown: Select the filter type (Low Pass, High Pass, Band Pass, Band Stop).
Signal Dropdown: Select the input test signal (Sine+Noise, Multi-tone, Square+Multi, Chirp, Square Wave, White Noise).
Cutoff (ω): Adjust the cutoff frequency from 0.01π to 0.45π.
Taps (N): Set the number of filter taps from 4 to 128.
Pause/Run: Freezes or resumes the signal animation. Useful for detailed examination of the convolution process.
◀ Step / Step ▶: Advance the animation backward or forward one sample at a time while paused.
Reset: Returns all settings to default values.
Show Convolution: Toggle the visual overlay showing which samples are being multiplied by the kernel.
Speed: Control the animation speed (samples processed per frame).
Noise Level: Adjust the amount of high-frequency noise added to the test signal (applies to Sine+Noise signal).
Linear/dB Toggle: Switch the frequency response plot between linear scale (0-1) and decibel scale (useful for seeing stopband details). Default is dB scale.
Drag Coefficients: Click and drag the red bars to manually edit coefficient values and design custom filters!
Key Concepts
Finite Impulse Response: Unlike IIR (Infinite Impulse Response) filters that use feedback, FIR filters have no recursion. Their impulse response is exactly the coefficient array h[k], which has finite length N. This guarantees stability—an FIR filter can never become unstable or oscillate.
Linear Phase: FIR filters with symmetric coefficients (h[k] = h[N-1-k]) have perfectly linear phase response. This means all frequencies are delayed by the same amount, preserving the shape of signals like audio waveforms or digital pulses.
Trade-offs: FIR filters require more coefficients (and thus more computation) than IIR filters to achieve the same sharpness. However, they offer guaranteed stability, linear phase, and simpler design. Modern DSP processors have specialized MAC units that make FIR filters very efficient.
Duality: There's a beautiful duality between the time domain (coefficients) and frequency domain (response). A rectangular coefficient window (Moving Average) produces a sinc-like frequency response. A sinc-shaped coefficient pattern produces a rectangular (ideal brick-wall) frequency response. This is the essence of Fourier duality.
Applications: FIR filters are everywhere in signal processing—audio equalizers, anti-aliasing filters before ADCs, interpolation filters for sample rate conversion, matched filters in communications, edge detection in image processing, and noise reduction in medical devices.
Z-Plane: Poles and Zeros in FIR Filters
The Z-plane visualization provides deep insight into a filter's behavior. Understanding pole-zero locations is fundamental to digital filter analysis.
Poles in FIR Filters
FIR filters technically have poles, but only at z = 0 (the origin). The transfer function of an FIR filter is:
The denominator is zN-1, so all (N-1) poles are at z = 0. These are called "trivial poles" and are often ignored in practice because:
They're always inside the unit circle → FIR filters are always stable
They don't meaningfully affect the frequency response
Zeros: Location Matters!
The location of zeros relative to the unit circle has important implications:
Zero Location
Meaning
Filter Property
On Unit Circle (|z| = 1)
Complete nulls at that frequency
That frequency is completely blocked (0 dB → -∞ dB)
Inside Circle (|z| < 1)
Minimum-phase zeros
Minimum group delay; causal and stable inverse possible
Outside Circle (|z| > 1)
Maximum-phase zeros
More group delay; inverse filter would be unstable
Why Unit Circle Zeros are Special
When a zero lies exactly on the unit circle at angle θ, it creates a perfect null at the frequency ω = θ. For example:
Moving Average: Zeros are evenly spaced on the unit circle at z = ej2πk/N (except z=1). These create the characteristic nulls visible in the frequency response ripples.
Notch Filter: A zero placed at z = ejω₀ completely removes frequency ω₀ from the signal.
Linear Phase and Zero Symmetry
For a linear-phase FIR filter (symmetric coefficients), zeros come in conjugate reciprocal pairs:
If z₀ is a zero, so is z₀* (complex conjugate)
If z₀ is a zero, so is 1/z₀* (reciprocal conjugate)
This means zeros appear in groups of 4 (or pairs on the real axis/unit circle). In the visualization, you can see this symmetry when using the preset filters.
Tip: The zeros shown in the Z-plane are calculated from the filter coefficients using polynomial root-finding. Watch how the zero pattern changes as you switch between different filter types and design methods!