Accelerating the pace of engineering and science

# Documentation

## One-Dimensional Wavelet Packet Analysis

We now turn to the Wavelet Packet 1-D tool to analyze a synthetic signal that is the sum of two linear chirps.

Starting the Wavelet Packet 1-D Tool.

1. From the MATLAB® prompt, type wavemenu.

The Wavelet Toolbox Main Menu appears.

Click the Wavelet Packet 1-D menu item.

2. When the Load Signal dialog box appears, select the MAT-file sumlichr.mat, which should reside in the MATLAB folder toolbox/wavelet/wavedemo. Click the OK button.

The sumlichr signal is loaded into the Wavelet Packet 1-D tool.

Analyzing a Signal.

1. Make the appropriate settings for the analysis. Select the db2 wavelet, level 4, entropy threshold, and for the threshold parameter type 1. Click the Analyze button.

The available entropy types are listed below.

Type

Description

Shannon

Nonnormalized entropy involving the logarithm of the squared value of each signal sample — or, more formally,

$-\sum {s}_{i}^{2}\mathrm{log}\left({s}_{i}^{2}\right).$

Threshold

The number of samples for which the absolute value of the signal exceeds a threshold ε.

Norm

The concentration in l p norm with 1 ≤ p.

Log Energy

The logarithm of "energy," defined as the sum over all samples:

$\sum \mathrm{log}\left({s}_{i}^{2}\right).$

SURE (Stein's Unbiased Risk Estimate)

A threshold-based method in which the threshold equals

$\sqrt{2{\mathrm{log}}_{e}\left(n{\mathrm{log}}_{2}\left(n\right)\right)}$

where n is the number of samples in the signal.

User

An entropy type criterion you define in a file.

For more information about the available entropy types, user-defined entropy, and threshold parameters, see the wentropy reference page and Choosing the Optimal Decomposition.

 Note   Many capabilities are available using the command area on the right of the Wavelet Packet 1-D window.

Computing the Best Tree.

Because there are so many ways to reconstruct the original signal from the wavelet packet decomposition tree, we select the best tree before attempting to compress the signal.

1. Click the Best Tree button.

After a pause for computation, the Wavelet Packet 1-D tool displays the best tree. Use the top and bottom sliders to spread nodes apart and pan over to particular areas of the tree, respectively.

Observe that, for this analysis, the best tree and the initial tree are almost the same. One branch at the far right of the tree was eliminated.

### Compressing a Signal Using Wavelet Packets

Selecting a Threshold for Compression.

1. Click the Compress button.

The Wavelet Packet 1-D Compression window appears with an approximate threshold value automatically selected.

The leftmost graph shows how the threshold (vertical yellow dotted line) has been chosen automatically (1.482) to balance the number of zeros in the compressed signal (blue curve that increases as the threshold increases) with the amount of energy retained in the compressed signal (purple curve that decreases as the threshold increases).

This threshold means that any signal element whose value is less than 1.482 will be set to zero when we perform the compression.

Threshold controls are located to the right (see the red box in the figure above). Note that the automatic threshold of 1.482 results in a retained energy of only 81.49%. This may cause unacceptable amounts of distortion, especially in the peak values of the oscillating signal. Depending on your design criteria, you may want to choose a threshold that retains more of the original signal's energy.

2. Adjust the threshold by typing 0.8938 in the text field opposite the threshold slider, and then press the Enter key.

The value 0.8938 is a number that we have discovered through trial and error yields more satisfactory results for this analysis.

After a pause, the Wavelet Packet 1-D Compression window displays new information.

Note that, as we have reduced the threshold from 1.482 to 0.8938,

• The vertical yellow dotted line has shifted to the left.

• The retained energy has increased from 81.49% to 90.96%.

• The number of zeros (equivalent to the amount of compression) has decreased from 81.55% to 75.28%.

Compressing a Signal.

1. Click the Compress button.

The Wavelet Packet 1-D tool compresses the signal using the thresholding criterion we selected.

The original (red) and compressed (yellow) signals are displayed superimposed. Visual inspection suggests the compression quality is quite good.

Looking more closely at the compressed signal, we can see that the number of zeros in the wavelet packets representation of the compressed signal is about 75.3%, and the retained energy about 91%.

If you try to compress the same signal using wavelets with exactly the same parameters, only 89% of the signal energy is retained, and only 59% of the wavelet coefficients set to zero. This illustrates the superiority of wavelet packets for performing compression, at least on certain signals.

You can demonstrate this to yourself by returning to the main Wavelet Packet 1-D window, computing the wavelet tree, and then repeating the compression.

### De-Noising a Signal Using Wavelet Packets

We now use the Wavelet Packet 1-D tool to analyze a noisy chirp signal. This analysis illustrates the use of Stein's Unbiased Estimate of Risk (SURE) as a principle for selecting a threshold to be used for de-noising.

This technique calls for setting the threshold T to

$T=\sqrt{2{\mathrm{log}}_{e}\left(n{\mathrm{log}}_{2}\left(n\right)\right)}$

where n is the length of the signal.

A more thorough discussion of the SURE criterion appears in Choosing the Optimal Decomposition. For now, suffice it to say that this method works well if your signal is normalized in such a way that the data fit the model x(t) = f(t) + e(t), where e(t) is a Gaussian white noise with zero mean and unit variance.

If you've already started the Wavelet Packet 1-D tool and it is active on your computer's desktop, skip ahead to step 3.