University of Glasgow · FACULTY OF ELECTRICAL ENGINEERING

ENG5027 Chap.7 Deriving and Implementing FIR Filters

- one subject, every graph, every model, every mark
7 Chapters3-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 7 of 13 · ENG5027

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.

In this chapter

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

Q [6 marks]. An FIR filter has h = [1, 3, 3, 1] / 8. Find its DC gain and its Nyquist gain, state whether it has linear phase and give its delay, then compute the first four outputs for a unit step. Marks shown reflect our own judgement of effort, not an official mark allocation.
A four-tap transversal filter: the input moves through three one-sample delays, each stored value is multiplied by its coefficient, and the products are summed.A four-tap transversal filter: the input moves through three one-sample delays, each stored value is multiplied by its coefficient, and the products are summed.x(n)z⁻¹h(0)z⁻¹h(1)z⁻¹h(2)h(3)y(n)products are summed on the output rail
A four-tap transversal filter: the input moves through three one-sample delays, each stored value is multiplied by its coefficient, and the products are summed.
  • 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.
The filter passes DC with unity gain, blocks Nyquist, has linear phase with a delay of 1.5 samples and a step response of 0.125, 0.5, 0.875, 1.
Sia tip — Check the parity of the length with the symmetry: an even-length symmetric filter is forced to zero at Nyquist, so it can never be a highpass.
Glossary

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.
FAQ

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.

Study strategy

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.

A+Everything unlocked
Unlocks this Bible + all 26 of your subjects at University of Glasgow, plus 1,000+ more Bibles across the AskSia library.
Sia - your ENG5027 tutor, unlimited, worked the way the exam marks it
The full 3-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works