S718 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S7 · Lesson 18 · Finite word-length effects

Fixed-point numbers, the additive model of roundoff noise, noise gain through a filter, scaling against overflow, and zero-input limit cycles

A filter designed in floating point runs on a processor with 16 or 24 bits, and every multiplication has to be rounded back to that width. Each rounding injects a tiny error that the filter then processes like signal: a recursive filter with poles near the unit circle amplifies it, sometimes by tens of decibels. Overflow is worse, since a sum that wraps around turns a small signal into a full-scale one. And with no input at all, rounding can keep a recursive filter humming forever in a limit cycle. This lesson puts numbers on all three so a design can be checked before it's coded.

  • The noise gain ∑h2[n] of a two-pole resonator 1/(1−2rcos⁡θz−1+r2z−2), in dB, against the pole angle θ: how much the filter amplifies roundoff noise injected at its input.
  • Poles near the unit circle (r → 1) raise it sharply; so do poles near θ = 0 or π, where the two poles crowd together.
  • A narrowband lowpass with r = 0.99 and θ = 0.3 multiplies the roundoff noise power by 290, nearly 25 dB.

Predict

A first-order recursive filter y[n] = 0.99y[n − 1] + x[n] runs in 16-bit fixed point with rounding after the multiply. Roughly how much louder is the roundoff noise at its output than the noise of one rounding?

Name it

Fixed point and rounding

A (B + 1)-bit two's-complement fraction covers [−1, 1) in steps of Δ=2−B. Rounding a product to that grid adds an error e[n] modeled as white noise, uniform on [−Δ/2,Δ/2]:

σe2=Δ212=2−2B12

which for B = 15 is −101.1 dB relative to 1.

Noise through a filter

A noise source injected at a node whose path to the output has impulse response g[n] produces output noise power

σf2=σe2∑ng2[n]

For a first-order pole a, ∑g2=11−a2. For the resonator above, 1+r2(1−r2)[(1+r2)2−4r2cos2⁡θ]. Every multiplier rounded separately adds its own source; in direct form I they all enter at one node.

Overflow and scaling

To guarantee no overflow with |x[n]| ≤ 1, scale the input by 1/∑|h[n]| (the L1 norm, safe but pessimistic); for sinusoidal inputs, 1/max⁡|H(ejω)| suffices. Scaling down raises the relative noise, so it trades overflow against SNR. Saturation arithmetic clips instead of wrapping and prevents the large-scale overflow oscillations that wrap-around can sustain.

Limit cycles

With rounding, a first-order filter y[n]=Q(ay[n−1]) can get stuck at a nonzero value with no input: any |y| inside the dead band

|y|≤Δ/21−|a|

rounds back to itself (a > 0) or alternates in sign (a < 0). For a = 0.9 that's up to 5 LSBs of steady output from a filter that should have decayed to zero.

Worked example

A 16-bit (B = 15) filter with a pole at 0.99 has one rounding point at its input. What's the output noise, in dB relative to full scale, and in LSBs rms?

Show the solution
  1. Rounding noise. σe2=2−3012 which is −101.1 dB.
  2. Noise gain. G=11−0.9801=50.3 which is +17.0 dB.
  3. Output noise. −101.1+17.0=−84.1dB re 1.
  4. In LSBs. σ=50.3/12=2.05LSB rms so the bottom bit of the output is pure noise.

Answer −84.1 dB relative to full scale, or 2.05 LSB rms.

Worked example

The same filter must never overflow for inputs bounded by 1. How much must the input be scaled, and what does that do to the SNR?

Show the solution
  1. Worst-case gain. ∑|h[n]|=∑0.99n=100
  2. Scale the input. The input must be multiplied by 0.01, a 40 dB reduction in signal while the roundoff noise stays put: the SNR drops by 40 dB.
  3. Sinusoidal inputs. For sinusoidal inputs the peak gain |H(1)| = 100 gives the same factor here; for wideband filters the two scalings differ.

Answer the input must be scaled by 0.01, which costs 40 dB of SNR.

Worked example

A resonator with poles at 0.95e±jπ/3 rounds once at its input. What is its noise gain, and its output noise in LSBs rms?

Show the solution
  1. Noise-gain formula. G=1+r2(1−r2)[(1+r2)2−4r2cos2⁡θ]
  2. Put in r = 0.95 and θ = π/3. G=1.90250.0975×(3.6195−0.9025)=7.18 or 8.6 dB.
  3. Output noise. Rounding noise of 1/12 LSB² becomes σ2=7.1812LSB2=0.60LSB2 which is 0.77 LSB rms.
  4. Closer poles. Moving the poles closer to the circle raises the gain roughly as 1/(1−r), so narrow resonators need more bits.

Answer a noise gain of 7.18 (8.6 dB), giving 0.77 LSB rms at the output.

Check

Products are rounded to B = 11 fractional bits. What's the roundoff noise power in dB relative to 1?

Check

Roundoff noise enters a first-order recursive filter with its pole at 0.9. By how much is it amplified?

Check

What's the noise gain of the resonator with poles at 0.9e^{±j0.4}?

Check

A filter with pole 0.95 rounds once at its input. What's the output roundoff noise in LSBs rms?

Check

To make overflow impossible for any input bounded by 1, by what factor must the input of the filter with pole 0.9 be scaled?

Check

A first-order filter with pole 0.9 rounds after the multiply. How large (in LSBs) can a zero-input limit cycle be?

Check

A filter with a pole at 0.5 rounds once at its input, with B = 15 fractional bits.

(a)

What is the output noise power relative to full scale?

(b)

How large can a zero-input limit cycle be?

Check

A first-order filter with pole a rounds to B fractional bits once per sample.

Step 1

What is the rounding noise power?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why does rounding make a recursive filter able to oscillate forever with no input, when the ideal filter decays to zero?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.