# Finite impulse response
A **finite impulse response** (FIR) filter is a [[Digital_filter|digital filter]] whose impulse response settles to exactly zero after a fixed number of samples, in contrast to an [[Infinite_impulse_response|infinite impulse response]] filter, whose response can ring on indefinitely because it feeds its own past output back into itself. An FIR filter of order M sums M+1 weighted, delayed copies of its input and nothing else, so its behaviour is fixed the moment its M+1 coefficients are chosen, and it can never become unstable no matter how those coefficients are set. Two microsims on this page carry the idea: the primary one builds a low-pass filter from a truncated, windowed sinc function and lets the reader drag the cutoff while a stray high-frequency tone disappears from the output trace, and a companion sketch instead exposes the tap weights of a general tapped-delay-line FIR filter directly, from a plain moving average to a hand-tuned notch.
Because it has no feedback, an FIR filter's coefficients are also, up to reversal, literally its impulse response, a fact this article uses throughout to move between the time domain and the frequency domain.
## Definition
A finite impulse response filter of order M computes each output sample as `y[n] = sum_{k=0}^{M} b_k*x[n-k]`, a weighted sum of the current input and the M samples before it, and nothing else.[^stib072] This is equivalent to a [[Convolution|convolution]] of the input with the coefficient sequence, and the filter's [[Impulse_response|impulse response]] h[n] — the output produced when x is a single 1 at n = 0 followed by zeros — is therefore just that sequence itself, `h[n] = b_n` for 0 ≤ n ≤ M and `h[n] = 0` everywhere outside that range: the filter's entire memory is the length of its own tap list, and it does not, and by construction cannot, depend on any output it produced earlier. The definition above is discrete-time, but the same finite-duration idea also describes a [[Discrete_time_and_continuous_time|continuous-time]] filter built from a finite analog delay line rather than a clocked shift register. Because the first M outputs are computed before the filter has seen M samples of history, they are conventionally taken to use zeros for the missing input samples,[^stib084] a boundary effect that shows up as a short transient at the start of any FIR-filtered record.
## Properties
An FIR filter with real coefficients is unconditionally stable: every pole of its [[Transfer_function|transfer function]] sits at the origin of the [[Z-transform|z-transform]]'s complex plane, so there is no pole that a rounding error or a coefficient change could push outside the unit circle, the instability mechanism that has to be watched constantly in an infinite impulse response design. An FIR filter can also be made exactly linear-phase — every frequency delayed by the same number of samples, so a pulse's shape survives the filter even though its arrival is delayed — simply by choosing symmetric coefficients, `b_k = b_{M-k}`; the constant group delay this produces is `(N-1)/2` samples for an N-tap filter, the same figure both microsims on this page report directly in their live readout. The price of these guarantees is length: a sharp transition between passband and stopband generally needs a much higher order, and so a much longer delay, than an infinite impulse response filter meeting the identical specification.
## Frequency response
A filter's frequency response is its transfer function evaluated on the unit circle — equivalently, the [[Discrete-time_Fourier_transform|discrete-time Fourier transform]] of its own taps, `H(w_hat) = sum_{k=0}^{M} b_k*exp(-j*k*w_hat)`, where the digital frequency `w_hat = omega*T_s` runs from −π to π radians per sample and π itself is the [[Nyquist_frequency|Nyquist frequency]].[^stib071][^stib074] The simplest case is a single delayed echo added to the original signal, `y(t) = x(t) + b1*x(t - tau)`, whose magnitude `|H| = sqrt(1 + b1^2 + 2*b1*cos(w*tau))` rises to a maximum of `1 + b1` wherever `w*tau` is an even multiple of π and falls to a minimum of `1 - b1` at odd multiples — the comb filter, so called because a delay of 167 microseconds places its peaks at 0, 6 and 12 kHz and its notches at 3, 9 and 15 kHz.[^stib069] A second concrete case, `y[n] = x[n] + x[n-2]`, is a two-tap filter with zeros at `e^{±j*pi/2}`, giving `|H(w_hat)| = 2*|cos(w_hat)|`;[^stib077][^stib080] sampled at 100 Hz it removes a 25 Hz tone from a 5 Hz plus 25 Hz mixture completely, because 25 Hz sits at exactly one quarter of the sampling rate, where the zero is.[^stib084] Placing zeros is, in fact, the whole of FIR design in the frequency domain: an ideal 200–300 Hz bandpass filter, for instance, keeps only a 250 Hz tone out of tones at 50, 100, 250 and 350 Hz by placing its [[Pole–zero_plot|zeros]] near every frequency it must remove and none near the frequency it must keep.[^stib065]
## Filter design
Two families of method turn a frequency-domain specification into the coefficients above: one starts from an ideal, infinitely long response and shortens it, and the other searches directly for the finite-length response that best matches the specification by some numerical error measure.
### Window design method
An ideal [[Low-pass_filter|low-pass filter]]'s impulse response is a sinc function, `h[n] = 2*f_c*sinc(2*f_c*(n - M/2))`, which never reaches zero and so cannot be built. The window method multiplies that infinite sinc by a finite [[Window_function|window]] `w[n]` that tapers smoothly to zero at both ends, giving a realizable filter `h[n] = 2*f_c*sinc(2*f_c*(n - M/2))*w[n]` whose length trades directly against how closely it approximates the ideal brick wall. A rectangular window is the simplest choice and gives the narrowest transition for a given length, but its abrupt edges leave the most ripple in both bands; the Hann, Hamming and Blackman windows the primary microsim offers taper more gradually and trade a wider transition for deeper stopband attenuation, in that order.
### Least mean square error (MSE) method
Rather than shaping a known ideal response, the least-mean-square method poses filter design as a numerical optimization: choose the M+1 coefficients that minimise the total squared difference between the filter's actual frequency response and the desired one, evaluated at a dense set of frequency points. The result, for the same order and the same specification, generally distributes its error more evenly across the passband and stopband than a windowed design does, which is why it, or its equal-ripple relative, is the default choice inside most computer-aided filter-design tools even though it gives up the window method's closed-form simplicity.
## Moving average example
The simplest FIR filter of all is the moving average: an N-tap filter with every coefficient equal to `1/N`. Averaging N = 5 consecutive samples, for instance, gives the frequency response `|H(w_hat)| = |sin(5*w_hat/2)| / (5*|sin(w_hat/2)|)`, a curve that starts at 1 for a constant signal and touches zero every time `w_hat` is a multiple of `2*pi/5`, so a five-point average completely removes any tone whose period is exactly five samples, or an integer fraction of that. The moving average is a poor [[Low-pass_filter|low-pass filter]] by the standard of the sinc-windowed design above — its stopband is riddled with these narrow notches rather than falling away smoothly — but it is cheap, needs no multiplications beyond a running sum, and is a preset a reader can select directly in the second microsim below, alongside a differentiator, a half-band low-pass filter and a high-pass filter built the same tapped-delay way.
## Microsims
The primary microsim, *Finite impulse response*, builds a windowed-sinc low-pass filter and runs it on a live test signal. A dropdown chooses the [[Window_function|window]] (Rectangular, Hann, Hamming or Blackman), a slider sets the order N−1 (8 to 128 taps), and a second slider drags the cutoff f_c from 0.02 to 0.48 cycles per sample. Three panels track every change together: the impulse response h[n] as a stem plot, the magnitude response |H(e^jω)| with the cutoff marked, and a scrolling scope overlaying a two-tone-plus-noise test input against the filtered output. The live readout reports the group delay, the passband ripple and the stopband attenuation the current window and order actually achieve.
*Try:* Switch the window from Rectangular to Blackman and watch the stopband-attenuation readout deepen by tens of decibels while the transition band around the cutoff marker visibly widens.
A second microsim, *FIR filter*, exposes the tapped-delay-line structure directly as an animated signal-flow diagram: each delay block `z^-1`, each tap weight `b[k]`, and the multiply–accumulate sum that forms `y[n]`. A preset menu selects Moving Average, Differentiator, Half-Band LPF or High-Pass, a tap-count slider resets the filter order, and individual tap sliders let the reader hand-edit any coefficient; the impulse response, magnitude response and scrolling scope update to match immediately. A three.js companion, built from the pole–zero plot idea, renders the same two-zero notch discussed above directly on the z-plane, in more depth than is covered here.
*Try:* Select the Moving Average preset, then raise the tap count and watch the narrow notches in the magnitude response move closer together and multiply.
## Wikipedia : Wikitube
**Strict pair:** [Wikipedia](https://en.wikipedia.org/wiki/Finite_impulse_response) : [Wikitube](https://en.wikitube.io/wiki/Finite_impulse_response)
Skeleton mirrored at revision 1338221948. Prose, emphasis and the microsims are Wikitube's own.
## See also
- [[Adaptive_filter]]
- [[Matched_filter]]
- [[Window_function]]
- [[Pole–zero_plot]]
- [[Digital_filter]]
- [[Impulse_response]]
- [[Convolution]]
- [[Infinite_impulse_response]]
## Notes
The impulse-response and magnitude-response panels in both microsims are ILLUSTRATIVE: the analog-to-digital and digital-to-analog stages that would surround such a filter in a real system are omitted, and the test signals mix only two or three known tones with synthetic noise rather than a recorded signal. Page numbers in the references below are PDF pages of the open editions cited, not the printed page numbers of the original books.
## References
The algebra of convolution, stability and linear phase used above is standard textbook material and is not separately footnoted beyond the worked figures below, per the Wikitube style guide §6.1.
[^stib072]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, p. 72 (PDF page). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
[^stib071]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, p. 71 (PDF page). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
[^stib074]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, p. 74 (PDF page). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
[^stib069]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, pp. 69-70 (PDF pages). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
[^stib077]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, p. 77 (PDF page). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
[^stib080]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, pp. 79-80 (PDF pages). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
[^stib084]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, pp. 83-84 (PDF pages). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
[^stib065]: Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain*. 2020, pp. 65-68 (PDF pages). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain. CC BY-SA.
<!-- Hubs: Signal_processing. Portals: PORTAL_Signal_Processing. Signal Processing portal wave 1 · 2026-09-17 · drafted. -->