HuntsvilleEngineers mark
HE Reference Shelf — huntsvilleengineers.com
The Reference Shelf · Applied Engineering Math

FIR filter design

An FIR filter is a weighted average of the last N input samples — no feedback, always stable, and if you make the weights symmetric it delays every frequency by exactly the same amount, which is why it's the default filter in DAQ and comms firmware.

Also known as: finite impulse response filter · Parks-McClellan · windowed-sinc design

The formula

The filter itself:

y[n] = Σₖ h[k] · x[n − k]        (k = 0 … N−1)

Reading: the output right now is a weighted sum of the last N inputs, nothing else — the impulse response h[k] is literally the list of tap weights, and it is finite because there is no feedback to let anything ring forever.

Its frequency response:

H(ω) = Σₖ h[k] · e^(−j·ω·k)      (ω in rad/sample; ω = π is fs/2)

Reading: the taps are the Fourier coefficients of the frequency response — pick the response you want, and the taps fall out of the inverse transform.

Linear phase, the reason FIR exists as a category:

h[k] = h[N−1−k]   ⇒   group delay = (N−1)/2 samples, constant at every frequency

Reading: make the taps symmetric and every frequency component comes out delayed by the same amount — the waveform shape survives, just shifted.

Windowed-sinc design (the workhorse method):

h[k] = sin(ωc·(k − M)) / (π·(k − M)) · w[k],    M = (N−1)/2

Reading: the ideal lowpass has a sinc impulse response that runs forever; chop it to N taps and taper the cut with a window w[k] so the truncation doesn't ring.

Kaiser's tap-count estimate, the formula you size hardware with:

N ≈ (A − 7.95) / (2.285·Δω) + 1

Reading: taps scale with stopband attenuation A (dB) and inversely with transition width Δω (rad/sample) — halve the transition band and you double the filter.

Parks–McClellan states the design problem as minimax approximation:

minimize  max |W(ω) · (H(ω) − D(ω))|   over the passbands and stopbands

Reading: find the taps whose worst-case weighted error against the desired response D(ω) is as small as it can possibly be; the alternation theorem guarantees the optimum ripples with equal peaks, which is why the result is called equiripple.

Where you meet it

  • On the test stand, inside the DAQ. Every decimating digitizer runs an FIR before it throws samples away — the anti-alias filter that keeps 30 kHz pyro ringing from folding into your 10 kHz strain record. Linear phase is why the shock transient still looks like the shock transient afterward: every component of the edge arrives together, delayed by exactly (N−1)/2 samples, which you correct by shifting the time axis and nothing more.
  • In comms and SDR firmware. The channel filter in an FPGA is almost always an equiripple FIR designed against an adjacent-channel rejection mask. Tap count is DSP slices, power, and latency, so the design meeting is a fight between the systems engineer's transition band and the FPGA lead's resource budget — Kaiser's formula is the opening bid, Parks–McClellan is the final offer.
  • At the bench, whether you knew it or not. A moving average is an FIR with equal taps. A 5-point average puts perfect nulls at fs/5 and 2fs/5 (verified: zeros land at 0.4π and 0.8π rad/sample) — which is exactly why an averaging window sized to one period of line frequency kills 60 Hz hum, and why an arbitrary one just smears it.
  • At the data-review board. When someone asks whether the filter distorted the transient, an FIR lets you answer in one sentence: constant group delay, known startup transient of N−1 samples, done. An IIR answer involves phase plots and hand-waving.

How it works

The two design schools, and what each buys you:

Windowed sinc. Truncating the ideal sinc with no taper hits the Gibbs phenomenon: the stopband stalls near 21 dB down no matter how many taps you add. The window trades transition width for sidelobe suppression, and each classic window is a fixed point on that trade: rectangular ≈ 21 dB, Hann ≈ 44 dB, Hamming ≈ 53 dB, Blackman ≈ 74 dB of stopband attenuation (all four verified numerically on a 101-tap lowpass). Length buys you a narrower transition band; the window choice sets the attenuation ceiling. The Kaiser window replaces that menu with a knob — its β parameter dials the trade continuously, and the tap-count formula above predicts the length. Checked: a 60 dB spec with a 0.1π transition band predicts 74 taps; the resulting filter measures 59.5 dB. The formula is honest to within about half a dB.

