Wavelet Toolbox |
Advice to the Reader
You should follow along and process these examples on your own, using either the graphical interface or the command line functions.
Use the graphical interface for immediate signal processing. To execute the analyses included in the figures:
This triggers the execution of the examples.
When using the command line, follow the process illustrated in this M-file to conduct calculations:
% Load original 1-D signal. load sumsin; s = sumsin; % Perform the decomposition of s at level 5, using coif3. w = 'coif3' [c,l] = wavedec(s,5,w); % Reconstruct the approximation signals and detail signals at % levels 1 to 5, using the wavelet decomposition structure [c,l]. for i = 1:5 A(i,:) = wrcoef('a',c,l,w,i); D(i,:) = wrcoef('d',c,l,w,i); end
Note
This loop replaces 10 separate wrcoef statements defining approximations and details. The variable A contains the five approximations and the variable D contains the five details.
|
% Plots. t = 100:900; subplot(6,2,1); plot(t,s(t),'r'); title('Orig. signal and approx. 1 to 5.'); subplot(6,2,2); plot(t,s(t),'r'); title('Orig. signal and details 1 to 5.'); for i = 1:5, subplot(6,2,2*i+1); plot(t,A(5-i+1,t),'b'); subplot(6,2,2*i+2); plot(t,D(5-i+1,t),'g'); end
About Further Exploration
Tip 1. On all figures, visually check that for j = 0, 1, ..., Aj = Aj+1 + Dj+1.
Tip 2. Don't forget to change wavelets. Test the shortest ones first.
Tip 3. Identify edge effects. They will create problems for a correct analysis. At present, there is no easy way to avoid them perfectly. You can use tools described in the section Dealing with Border Distortion and see also the dwtmode
reference page. They should eliminate or greatly reduce these effects.
Tip 4. As much as possible, conduct calculations manually to cross-check results with the values in the graphic representations. Manual calculations are possible with the db1
wavelet.
For the sake of simplicity in the following examples, we use only the haar
and db
family wavelets, which are the most frequently used wavelets.
Illustrated Examples | Example 1: A Sum of Sines |
© 1994-2005 The MathWorks, Inc.