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

S7 · Lesson 43 · Wavelets and multiresolution

The discrete wavelet transform as an iterated filter bank, Haar and Daubechies filters, and wavelet denoising

The STFT (lesson 30) analyzes every frequency with the same window, so it must choose between seeing quick events and resolving close tones. Many signals want both at once: a transient's sharp edge needs fine time resolution at high frequencies, while a slow drift needs fine frequency resolution at low ones. The discrete wavelet transform gets this by splitting a signal in two with a perfect-reconstruction filter bank (lesson 42), then splitting the low half again, and again. The result is a set of octave bands, each sampled just fast enough, with as many coefficients as the signal had samples and an O(N) cost.

  • The curves are the lowpass responses of the two simplest orthogonal wavelets: Haar, 2|cos⁡(ω/2)|, and Daubechies-4, 2cos4⁡(ω/2)(1+2sin2⁡(ω/2)).
  • Both pass DC with gain √2 and reject ω = π completely; D4's extra zero at π makes it flatter at both ends.
  • Each level of the transform reuses the same filters on the previous level's lowpass output, halving the band each time.

Predict

A signal of 4096 samples at 8 kHz goes through a three-level wavelet transform. Which band does the third level's detail cover, and how many coefficients does it have?

Name it

The iterated filter bank

An orthogonal two-channel bank uses a lowpass h0 of even length L and the highpass h1[n]=(−1)nh0[L−1−n], each followed by decimation by 2; synthesis uses the time-reversed filters and reconstructs perfectly. The discrete wavelet transform applies it J times to the lowpass output:

  • level j's detail covers fs/2j+1 to fs/2j and has N/2j coefficients; the final approximation has N/2J;
  • the bands are octaves, constant-Q: short windows at high frequencies, long ones at low;
  • the total cost is about 2LN multiplications, since each level handles half the samples of the one before.

Haar and Daubechies

  • Haar: h0=[1,1]/2. Each level's approximation is the scaled sum of pairs, the detail the scaled difference. Simple, but its blocky basis spreads smooth signals into many details.
  • Daubechies-4: h0=142[1+3,3+3,3−3,1−3]=[0.483,0.837,0.224,−0.129], with two vanishing moments: its details are zero for any linear trend, so smooth regions produce almost no detail coefficients.
  • For orthonormal filters ∑h0=2 and ∑h02=1, so the transform preserves energy.

Denoising by thresholding

A smooth signal's energy concentrates in a few large coefficients while white noise spreads evenly over all of them. Setting detail coefficients below a threshold to zero (hard) or shrinking all of them toward zero by it (soft), then inverting, removes most of the noise and keeps edges sharp. Donoho's universal threshold is σ2ln⁡N for noise of standard deviation σ in N coefficients.

Worked example

Take two levels of the Haar transform of [4, 6, 10, 12] and check the energy.

Show the solution
  1. Level 1 approximations. (4+6)/2=7.07(10+12)/2=15.56
  2. Level 1 details. (4−6)/2=−1.41(10−12)/2=−1.41
  3. Level 2. Transform the two approximations again: (7.07+15.56)/2=16(7.07−15.56)/2=−6
  4. Energy. 162+62+1.412+1.412=296=42+62+102+122 Most of it sits in one coefficient.

Answer the transform is [16, −6, −1.41, −1.41], and its energy, 296, matches the signal's.

Worked example

Check the Daubechies-4 lowpass taps and find the first highpass tap.

Show the solution
  1. Sum of the taps. h0=[0.483,0.837,0.224,−0.129] sums to 1.414 = √2.
  2. Sum of the squares. The squares sum to 1, as orthonormality requires.
  3. Highpass. h1[n]=(−1)nh0[3−n]=[−0.129,−0.224,0.837,−0.483]
  4. Check. Its entries sum to zero: no response at DC.

Answer the lowpass taps sum to √2 with squares summing to 1, and the first highpass tap is −0.129.

Worked example

A 4096-sample record has white noise of standard deviation 0.1. What universal threshold does wavelet denoising use?

Show the solution
  1. Universal threshold. T=σ2ln⁡N=0.12ln⁡4096=0.1×4.08=0.41
  2. What it does. Pure noise coefficients almost never exceed it, so after thresholding the noise is nearly gone.
  3. What survives. Signal coefficients larger than 0.41 survive, keeping edges that a linear lowpass filter would blur.

Answer a threshold of 0.41.

Check

The Haar transform's first level acts on the pair [3, 1].

(a)

What is the approximation coefficient?

(b)

What is the detail coefficient?

Check

A wavelet transform runs on 16 kHz data; consider level 1's detail.

(a)

What is its lower band edge?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

What is its upper band edge?

Check

An N = 4096-sample signal gets a J = 3-level wavelet transform.

(a)

How many detail coefficients does level 3 have?

(b)

How many approximation coefficients remain?

Check

Wavelet denoising handles N = 512 coefficients with noise of standard deviation 0.1.

(a)

What is the universal threshold?

Check

A wavelet transform with length-4 filters runs on 1024 samples, to many levels.

(a)

About how many multiplications does it need?

Check

Why does a wavelet transform suit a signal with sharp transients on a slowly varying background better than an STFT with one fixed window?

Check

A Haar level acts on [a, b].

Step 1

What is the approximation s?

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

Check

Write haar(x, J): a J-level orthonormal Haar transform of a list whose length is divisible by 2J, returning (approximation, [detail level 1, …, detail level J]), and ihaar(a, details) that inverts it.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why does thresholding wavelet coefficients remove noise while keeping sharp edges, when a lowpass filter blurs them?

Practice

Keep practicing

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