## Continuous Wavelet Transform as a Bandpass Filter

### CWT as a Filtering Technique

The continuous wavelet transform (CWT) computes the inner product of a signal, $$f(t)$$, with translated and dilated versions of an analyzing wavelet, $$\psi (t).$$ The definition of the CWT is:

$$C(a,b;f(t),\psi (t))={\displaystyle {\int}_{-\infty}^{\infty}f}(t)\frac{1}{a}{\psi}^{*}\left(\frac{t-b}{a}\right)dt$$

You can also interpret the CWT as a frequency-based filtering of the signal by rewriting the CWT as an inverse Fourier transform.

$$C(a,b;f(t),\psi (t))=\frac{1}{2\pi}{\displaystyle {\int}_{-\infty}^{\infty}\widehat{f}}(\omega )\overline{\widehat{\psi}}(a\omega ){e}^{i\omega b}d\omega $$

where $$\widehat{f}(\omega )$$ and $$\widehat{\psi}(\omega )$$ are the Fourier transforms of the signal and the wavelet.

From the preceding equations, you can see that stretching a wavelet in time causes its support in the frequency domain to shrink. In addition to shrinking the frequency support, the center frequency of the wavelet shifts toward lower frequencies. The following figure demonstrates this effect for a hypothetical wavelet and scale (dilation) factors of 1,2, and 4.

This depicts the CWT as a bandpass filtering of the input signal. CWT coefficients at
lower scales represent energy in the input signal at higher frequencies, while CWT
coefficients at higher scales represent energy in the input signal at lower frequencies.
However, unlike Fourier bandpass filtering, the width of the bandpass filter in the CWT is
inversely proportional to scale. The width of the CWT *filters* decreases
with increasing scale. This follows from the *uncertainty* relationships
between the time and frequency support of a signal: the broader the support of a signal in
time, the narrower its support in frequency. The converse relationship also holds.

In the wavelet transform, the scale, or dilation operation is defined to preserve
energy. To preserve energy while shrinking the frequency support requires that the peak
energy level increases. The implementation of `cwt`

in Wavelet Toolbox™ uses L1 normalization. The *quality factor*, or *Q
factor* of a filter is the ratio of its peak energy to bandwidth. Because
shrinking or stretching the frequency support of a wavelet results in commensurate increases
or decreases in its peak energy, wavelets are often referred to as constant-Q
filters.

### DFT-Based Continuous Wavelet Transform

The equation in the preceding section defined the CWT as the inverse Fourier transform of a product of Fourier transforms.

$$C(a,b;f(t),\psi (t))=\frac{1}{2\pi}{\displaystyle {\int}_{-\infty}^{\infty}\stackrel{\wedge}{f}}(\omega ){\widehat{\psi}}^{*}(a\omega ){e}^{j\omega b}d\omega $$

The *time* variable in the inverse Fourier transform is the
translation parameter, *b*.

This suggests that you can compute the CWT with the inverse Fourier transform. Because
there are efficient algorithms for the computation of the discrete Fourier transform and its
inverse, you can often achieve considerable savings by using `fft`

and `ifft`

when possible.

To obtain a picture of the CWT in the Fourier domain, start with the definition of the wavelet transform:

$$<f(t),{\psi}_{a,b}(t)>=\frac{1}{a}{\displaystyle {\int}_{-\infty}^{\infty}f}(t){\psi}^{*}({\scriptscriptstyle \frac{t-b}{a}})dt$$

If you define:

$${\tilde{\psi}}_{a}(t)=\frac{1}{a}{\psi}^{*}(-t/a)$$

you can rewrite the wavelet transform as

$$(f\ast {\tilde{\psi}}_{a})(b)={\displaystyle {\int}_{-\infty}^{\infty}f}(t){\tilde{\psi}}_{a}(b-t)dt$$

which explicitly expresses the CWT as a convolution.

To implement the discretized version of the CWT, assume that the input sequence is a
length N vector, *x[n]*. The discrete version of the preceding convolution is:

$${W}_{a}[b]={\displaystyle \sum _{n=0}^{N-1}x}[n]\text{\hspace{0.05em}}\text{\hspace{0.05em}}{\tilde{\psi}}_{a}[b-n]$$

To obtain the CWT, it appears you have to compute the convolution for each value of the
shift parameter, *b*, and repeat this process for each scale,
*a*.

However, if the two sequences are circularly-extended (periodized to length N), you can express the circular convolution as a product of discrete Fourier transforms. The CWT is the inverse Fourier transform of the product

$${W}_{a}(b)=\frac{1}{N}\sqrt{\frac{2\pi}{\Delta t}}{\displaystyle \sum _{k=0}^{N-1}\stackrel{\wedge}{X}}(2\pi k/N\Delta t)\stackrel{\wedge}{\psi}*(a2\pi k/N\Delta t){e}^{j2\pi kb/N}$$

where Δt is the sampling interval (period).

Expressing the CWT as an inverse Fourier transform enables you to use the
computationally-efficient `fft`

and `ifft`

algorithms to reduce the cost of computing convolutions.

The `cwt`

function implements the CWT.