% 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 % 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
DWT Single-level discrete 1-D wavelet transform. DWT performs a single-level 1-D wavelet decomposition with respect to either a particular wavelet (wname, see WFILTERS for more information) or particular wavelet filters (Lo_D and Hi_D) that you specify. [CA,CD] = DWT(X,wname) computes the approximation coefficients vector CA and detail coefficients vector CD, obtained by a wavelet decomposition of the vector X. wname is a string containing the wavelet name. [CA,CD] = DWT(X,Lo_D,Hi_D) computes the wavelet decomposition as above given these filters as input: Lo_D is the decomposition low-pass filter. Hi_D is the decomposition high-pass filter. Lo_D and Hi_D must be the same length.
Let LX = length(X) and LF = the length of filters; then length(CA) = length(CD) = LA where LA = CEIL(LX/2), if the DWT extension mode is set to periodization. LA = FLOOR((LX+LF-1)/2) for the other extension modes. For the different signal extension modes, see DWTMODE. [CA,CD] = DWT(...,mode,MODE) computes the wavelet decomposition with the extension mode MODE you specify. MODE is a string containing the extension mode. Example: x = 1:8; [ca,cd] = dwt(x,db1,mode,sym)
The MATLAB® code needed to generate s, cD, and cA iss = sin(20.*linspace(0,pi,1000)) + 0.5.*rand(1,1000);[cA,cD] = dwt(s,db2);where db2 is the name of the wavelet we want to use for theanalysis.Notice that the detail coefficients cD are small and consist mainly ofa high-frequency noise, while the approximation coefficients cAcontain much less noise than does the original signal.[length(cA) length(cD)] ans = 501 501
You may observe that the actual lengths ofthe detail and approximation coefficientvectors are slightly more than half the lengthof the original signal. This has to do with thefiltering process, which is implemented byconvolving the signal with a filter. Theconvolution "smears" the signal, introducingseveral extra samples into the result.
This process involves two aspects: breaking up a signal to obtain the wavelet coefficients, and reassembling the signal from thecoefficients. Weve already discussed decomposition and reconstruction at somelength. Of course, there is no point breaking up a signal merely tohave the satisfaction of immediately reconstructing it. We maymodify the wavelet coefficients before performing the reconstructionstep. We perform wavelet analysis because the coefficients thusobtained have many known uses, de-noising and compression beingforemost among them.But wavelet analysis is still a new and emerging field. No doubt, many uncharted uses of the wavelet coefficients lie in wait. Thetoolbox can be a means of exploring possible uses and hithertounknown applications of wavelet analysis. Explore the toolboxfunctions and see what you discover.
Wavelet Packet AnalysisThe wavelet packet method is a generalization of wavelet decomposition that offers a richer range ofpossibilities for signal analysis. In wavelet analysis, a signal is split into anapproximation and a detail. The approximation is thenitself split into a second-level approximation and detail,and the process is repeated. For an n-leveldecomposition, there are n+1 possible ways todecompose or encode the signal.
In wavelet packet analysis, the detailsas well as the approximations can besplit.
For instance, wavelet packet analysis allows the signal S to be represented as A1 + AAD3 + DAD3 +DD2. This is an example of a representation that isnot possible with ordinary wavelet analysis.Choosing one out of all these possible encodingspresents an interesting problem. In this toolbox, weuse an entropy-based criterion to select the mostsuitable decomposition of a given signal. This meanswe look at each node of the decomposition tree andquantify the information to be gained by performingeach split.
Simple and efficient algorithms exist for both waveletpacket decomposition and optimal decompositionselection. This toolbox uses an adaptive filteringalgorithm, based on work by Coifman andWickerhauser (see [CoiW92] in References), with directapplications in optimal signal coding and datacompression.Such algorithms allow the Wavelet Packet 1-D andWavelet Packet 2-D tools to include "Best Level" and"Best Tree" features that optimize the decompositionboth globally and with respect to each node.
Introduction to the Wavelet FamiliesSeveral families of wavelets that haveproven to be especially useful areincluded in this toolbox. What followsis an introduction to some waveletfamilies.
HaarDaubechiesBiorthogonal CoifletsSymletsMorletMexican Hat MeyerOther Real Wavelets Complex Wavelets
HaarAny discussion of wavelets beginswith Haar wavelet, the first andsimplest. Haar wavelet isdiscontinuous, and resembles a stepfunction. It represents the samewavelet as Daubechies db1. See Haarfor more detail.
DaubechiesIngrid Daubechies, one of the brightest stars in theworld of wavelet research, invented what are calledcompactly supported orthonormal wavelets -- thusmaking discrete wavelet analysis practicable.The names of the Daubechies family wavelets arewritten dbN, where N is the order, and db the"surname" of the wavelet. The db1 wavelet, asmentioned above, is the same as Haar wavelet. Hereare the wavelet functions psi of the next nine membersof the family:
You can obtain a survey of the main properties of this family by typingwaveinfo(db) from the MATLAB command line. See Daubechies Wavelets: dbN for more detail.
waveinfo(db)General characteristics: Compactly supported wavelets with extremal phase and highest number of vanishing moments for a given support width. Associated scaling filters are minimum-phase filters. Family Daubechies Short name db Order N N strictly positive integer Examples db1 or haar, db4, db15 Orthogonal yes Biorthogonal yes Compact support yes DWT possible CWT possible
BiorthogonalThis family of wavelets exhibits theproperty of linear phase, which isneeded for signal and imagereconstruction. By using twowavelets, one for decomposition (onthe left side) and the other forreconstruction (on the right side)instead of the same single one,interesting properties are derived.
You can obtain a survey of the main properties of this family by typingwaveinfo(bior) from the MATLAB command line. See Biorthogonal Wavelet Pairs: biorNr.Nd for more detail.
CoifletsBuilt by I. Daubechies at the request of R.Coifman. The wavelet function has 2Nmoments equal to 0 and the scaling functionhas 2N-1 moments equal to 0. The twofunctions have a support of length 6N-1. Youcan obtain a survey of the main properties ofthis family by typing waveinfo(coif) from theMATLAB command line. See Coiflet Wavelets:coifN for more detail.
SymletsThe symlets are nearly symmetricalwavelets proposed by Daubechies asmodifications to the db family. Theproperties of the two wavelet familiesare similar. Here are the waveletfunctions psi.
You can obtain a survey of the main properties of this family by typingwaveinfo(sym) from the MATLAB command line. See Symlet Wavelets: symN for more detail.
MorletThis wavelet has no scaling function,but is explicit.
You can obtain a survey of the mainproperties of this family by typingwaveinfo(morl) from the MATLABcommand line. See Morlet Wavelet:morl for more detail.
Mexican HatThis wavelet has no scaling functionand is derived from a function that isproportional to the second derivativefunction of the Gaussian probabilitydensity function.
You can obtain a survey of the main properties of this family by typingwaveinfo(mexh) from the MATLAB command line. See Mexican Hat Wavelet: mexh for more information.
MeyerThe Meyer wavelet and scalingfunction are defined in the frequencydomain.
You can obtain a survey of the main properties of this family by typingwaveinfo(meyer) from the MATLAB command line. See Meyer Wavelet: meyr for more detail.
Other Real WaveletsSome other real wavelets areavailable in the toolbox:Reverse BiorthogonalGaussian derivatives familyFIR based approximation of the MeyerwaveletSee Additional Real Wavelets for moreinformation.
Complex WaveletsSome complex wavelet families areavailable in the toolbox:Gaussian derivativesMorletFrequency B-SplineShannonSee Complex Wavelets for moreinformation.