# Intuition behind the Continuous Wavelet Transform?

I was thinking sometime back about how to explain the Continuous Wavelet Transform ELI5. So this is what I came across.

The correlation of two exact signals is 1. So if I have an input signal $f(x)$ made up of an array of frequencies, how can I find out what frequencies exist at what points? Well, slide a signal $m(y)$ where $-\infty > y > +\infty$ over $f(x)$, and at those points where the co-relation of these signals is 1, well, those frequencies are present, at those times. This if of course a Continuous Wavelet Transform. Am I correct?

• Continuous complex Morlet wavelet transform is exactly the same thing as the continuous STFT, except you stretch and squeeze the blips, changing the length but keeping the number of wiggles the same, while STFT keeps the length the same while making the blips more or less wiggly. Commented May 16, 2014 at 16:18
• What is ELI5 behind "Continuous Wavelet Transform"? Commented Feb 27, 2016 at 21:00
• Commented Feb 13, 2023 at 16:33

I think that the best way to explain the CWT is to start by explaining the Fourier Transform, then move on to explaining the Short-Time Fourier Transform, and then finally explain the CWT as a variation of the STFT.

The Fourier Transform exploits the fact that any decently behaved function can be represented as a sum of sinusoids (i.e. a Fourier series) and that the sinusoid basis posses the property of orthogonality:

$$\int_{-\infty}^{\infty} \sin(nx)\,\sin(mx)\,dx = \int_{-\infty}^{\infty} \cos(nx)\,\cos(mx)\,dx = \begin{cases} 1, & \text{if n=m} \\ 0, & \text{if n\neq m} \end{cases}$$

So, since:

$$e^{iax} = \cos(ax)+i\,\sin(ax)$$

the Fourier Transform is simply doing this integration for all frequencies and keeping track of which outputs are zero (i.e. that frequency is not in the signal) and which are non-zeros (i.e. that frequency is in the data and its output is scaled by how much of it is in there):

$$S(f) = \int_{-\infty}^{\infty} s(t)\,e^{i2\pi ft}dt$$

In this case you are doing this integration over the entire signal so you can't really tell if the frequency content is changing from the beginning of the signal to the end. One way around this is to compute the Short-Time Fourier Transform: i.e. window the signal, calculate the Fourier transform of the windowed signal, store it, then shift the window down a bit and repeat for all shifts:

$$S(\tau,f) = \int_{-\infty}^{\infty} w(t- \tau)\,s(t)\,e^{i2\pi ft}dt$$

where

$$w(\tau,t)=\begin{cases} 1, & \text{if \tau\approx t} \\ 0, & \text{if \tau \not\approx t} \end{cases}$$

The key thing here is that you are calculating the typical Fourier transform but of a new signal that only exists in a localized part of the t-axis. To emphasize this, you can see the new signal whose Fourier transform we are calculating by associating:

$$S(\tau,f) = \int_{-\infty}^{\infty} [w(t-\tau)\,s(t)]\,e^{i2\pi ft}dt$$

And here's a graphical example of this showing the new signal for different $\tau$ values and on the right are a few sinusoids to represent what we are using to decompose the signals (i.e. our basis, or kernel).

But, we can also change the association as such without changing the outcome:

$$S(\tau,f) = \int_{-\infty}^{\infty} s(t)\,[w(t-\tau)\,e^{i2\pi ft}]dt$$

So this means that instead of windowing our signal, we are windowing our basis functions. But here's the kicker, if we are windowing our basis functions, we don't have to use a constant-size window since we know that a basis function of high frequency will need a shorter window than a basis function of low frequency. This is the whole point of the CWT. It is a decomposition of a signal by "wavelets" (i.e. windowed sinusoids in this case) where the windowing is adaptive to the sinusoid frequency. If the we choose a Gaussian window (as I have chosen in these examples), then our wavelets are called Morlet wavelets (or Gabor wavelets, in some literature).

Finally, you can generalize this for any choice of wavelet that you want. In that generalization, you can describe your wavelet basis functions as being "stretched" and "squeezed" versions of some arbitrary "mother" wavelet, $\psi$. And so the previous equation can now be written as the final form of the CWT:

$$S(a,b) = \frac{1}{\sqrt b}\int_{-\infty}^{\infty} s(t)\,\psi (\frac{t-a}{b})dt$$

where $a$ is now what used to be our $\tau$ (i.e. a time shift), and $b$ is called the "scale" which is just a parameter to stretch and squeeze the wavelet (similar to what our parameter $f$ was except now the interpretation is more difficult). And the only reason you have the $\frac{1}{\sqrt b}$ up front is to normalize the wavelets so that they have the same "energy" and you end up comparing apples to apples in your time-frequency representation.

I hope this helps!

-Antonio

A wavelet has a shape, seldom a frequency. That is why the Gabor transforms and Gabor wavelet got an extra name. The Mexican hat, for instance, can be more precisely described as having a dominant frequency range.

In your explanation, the scale direction of the CWT is still missing. The interpretation of convolution is correct. However, in CWT, detection of details or events of a signal is not unique to one time and scale, there will be a time and scale range associated, most often, something looking like a curve in the time-scale image.

• "seldom a frequency" disagreed. The provided example is also bad, Gabor CWT is about as analogous to STFT as it gets. Commented Feb 13, 2023 at 18:01
• That depends on what you mean. Among all the functions that satisfy the minimal conditions for a CWT wavelet, the ones that are approximately localized in time and frequency are a small subset. Explicit (simple) constructions of such well-behaved, practically useful wavelets usually get named. What is better among the good wavelets is then another question. Commented Feb 13, 2023 at 19:04
• My concern is that such blunt framing serves the myth that "CWT is scales, not frequencies", while frequencies are just as (if not more) applicable as in STFT. "Frequency" isn't flawlessly executed in FFT either, in fact it's even worse! I've not studied all CWT wavelets, but what I've seen from scipy, PyWavelets, and MATLAB look fine to me, and should cover vast majority of use cases. And again, if by "Gabor" we mean Gaussian-windowed complex sinusoids, that to me is a peak example of "as good as in STFT". Commented Feb 14, 2023 at 11:42
• To a large part, scales are frequencies (usually depicted in a logarithmic scale). One can not avoid the uncertainty inequality (here of the Fourier transform, frequency standing for impulse). Wavelets have a place in the middle, neither localized in frequency, but best if concentrated in a frequency band, and not localized in position, but best if concentrated (if not fully contained) in a compact interval. All finite approximations of the CWT, DWT and also the Fourier transforms suffer from aliasing effects, especially if the signal is far from band-limited. Commented Feb 14, 2023 at 13:20
• Sure, they're Heisenberg-bound, just like STFT! Hence "center" frequency - only difference being log-scaling of frequencies and bandwidths, and zero-mean enforcement. And with a few extra steps on qualifying signals, both can break Heisenberg. Commented Feb 14, 2023 at 13:51

You might be interested in the following link where wavelet transform is intuitively presented. It starts from Fourier transform and points out the problem of loss of localisation in frequency domain. It is followed by Short Time Fourier Transform (STFT). Duality in time frequency is also stated for STFT and then the concept of SCALE is introduced followed by THE WAVELET TRANSFORM