University of Glasgow · FACULTY OF ELECTRICAL ENGINEERING

ENG5027 Chap.10 Matched and Adaptive Filters in Fixed Point

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

Matched and Adaptive Filters in Fixed Point

Matched and Adaptive Filters in Fixed Point covers three practical extensions of the FIR filter. The first is integer arithmetic for processors without floating point. Coefficients are multiplied by two to the power W and rounded, the filter runs in integers, and the accumulated sum is shifted right by W bits. Without scaling, the small coefficients of a long filter all round to zero.

The accumulator must be wide enough for the worst case, the input bits plus the coefficient bits plus the base-two logarithm of the number of taps; the lecture example of 12-bit samples, 12-bit coefficients and 1000 taps needs 34 bits. Two's complement arithmetic wraps on overflow, so temporary overflows are harmless as long as the final sum fits, and a filter with gain below one can drop the logarithm term.

The second extension is the matched filter. Choosing the impulse response as the time-reversed template turns convolution into correlation, so the output peaks where the input resembles the template. A detection chain adds a highpass to remove DC, squaring to sharpen peaks, a threshold and a plausibility heuristic, the structure used for heartbeat detection in the second lab.

The third is the LMS adaptive filter, which updates each coefficient by the learning rate times the error times the corresponding delayed input. A 50 Hz canceller shows the effect of the learning rate: too small never fully cleans the signal, too large diverges.

In this chapter

What this chapter covers

  • 01

    Scaling coefficients to integers

  • 02

    Accumulator width and overflow

  • 03

    Two's complement wrap-around

  • 04

    Matched filter as a correlator

  • 05

    The detection chain for heartbeats

  • 06

    The LMS update rule

  • 07

    Choosing the learning rate

Worked example · free

Fixed-point budget and one LMS step

Q [6 marks]. A 16-bit input feeds a 256-tap FIR filter with coefficients scaled to 14 bits. Find the worst-case accumulator width and the width if the filter gain is below one. Then, with learning rate 0.02 and error 0.5, update weights whose buffer holds [0.2, −0.4]. Marks here are a revision weighting and not an official university allocation.
Noise cancelling with a mains reference: the adaptive filter learns the interference, subtraction leaves the ECG, and the error drives each weight update.Noise cancelling with a mains reference: the adaptive filter learns the interference, subtraction leaves the ECG, and the error drives each weight update.Reference x(n)50 Hz from mainsAdaptive FIRoutput y(n)Compare with d(n)error e(n)Update weightsΔh = μ e xupdated weights return to adaptive FIR
Noise cancelling with a mains reference: the adaptive filter learns the interference, subtraction leaves the ECG, and the error drives each weight update.
  • 2log₂ 256 = 8, so the worst case is 16 + 14 + 8 = 38 bits.
  • 1With gain below one the growth term can be dropped, leaving 16 + 14 = 30 bits, which fits a 32-bit accumulator.
  • 2The LMS change is μ e x(n − m) = 0.02 × 0.5 × [0.2, −0.4] = [0.002, −0.004].
  • 1Each new weight is the old weight plus its change, so the first rises by 0.002 and the second falls by 0.004.
The worst case needs 38 bits, or 30 bits when the gain is below one, and the LMS step changes the two weights by +0.002 and −0.004.
Sia tip — Add the bit counts before choosing a data type; a 32-bit integer silently fails a 38-bit worst case.
Glossary

Key terms

Fixed-point arithmetic
Integer computation in which a scale factor of two to the W represents fractional values.
Two's complement
The signed integer format whose overflow wraps cyclically from the largest to the most negative value.
Matched filter
An FIR filter whose coefficients are a time-reversed template, so its output measures similarity.
Learning rate
The step size that scales each LMS coefficient update.
FAQ

Matched and Adaptive Filters in Fixed Point FAQ

Why does a temporary overflow not ruin the result?

In two's complement, wrapping past the largest value and later wrapping back cancel exactly. As long as the finished sum fits in the accumulator, the intermediate overflows leave no trace in the output.

Why is the output of a matched filter squared?

Squaring makes every value positive and enlarges the gap between large and small values, for example turning 0.1 into 0.01 and 10 into 100. Peaks then stand out clearly against the threshold.

What reference does an LMS noise canceller need?

It needs a signal that is correlated with the interference but not with the wanted signal. For mains interference on an ECG, a 50 Hz reference works because the heart signal does not share that frequency.

Study strategy

Exam move

Split revision into the three topics and connect them at the end. For fixed point, practise bit budgets for several combinations of input width, coefficient width and tap count, and decide when the gain argument lets you drop the growth term. Scale a few coefficients by two to the twelve and to the fourteen, round them, and compute the representation error.

For matched filtering, reverse a short template by hand, convolve it with a signal that contains the template, and confirm the peak occurs where the template ends. Then sketch the full detection chain and explain each stage in one line, including a heuristic such as a maximum plausible heart rate. For LMS, run two or three updates by hand with small numbers and observe how the error changes.

Finally, connect the parts: a matched filter or an adaptive filter is still an FIR filter, so its coefficients must be scaled and its accumulator budgeted in the same way when it runs on minimal hardware.

Working through Matched and Adaptive Filters in Fixed Point in ENG5027? Sia is AskSia’s AI Electrical Engineering tutor — ask any ENG5027 Matched and Adaptive Filters in Fixed Point 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