ENG5027 Chap.7 Deriving and Implementing FIR Filters
Deriving and Implementing FIR Filters
Deriving and Implementing FIR Filters introduces the finite impulse response filter as a weighted sum of delayed inputs. Its transfer function is a polynomial in z to the minus one, the output is the input transform multiplied by that polynomial, and because there is no feedback the impulse response ends after the last tap, so the filter is always stable.
The two-point moving average is the first example: on the unit circle its response factors into a half-sample delay times the cosine of half the frequency, giving unity gain at DC and zero gain at Nyquist. The lecture then asks when an FIR filter has linear phase.
Writing the response as a real amplitude times a linear-phase exponential and comparing it with the inverse transform leads to the condition that the impulse response is symmetric or antisymmetric about its centre. Combined with odd or even length that gives four FIR types, each with different built-in zeros.
A linear-phase filter delays every frequency by about half its length, which keeps the shape of pulses such as the QRS complex of an ECG. The chapter contrasts this causal, real-time route with filtering by editing FFT coefficients, which needs the whole record and future samples.
It finishes with implementation: a ring buffer stores incoming samples at a moving offset so that no data are shifted, the form required in the second lab.
What this chapter covers
- 01
FIR transfer functions and stability
- 02
The two-point moving average
- 03
Gain at DC and Nyquist
- 04
Linear phase and symmetric responses
- 05
The four FIR types
- 06
Causal filtering versus FFT editing
- 07
Ring-buffer implementation
Worked example · free
Response and type of a four-tap filter
- 1The DC gain is the coefficient sum, 8/8 = 1.
- 1The Nyquist gain is the alternating sum, (1 − 3 + 3 − 1)/8 = 0, so Nyquist is blocked.
- 2The coefficients are symmetric with even length, so the phase is linear and the delay is (4 − 1)/2 = 1.5 samples.
- 2The step outputs are running sums of the taps: 0.125, 0.5, 0.875 and then 1.
Key terms
- Moving average
- An FIR filter whose equal coefficients average the most recent input samples.
- Ring buffer
- A fixed-length array written at a moving offset so that new samples never require shifting the rest.
- Transversal filter
- The tapped delay-line structure in which each delayed input is weighted and summed.
Deriving and Implementing FIR Filters FAQ
Why is an FIR filter always stable?
It has no feedback, so each output depends on a finite number of inputs and the impulse response ends after the last coefficient. A bounded input can therefore only produce a bounded output.
What is the delay of a linear-phase FIR filter?
A symmetric or antisymmetric filter delays every frequency by the same amount, half of one less than its length in samples. For a long ECG filter this delay is noticeable but harmless because the waveform shape is preserved.
Why not filter by editing FFT coefficients instead?
Editing the spectrum of a whole recording uses samples from the future at every point, so it is not causal and cannot run as data arrive. An FIR filter processes each sample immediately, at the cost of a fixed delay.
Exam move
Combine algebra with code. For a handful of short coefficient lists, find the DC and Nyquist gains, sketch the magnitude, decide the symmetry type and state the delay. Derive the moving-average response on the unit circle yourself, since the factorisation trick reappears in longer filters. Learn which FIR types force zeros at DC or Nyquist by checking one example of each.
Then write a ring-buffer filter on paper: a buffer, an offset, a loop that accumulates coefficient times stored sample with wrapped indices, and an update of the offset. Trace it by hand for three input samples to confirm the output.
The second lab requires exactly this structure inside a class with a method that takes one sample and returns one sample, and it penalises shifting the whole delay line, so practising the indexing now saves time at the bench and in any exam part that asks for pseudo-code.
Working through Deriving and Implementing FIR Filters in ENG5027? Sia is AskSia’s AI Electrical Engineering tutor — ask any ENG5027 Deriving and Implementing FIR Filters question and get a clear, step-by-step explanation grounded in how ENG5027 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.