# Daubechies Daub4 wavelet transform

The level 1 Daubechies Daub4 wavelet transform of the signal x(k) of length N is x → (b1 | a1), where a1 and b1 are vectors of length N/2, computed from x via the inner products

$$a_1=(A_1*x,A_2*x,...,A_{N/2}*x)$$ $$b_1=(B_1*x,B_2*x,...,B_{N/2}*x)$$

with the vectors of length N

$$A_1=(\frac{1+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{3-\sqrt{3}}{4\sqrt{2}},\frac{1-\sqrt{3}}{4\sqrt{2}},0,0,0,0,...,0,0,0,0,0)$$ $$A_2=(0,0,\frac{1+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{3-\sqrt{3}}{4\sqrt{2}},\frac{1-\sqrt{3}}{4\sqrt{2}},0,0,...,0,0,0,0,0)$$ $$A_3=(0,0,0,0,\frac{1+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{3-\sqrt{3}}{4\sqrt{2}},\frac{1-\sqrt{3}}{4\sqrt{2}},...,0,0,0,0,0)$$ $$...$$ $$A_{\frac{N}{2}-1}=(0,0,0,0,0,0,0,0,...,\frac{1+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{3-\sqrt{3}}{4\sqrt{2}},\frac{1-\sqrt{3}}{4\sqrt{2}})$$ $$A_{\frac{N}{2}}=(\frac{3-\sqrt{3}}{4\sqrt{2}},\frac{1-\sqrt{3}}{4\sqrt{2}},0,0,0,0,0,0,...,0,0,\frac{1+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}})$$

and

$$B_1=(\frac{1-\sqrt{3}}{4\sqrt{2}},\frac{-3+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{-1-\sqrt{3}}{4\sqrt{2}},0,0,0,0,...,0,0,0,0,0)$$ $$B_2=(0,0,\frac{1-\sqrt{3}}{4\sqrt{2}},\frac{-3+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{-1-\sqrt{3}}{4\sqrt{2}},0,0,...,0,0,0,0,0)$$ $$B_3=(0,0,0,0,\frac{1-\sqrt{3}}{4\sqrt{2}},\frac{-3+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{-1-\sqrt{3}}{4\sqrt{2}},...,0,0,0,0,0)$$ $$...$$ $$B_{\frac{N}{2}-1}=(0,0,0,0,0,0,0,0,...,\frac{1-\sqrt{3}}{4\sqrt{2}},\frac{-3+\sqrt{3}}{4\sqrt{2}},\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{-1-\sqrt{3}}{4\sqrt{2}})$$ $$B_{\frac{N}{2}}=(\frac{3+\sqrt{3}}{4\sqrt{2}},\frac{-1-\sqrt{3}}{4\sqrt{2}},0,0,0,0,0,0,...,0,0,\frac{1-\sqrt{3}}{4\sqrt{2}},\frac{-3+\sqrt{3}}{4\sqrt{2}})$$

The level 2 Daubechies Daub4 wavelet transform is x → (b1 | b2 | a2), where a2 and b2 are the level 1 Daubechies Daub4 wavelet transform of a1, computed with vectors A and B of length N / 2. The level N Daubechies Daub4 wavelet transform is computed by successively taking the transforms of the "a" portion of the previous level of the transform, with vectors that are of length equal to half of the length of the previous transform.

Note that x(k) can be reconstructed from a1 and b1 with the computation

$$x(k)=\sum_{i=0}^{N-1}A_i(k)a_1(i)+\sum_{i=0}^{N-1}B_i(k)b_1(i)$$

In the level 2 transform, a1 can be reconstructed from a2 and b2 and thus x(k) can be reconstructed from b1, b2, and a2 (hence, a1 is omitted from the definition of the transform x → (b1 | b2 | a2)).

In each successive iteration, the "a" and "b" vectors are of length equal to half of the length of the previous level transform. Thus, if N = 2n for some integer n, we can write x → (b1 | b2 | … | bN-1 | aN-1), where aN-1 and bN-1 are vectors of length 2 (unlike when using the Haar wavelet transform, we cannot get to level N and vectors aN and bN of length 1, as the A and B vectors have four nonzero values rather than just two). Note that b1 is of length N / 2, b2 is of length N / 4 and so on. The combined length of b1, b2, …, bN-1, aN-1 is N and so these vectors carry the same amount of information as x(k). Since x(k) can be reconstructed from these vectors, they carry the same information as x(k).

As in the Haar wavelet transform, a1 averages the signal x(k) and is the "trend" of the signal. b1 contains the fluctuations that a1 removes. a1 is computed as the convolution of the signal x(k) with A1 (with the caveat that the step of this convolution is two samples, rather than one). b1 is the convolution of the signal x(k) with B1. In other words, a1 and b1 are the results of a low pass filter and a high pass filter on x(k) (the vectors A1 and B1). Similarly, a2 and b2 are the trend and fluctuations of a1 and so on.

The Daub4 wavelet transform is only one of the Daubechies wavelet transforms.

## Data compression example with the Daubechies Daub4 wavelet transform

Take the signal x(k) of length N = 256 that consists of two simple waves with frequencies 5 Hz and 9 Hz, given the sampling frequency 256 Hz. The phase of the 9 Hz frequency is 10 samples and the phase of the 5 Hz frequency is zero. The signal is

$$x(k)=\sin(\frac{2\pi\,k\,5}{256})+\sin(\frac{2\pi\,(k-10)\,9}{256})$$

A detailed example of compressing this signal is provided in the topic Haar wavelet transform. This example here compares the results of the Haar and Daubechies Daub4 wavelet transforms.

Decompose this signal using the Daubechies Daub4 wavelet transform into b1, b2, …, b7, and a7. Sort all values of these vectors (as one single array) and remove the smallest values (replace them with 0). If we need to transmit the signal, we can transmit only the nonzero values. We can use bitmasks to denote where the nonzero values should be placed when the b1, …, a7 vectors are reconstructed and we can then reconstruct the signal x(k) from these vectors. This will result in transmitting less data, than the signal x(k) itself.

In the example described in the topic Haar wavelet transform, for example, removing half of all values (the smaller values) allowed the transform to retain 99.5% of the energy of the signal, where the energy is computed as the sum of the squares of the values of the transform. Since half of the values were zeroed out, the compression ratio in that example was 2:1. In the Daubechies Daub4 wavelet transform of this same signal, 99.5% of the energy can be retained if only a fifth of the values are retained and four fifths are zeroed out. That is, the same amount of energy can be retained with 5:1 compression. If 5:1 compression is used in the Haar wavelet transform, the loss of energy will be over 5%, which is significant.

The reconstructed signal x(k), after a number of values are removed from the vectors b1, …, a7, is not the same as the original, of course. The following graphs show the two signals.

The frequency content of the reconstructed signal is also different. The following two graphs show a zoom in the Fourier transform of the original and reconstructed signals.

### Filtered HTML

• Freelinking helps you easily create HTML links. Links take the form of [[indicator:target|Title]]. By default (no indicator): Click to view a local node.