Functions > Transforms and Filters > Example: Wavelet Transforms
  
Example: Wavelet Transforms
Use the wavelet transform functions for compressing data.
1. Define a single square wave signal, where:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Evaluate array n and plot signal S:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Over the range of 0..255, signal S has an amplitude of 1 for all values of n (96..160), and an amplitude of zero otherwise.
Click to copy this expression
3. Use the wave function to calculate the Wavelet transform of signal S:
Click to copy this expression
Click to copy this expression
4. Calculate the number of levels contained in this transform:
Click to copy this expression
Click to copy this expression
Click to copy this expression
5. Use functions submatrix and floor in order to obtain a sense of the relative importance of each level:
Click to copy this expression
Click to copy this expression
6. Plot several levels of coefficients simultaneously:
Click to copy this expression
7. Represent signal with less data, by doing two things:
a. Zero out the higher level coefficients
b. Compute the inverse wavelet transform of the new coefficient vectors
First level at which coefficients are set to zero (L < 7 may be varied).
Click to copy this expression
Click to copy this expression
Click to copy this expression
8. Use function iwave to recover the original signal:
Click to copy this expression
9. Plot and compare the original signal with the transformed signal:
Click to copy this expression
This technique offers a way of compressing the data needed to represent a signal.