Equiripple (Parks–McClellan). The window method wastes performance — its stopband keeps dropping past the spec where flat-at-spec would do. Parks–McClellan spends that waste: it finds the taps whose error ripples evenly at the smallest possible peak, so every tap works equally hard. Same 60 dB / 0.1π spec: 68 taps instead of 74, and the gap widens when the passband and stopband ripples are allowed to differ, because the window method needlessly forces them equal.

What people get wrong:

  1. Ignoring the delay. (N−1)/2 samples is real time — a 400-tap filter at 50 kSa/s is 4 ms. In a recorded data set you shift the time axis and move on. In a feedback loop, 4 ms of transport delay eats phase margin, which is why sharp FIRs live in telemetry paths and rarely inside control laws.
  2. Trusting the first N−1 samples. The filter starts full of zeros. Until the taps fill with real data the output is the startup transient, not the measurement. Cut it or flag it.
  3. An even-length symmetric filter (Type II) has a forced zero at fs/2. Design a highpass with an even tap count and the tool will fight you or quietly fail the spec at Nyquist. Odd N for highpass and bandstop.
  4. Mixing normalized-frequency conventions. One tool wants f/fs, another wants f/(fs/2), a third wants rad/sample. A cutoff off by a factor of two passes every unit check and fails on the bench.
  5. Fixed-point coefficient quantization raises the stopband floor. A design that shows 80 dB in double precision will not deliver 80 dB in 16-bit coefficients. Quantize the taps, then re-plot the response, then believe it.
  6. Specifying a transition band you can't afford. Kaiser's formula runs in your head: 60 dB across one percent of fs/2 costs on the order of a thousand taps. Run the estimate before promising the spec.

Zero-phase filtering — running the filter forward and backward so the delays cancel — is legitimate and standard for post-test data reduction, and impossible in real time. Know which job you're doing.

History

The math came first, from Kyiv. Evgeny Remez, working on Chebyshev approximation at the Ukrainian Academy of Sciences, published his exchange algorithm in a burst of three papers in 1934 — an iterative recipe for finding the polynomial whose worst-case error against a target function is minimal [6][7]. It sat in the approximation-theory literature for nearly forty years while digital filters didn't exist yet.

By 1970 they did, and the field knew equiripple filters were the right answer without having a general way to compute them — Otto Herrmann and others could construct them only in special cases, and Ed Hofstetter's "maximal ripple" method couldn't pin band edges where the designer wanted them [2]. Over spring break in 1971, Thomas Parks of Rice University drove to a conference at Princeton and heard Hofstetter present that work. He recognized the missing piece as Remez's 1934 algorithm and handed the problem to a graduate student in his signal-theory course, James McClellan, as a term project. McClellan had working code in about six weeks [2][3]. The paper landed in the IEEE Transactions on Circuit Theory in March 1972 [4], and the 1973 FORTRAN program written with Lawrence Rabiner at Bell Labs — carefully documented, freely circulated — put optimal filter design on every engineer's desk that had a card reader [2][5]. That same code's descendants are what runs when you call remez today.

The window school matured in parallel at Bell Labs, where James Kaiser developed his I₀-sinh window as a computable stand-in for the theoretically optimal prolate spheroidal functions, publishing the design method — including the tap-count formula quoted above — at the IEEE circuits symposium in 1974 [8][9]. Between McClellan's term project and Kaiser's window, the two methods engineers still reach for first were both on the table by the mid-seventies.

Related tools

Sources

  1. https://en.wikipedia.org/wiki/Finite_impulse_response
  2. https://en.wikipedia.org/wiki/Parks%E2%80%93McClellan_filter_design_algorithm
  3. https://doi.org/10.1109/MSP.2005.1406492
  4. https://www.semanticscholar.org/paper/Chebyshev-Approximation-for-Nonrecursive-Digital-Parks-McClellan/f73477afc935bad05585966f04bf62b68f25241f
  5. https://web.ece.ucsb.edu/Faculty/Rabiner/ece259/Reprints/062_computer%20program.pdf
  6. https://en.wikipedia.org/wiki/Remez_algorithm
  7. https://mathshistory.st-andrews.ac.uk/Biographies/Remez/
  8. https://en.wikipedia.org/wiki/Kaiser_window
  9. https://www.mathworks.com/help/signal/ref/kaiserord.html

Written by HE in our own words from the cited sources — engineering judgment included, your stamp still required. All entries →

★ The Reference Shelf

Reading is free. The shelf is for cardholders.

Your library card is an email address: pin it to your shelf, print the card, take the FE/PE quick-reference pack, read the Huntsville history. The shelf remembers what you reach for.

Already on the list? Enter with your subscribed email →