This example shows how the variable time-frequency resolution of the continuous wavelet transform can help you obtain a sharp time-frequency representation.
- Wavelet Toolbox™ provides functions and apps for analyzing and synthesizing signals and images. The toolbox includes algorithms for continuous wavelet analysis, wavelet coherence, synchrosqueezing, and data-adaptive time-frequency analysis.
- We would like to show you a description here but the site won’t allow us.
The continuous wavelet transform (CWT) is a time-frequency transform, which is ideal for analyzing nonstationary signals. A signal being nonstationary means that its frequency-domain representation changes over time. Many signals are nonstationary, such as electrocardiograms, audio signals, earthquake data, and climate data.
Load Hyperbolic Chirp
Apache2 Ubuntu Default Page: It works.
Load a signal that has two hyperbolic chirps. The data are sampled at 2048 Hz. The first chirp is active between 0.1 and 0.68 seconds, and the second chirp is active between 0.1 and 0.75 seconds. The instantaneous frequency (in hertz) of the first chirp at time is . The instantaneous frequency of the second chirp at time is . Plot the signal.
Time-Frequency Analysis: Fourier Transform
The Fourier transform (FT) is very good at identifying frequency components present in a signal. However, the FT does not identify when the frequency components occur.
Plot the magnitude spectrum of the signal. Zoom in on the region between 0 and 200 Hz.
Wavelet Transform In Matlab
Time-Frequency Analysis: Short-Time Fourier Transform
The Fourier transform does not provide time information. To determine when the changes in frequency occur, the short-time Fourier transform (STFT) approach segments the signal into different chunks and performs the FT on each chunk. The STFT tiling in the time-frequency plane is shown here.
The STFT provides some information on both the timing and the frequencies at which a signal event occurs. However, choosing a window (segment) size is key. For time-frequency analysis using the STFT, choosing a shorter window size helps obtain good time resolution at the expense of frequency resolution. Conversely, choosing a larger window helps obtain good frequency resolution at the expense of time resolution.
Once you pick a window size, it remains fixed for the entire analysis. If you can estimate the frequency components you are expecting in your signal, then you can use that information to pick a window size for the analysis.
The instantaneous frequencies of the two chirps at their initial time points are approximately 5 Hz and 15 Hz. Use the helper function helperPlotSpectrogram
to plot the spectrogram of the signal with a time window size of 200 milliseconds. The source code for helperPlotSpectrogram
is listed in the appendix. The helper function plots the instantaneous frequencies over the spectrogram as black dashed-line segments. The instantaneous frequencies are resolved early in the signal, but not as well later.
Now use helperPlotSpectrogram
to plot the spectrogram with a time window size of 50 milliseconds. The higher frequencies, which occur later in the signal, are now resolved, but the lower frequencies at the beginning of the signal are not.
For nonstationary signals like the hyperbolic chirp, using the STFT is problematic. No single window size can resolve the entire frequency content of such signals.
Time-Frequency Analysis: Continuous Wavelet Transform
The continuous wavelet transform (CWT) was created to overcome the resolution issues inherent in the STFT. The CWT tiling on the time-frequency plane is shown here.
The CWT tiling of the plane is useful because many real-world signals have slowly oscillating content that occurs on long scales, while high frequency events tend to be abrupt or transient. However, if it were natural for high-frequency events to be long in duration, then using the CWT would not be appropriate. You would have poorer frequency resolution without gaining any time resolution. But that is quite often not the case. The human auditory system works this way; we have much better frequency localization at lower frequencies, and better time localization at high frequencies.
Plot the scalogram of the CWT. The scalogram is the absolute value of the CWT plotted as a function of time and frequency. The plot uses a logarithmic frequency axis because frequencies in the CWT are logarithmic. The presence of the two hyperbolic chirps in the signal is clear from the scalogram. With the CWT, you can accurately estimate the instantaneous frequencies throughout the duration of the signal, without worrying about picking a segment length.
The white dashed line marks what is known as the cone of influence. The cone of influence shows areas in the scalogram potentially affected by boundary effects. For more information, see Boundary Effects and the Cone of Influence.
To get a sense of how rapidly the magnitude of the wavelet coefficients grows, use the helper function helperPlotScalogram3d
to plot the scalogram as a 3-D surface. The source code for helperPlotScalogram3d
is listed in the appendix.
Use the helper function helperPlotScalogram
to plot the scalogram of the signal and the instantaneous frequencies. The source code for helperPlotScalogram
is listed in the appendix. The instantaneous frequencies align well with the scalogram features.
Appendix – Helper Functions
helperPlotSpectrogram
helperPlotScalogram
helperPlotScalogram3d
See Also
cwt
| cwtfilterbank
| waveletScattering
| waveletScattering2
Related Topics
Algorithms
For compactly supported wavelets defined by filters, in general no closed form analytic formula exists.
The algorithm used is the cascade algorithm. It uses the single-level inverse wavelet transform repeatedly.
Let us begin with the scaling function ϕ.
Since ϕ is also equal to ϕ0,0, this function is characterized by the following coefficients in the orthogonal framework:
<ϕ, ϕ0,n> = 1 only if n = 0 and equal to 0 otherwise
<ϕ, ψ−j,k> = 0 for positive j, and all k.
This expansion can be viewed as a wavelet decomposition structure. Detail coefficients are all zeros and approximation coefficients are all zeros except one equal to 1.
Then we use the reconstruction algorithm to approximate the function ϕ over a dyadic grid, according to the following result:
For any dyadic rational of the form x = n2−j in which the function is continuous and where j is sufficiently large, we have pointwise convergence and
Wavelet Matlab Tutorial Pdf
where C is a constant, and α is a positive constant depending on the wavelet regularity.
Then using a good approximation of ϕ on dyadic rationals, we can use piecewise constant or piecewise linear interpolations η on dyadic intervals, for which uniform convergence occurs with similar exponential rate:
So using a J-step reconstruction scheme, we obtain an approximation that converges exponentially towards ϕ when J goes to infinity.
Approximations are computed over a grid of dyadic rationals covering the support of the function to be approximated.
Since a scaled version of the wavelet function ψ can also be expanded on the (ϕ−1,n))n, the same scheme can be used, after a single-level reconstruction starting with the appropriate wavelet decomposition structure. Approximation coefficients are all zeros and detail coefficients are all zeros except one equal to 1.
For biorthogonal wavelets, the same ideas can be applied on each of the two multiresolution schemes in duality.
Matlab Discrete Wavelet Transform
Note
This algorithm may diverge if the function to be approximated is not continuous on dyadic rationals.