The Wavelet Toolbox™ software enables you to perform a continuous wavelet analysis of your univariate or bivariate 1-D input signals. You can perform continuous wavelet analyses at the command line or with graphical user interfaces accessible through wavemenu.
Key features include:
Continuous wavelet transform (CWT) of a 1-D input signal using real-valued and complex-valued wavelets. The Wavelet Toolbox software features CWT algorithms based on the correlation of the signal with an analyzing wavelet, cwt, and based on the discrete Fourier transform of the input signal and analyzing wavelet, cwtft.
Inverse CWT of 1–D input signal. For select analyzing wavelets, you can invert the CWT to reconstruct a time and scale-localized approximation to your input signal. See icwtft and icwtlin for details.
Wavelet cross spectrum and coherence. You can use wcoher to compute the wavelet cross spectrum and coherence between two time series. The wavelet cross spectrum and coherence can reveal localized similarities between two time series in time and scale. See Wavelet CoherenceWavelet Coherence for examples.
Pattern-adapted wavelets for signal analysis. A strength of wavelet analysis is the ability to design wavelets that mimic the structures you wish to detect. Using pat2cwav and wavemngr you can add custom wavelets optimized to detect specified patterns in your data. See Pattern Adapted Wavelets for Signal DetectionPattern Adapted Wavelets for Signal Detection for examples.
In this section, you'll learn how to
Load a signal
Perform a continuous wavelet transform of a signal
Produce a plot of the coefficients
Produce a plot of coefficients at a given scale
Produce a plot of local maxima of coefficients across scales
Select the displayed plots
Switch from scale to pseudo-frequency information
Zoom in on detail
Display coefficients in normal or absolute mode
Choose the scales at which analysis is performed
Since you can perform analyses either from the command line or using the graphical interface tools, this section has subsections covering each method.
The final subsection discusses how to exchange signal and coefficient information between the disk and the graphical tools.
This example involves a noisy sinusoidal signal.
From the MATLAB^{®} prompt, type
load noissin;
You now have the signal noissin in your workspace:
whos
Name | Size | Bytes | Class |
---|---|---|---|
noissin | 1x1000 | 8000 | double array |
Perform a Continuous Wavelet Transform.
Use the cwt command. Type
c = cwt(noissin,1:48,'db4');
The arguments to cwt specify the signal to be analyzed, the scales of the analysis, and the wavelet to be used. The returned argument c contains the coefficients at various scales. In this case, c is a 48-by-1000 matrix with each row corresponding to a single scale.
The cwt command accepts a fourth argument. This is a flag that, when present, causes cwt to produce a plot of the absolute values of the continuous wavelet transform coefficients.
The cwt command can accept more arguments to define the different characteristics of the produced plot. For more information, see the cwt reference page.
c = cwt(noissin,1:48,'db4','plot');
A plot appears.
Of course, coefficient plots generated from the command line can be manipulated using ordinary MATLAB graphics commands.
Choose scales for the analysis.
The second argument to cwt gives you fine control over the scale levels on which the continuous analysis is performed. In the previous example, we used all scales from 1 to 48, but you can construct any scale vector subject to these constraints:
All scales must be real positive numbers.
The scale increment must be positive.
The highest scale cannot exceed a maximum value depending on the signal.
Let's repeat the analysis using every other scale from 2 to 128. Type
c = cwt(noissin,2:2:128,'db4','plot');
A new plot appears:
This plot gives a clearer picture of what's happening with the signal, highlighting the periodicity.
We now use the Continuous Wavelet 1-D tool to analyze the same noisy sinusoidal signal we examined earlier using the command line interface in Command Line Continuous Wavelet Analysis.
Start the Continuous Wavelet 1-D Tool. From the MATLAB prompt, type
wavemenu
The Wavelet Toolbox Main Menu appears.
Click the Continuous Wavelet 1-D menu item.
The continuous wavelet analysis tool for one-dimensional signal data appears.
Choose the File > Load Signal menu option.
When the Load Signal dialog box appears, select the MAT-file noissin.mat, which should reside in the MATLAB folder toolbox/wavelet/wavedemo. Click the OK button.
The noisy sinusoidal signal is loaded into the Continuous Wavelet 1-D tool.
The default value for the sampling period is equal to 1 (second).
Perform a Continuous Wavelet Transform.
To start our analysis, let's perform an analysis using the db4 wavelet at scales 1 through 48, just as we did using command line functions in the previous section.
In the upper right portion of the Continuous Wavelet 1-D tool, select the db4 wavelet and scales 1–48.
After a pause for computation, the tool displays the coefficients plot, the coefficients line plot corresponding to the scale a = 24, and the local maxima plot, which displays the chaining across scales (from a = 48 down to a = 1) of the coefficients local maxima.
View Wavelet Coefficients Line.
Select another scale a = 40 by clicking in the coefficients plot with the right mouse button. See step 9 to know, more precisely, how to select the desired scale.
Click the New Coefficients Line button. The tool updates the plot.
Click the Refresh Maxima Line button. The local maxima plot displays the chaining across scales of the coefficients local maxima from a = 40 down to a = 1.
Hold down the right mouse button over the coefficients plot. The position of the mouse is given by the Info frame (located at the bottom of the screen) in terms of location (X) and scale (Sca).
Switch from scale to Pseudo-Frequency Information.
Using the option button on the right part of the screen, select Frequencies instead of Scales. Again hold down the right mouse button over the coefficients plot, the position of the mouse is given in terms of location (X) and frequency (Frq) in Hertz.
This facility allows you to interpret scale in terms of an associated pseudo-frequency, which depends on the wavelet and the sampling period..
Deselect the last two plots using the check boxes in the Selected Axes frame.
Drag a rubber band box (by holding down the left mouse button) over the portion of the signal you want to magnify.
Click the X+ button (located at the bottom of the screen) to zoom horizontally only.
The Continuous Wavelet 1-D tool enlarges the displayed signal and coefficients plot (for more information on zooming, see Connection of Plots in the Wavelet Toolbox User's Guide).
As with the command line analysis on the preceding pages, you can change the scales or the analyzing wavelet and repeat the analysis. To do this, just edit the necessary fields and click the Analyze button.
View normal or absolute coefficients.
The Continuous Wavelet 1-D tool allows you to plot either the absolute values of the wavelet coefficients, or the coefficients themselves.
More generally, the coefficients coloration can be done in several different ways. For more details on the Coloration Mode, see Controlling the Coloration Mode.
Choose either one of the absolute modes or normal modes from the Coloration Mode menu. In normal modes, the colors are scaled between the minimum and maximum of the coefficients. In absolute modes, the colors are scaled between zero and the maximum absolute value of the coefficients.
The Continuous Wavelet 1-D graphical interface tool lets you import information from and export information to disk.
You can
Load signals from disk into the Continuous Wavelet 1-D tool.
Save wavelet coefficients from the Continuous Wavelet 1-D tool to disk.
To load a signal you've constructed in your MATLAB workspace into the Continuous Wavelet 1-D tool, save the signal in a MAT-file (with extension mat or other).
For instance, suppose you've designed a signal called warma and want to analyze it in the Continuous Wavelet 1-D tool.
save warma warma
The workspace variable warma must be a vector.
sizwarma = size(warma) sizwarma = 1 1000
To load this signal into the Continuous Wavelet 1-D tool, use the menu option File > Load Signal. A dialog box appears that lets you select the appropriate MAT-file to be loaded.
Note The first one-dimensional variable encountered in the file is considered the signal. Variables are inspected in alphabetical order. |
The Continuous Wavelet 1-D tool lets you save wavelet coefficients to disk. The toolbox creates a MAT-file in the current folder with the extension wc1 and a name you give it.
To save the continuous wavelet coefficients from the present analysis, use the menu option File > Save > Coefficients.
A dialog box appears that lets you specify a folder and filename for storing the coefficients.
Consider the example analysis:
File > Example Analysis > with haar at scales [1:1:64] → Cantor curve.
After saving the continuous wavelet coefficients to the file cantor.wc1, load the variables into your workspace:
load cantor.wc1 -mat whos
Name | Size | Bytes | Class |
---|---|---|---|
coeff | 64x2188 | 1120256 | double array |
scales | 1x64 | 512 | double array |
wname | 1x4 | 8 | char array |
Variables coefs and scales contain the continuous wavelet coefficients and the associated scales. More precisely, in the above example, coefs is a 64-by-2188 matrix, one row for each scale; and scales is the 1-by-64 vector 1:64. Variable wname contains the wavelet name.