Some tips for wavelet

4 min read

Wavelet analysis is a classic and powerful tool for analyzing signals, but its mathematical theory is quite difficult and complicated. In addition to the formula derivation, wavelet analysis has some small but useful details that could be easily ignored. Here I leave some tips so I can quickly pick up things about wavelet in the future.

  • Any function whose domain is negative infinity to positive infinity and the integral of the function in the domain is 0 can be called a wavelet function. Some extra conditions (orthogonal normalization, scale dispersion, Compact Support, etc.) are required for computational simplicity and engineering implementation.
  • Compared to the classical Fourier transform, wavelet can not only perform amplitude-frequency analysis, but also time-frequency analysis. Compared with the short-time Fourier transform (STFT), wavelet analysis can achieve higher resolution in the time domain and the frequency domain, and the calculation needed for optimized discrete wavelet is much smaller than the STFT.
  • For the fitting of the mutated signal, the wavelet expression is simpler in the same precision (ie, fewer terms with non-zero coefficients). This makes the wavelet transform very suitable for compression algorithms.
  • For fast Fourier transform (FFT), the algorithm time complexity is O(N*logN); for optimized wavelet transform, the algorithm time complexity is O(N), which is faster than FFT.
  • If mother wavelet is marked ψ(x)\psi(x), the collection of wavelet bases can be represented as {psijk,jZ,kZ}\{psi _{jk}, j \in Z, k \in Z\} Or, it can also be represented as { phij0,k,ψjk,jj0,kZ}\{\ phi _{j_0,k}, \psi _{jk}, j \ge j_0, k \in Z\}, where ϕ00\phi _{00} is called the scaling function.

    • Pay attention to the difference between the domain of two collections
    • The reason why the two are mutually alternative is because the collection { phij0,k,kZ}\{\ phi _{j_0,k}, k \in Z\} owns the same subspace with the collection {ψjk,j<j0,kZ}\{ \psi _{jk}, j < j_0 , k \in Z\}
    • When using the wavelet transform in production, the latter set (that is, the set containing the scaling function) is used as the wavelet base , mainly because the decomposition coefficient items of the previous set are too much.
    • Simple wavelet decomposition result of the actual signal (such as haar wavelet) can be obtained by matrix calculation. An example of this can be found in WAVELETS FOR KIDS.
  • For wavelet decomposition of large amount of signals, the matrix calculation method expenses the much calculation resources hence it’s difficult to apply to production. To solve this problem, Mallat proposed the Mallat algorithm, which is a classical algorithm for implementing wavelet decomposition in production.
  • Decomposition formula for Mallat algorithm:

    Aj+1(n)=kH(k)Aj(2nk),Dj+1(n)=kG(k)Aj(2nk)A_{j+1}(n) = \sum_k H(k)A_j(2n - k), D_{j+1}(n) = \sum_k G(k)A_j( 2n - k)

    • From the perspective of signal processing, the Mallat algorithm actually equates wavelet decomposition to the combined output of two filters at each scale.
    • MATLAB’s wfilters function is able to get the coefficients of the filter groups. For example, with [Lo_D, Hi_D, Lo_R, Hi_R] = wfilters('db1'), you can get the filter coefficient of haar wavelet, where Lo stands for low-pass filter, ie H(k);Hi stands for high-pass filter, ie G(k); _D stands for decomposition coefficient; _R stands for reconstruction coefficient.
    • Since the actual input signal is finite, it is now and then to face boundary problems. Zero extension is the easiest solution, but it is also the worst one. The cycle extension can guarantee the accuracy of the reconstruction, but it will cause the wavelet coefficient become large at the edge of signal. The widely used extension method is symmetric extension.
    • Classic implementation of symmetric extension:

      f(n)={f(n1)(filterLen1)n<0f(n)0nsLen1f(2sLenn1)Len1<nsLen+filterLen2f^`(n) = \left\{\begin{matrix} f(-n-1) & -(filterLen - 1) \le n < 0\\ f( n) & 0 \le n \le sLen - 1\\ f(2sLen - n - 1) & Len - 1 < n \le sLen + filterLen -2 \end{matrix}\right.

  • Reconstruction formula for Mallat algorithm:

    Aj(n)=kh(n2k)Aj+1(k)+kg(n2k)Dj+1(k)A_j(n) = \sum_k h(n - 2k)A_{j+1}(k) + \sum_k g(n - 2k)D_{j+1}(k)

  • Wavelet analysis studies the square integrable function space, which means that the mother wavelet must be the derivative of a function f(x). In fact, the ratio of the wavelet coefficient of a signal to the derivative of the impulse response of the same signal filtered is a fixed value. That is to say, the zero-crossing point of the discrete signal wavelet coefficient is the extreme point of the original signal filtered on the scale, and the maximum value of the wavelet is the maximum slope of the filtered signal.