Summary of Contents

Page 1
Wavelet Toolbox™ 4 User’s Guide Michel Misiti Yves Misiti Georges Oppenheim JeanMichel Poggi...

Page 2
Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.

Page 3
Revision History March 1997 First printing New for Version 1.0 September 2000 Second printing Revised for Version 2.0 (Release 12) June 2001 Online only Revised for Version 2.1 (Release 12.1) July 2002 Online only Revised for Version 2.2 (Release 13) June 2004 Online only Revised for Version 3.0 (Release 14)

Page 4
Acknowledgments The authors wish to express their gratitude to all the colleagues who directly or indirectly contributed to the making of the Wavelet Toolbox™ software. Specifically • For the wavelet questions to PierreGilles LemariéRieusset (Evry) and Yves Meyer (ENS Cachan) •...

Page 5
About the Authors Michel Misiti, Georges Oppenheim, and JeanMichel Poggi are mathematics professors at Ecole Centrale de Lyon, University of MarneLaVallée and Paris 5 University. Yves Misiti is a research engineer specializing in Computer Sciences at Paris 11 University. The authors are members of the “Laboratoire de Mathématique” at OrsayParis 11 University France.

Page 6
functions and that other bases made of weird functions serve to look at new foreign signals, as strange as most fractals or some transient signals. Recently, wavelets were determined to be the best way to compress a huge library of fingerprints. This is not only a milestone that highlights the practical value of wavelets, but it has also proven to be an instructive process for the researchers involved in the project.

Page 7
Wavelet Toolbox software is a great way to work with wavelets. The toolbox, ® together with the power of MATLAB software, really allows one to write complex and powerful applications, in a very short amount of time. The Graphic User Interface is both userfriendly and intuitive.

Page 8: Table Of Contents
Contents Wavelets: A New Tool for Signal Analysis Product Overview ........12 Background Reading .

Page 9: Table Of Contents
Discrete Wavelet Transform ......124 OneStage Filtering: Approximations and Details ..124 MultipleLevel Decomposition .

Page 10: Table Of Contents
Wavelets: Working with Images ..... . . 296 ® Understanding Images in the MATLAB Environment ..296 Indexed Images .

Page 11: Table Of Contents
OneDimensional Wavelet Regression Estimation ..2140 OneDimensional Estimation Using the GUI for Equally Spaced Observations (Fixed Design) ... . . 2140 OneDimensional Estimation Using the GUI for Randomly Spaced Observations (Stochastic Design) .

Page 12: Table Of Contents
Importing and Exporting Information from the Graphical Interface ....... . . 2198 Image Fusion .

Page 13: Table Of Contents
TwoDimensional True Compression ....2317 TwoDimensional True Compression Using the Command Line ........2317 TwoDimensional True Compression Using the Graphical Interface .

Page 14: Table Of Contents
DeNoising Signals ........318 Discussion ......... . 318 DeNoising Images .

Page 15: Table Of Contents
Using Wavelet Packets About Wavelet Packet Analysis ......52 OneDimensional Wavelet Packet Analysis ....57 Compressing a Signal Using Wavelet Packets .

Page 16: Table Of Contents
TwoDimensional Wavelet Capabilities ....633 Dealing with Border Distortion ..... . . 635 Signal Extensions: ZeroPadding, Symmetrization, and Smooth Padding .

Page 17: Table Of Contents
Noise Processing ........695 DeNoising ......... 697 Data Compression .

Page 18: Table Of Contents
Function Reference General Wavelet Functions ......82 Wavelet Families ........83 1D Continuous Wavelets .

Page 19
GUI Reference General Features ........A2 Color Coding .

Page 20
Simple Use of Objects Through Four Examples ..B5 Example 1: plot and wpviewcf ......B5 Example 2: drawtree and readtree .

Page 21
Contents...

Page 22
Wavelets: A New Tool for Signal Analysis • Product Overview (p. 12) • Background Reading (p. 14) • Installing Wavelet Toolbox™ Software (p. 15) • Wavelet Applications (p. 17) • Fourier Analysis (p. 19) • ShortTime Fourier Analysis (p. 110) •...

Page 23: Product Overview
® Wavelet Toolbox™ software is a collection of functions built on the MATLAB technical computing environment. It provides tools for the analysis and synthesis of signals and images, and tools for statistical applications, using wavelets and wavelet packets within the framework of MATLAB.

Page 24
Product Overview The second category of tools is a collection of graphical interface tools that afford access to extensive functionality. Access these tools from the command line by typing wavemenu Note The examples in this guide are generated using Wavelet Toolbox software with the DWT extension mode set to (for zero padding), except 'zpd'...

Page 25: Background Reading
Wavelets: A New Tool for Signal Analysis Background Reading Wavelet Toolbox™ software provides a complete introduction to wavelets and assumes no previous knowledge of the area. The toolbox allows you to use wavelet techniques on your own data immediately and develop new insights. It is our hope that, through the use of these practical tools, you may want to explore the beautiful underlying mathematics and theory.

Page 26: System Recommendations, Platformspecific Details
This manual makes no assumption that your computer is running any other MATLAB toolboxes. PlatformSpecific Details Some details of the use of the Wavelet Toolbox software may depend on your hardware or operating system.

Page 27
Wavelets: A New Tool for Signal Analysis Fonts for NonWindows Platforms We recommend you set your operating system to use standard default fonts. However, for all platforms, if you prefer to use large fonts, some of the labels in the GUI figures may be illegible when using the default display mode of the toolbox.

Page 28: Wavelet Applications, Scale Aspects, Time Aspects
Wavelet Applications Wavelet Applications Wavelets have scale aspects and time aspects, consequently every application has scale and time aspects. To clarify them we try to untangle the aspects somewhat arbitrarily. For scale aspects, we present one idea around the notion of local regularity. For time aspects, we present a list of domains.

Page 29: Wavelet Decomposition As A Whole
Wavelets: A New Tool for Signal Analysis As domain applications, we get: • Industrial supervision of gearwheel • Checking undue noises in craned or dented wheels, and more generally in nondestructive control quality processes • Detection of short pathological events as epileptic crises or normal ones as evoked potentials in EEG (medicine) •...

Page 30: Fourier Analysis
Fourier Analysis Fourier Analysis Signal analysts already have at their disposal an impressive arsenal of tools. Perhaps the most well known of these is Fourier analysis, which breaks down a signal into constituent sinusoids of different frequencies. Another way to think of Fourier analysis is as a mathematical technique for transforming our view of the signal from timebased to frequencybased.

Page 31: Shorttime Fourier Analysis
Wavelets: A New Tool for Signal Analysis ShortTime Fourier Analysis In an effort to correct this deficiency, Dennis Gabor (1946) adapted the Fourier transform to analyze only a small section of the signal at a time — a technique called windowing the signal. Gabor’s adaptation, called the ShortTime Fourier Transform (STFT), maps a signal into a twodimensional function of time and frequency.

Page 32: Wavelet Analysis
Wavelet Analysis Wavelet Analysis Wavelet analysis represents the next logical step: a windowing technique with variablesized regions. Wavelet analysis allows the use of long time intervals where we want more precise lowfrequency information, and shorter regions where we want highfrequency information. Wavelet Time Transform...

Page 33: What Can Wavelet Analysis Do?
Wavelets: A New Tool for Signal Analysis What Can Wavelet Analysis Do? One major advantage afforded by wavelets is the ability to perform local analysis — that is, to analyze a localized area of a larger signal. Consider a sinusoidal signal with a small discontinuity — one so tiny as to be barely visible.

Page 34
Wavelet Analysis Indeed, in their brief history within the signal processing field, wavelets have already proven themselves to be an indispensable addition to the analyst’s collection of tools and continue to enjoy a burgeoning popularity today. 113...

Page 35: What Is Wavelet Analysis?, Number Of Dimensions
Wavelets: A New Tool for Signal Analysis What Is Wavelet Analysis? Now that we know some situations when wavelet analysis is useful, it is worthwhile asking “What is wavelet analysis?” and even more fundamentally, “What is a wavelet?” A wavelet is a waveform of effectively limited duration that has an average value of zero.

Page 36: Continuous Wavelet Transform
Continuous Wavelet Transform Continuous Wavelet Transform Mathematically, the process of Fourier analysis is represented by the Fourier transform: – f t e – which is the sum over all time of the signal f(t) multiplied by a complex exponential. (Recall that a complex exponential can be broken down into real and imaginary sinusoidal components.) The results of the transform are the Fourier coefficients , which when...

Page 37: Scaling
Wavelets: A New Tool for Signal Analysis Multiplying each coefficient by the appropriately scaled and shifted wavelet yields the constituent wavelets of the original signal. Wavelet Transform Signal Constituent wavelets of different scales and positions Scaling We’ve already alluded to the fact that wavelet analysis produces a timescale view of a signal, and now we’re talking about scaling and shifting wavelets.

Page 38: Shifting, Five Easy Steps To A Continuous Wavelet Transform
Continuous Wavelet Transform The scale factor works exactly the same with wavelets. The smaller the scale factor, the more “compressed” the wavelet.     It is clear from the diagrams that, for a sinusoid , the scale factor related (inversely) to the radian frequency .

Page 39
Wavelets: A New Tool for Signal Analysis It’s really a very simple process. In fact, here are the five steps of an easy recipe for creating a CWT: Take a wavelet and compare it to a section at the start of the original signal. Calculate a number, , that represents how closely correlated the wavelet is with this section of the signal.

Page 40
Continuous Wavelet Transform Signal Wavelet C = 0.2247 Repeat steps 1 through 4 for all scales. When you’re done, you’ll have the coefficients produced at different scales by different sections of the signal. The coefficients constitute the results of a regression of the original signal performed on the wavelets.

Page 41: Scale And Frequency
Wavelets: A New Tool for Signal Analysis These coefficient plots resemble a bumpy surface viewed from above. If you could look at the same surface from the side, you might see something like this: The continuous wavelet transform coefficient plots are precisely the timescale view of the signal we referred to earlier.

Page 42: Scale Of Nature
Continuous Wavelet Transform • High scale a Stretched wavelet Slowly changing, coarse features Low frequency Scale of Nature It’s important to understand that the fact that wavelet analysis does not produce a timefrequency view of a signal is not a weakness, but a strength of the technique.

Page 43: Transform?
Wavelets: A New Tool for Signal Analysis Here is a case where thinking in terms of scale makes much more sense than thinking in terms of frequency. Inspection of the CWT coefficients plot for this signal reveals patterns among scales and shows the signal’s possibly fractal nature.

Page 44
Continuous Wavelet Transform The CWT is also continuous in terms of shifting: during computation, the analyzing wavelet is shifted smoothly over the full domain of the analyzed function. 123...

Page 45: Discrete Wavelet Transform, Onestage Filtering: Approximations And Details
Wavelets: A New Tool for Signal Analysis Discrete Wavelet Transform Calculating wavelet coefficients at every possible scale is a fair amount of work, and it generates an awful lot of data. What if we choose only a subset of scales and positions at which to make our calculations? It turns out, rather remarkably, that if we choose scales and positions based on powers of two —...

Page 46
Discrete Wavelet Transform Filters lowpass highpass The original signal, , passes through two complementary filters and emerges as two signals. Unfortunately, if we actually perform this operation on a real digital signal, we wind up with twice as much data as we started with. Suppose, for instance, that the original signal S consists of 1000 samples of data.

Page 47
High Frequency ~500 DWT coefficients cA Low Frequency 1000 data points ~500 DWT coefficients ® The MATLAB code needed to generate , and s = sin(20.*linspace(0,pi,1000)) + 0.5.*rand(1,1000); [cA,cD] = dwt(s,'db2'); where is the name of the wavelet we want to use for the analysis.

Page 48: Multiplelevel Decomposition
Discrete Wavelet Transform MultipleLevel Decomposition The decomposition process can be iterated, with successive approximations being decomposed in turn, so that one signal is broken down into many lower resolution components. This is called the wavelet decomposition tree. Looking at a signal’s wavelet decomposition tree can yield valuable information.

Page 49
Wavelets: A New Tool for Signal Analysis details consist of a single sample or pixel. In practice, you’ll select a suitable number of levels based on the nature of the signal, or on a suitable criterion such as entropy (see “Choosing the Optimal Decomposition” on page 6147). 128...

Page 50: Wavelet Reconstruction
Wavelet Reconstruction Wavelet Reconstruction We’ve learned how the discrete wavelet transform can be used to analyze, or decompose, signals and images. This process is called decomposition or analysis. The other half of the story is how those components can be assembled back into the original signal without loss of information.

Page 51: Reconstruction Filters, Reconstructing Approximations And Details
Wavelets: A New Tool for Signal Analysis Reconstruction Filters The filtering part of the reconstruction process also bears some discussion, because it is the choice of filters that is crucial in achieving perfect reconstruction of the original signal. The downsampling of the signal components performed during the decomposition phase introduces a distortion called aliasing.

Page 52
Wavelet Reconstruction It is also possible to reconstruct the approximations and details themselves from their coefficient vectors. As an example, let’s consider how we would reconstruct the firstlevel approximation from the coefficient vector We pass the coefficient vector through the same process we used to reconstruct the original signal.

Page 53: Relationship Of Filters To Wavelet Shapes
Wavelets: A New Tool for Signal Analysis Extending this technique to the components of a multilevel analysis, we find that similar relationships hold for all the reconstructed signal constituents. That is, there are several ways to reassemble the original signal: Reconstructed Signal Components...

Page 54
Wavelet Reconstruction Lprime = 0.3415 0.5915 0.1585 0.0915 If we reverse the order of this vector (see ), and then multiply every even wrev sample by –1, we obtain the highpass filter Hprime = 0.0915 0.1585 0.5915 0.3415 Next, upsample by two (see ), inserting zeros in alternate Hprime...

Page 55
Wavelets: A New Tool for Signal Analysis Second Iteration Third Iteration 0.15 0.05 0.05 −0.05 −0.05 −0.1 Fourth Iteration Fifth Iteration 0.04 0.02 0.02 0.01 −0.02 −0.01 −0.02 −0.04 The curve begins to look progressively more like the wavelet. This means that the wavelet’s shape is determined entirely by the coefficients of the reconstruction filters.

Page 56: Multistep Decomposition And Reconstruction
Wavelet Reconstruction Multistep Decomposition and Reconstruction A multistep analysissynthesis process can be represented as ~500 ~250 1000 1000 ..~250 Analysis Synthesis Decomposition Wavelet Reconstruction IDWT Coefficients This process involves two aspects: breaking up a signal to obtain the wavelet coefficients, and reassembling the signal from the coefficients.

Page 57: Wavelet Packet Analysis
Wavelets: A New Tool for Signal Analysis Wavelet Packet Analysis The wavelet packet method is a generalization of wavelet decomposition that offers a richer range of possibilities for signal analysis. In wavelet analysis, a signal is split into an approximation and a detail. The approximation is then itself split into a secondlevel approximation and detail, and the process is repeated.

Page 58
Wavelet Packet Analysis Choosing one out of all these possible encodings presents an interesting problem. In this toolbox, we use an entropybased criterion to select the most suitable decomposition of a given signal. This means we look at each node of the decomposition tree and quantify the information to be gained by performing each split.

Page 59: History Of Wavelets
Wavelets: A New Tool for Signal Analysis History of Wavelets From an historical point of view, wavelet analysis is a new method, though its mathematical underpinnings date back to the work of Joseph Fourier in the nineteenth century. Fourier laid the foundations with his theories of frequency analysis, which proved to be enormously important and influential.

Page 60: Introduction To The Wavelet Families
• “Other Real Wavelets” on page 147 • “Complex Wavelets” on page 147 To explore all wavelet families on your own, check out the Wavelet Display tool: ® Type at the MATLAB command line. The Wavelet Toolbox wavemenu appears. Main Menu 139...

Page 61
Wavelets: A New Tool for Signal Analysis Click the Wavelet Display menu item. The Wavelet Display tool appears. Select a family from the Wavelet menu at the top right of the tool. Click the Display button. Pictures of the wavelets and their associated filters appear.

Page 62: Haar
Introduction to the Wavelet Families Haar Any discussion of wavelets begins with Haar wavelet, the first and simplest. Haar wavelet is discontinuous, and resembles a step function. It represents the same wavelet as Daubechies . See “Haar” on page 673 for more detail. Wavelet function psi −1 141...

Page 63: Daubechies
−1 −1 −1 −1 −1 −1 −1 −1 db10 You can obtain a survey of the main properties of this family by typing from the MATLAB command line. See “Daubechies Wavelets: waveinfo('db') dbN” on page 672 for more detail. 142...

Page 64: Biorthogonal
Introduction to the Wavelet Families Biorthogonal This family of wavelets exhibits the property of linear phase, which is needed for signal and image reconstruction. By using two wavelets, one for decomposition (on the left side) and the other for reconstruction (on the right side) instead of the same single one, interesting properties are derived.

Page 65
−1 bior3.9 bior4.4 −0.5 −1 −1 bior5.5 bior6.8 You can obtain a survey of the main properties of this family by typing from the MATLAB command line. See “Biorthogonal waveinfo('bior') Wavelet Pairs: biorNr.Nd” on page 676 for more detail. 144...

Page 66: Coiflets, Symlets
−1 −1 −1 sym6 sym8 sym7 You can obtain a survey of the main properties of this family by typing from the MATLAB command line. See “Symlet Wavelets: waveinfo('sym') symN” on page 674 for more detail. 145...

Page 67: Morlet, Mexican Hat
Wavelet function psi −0.5 −8 −6 −4 −2 You can obtain a survey of the main properties of this family by typing from the MATLAB command line. See “Morlet Wavelet: waveinfo('morl') morl” on page 681 for more detail. Mexican Hat...

Page 68: Meyer, Other Real Wavelets, Complex Wavelets
Wavelet function psi −0.5 −5 You can obtain a survey of the main properties of this family by typing from the MATLAB command line. See “Meyer Wavelet: waveinfo('meyer') meyr” on page 678 for more detail. Other Real Wavelets Some other real wavelets are available in the toolbox: •...

Page 69
Wavelets: A New Tool for Signal Analysis 148...

Page 70
Using Wavelets This chapter takes you stepbystep through examples that teach you how to use the graphical tools and commandline functions. • Introduction to Wavelet Toolbox™ GUIs and Functions (p. 23) • OneDimensional Continuous Wavelet Analysis (p. 24) • OneDimensional Complex Continuous Wavelet Analysis (p. 220) •...

Page 71
Using Wavelets • Multiscale Principal Components Analysis (p. 2247) • OneDimensional Multisignal Analysis (p. 2261) • TwoDimensional True Compression (p. 2317)

Page 72
Introduction to Wavelet Toolbox™ GUIs and Functions Introduction to Wavelet Toolbox™ GUIs and Functions Wavelet Toolbox™ software contains graphical tools and commandline functions that let you • Examine and explore properties of individual wavelets and wavelet packets • Examine statistics of signals and signal components •...

Page 73: Onedimensional Continuous Wavelet Analysis
Using Wavelets OneDimensional Continuous Wavelet Analysis This section takes you through the features of continuous wavelet analysis using Wavelet Toolbox™ software. The toolbox requires only one function for continuous wavelet analysis: You’ll find full information about this function in its reference page. In this section, you’ll learn how to •...

Page 74: Continuous Analysis Using The Command Line
OneDimensional Continuous Wavelet Analysis Continuous Analysis Using the Command Line This example involves a noisy sinusoidal signal. −0.5 −1 1000 Load a signal. From the MATLAB® prompt, type load noissin; You now have the signal in your workspace: noissin whos Name...

Page 75
= cwt(noissin,1:48,'db4','plot'); A plot appears. Absolute Values of Ca,b Coefficients for a = 1 2 3 4 5 ... 1000 time (or space) b Of course, coefficient plots generated from the command line can be manipulated using ordinary MATLAB graphics commands.

Page 76
OneDimensional Continuous Wavelet Analysis Choose scales for the analysis. The second argument to 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.

Page 77: Continuous Analysis Using The Graphical Interface
We now use the Continuous Wavelet 1D tool to analyze the same noisy sinusoidal signal we examined earlier using the command line interface in “Continuous Analysis Using the Command Line” on page 25. Start the Continuous Wavelet 1D Tool. From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears.

Page 78
OneDimensional Continuous Wavelet Analysis Click the Continuous Wavelet 1D menu item. The continuous wavelet analysis tool for onedimensional signal data appears.

Page 79
Using Wavelets Load a signal. Choose the File > Load Signal menu option. When the Load Signal dialog box appears, select the demo MATfile , which should reside in the MATLAB folder noissin.mat . Click the OK button. toolbox/wavelet/wavedemo The noisy sinusoidal signal is loaded into the Continuous Wavelet 1D tool.

Page 80
OneDimensional Continuous Wavelet Analysis Click the Analyze button. 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.

Page 81
Using Wavelets View Maxima Line. 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 ).

Page 82
OneDimensional Continuous Wavelet Analysis Switch from scale to PseudoFrequency 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.

Page 83
Using Wavelets This facility allows you to interpret scale in terms of an associated pseudofrequency, which depends on the wavelet and the sampling period. For more information on the connection between scale and frequency, see “How to Connect Scale to Frequency?” on page 666. Deselect the last two plots using the check boxes in the Selected Axes frame.

Page 84
OneDimensional Continuous Wavelet Analysis Zoom in on detail. 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.

Page 85
Using Wavelets The Continuous Wavelet 1D tool enlarges the displayed signal and coefficients plot (for more information on zooming, see “Connection of Plots” on page A3). 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.

Page 86: Graphical Interface
• Save wavelet coefficients from the Continuous Wavelet 1D tool to disk. Loading Signals into the Continuous Wavelet 1D Tool To load a signal you’ve con*ucted in your MATLAB workspace into the Continuous Wavelet 1D tool, save the signal in a MATfile (with extension or other).

Page 87
Using Wavelets The workspace variable must be a vector. warma sizwarma = size(warma) sizwarma = 1000 To load this signal into the Continuous Wavelet 1D tool, use the menu option File > Load Signal . A dialog box appears that lets you select the appropriate MATfile to be loaded.

Page 88
OneDimensional Continuous Wavelet Analysis After saving the continuous wavelet coefficients to the file , load the cantor.wc1 variables into your workspace: load cantor.wc1 mat whos Name Size Bytes Class coeff 64x2188 1120256 double array scales 1x64 double array wname char array Variables contain the continuous wavelet coefficients and coefs...

Page 89: Onedimensional Complex Continuous Wavelet Analysis
Using Wavelets OneDimensional Complex Continuous Wavelet Analysis This section takes you through the features of complex continuous wavelet analysis using the Wavelet Toolbox™ software and focuses on the differences between the real and complex continuous analysis. You can refer to the section “OneDimensional Continuous Wavelet Analysis” on page 24 if you want to learn how to •...

Page 90: Complex Continuous Analysis Using The Command Line
OneDimensional Complex Continuous Wavelet Analysis Complex Continuous Analysis Using the Command Line This example involves a cusp signal. 1000 1200 Load a signal. From the MATLAB® prompt, type load cuspamax; You now have the signal in your workspace: cuspamax whos Name...

Page 91
Using Wavelets Perform a Continuous Wavelet Transform. Use the command. Type c = cwt(cuspamax,1:2:64,'cgau4'); The arguments to specify the signal to be analyzed, the scales of the analysis, and the wavelet to be used. The returned argument contains the coefficients at various scales. In this case, is a complex 32by1024 matrix, each row of which corresponds to a single scale.

Page 92: Complex Continuous Analysis Using The Graphical Interface
(or space) b time (or space) b Of course, coefficient plots generated from the command line can be manipulated using ordinary MATLAB graphics commands. Complex Continuous Analysis Using the Graphical Interface We now use the Complex Continuous Wavelet 1D tool to analyze the same cusp signal we examined using the command line interface in the previous section.

Page 93
Using Wavelets Click the Complex Continuous Wavelet 1D menu item. 224...

Page 94
Load a signal. Choose the File > Load Signal menu option. When the Load Signal dialog box appears, select the demo MATfile , which should reside in the MATLAB folder cuspamax.mat . Click the OK button. toolbox/wavelet/wavedemo The cusp signal is loaded into the Complex Continuous Wavelet 1D tool.

Page 95
Using Wavelets functions in “Complex Continuous Analysis Using the Command Line” on page 221. In the upperright portion of the Complex Continuous Wavelet 1D tool, select the wavelet and scales 1–64 in steps of 2. cgau4 Select cgau4 Select scales from 1 to 64 in steps of 2 Click the Analyze button.

Page 96
OneDimensional Complex Continuous Wavelet Analysis Each side has exactly the same representation that we found in “Continuous Analysis Using the Graphical Interface” on page 28. Select the plots related to the modulus of the coefficients using the Modulus option button in the Selected Axes frame. 227...

Page 97
Using Wavelets The figure now looks like the one in the real Continuous Wavelet 1D tool. Importing and Exporting Information from the Graphical Interface To know how to import and export information from the Complex Continuous Wavelet Graphical Interface, see the corresponding paragraph in “OneDimensional Continuous Wavelet Analysis”...

Page 98: Onedimensional Discrete Wavelet Analysis
OneDimensional Discrete Wavelet Analysis OneDimensional Discrete Wavelet Analysis This section takes you through the features of onedimensional discrete wavelet analysis using the Wavelet Toolbox™ software. The toolbox provides these functions for onedimensional signal analysis. For more information, see the reference pages. AnalysisDecomposition Functions Function Name Purpose...

Page 99
Using Wavelets Denoising and Compression Function Name Purpose ddencmp Provide default values for denoising and compression wbmpen Penalized threshold for wavelet 1D or 2D denoising wdcbm Thresholds for wavelet 1D using BirgéMassart strategy wdencmp Wavelet denoising and compression wden Automatic wavelet denoising Threshold settings manager wthrmngr In this section, you’ll learn how to...

Page 100: Onedimensional Analysis Using The Command Line
Wavelet analysis effectively removes the noise. Load a signal. ® From the MATLAB prompt, type load leleccum; Set the variables. Type s = leleccum(1:3920); l_s = length(s);...

Page 101
Using Wavelets Construct approximations and details from the coefficients. To construct the level 1 approximation and detail ( ) from the coefficients , type A1 = upcoef('a',cA1,'db1',1,l_s); D1 = upcoef('d',cD1,'db1',1,l_s); A1 = idwt(cA1,[],'db1',l_s); D1 = idwt([],cD1,'db1',l_s); Display the approximation and detail. To display the results of the levelone decomposition, type subplot(1,2,1);...

Page 102
OneDimensional Discrete Wavelet Analysis err = 2.2737e013 Perform a multilevel wavelet decomposition of a signal. To perform a level 3 decomposition of the signal (again using the wavelet), type [C,L] = wavedec(s,3,'db1'); The coefficients of all the components of a thirdlevel decomposition (that is, the thirdlevel approximation and the first three levels of detail) are returned concatenated into one vector, C.

Page 103
Using Wavelets Results are displayed in the figure below, which contains the signal , the approximation coefficients at level 3 ( , and the details coefficients from cA3) level 3 to 1 ( from the top to the bottom. cD1) Original signal s and coefficients.

Page 104
OneDimensional Discrete Wavelet Analysis Display the results of a multilevel decomposition. To display the results of the level 3 decomposition, type subplot(2,2,1); plot(A3); title('Approximation A3') subplot(2,2,2); plot(D1); title('Detail D1') subplot(2,2,3); plot(D2); title('Detail D2') subplot(2,2,4); plot(D3); title('Detail D3') Approximation A3 Detail D1 −20 −40 1000...

Page 105
Using Wavelets Crude denoising of a signal. Using wavelets to remove noise from a signal requires identifying which component or components contain the noise, and then reconstructing the signal without those components. In this example, we note that successive approximations become less and less noisy as more and more highfrequency information is filtered out of the signal.

Page 106
OneDimensional Discrete Wavelet Analysis Original Level 3 Approximation Of course, in discarding all the highfrequency information, we’ve also lost many of the original signal’s sharpest features. Optimal denoising requires a more subtle approach called thresholding. This involves discarding only the portion of the details that exceeds a certain limit.

Page 107
But there’s a better way. Note that , and are just MATLAB vectors, so we could directly manipulate each vector, setting each element to some fraction of the vectors’ peak or average value. Then we could reconstruct new detail signals from the thresholded coefficients.

Page 108
OneDimensional Discrete Wavelet Analysis Note that uses the results of the decomposition ( ) that we wdencmp calculated in step 6 on page 233. We also specify that we used the wavelet to perform the original analysis, and we specify the global thresholding option .

Page 109: Onedimensional Analysis Using The Graphical Interface
In this section, we explore the same electrical consumption signal as in the previous section, but we use the graphical interface tools to analyze the signal. Start the 1D Wavelet Analysis Tool. From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears.

Page 110
OneDimensional Discrete Wavelet Analysis Click the Wavelet 1D menu item. The discrete wavelet analysis tool for onedimensional signal data appears. 241...

Page 111
Using Wavelets Load a signal. From the File menu, choose the Load > Signal option. When the Load Signal dialog box appears, select the demo MATfile , which is in the MATLAB folder leleccum.mat toolbox/wavelet/wavedemo Click the OK button. 242...

Page 112
OneDimensional Discrete Wavelet Analysis The electrical consumption signal is loaded into the Wavelet 1D tool. Perform a singlelevel wavelet decomposition. To start our analysis, let’s perform a singlelevel decomposition using the wavelet, just as we did using the commandline functions in “OneDimensional Analysis Using the Command Line”...

Page 113
Using Wavelets Zoom in on relevant detail. One advantage of using the graphical interface tools is that you can zoom in easily on any part of the signal and examine it in greater detail. Drag a rubber band box (by holding down the left mouse button) over the portion of the signal you want to magnify.

Page 114
OneDimensional Discrete Wavelet Analysis Click the X+ button (located at the bottom of the screen) to zoom horizontally. The Wavelet 1D tool zooms all the displayed signals. The other zoom controls do more or less what you’d expect them to. The button, for example, zooms out horizontally.

Page 115
Using Wavelets Perform a multilevel decomposition. Again, we’ll use the graphical tools to emulate what we did in the previous section using command line functions. To perform a level 3 decomposition of the signal using the wavelet: Select 3 from the Level menu at the upper right, and then click the Analyze button again.

Page 116
OneDimensional Discrete Wavelet Analysis Selecting Different Views of the Decomposition The Display mode menu (middle right) lets you choose different views of the wavelet decomposition. The default display mode is called “Full Decomposition Mode.” Other alternatives include:  “Separate Mode,” which shows the details and the approximations in separate columns.

Page 117
Using Wavelets Separate Mode Superimpose Mode Tree Mode Show & Scroll Mode Show & Scroll Mode (Stem Cfs) You can change the default display mode on a persession basis. Select the desired mode from the View > Default Display Mode submenu. Note The Compression and Denoising windows opened from the Wavelet tool will inherit the current coefficient visualization attribute (stems or colored blocks).

Page 118
OneDimensional Discrete Wavelet Analysis These options include the ability to suppress the display of various components, and to choose whether or not to display the original signal along with the details and approximations. Remove noise from a signal. The graphical interface tools feature a denoising option with a predefined thresholding strategy.

Page 119
Using Wavelets The Wavelet 1D Denoising window appears. While a number of options are available for finetuning the denoising algorithm, we’ll accept the defaults of soft fixed form thresholding and unscaled white noise. Continue by clicking the denoise button. The denoised signal appears superimposed on the original. The tool also plots the wavelet coefficients of both signals.

Page 120
OneDimensional Discrete Wavelet Analysis Zoom in on the plot of the original and denoised signals for a closer look. Drag a rubber band box around the pertinent area, and then click the XY+ button. The denoise window magnifies your view. By default, the original signal is shown in red, and the denoised signal in yellow.

Page 121
Using Wavelets Dismiss the Wavelet 1D Denoising window: click the Close button. You cannot have the denoise and Compression windows open simultaneously, so close the Wavelet 1D Denoising window to continue. When the Update Synthesized Signal dialog box appears, click No . If you click Yes , the Synthesized Signal is then available in the Wavelet 1D main window.

Page 122
OneDimensional Discrete Wavelet Analysis Bring up the Com pression window: click the Compress button, located in the middle right of the window, underneath the Analyze button. The Compression window appears. Thresholding method menus Threshold slider Compress button While you always have the option of choosing by level thresholding, here we’ll take advantage of the global thresholding feature for quick and easy compression.

Page 123
Using Wavelets Note If you want to experiment with manual thresholding, choose the By option from the menu located at the top right of the Level thresholding window. The sliders located below this menu then Wavelet 1D Compression control the leveldependent thresholds, indicated by yellow dotted lines running horizontally through the graphs on the left of the window.

Page 124
OneDimensional Discrete Wavelet Analysis Displayed statistics include measures of tendency (mean, mode, median) and dispersion (range, standard deviation). In addition, the tool provides frequencydistribution diagrams (histograms and cumulative histograms), as well as timeseries diagrams: autocorrelation function and spectrum. The same feature exists for the Wavelet 1D Denoising tool. Dismiss the Wavelet 1D Compression window: click the Close button.

Page 125
Using Wavelets The Wavelet 1D Statistics window appears displaying by default statistics on the original signal. Select the synthesized signal or signal component whose statistics you want to examine. Click the appropriate option button, and then click the Show button. Here, we’ve chosen to examine the compressed signal Statistics using more 100 bins instead of 30, which is the default: 256...

Page 126
OneDimensional Discrete Wavelet Analysis Displayed statistics include measures of tendency (mean, mode, median) and dispersion (range, standard deviation). In addition, the tool provides frequencydistribution diagrams (histograms and cumulative histograms). You can plot these histograms separately using the Histograms button from the Wavelets 1D window. Click the Approximation option button.

Page 127
Using Wavelets Importing and Exporting Information from the Graphical Interface The Wavelet 1D graphical interface tool lets you import information from and export information to disk. Saving Information to Disk You can save synthesized signals, coefficients, and decompositions from the tool to the disk, where the information can be manipulated and Wavelet 1D later reimported into the graphical tool.

Page 128
OneDimensional Discrete Wavelet Analysis Save information to disk Saving Synthesized Signals. You can process a signal in the Wavelet 1D tool and then save the processed signal to a MATfile (with extension or other). For example, load the example analysis: File > Example Analysis > Basic , and perform a compression or Signals >...

Page 129
Using Wavelets When the synthesized signal is obtained using any thresholding method except a global one, the saved structure is whos Name Size Bytes Class synthsig 1x1000 8000 double array thrParams cell array wname char array The synthesized signal is given by the variable .

Page 130
OneDimensional Discrete Wavelet Analysis where the variable contains the global threshold: valTHR valTHR valTHR = 1.2922 Saving Discrete Wavelet Transform Coefficients. The Wavelet 1D tool lets you save the coefficients of a discrete wavelet transform (DWT) to disk. The toolbox creates a MATfile in the current folder with a name you choose.

Page 131
Using Wavelets Saving Decompositions. The Wavelet 1D tool lets you save the entire set of data from a discrete wavelet analysis to disk. The toolbox creates a MATfile in the current folder with a name you choose, followed by the extension (wavelet analysis 1D).

Page 132
Wavelet 1D tool, or else errors will result when you try to load information. Load information from disk Loading Signals. To load a signal you’ve constructed in your MATLAB workspace into the Wavelet 1D tool, save the signal in a MATfile (with extension other). For instance, suppose you’ve designed a signal called...

Page 133
Using Wavelets 1000 To load this signal into the Wavelet 1D tool, use the menu option File > Load > Signal A dialog box appears that lets you select the appropriate MATfile to be loaded. Note The first onedimensional variable encountered in the file is considered the signal.

Page 134
OneDimensional Discrete Wavelet Analysis Loading Decompositions. To load discrete wavelet transform decomposition data into the Wavelet 1D graphical interface, you must first save the appropriate data in a MATfile (with extension or other). The MATfile contains the following variables. Variable Status Description Required...

Page 135: Twodimensional Discrete Wavelet Analysis
Using Wavelets TwoDimensional Discrete Wavelet Analysis This section takes you through the features of twodimensional discrete wavelet analysis using the Wavelet Toolbox™ software. The toolbox provides these functions for image analysis. For more information, see the function reference pages. Note In this section the presentation and examples use twodimensional arrays corresponding to indexed image representations.

Page 136
TwoDimensional Discrete Wavelet Analysis AnalysisDecomposition Functions Function Name Purpose dwt2 Singlelevel decomposition wavedec2 Decomposition wmaxlev Maximum wavelet decomposition level SynthesisReconstruction Functions Function Name Purpose idwt2 Singlelevel reconstruction waverec2 Full reconstruction wrcoef2 Selective reconstruction upcoef2 Single reconstruction Decomposition Structure Utilities Function Name Purpose detcoef2 Extraction of detail coefficients...

Page 137
Using Wavelets DeNoising and Compression Function Name Purpose ddencmp Provide default values for denoising and compression wbmpen Penalized threshold for wavelet 1D or 2D denoising wdcbm2 Thresholds for wavelet 2D using BirgéMassart strategy Wavelet denoising and compression wdencmp Threshold settings manager wthrmngr In this section, you’ll learn •...

Page 138: Twodimensional Analysis Using The Command Line
, which displays a rescaled version of leading to a image(wcodemat(I)) clearer presentation of the details and approximations (see wcodemat reference page). Load an image. ® From the MATLAB prompt, type load wbarb; whos Name Size Bytes Class 256x256...

Page 139
Using Wavelets Convert an indexed image to a grayscale image. If the colormap is smooth, the wavelet transform can be directly applied to the indexed image; otherwise the indexed image should be converted to grayscale format. For more information, see “Wavelets: Working with Images”...

Page 140
TwoDimensional Discrete Wavelet Analysis subplot(2,2,2); image(wcodemat(H1,192)); title('Horizontal Detail H1') subplot(2,2,3); image(wcodemat(V1,192)); title('Vertical Detail V1') subplot(2,2,4); image(wcodemat(D1,192)); title('Diagonal Detail D1') Regenerate an image by singlelevel Inverse Wavelet Transform. To find the inverse transform, type Xsyn = idwt2(cA1,cH1,cV1,cD1,'bior3.7'); This reconstructs or synthesizes the original image from the coefficients of the level 1 approximation and details.

Page 141
Using Wavelets [C,S] = wavedec2(X,2,'bior3.7'); where is the original image matrix, and 2 is the level of decomposition. The coefficients of all the components of a secondlevel decomposition (that is, the secondlevel approximation and the first two levels of detail) are returned concatenated into one vector, .

Page 142
TwoDimensional Discrete Wavelet Analysis D1 = wrcoef2('d',C,S,'bior3.7',1); H2 = wrcoef2('h',C,S,'bior3.7',2); V2 = wrcoef2('v',C,S,'bior3.7',2); D2 = wrcoef2('d',C,S,'bior3.7',2); Display the results of a multilevel decomposition. Note With all the details involved in a multilevel image decomposition, it makes sense to import the decomposition into the Wavelet 2D graphical tool in order to more easily display it.

Page 143
Using Wavelets Reconstruct the original image from the multilevel decomposition. To reconstruct the original image from the wavelet decomposition structure, type X0 = waverec2(C,S,'bior3.7'); This reconstructs or synthesizes the original image from the coefficients the multilevel decomposition. Compress the image and display it. To compress the original image , use the command to calculate the...

Page 144
TwoDimensional Discrete Wavelet Analysis specify the global thresholding option . See 'gbl' ddencmp wdencmp reference pages for more information about the use of these commands. To view the compressed image side by side with the original, type colormap(map); subplot(121); image(X); title('Original Image'); axis square subplot(122);...

Page 145: Twodimensional Analysis Using The Graphical Interface
In this section we explore the same image as in the previous section, but we use the graphical interface tools to analyze the image. Start the 2D Wavelet Analysis Tool. From the MATLAB prompt, type wavemenu The Wavelet Tool Main Menu appears.

Page 146
Load an image. From the File menu, choose the Load > Image option. When the Load Image dialog box appears, select the demo MATfile , which is in the MATLAB folder wbarb.mat toolbox/wavelet/wavedemo Click the OK button.

Page 147
Using Wavelets The image is loaded into the Wavelet 2D tool. Analyze the image. Using the Wavelet and Level menus located to the upper right, determine the wavelet family, the wavelet type, and the number of levels to be used for the analysis.

Page 148
TwoDimensional Discrete Wavelet Analysis Original image Visualization Synthesized image Decomposition 279...

Page 149
Using Wavelets Using Square Mode Features. By default, the analysis appears in “Square Mode.” This mode includes four different displays. In the upper left is the original image. Below that is the image reconstructed from the various approximations and details. To the lower right is a decomposition showing the coarsest approximation coefficients and all the horizontal, diagonal, and vertical detail coefficients.

Page 150
TwoDimensional Discrete Wavelet Analysis Approximation coefficients cA2 Reconstructed Approximation A2 Using Tree Mode Features. Choose Tree from the View Mode menu. Your display changes to reveal the following. 281...

Page 151
Using Wavelets This is the same information shown in square mode, with in addition all the approximation coefficients, but arranged to emphasize the tree structure of the decomposition. The various buttons and menus work just the same as they do in square mode. Zooming in on Detail.

Page 152
TwoDimensional Discrete Wavelet Analysis The Wavelet 2D tool enlarges the displayed images. To zoom back to original magnification, click the History button. Compress the image Click the Compress button, located to the upper right of the Wavelet 2D window. The Wavelet 2D Compression window appears. 283...

Page 153
Using Wavelets Threshold menus Compress button The tool automatically selects thresholding levels to provide a good initial balance between retaining the image’s energy while minimizing the number of coefficients needed to represent the image. However, you can also adjust thresholds manually using the By Level thresholding option, and then the sliders or edits corresponding to each level.

Page 154
TwoDimensional Discrete Wavelet Analysis Threshold menus Direction menu Compress button Select from the direction menu whether you want to adjust thresholds for horizontal, diagonal or vertical details. To make the actual adjustments for each level, use the sliders or use the left mouse button to directly drag the yellow vertical lines.

Page 155
Usually this information is the same, but in some cases, edge effects may cause the original image to be cropped slightly. To see the exact statistics, use the command line functions to get the desired image and then apply the desired MATLAB statistical function(s). 286...

Page 156
TwoDimensional Discrete Wavelet Analysis Importing and Exporting Information from the Graphical Interface The Wavelet 2D graphical tool lets you import information from and export information to disk, if you adhere to the proper file formats. Saving Information to Disk You can save synthesized images, coefficients, and decompositions from the tool to disk, where the information can be manipulated and later Wavelet 2D reimported into the graphical tool.

Page 157
Using Wavelets Name Size Bytes Class 359x371 1065512 double array 64x3 1536 double array valTHR double array wname char array The synthesized image is given by contains the colormap. In addition, the parameters of the denoising or compression process are given by the wavelet name ( ) and the global threshold ( wname...

Page 158
TwoDimensional Discrete Wavelet Analysis Name Size Bytes Class valTHR double array wname char array Variable contains the colormap. Variable contains the wavelet name wname is empty since the synthesized image is the same as the original valTHR one. Variables contain the discrete wavelet coefficients and the coefs sizes associated matrix sizes.

Page 159
Using Wavelets Name Size Bytes Class sizes double array valTHR double array wave_name char array Variables contain the wavelet decomposition structure. Other coefs sizes variables contain the wavelet name, the colormap, and the filename containing the data. Variable is empty since the synthesized image is the same as valTHR the original one.

Page 160
by3 matrix called . This is the colormap associated with the image. When MATLAB displays such an image, it uses the values of the matrix to look up the desired color in this colormap. If the colormap is not given, the Wavelet 2D tool uses a monotonic colormap with colors.

Page 161
Using Wavelets Note The graphical tools allow you to load an image that does not contain integers from 1 to n. The computations are correct because they act directly on the matrix, but the display of the image is strange. The values less than 1 are evaluated as 1, the values greater than n are evaluated as n, and a real value within the interval [1,n] is evaluated as the closest integer.

Page 162
TwoDimensional Discrete Wavelet Analysis For an indexed image the matrix is a by array: sizes (n+2 coefs (3n+1 sections) n‚Äì1 n‚Äì1 n‚Äì1 sizes (n+2by2) For a truecolor image, the matrix is a by sizes (n+2 coefs (3n+1 sections) n‚Äì1 n‚Äì1 n‚Äì1 sizes (n+2by3) 293...

Page 163
Using Wavelets Variable must be a vector of concatenated DWT coefficients. The coefs coefs vector for an level decomposition contains sections, consisting of the 3n+1 level approximation coefficients, followed by the horizontal, vertical, and diagonal detail coefficients, in that order, for each level. Variable is a sizes matrix, the rows of which specify the size of...

Page 164
TwoDimensional Discrete Wavelet Analysis Use the File > Load > Decomposition menu option from the Wavelet 2D tool to load the image decomposition data. A dialog box appears, allowing you to choose the folder and file in which your data reside. Note When loading an image, a decomposition, or coefficients from a MATfile, the extension of this file is free.

Page 165: Indexed Images
Understanding Images in the MATLAB Environment ® The basic data structure in MATLAB is the rectangular matrix, an ordered set of real or complex elements. This object is naturally suited to the representation of images, which are realvalued, ordered sets of color or intensity data.

Page 166: Wavelet Decomposition Of Indexed Images
Wavelets: Working with Images When MATLAB displays an indexed image, it uses the values in the image matrix to look up the desired color in the colormap. For instance, if the image matrix contains the value 18 in matrix location (86,198), the color for pixel (86,198) is the color from row 18 of the colormap.

Page 167: Rgb (truecolor) Images
RGB (Truecolor) Images An RGB image, sometimes referred to as a truecolor image, is stored in MATLAB as an mbynby3 data array that defines red, green, and blue color components for each individual pixel. RGB images do not use a palette. The color of each pixel is determined by the combination of the red, green, and blue intensities stored in each color plane at the pixel’s location.

Page 168: Wavelet Decomposition Of Truecolor Images, Other Images, Image Conversion
If you do not have Image Processing Toolbox software, the examples below demonstrate how this conversion may be performed using basic MATLAB commands. Example 1: Converting Color Indexed Images load xpmndrll...

Page 169
Using Wavelets image(X2) title('Original Color Indexed Image') colormap(map); colorbar Orignal Color Indexed Image The color bar to the right of the image is not smooth and does not monotonically progress from dark to light. This type of indexed image is not suitable for direct wavelet decomposition with the toolbox and needs to be preprocessed.

Page 170
Wavelets: Working with Images n = 64; % Number of shades in new indexed image X = round(Xrgb*(n1)) + 1; map2 = gray(n); figure image(X), title('Processed Gray Scale Indexed Image') colormap(map2), colorbar Processed Gray Scale Indexed Image The color bar of the converted image is now linear and has a smooth transition from dark to light.

Page 171
Using Wavelets % A is an S1xS2x3 array of uint8. A = double(A); Xrgb = 0.2990*A(:,:,1) + 0.5870*A(:,:,2) + 0.1140*A(:,:,3); NbColors = 255; X = wcodemat(Xrgb,NbColors); map = pink(NbColors); The same program can be used to convert BMP or JPEG files. 2102...

Page 172
OneDimensional Discrete Stationary Wavelet Analysis OneDimensional Discrete Stationary Wavelet Analysis This section takes you through the features of onedimensional discrete stationary wavelet analysis using the Wavelet Toolbox™ software. For more information see “Discrete Stationary Wavelet Transform (SWT)” on page 644. The toolbox provides these functions for onedimensional discrete stationary wavelet analysis.

Page 173
OneDimensional Analysis Using the Command Line This example involves a noisy Doppler test signal. Load a signal. ® From the MATLAB prompt, type load noisdopp Set the variables. Type s = noisdopp;...

Page 174
OneDimensional Discrete Stationary Wavelet Analysis This generates the coefficients of the level 1 approximation ( ) and detail ). Both are of the same length as the signal. Type whos Name Size Bytes Class noisdopp 1x1024 8192 double array 1x1024 8192 double array 1x1024...

Page 175
Using Wavelets Regenerate the signal by Inverse Stationary Wavelet Transform. To find the inverse transform, type A0 = iswt(swa,swd,'db1'); To check the perfect reconstruction, type err = norm(sA0) err = 2.1450e14 Construct and display approximation and detail from the coefficients. To construct the level 1 approximation and detail ( ) from the coefficients...

Page 176
OneDimensional Discrete Stationary Wavelet Analysis Approximation A1 Detail D1 −0.5 −2 −1 −4 −1.5 −6 −2 −8 −2.5 200 400 600 800 1000 200 400 600 800 1000 Perform a multilevel Stationary Wavelet Decomposition. To perform a decomposition at level 3 of the signal (again using the wavelet), type [swa,swd] = swt(s,3,'db1');...

Page 177
Using Wavelets Name Size Bytes Class noisdopp 1x1024 8192 double array 1x1024 8192 double array 3x1024 24576 double array 3x1024 24576 double array Display the coefficients of approximations and details. To display the coefficients of approximations and details, type kp = 0; for i = 1:3 subplot(3,2,kp+1), plot(swa(i,:));...

Page 178
OneDimensional Discrete Stationary Wavelet Analysis Approx. cfs level 1 Detail cfs level 1 −10 −2 −20 −4 200 400 600 800 1000 200 400 600 800 1000 Approx. cfs level 2 Detail cfs level 2 −5 −10 −20 −10 200 400 600 800 1000 200 400 600 800 1000 Approx.

Page 179
Using Wavelets Reconstruct and display approximations at Levels 1 and 2 from approximation at Level 3 and details at Levels 2 and 3. To reconstruct the approximations at levels 2 and 3, type A(2,:) = A(3,:) + D(3,:); A(1,:) = A(2,:) + D(2,:); To display the approximations and details at levels 1, 2 and 3, type kp = 0;...

Page 180
OneDimensional Discrete Stationary Wavelet Analysis Remove noise by thresholding. To denoise the signal, use the command to calculate a default global ddencmp threshold. Use the command to perform the actual thresholding of wthresh the detail coefficients, and then use the command to obtain the iswt denoised signal.

Page 181
Using Wavelets Original signal −5 −10 1000 De−noised signal −5 −10 1000 The obtained signal remains a little bit noisy. The result can be improved by considering the decomposition of at level 5 instead of level 3, and repeating steps 14 and 15. To improve the previous denoising, type 2112...

Page 182
OneDimensional Discrete Stationary Wavelet Analysis [swa,swd] = swt(s,5,'db1'); [thr,sorh] = ddencmp('den','wv',s); dswd = wthresh(swd,sorh,thr); clean = iswt(swa,dswd,'db1'); subplot(2,1,1), plot(s); title('Original signal') subplot(2,1,2), plot(clean); title('denoised signal') Original signal −5 −10 1000 De−noised signal −5 −10 1000 A second syntax can be used for the functions, giving the same iswt results:...

Page 183
The basic idea is to average many slightly different discrete wavelet analyses. Start the Stationary Wavelet Transform DeNoising 1D Tool. From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears.

Page 184
OneDimensional Discrete Stationary Wavelet Analysis Click the SWT Denoising 1D menu item. The discrete stationary wavelet transform denoising tool for onedimensional signals appears. 2115...

Page 185
Load data. From the File menu, choose the Load Signal option. When the Load Signal dialog box appears, select the MATfile , which should reside in the MATLAB folder noisbloc.mat toolbox/wavelet/wavedemo Click the OK button. The noisy blocks signal is loaded into the SWT Denoising 1D tool.

Page 186
OneDimensional Discrete Stationary Wavelet Analysis Perform a Stationary Wavelet Decomposition. Select the wavelet from the Wavelet menu and select 5 from the Level menu, and then click the Decompose Signal button. After a pause for computation, the tool displays the stationary wavelet approximation and detail coefficients of the decomposition.

Page 187
Using Wavelets of the window. The yellow dotted lines can also be dragged directly using the left mouse button over the graphs. Note that the approximation coefficients are not thresholded. Click the denoise button. The result is quite satisfactory, but seems to be oversmoothed around the discontinuities of the signal.

Page 188
OneDimensional Discrete Stationary Wavelet Analysis The residuals clearly contain some signal information. Selecting a Thresholding Method. Select hard for the thresholding mode instead of , and then click the denoise button. soft 2119...

Page 189: Importing And Exporting From The Gui
Using Wavelets The result is of good quality and the residuals look like a white noise sample. To investigate this last point, you can get more information on residuals by clicking the Residuals button. Importing and Exporting from the GUI The tool lets you save the denoised signal to disk.

Page 190
OneDimensional Discrete Stationary Wavelet Analysis thrParams{1} ans = 1.0e+03 * 0.0010 1.0240 0.0041 Here the lower bound is 1, the upper bound is 1024, and the threshold value is 4.1. The total timeinterval is not segmented and the procedure does not use the interval dependent thresholds.

Page 191: Twodimensional Discrete Stationary Wavelet Analysis
Using Wavelets TwoDimensional Discrete Stationary Wavelet Analysis This section takes you through the features of twodimensional discrete stationary wavelet analysis using the Wavelet Toolbox™ software. For more information, see “Available Methods for DeNoising, Estimation, and Compression Using GUI Tools” on page 6122. The toolbox provides these functions for image analysis.

Page 192
(see the wcodemat reference page). This example involves a image containing noise. Load an image. ® From the MATLAB prompt, type load noiswom whos Name Size Bytes Class 96x96...

Page 193
Using Wavelets This generates the coefficients matrices of the levelone approximation ( and horizontal, vertical and diagonal details ( , and respectively). Both are of sizetheimage size. Type whos Name Size Bytes Class 96x96 73728 double array 255x3 6120 double array 96x96 73728 double array...

Page 194
TwoDimensional Discrete Stationary Wavelet Analysis Approximation swa Horiz. Detail swh Vertical Detail swv Diag. Detail swd Regenerate the image by Inverse Stationary Wavelet Transform. To find the inverse transform, type A0 = iswt2(swa,swh,swv,swd,'db1'); To check the perfect reconstruction, type err = max(max(abs(XA0))) err = 1.1369e13 Construct and display approximation and details from the coefficients.

Page 195
Using Wavelets To display the approximation and details at level 1, type colormap(map) subplot(2,2,1), image(wcodemat(A1,192)); title('Approximation A1') subplot(2,2,2), image(wcodemat(H1,192)); title('Horiz. Detail H1') subplot(2,2,3), image(wcodemat(V1,192)); title('Vertical Detail V1') subplot(2,2,4), image(wcodemat(D1,192)); title('Diag. Detail D1') Approximation A1 Horiz. Detail H1 Vertical Detail V1 Diag.

Page 196
TwoDimensional Discrete Stationary Wavelet Analysis matrices , and for a given swa(:,:,i) swh(:,:,i) swv(:,:,i) swd(:,:,i) level are of sizetheimage size. Type clear A0 A1 D1 H1 V1 err nulcfs whos Name Size Bytes Class 96x96 73728 double array 255x3 6120 double array 96x96x3 221184...

Page 197
Using Wavelets Approx. cfs level 1 Horiz. Det. cfs level 1 Vert. Det. cfs level 1 Diag. Det. cfs level 1 20 40 60 80 20 40 60 80 20 40 60 80 20 40 60 80 Approx. cfs level 2 Horiz.

Page 198
TwoDimensional Discrete Stationary Wavelet Analysis H(:,:,i) = iswt2(mzero,swcfs,mzero,mzero,'db1'); swcfs = mzero; swcfs(:,:,i) = swv(:,:,i); V(:,:,i) = iswt2(mzero,mzero,swcfs,mzero,'db1'); swcfs = mzero; swcfs(:,:,i) = swd(:,:,i); D(:,:,i) = iswt2(mzero,mzero,mzero,swcfs,'db1'); Reconstruct and display approximations at Levels 1, 2 from approximation at Level 3 and details at Levels 1, 2, and 3. To reconstruct the approximations at levels 2 and 3, type A(:,:,2) = A(:,:,3) + H(:,:,3) + V(:,:,3) + D(:,:,3);...

Page 199
Using Wavelets Approx. level 1 Horiz. Det. level 1 Vert. Det. level 1 Diag. Det. level 1 20 40 60 80 20 40 60 80 20 40 60 80 20 40 60 80 Approx. level 2 Horiz. Det. level 2 Vert.

Page 200
TwoDimensional Discrete Stationary Wavelet Analysis clean = iswt2(swa,dswh,dswv,dswd,'db1'); To display both the original and denoised images, type colormap(map) subplot(1,2,1), image(wcodemat(X,192)); title('Original image') subplot(1,2,2), image(wcodemat(clean,192)); title('denoised image') Original image De−noised image A second syntax can be used for the functions, giving the swt2 iswt2 same results:...

Page 201
The basic idea is to average many slightly different discrete wavelet analyses. Start the Stationary Wavelet Transform DeNoising 2D Tool. From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears: 2132...

Page 202
TwoDimensional Discrete Stationary Wavelet Analysis Click the SWT Denoising 2D menu item. The discrete stationary wavelet transform denoising tool for images appears. 2133...

Page 203
From the File menu, choose the Load Image option. When the Load Image dialog box appears, select the MATfile noiswom.mat which should reside in the MATLAB folder toolbox/wavelet/wavedemo Click the OK button. The noisy woman image is loaded into the SWT tool.

Page 204
TwoDimensional Discrete Stationary Wavelet Analysis Perform a Stationary Wavelet Decomposition. Select the wavelet from the Wavelet menu, select 4 from the Level haar menu, and then click the Decompose Image button. The tool displays the histograms of the stationary wavelet detail coefficients of the image on the left of the window.

Page 205
Using Wavelets vertically through the histograms of the coefficients on the left of the window. Click the denoise button. The result seems to be oversmoothed and the selected thresholds too aggressive. Nevertheless, the histogram of the residuals is quite good since it is close to a Gaussian distribution, which is the noise introduced to produce the analyzed image from a piece of the original image...

Page 206
TwoDimensional Discrete Stationary Wavelet Analysis The result is quite satisfactory, although it is possible to improve it slightly. Select the wavelet and click the Decompose Image button. Use the sym6 Sparsity slider to adjust the threshold value close to 40.44, and then click the denoise button.

Page 207
Using Wavelets Importing and Exporting Information from the Graphical Interface The tool lets you save the denoised image to disk. The toolbox creates a MATfile in the current folder with a name you choose. To save the denoised image from the present denoising process, use the menu File >...

Page 208
TwoDimensional Discrete Stationary Wavelet Analysis 255x3 6120 double array valTHR double array wname char array The denoised image is is the colormap. In addition, the parameters of the denoising process are available. The wavelet name is contained in , and the level dependent thresholds are encoded in .

Page 209: Onedimensional Wavelet Regression Estimation, Equally Spaced Observations (fixed Design)
For the examples in this section, switch the extension mode to symmetric padding, using the command dwtmode('sym') OneDimensional Estimation Using the GUI for Equally Spaced Observations (Fixed Design) Start the Regression Estimation 1D Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. 2140...

Page 210
OneDimensional Wavelet Regression Estimation Click the Regression Estimation 1D menu item. The discrete wavelet analysis tool for onedimensional regression estimation appears. 2141...

Page 211
When the Load data for Fixed Design Regression dialog box appears, select the demo MATfile , which should reside in the noisbloc.mat MATLAB folder toolbox/wavelet/wavedemo Click the OK button. The noisy blocks data is loaded into the Regression tool. Estimation 1D  Fixed Design...

Page 212
OneDimensional Wavelet Regression Estimation Processed data Select number of bins Initial data after a binning for the processed data The loaded data denoted (X,Y) and the processed data obtained after a binning, are displayed. Choose the processed data. The default value for the number of bins is 256 for this example. Enter 64 in the Nb bins (number of bins) edit box, or use the slider to adjust the value.

Page 213
Using Wavelets Perform a Wavelet Decomposition of the processed data. Select the wavelet from the Wavelet menu and select 5 from the Level haar menu, and then click the Decompose button. After a pause for computation, the tool displays the detail coefficients of the decomposition. Perform a regression estimation.

Page 214
OneDimensional Wavelet Regression Estimation You can see that the process removed the noise and that the blocks are well reconstructed. The regression estimate (in yellow) is the sum of the signals located below it: the approximation a5 and the reconstructed details after coefficient thresholding.

Page 215: Onedimensional Estimation Using The Gui For Randomly Spaced Observations (stochastic Design)
Regression dialog box appears, select the demo MATfile Regression ex1nsto.mat which should reside in the MATLAB folder toolbox/wavelet/wavedemo Click the OK button. This short set of data (of size 500) is loaded into the Regression Estimation 1D  Stochastic Design tool.

Page 216
OneDimensional Wavelet Regression Estimation From the Select thresholding method menu, select the item Penalize low and click the Estimate button. Check Show Estimated Function to validate the fit of the original data. 2147...

Page 217
Using Wavelets Importing and Exporting Information from the Graphical Interface Saving Function This tool lets you save the estimated function to disk. The toolbox creates a MATfile in the current folder with a name you choose. To save the estimated function from the present estimation, use the menu option File >...

Page 218
OneDimensional Wavelet Regression Estimation For example, for level 1, thrParams{1} ans = 0.4987 0.4997 1.0395 Loading Data To load data for regression estimation, your file must contain at least one vector. If your file contains only one vector, this vector is considered as ydata and an vector is automatically generated.

Page 219: Onedimensional Wavelet Density Estimation, Onedimensional Estimation Using The Graphical Interface
For the examples in this section, switch the extension mode to symmetric padding, using the command dwtmode('sym') OneDimensional Estimation Using the Graphical Interface Start the Density Estimation 1D Tool. From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. 2150...

Page 220
OneDimensional Wavelet Density Estimation 2151...

Page 221
From the File menu, choose the Load > Data for Density Estimate option. When the Load data for Density Estimate dialog box appears, select the demo MATfile , which should reside in the MATLAB folder ex1cusp1.mat . Click the OK button. The noisy cusp data is toolbox/wavelet/wavedemo loaded into the Density Estimation 1D tool.

Page 222
OneDimensional Wavelet Density Estimation Initial data Binned data Select number of bins for the processed data A 64 bin histogram of the data The sample, a 64bin histogram, and the processed data obtained after a binning are displayed. In this example, we’ll accept the default value for the number of bins (250).

Page 223
Using Wavelets Perform a density estimation. We’ll accept the defaults of global soft thresholding. The sliders located on the right of the window control the level dependent thresholds, indicated by yellow dotted lines running horizontally through the graphs on the left of the window.

Page 224
OneDimensional Wavelet Density Estimation You can see that the estimation process delivers a very irregular resulting density. The density estimate (in yellow) is the normalized sum of the signals located below it: the approximation and the reconstructed details after coefficient thresholding. Perform thresholding.

Page 225
Using Wavelets The estimated density is more satisfactory. It correctly identifies the smooth part of the density and the cusp at 0.7. Importing and Exporting Information from the Graphical Interface The tool lets you save the estimated density to disk. The toolbox creates a MATfile in the current folder with a name you choose.

Page 226
OneDimensional Wavelet Density Estimation Name Size Bytes Class thrParams cell array wname char array xdata 1x250 2000 double array ydata 1x250 2000 double array The estimated density is given by . The length of these vectors xdata ydata is of the same as the number of bins you choose in step 4. In addition, the parameters of the estimation process are given by the wavelet name in wname wname...

Page 227: Wavelet Coefficients
Using Wavelets OneDimensional Variance Adaptive Thresholding of Wavelet Coefficients This section takes you through the features of local thresholding of wavelet coefficients for onedimensional signals or data. This capability is available through graphical interface tools throughout the Wavelet Toolbox™ software: •...

Page 228: Using The Graphical Interface
OneDimensional Variance Adaptive Thresholding of Wavelet Coefficients OneDimensional Local Thresholding for DeNoising Using the Graphical Interface ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. Click the SWT Denoising 1D menu item. 2159...

Page 229
From the File menu, choose the Load Signal option. When the Load Signal dialog box appears, select the MATfile nblocr1.mat which should reside in the MATLAB folder toolbox/wavelet/wavedemo Click the OK button. The noisy blocks signal with two change points in the...

Page 230
OneDimensional Variance Adaptive Thresholding of Wavelet Coefficients The result is quite satisfactory, but seems to be oversmoothed when the signal is irregular. Select hard for the thresholding mode instead of soft , and then click the denoise button. 2161...

Page 231
Using Wavelets The result is not satisfactory. The denoised signal remains noisy before position 200 and after position 700. This illustrates the limits of the classical denoising strategies. In addition, the residuals obtained during the last trials clearly suggest to try a local thresholding strategy. Generate intervaldependent thresholds.

Page 232
OneDimensional Variance Adaptive Thresholding of Wavelet Coefficients Click the Generate button. After a pause for computation, the tool displays the default intervals associated with adapted thresholds. Three intervals are proposed. Since the variances for the three intervals are very different, the optimization program easily detects the correct structure. Nevertheless, you can visualize the intervals proposed for a number of intervals from 1 to 6 using the Select Number of Intervals menu (which 2163...

Page 233
Using Wavelets replaces the Generate button). Using the default intervals automatically propagates the interval delimiters and associated thresholds to all levels. denoise with IntervalDependent Thresholds. Click the Close button in the Int. window. When the Update Dependent Threshold Settings for ... dialog box appears, click Yes .

Page 234
OneDimensional Variance Adaptive Thresholding of Wavelet Coefficients Note that you can also change the interval limits by holding down the left mouse button over the vertical dotted red lines, and dragging them. You can also define your own interval dependent strategy. Click the Int. button.

Page 235
Using Wavelets Some Examples of Denoising with Interval Dependent Thresholds. From the File menu, choose the Example Analysis > Noisy Signals  option. The proposed items contain, in addition to Dependent Noise Variance the usual information, the “true” number of intervals. You can then experiment with various signals for which local thresholding is needed.

Page 236
OneDimensional Variance Adaptive Thresholding of Wavelet Coefficients whos Name Size Bytes Class dnelec 1x2000 16000 double array thrParams cell array wname char array The denoised signal is given by . In addition, the parameters of the dnelec denoising process are given by the wavelet name contained in wname: wname wname = haar...

Page 237
• Manual selection of coefficients For this section, switch the extension mode to symmetric padding using the command dwtmode('sym') Start the Wavelet Coefficients Selection 1D Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. 2168...

Page 238
OneDimensional Selection of Wavelet Coefficients Using the Graphical Interface Click the Wavelet Coefficients Selection 1D menu item. The discrete wavelet coefficients selection tool for onedimensional signals appears. 2169...

Page 239
Load data. From the File menu, choose the Load Signal option. When the Load Signal dialog box appears, select the demo MATfile , which should reside in the MATLAB folder noisbump.mat . Click the OK button. The noisy bumps data is toolbox/wavelet/wavedemo loaded into the Wavelet Coefficients Selection 1D tool.

Page 240
OneDimensional Selection of Wavelet Coefficients Using the Graphical Interface The tool displays below the original signal (on the left) its wavelet decomposition: the approximation coefficients and detail coefficients from at the top to at the bottom. In the middle of the window, below the synthesized signal (which at this step is the same, since all the wavelet coefficients are kept) it displays the selected coefficients.

Page 241
Using Wavelets Selecting Biggest Coefficients Globally. On the right of the window, find a column labeled Kept . The last line shows the total number of coefficients: 1049. This is a little bit more than the number of observations, which is 1024. You can choose the number of selected biggest coefficients by typing a number instead of 1049 or by using the slider.

Page 242
OneDimensional Selection of Wavelet Coefficients Using the Graphical Interface None of the approximation coefficients are kept. From the App. cfs menu, select the Selectable option. Type for the number of selected biggest coefficients and press Enter . Then, click the button.

Page 243
Using Wavelets Selecting Biggest Coefficients by Level. From the Define Selection method menu, select the By Level option. You can choose the number of selected biggest coefficients by level or select it using the sliders. Type for the approximation and each detail, and then click the Apply button. Selecting Coefficients Manually.

Page 244
OneDimensional Selection of Wavelet Coefficients Using the Graphical Interface Select seven coefficients individually by double clicking each of them using the left mouse button. The color of selected coefficients switches from green to yellow for the details and from blue to yellow for the approximation, which appear on the left of the window and appear in yellow on the middle part.

Page 245
Using Wavelets right of the window. Click the Apply button. The tool displays the null signal again. Note that when the coefficients are very close, it is easier to zoom in before selecting or deselecting them. Drag a rubber band box over the portion of the coefficient axes around the position 800 and containing all scales and click the Select button.

Page 246
OneDimensional Selection of Wavelet Coefficients Using the Graphical Interface Let’s perform the stepwise movie using the biggest coefficients, from k = 1 in steps of , click the Start button. As soon as the result is k = 31 satisfactory, click the Stop button. Save the synthesized signal.

Page 247
For this section, switch the extension mode to symmetric padding using the command dwtmode('sym') Start the Wavelet Coefficients Selection 2D Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. 2178...

Page 248
TwoDimensional Selection of Wavelet Coefficients Using the Graphical Interface Click the Wavelet Coefficients Selection 2D menu item. The discrete wavelet coefficients selection tool for images appears. 2179...

Page 249
Load data. From the File menu, choose the Load Image option. When the Load Image dialog box appears, select the demo MATfile , which should reside in the MATLAB folder noiswom.mat . Click the OK button. The noisy woman data is toolbox/wavelet/wavedemo loaded into the Wavelet Coefficients Selection 2D tool.

Page 250
TwoDimensional Selection of Wavelet Coefficients Using the Graphical Interface The tool displays its wavelet decomposition below the original image (on the left). The selected coefficients are displayed in the middle of the window, below the synthesized image (which, at this step, is the same since all the wavelet coefficients are kept).

Page 251
Using Wavelets Selecting Biggest Coefficients Globally. On the right of the window, find a column labeled Kept . The last line shows the total number of coefficients: 11874. This is a little bit more than the original image number of pixels. You can choose the number of selected biggest coefficients by typing a number instead of 11874, or by using the slider.

Page 252
TwoDimensional Selection of Wavelet Coefficients Using the Graphical Interface In the previous trial, the approximation coefficients were all kept. It is possible to relax this constraint by selecting another option from the App. menu (see “OneDimensional Selection of Wavelet Coefficients Using the Graphical Interface”...

Page 253
Using Wavelets Selecting Coefficients Automatically. From the Define Selection method menu, select the Stepwise movie option. The tool displays its wavelet decomposition on the left, below the original image. At the beginning, no coefficients are kept so the synthesized image is null. Perform the stepwise movie using the biggest coefficients, from , in steps of...

Page 254
TwoDimensional Selection of Wavelet Coefficients Using the Graphical Interface We’ve stopped the movie at 864 coefficients (including the number of approximation coefficients). Save the synthesized image. This tool lets you save the synthesized image to disk. The toolbox creates a MATfile in the current folder with a name you choose.

Page 255: Onedimensional Extension, Onedimensional Extension Using The Command Line, Onedimensional Extension Using The Graphical Interface
OneDimensional Extension Using the Command Line The function performs signal extension. For more information, see its wextend reference page. OneDimensional Extension Using the Graphical Interface Start the Signal Extension Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. 2186...

Page 256
Load data. From the File menu, choose the Load Signal option. When the Load Signal dialog box appears, select the demo MATfile , which should reside in the MATLAB folder noisbloc.mat . Click the OK button. The noisy blocks data is toolbox/wavelet/wavedemo loaded into the Signal Extension tool.

Page 257
Using Wavelets Extend the signal. Enter in the Desired Length box of the extended signal, and select the 1300 option from the Direction to extend menu. Then accept the default Left for the Extension mode , and click the Extend button. Symmetric 2188...

Page 258
OneDimensional Extension The tool displays the original signal delimited by a red box and the transformed signal delimited by a yellow box. The signal has been extended by left symmetric boundary values replication. Select the Both option from the Direction to extend menu and select the option from the Extension mode menu.

Page 259
Using Wavelets The signal is extended in both directions by replicating the first value to the left and the last value to the right, respectively. Extending Signal for SWT. Since the decomposition at level of a signal using SWT requires that divides evenly into the length of the signal, the tool provides a special option dedicated to this kind of extension.

Page 260
OneDimensional Extension Since the signal is of length , no extension is needed so the 1024 = 2^10 button is ineffective. Extend From the File menu, choose the Example Extension option and select the last item of the list. 2191...

Page 261
Using Wavelets Since the signal is of length 1000 and the decomposition level needed for SWT is 10, the tool performs a minimal right periodic extension. The extended signal is of length 1024. Select 4 from the SWT Decomposition Level menu, and then click the Extend button.

Page 262
OneDimensional Extension Truncating Signal. The same tool allows you to truncate a signal. Since truncation is not allowed for the special mode For SWT , select the option from the Extension mode menu. Type for the desired Periodic length and press Enter . Click the Truncate button. The tool displays the original signal delimited by a red box and the truncated signal delimited by a yellow box.

Page 263
Using Wavelets Importing and Exporting Information from the Graphical Interface This tool lets you save the transformed signal to disk. The toolbox creates a MATfile in the current folder with a name you choose. To save the transformed signal, use the menu option File > Save Transformed Signal .

Page 264: Twodimensional Extension, Twodimensional Extension Using The Command Line, Twodimensional Extension Using The Graphical Interface
TwoDimensional Extension Using the Command Line The function performs image extension. For more information, see its wextend reference page. TwoDimensional Extension Using the Graphical Interface Start the Image Extension Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. 2195...

Page 265
Using Wavelets Click the Image Extension menu item. Extend (or truncate) the image. From the File menu, choose the Example Extension option and select the first item of the list. 2196...

Page 266
TwoDimensional Extension The tool displays the original image delimited by a red box and the transformed image delimited by a yellow box. The image has been extended by zero padding. The right part of the window allows you to control the parameters of the extension/truncation process for the vertical and horizontal directions, respectively.

Page 267
Using Wavelets Importing and Exporting Information from the Graphical Interface This tool lets you save the transformed image to disk. The toolbox creates a MATfile in the current folder with a name you choose. To save the transformed image, use the menu option File > Save Transformed Image A dialog box appears that lets you specify a folder and filename for storing the image.

Page 268: Image Fusion, Image Fusion Using The Command Line
Image Fusion Image Fusion This section takes you through the features of Image Fusion, one of the Wavelet Toolbox™ specialized tools. For the examples in this section, switch the extension mode to symmetric padding, using the command: dwtmode('sym') The toolbox requires only one function for image fusion: .

Page 269
Using Wavelets load mask; X1 = X; load bust; X2 = X; Merge the two images from wavelet decompositions at level 5 using taking two different fusion methods: fusion by taking the mean for both approximations and details, XFUSmean = wfusimg(X1,X2,'db2',5,'mean','mean'); and fusion by taking the maximum for approximations and the minimum for the details.

Page 270
Image Fusion Example 2: Restoration by Fusion from Fuzzy Images Load two fuzzy versions of an original image. load cathe_1; X1 = X; load cathe_2; X2 = X; Merge the two images from wavelet decompositions at level 5 using sym4 taking the maximum of absolute value of the coefficients for both approximations and details.

Page 271: Image Fusion Using The Graphical Interface
Image Fusion Using the Graphical Interface Start the Image Fusion Tool. ® From the MATLAB prompt, type wavemenu to display the Wavelet Toolbox Main Menu and then click the Image menu item to display the Image Fusion Tool.

Page 272
Image Fusion 2203...

Page 273
Load original images. From the File menu, choose the Load Image 1 option. When the Load Image 1 dialog box appears, select the demo MATfile , which should reside in the MATLAB folder mask.mat . Click the OK button. toolbox/wavelet/wavedemo...

Page 274
Image Fusion Perform wavelet decompositions. Using the Wavelet and Level menus located to the upper right, determine the wavelet family, the wavelet type, and the number of levels to be used for the analysis. For this analysis, select the wavelet at level 5. Click the Decompose button.

Page 275
Using Wavelets The synthesized image and its decomposition (which is equal to the fusion of the two decompositions) appear. The new image produced by fusion clearly exhibits features from the two original ones. Let us now examine another example illustrating restoration using image fusion.

Page 276
Image Fusion The synthesized image is a restored version of good quality of the common underlying original image. Saving the Synthesized Image The Image Fusion Tool lets you save the synthesized image to disk. The toolbox creates a MATfile in the current folder with a name you choose. To save the synthesized image from the present selection, use the menu option File >...

Page 277: Onedimensional Fractional Brownian Motion Synthesis, Command Line
Using Wavelets OneDimensional Fractional Brownian Motion Synthesis This section takes you through the features of OneDimensional Fractional Brownian Motion Synthesis using one of the Wavelet Toolbox™ specialized tools. For the examples in this section, switch the extension mode to symmetric padding, using the command dwtmode('sym') The toolbox requires only one function to generate a fractional Brownian...

Page 278
OneDimensional Fractional Brownian Motion Synthesis % Generate fBm for H = 0.3 and H = 0.7 % Initialize the randn generator randn('state',1) % Set the parameter H and the sample length H = 0.3; lg = 1000; % Generate and plot waveletbased fBm for H = 0.3 fBm03 = wfbm(H,lg,'plot');...

Page 279
Fractional Brownian Motion Synthesis Using the Graphical Interface Start the Fractional Brownian Motion Synthesis Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. Click Fractional Brownian to display the OneDimensional Fractional Brownian Generation 1D Motion Synthesis Tool.

Page 280
OneDimensional Fractional Brownian Motion Synthesis 2211...

Page 281
Using Wavelets Generate From the Fractal Index edit button, type 0.3 and from the Seed frame, select the item State and set the value to 0. Next, click the Generate button. 2212...

Page 282
OneDimensional Fractional Brownian Motion Synthesis The synthesized signal exhibits a locally highly irregular behavior. Now let us try another value for the fractal index. From the Fractal Index edit button, type 0.7 and from the Seed frame, select the item State and set the value to 0.

Page 283: Saving The Synthesized Signal
Using Wavelets The synthesized signal clearly exhibits a stronger lowfrequency component and has locally a less irregular behavior. These properties can be investigated by clicking the Statistics button. Saving the Synthesized Signal The Fractional Brownian Motion Synthesis Tool lets you save the synthesized signal to disk.

Page 284
OneDimensional Fractional Brownian Motion Synthesis whos Name Size Bytes Class FBM_PARAMS struct array fbm07 1x1000 8000 double array FBM_PARAMS FBM_PARAMS = SEED: [2x1 double] Wav: 'db10' Length: 1000 H: 0.7000 Refinement: 6 The synthesized signal is given by . In addition, the parameters of the fbm07 generation are given by , which is a cell array of length 5.

Page 285: New Wavelet For Cwt, New Wavelet For Cwt Using The Command Line
Using Wavelets New Wavelet for CWT This section takes you through the features of New Wavelet for CWT, one of the Wavelet Toolbox™ specialized tools. The toolbox requires only one function to design a new wavelet adapted to a given pattern for CWT: .

Page 286
New Wavelet for CWT Name Size Bytes Class IntVAL double array 1x256 2048 double array 1x256 2048 double array caption 1x35 char array % This example is a demoexample, so we have the value of the % integral of the pattern as well as the details about its % construction in the caption variable.

Page 287: New Wavelet For Cwt Using The Graphical Interface
% square norm equal to 1. It is simply given by xval and psi. New Wavelet for CWT Using the Graphical Interface Start the New Wavelet for CWT Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. Click the New Wavelet for menu item to display the Pattern Adapted Admissible Wavelet Design Tool.

Page 288
New Wavelet for CWT 2219...

Page 289
From the File menu, choose the Load Pattern option. When the Load Pattern dialog box appears, select the demo MATfile , which should reside in the MATLAB folder ptpssin1.mat . Click the OK button. toolbox/wavelet/wavedemo...

Page 290
New Wavelet for CWT The selected pattern denoted by is defined on the interval and is of [0,1] integral 0.1592. It is not a wavelet, but it is a good candidate because it oscillates like a wavelet. Perform pattern approximation. Accept the default parameters leading to use a polynomial of degree 3 with constraints of continuity at the borders 0 and 1, to approximate the pattern .

Page 291
Using Wavelets The result is not really satisfactory. A solution is to increase the polynomial degree to fit better the pattern. Using the Polynomial Degree menu, increase the degree by selecting 6. Then click the Approximate button again. 2222...

Page 292
New Wavelet for CWT The result is now of good quality and can be used for pattern detection. Pattern detection using the new wavelet. Click the Run button. After a pause for computation, the tool displays the running signal and the pattern detection by CWT using the adapted wavelet.

Page 293
Using Wavelets The running signal is the superimposition of two dilated and translated versions of the pattern , namely . The two F((t20)/8) F((t40)/4) pairs (position, scale) to be detected are given by and are (20,8) (40,4) materialized by dashed lines in the lower right graph of the contour plot of the CWT.

Page 294
New Wavelet for CWT The quality of the detection is not altered at all. Compare the adapted wavelet and wellknown wavelets. Let us now compare the performance for pattern detection of the adapted wavelet versus wellknown wavelets. Click the Compare button. A new window appears.

Page 295
Using Wavelets This tool displays the pattern detection performed with the adapted wavelet on the left and wavelet (default) on the right. The two positions are perfectly detected in both cases but scales are slightly underestimated by wavelet. The tool allows you to generate various running signals and choose the wavelet to be compared with the adapted one.

Page 296: Saving The New Wavelet
New Wavelet for CWT Saving the New Wavelet The New Wavelet for CWT Tool lets you save the synthesized wavelet. The toolbox creates a MATfile in the current folder with a name you choose. To save the new wavelet from the present selection, use the option File > Save Adapted Wavelet .

Page 297: Multivariate Wavelet Denoising, Multivariate Wavelet Denoising Using The Command Line
• Improve the obtained result by retaining less principal components. • Display the number of retained principal components. • Display the estimated noise covariance matrix. ® Load a multivariate signal by typing the following at the MATLAB prompt: oad ex4mwden 2228...

Page 298
Multivariate Wavelet DeNoising whos Name Size Bytes Class covar double array 1024x4 32768 double array x_orig 1024x4 32768 double array Usually, only the matrix of data is available. Here, we also have the true noise covariance matrix ( ) and the original signals ( ).

Page 299
Using Wavelets Original signal 1 Observed signal 1 −5 −5 1000 1000 Original signal 2 Observed signal 2 −5 −10 −10 1000 1000 Original signal 3 Observed signal 3 −10 −10 1000 1000 Original signal 4 Observed signal 4 −5 −10 1000 1000...

Page 300
Multivariate Wavelet DeNoising Principal Component Analysis (PCA) on approximations in the wavelet domain or with final PCA. First, perform univariate denoising by typing the following to set the denoising parameters: level = 5; wname = 'sym4'; tptr = 'sqtwolog'; sorh = 's';...

Page 301
Using Wavelets Original signal 1 Observed signal 1 De−noised signal 1 −5 −5 −5 200 400 600 800 1000 200 400 600 800 1000 200 400 600 800 1000 Original signal 2 Observed signal 2 De−noised signal 2 −5 −5 −10 −10 −10...

Page 302
Multivariate Wavelet DeNoising Display the number of retained principal components. The second output argument gives the numbers of retained principal components for PCA for approximations and for final PCA. npc = As expected, since the signals are combinations of two initial ones, Kaiser’s rule automatically detects that only two principal components are of interest.

Page 303
Using Wavelets Original signal 1 Observed signal 1 De−noised signal 1 −5 −5 −5 200 400 600 800 1000 200 400 600 800 1000 200 400 600 800 1000 Original signal 2 Observed signal 2 De−noised signal 2 −5 −5 −10 −10 −10...

Page 304
Multivariate Wavelet DeNoising 2235...

Page 305
Using Wavelets Click Multivariate Denoising to open the Multivariate DeNoising GUI. 2236...

Page 306
Multivariate Wavelet DeNoising Load data. Select File > Load Signals. In the Select dialog box, select the MATfile from the MATLAB folder ex4mwden.mat toolbox/wavelet/wmultsig1d Click Open to load the noisy multivariate signal into the GUI. The signal is a matrix containing four columns, where each column is a signal to be denoised.

Page 307
Using Wavelets advantage of the relationships between the signals, leading to an additional denoising effect. Perform a wavelet decomposition and diagonalize the noise covariance matrix. Use the displayed default values for the Wavelet , the DWT Extension , and the decomposition Level , and then click Decompose and Mode Diagonalize.

Page 308
Multivariate Wavelet DeNoising Select Noise Adapted Basis to display the signals and their coefficients in the noiseadapted basis. To see more information about this new basis, click More on Noise Adapted Basis. A new figure displays the robust noise covariance estimate matrix and the corresponding eigenvectors and eigenvalues.

Page 309
Using Wavelets Eigenvectors define the change of basis, and eigenvalues are the variances of uncorrelated noises in the new basis. The multivariate denoising method proposed below is interesting if the noise covariance matrix is far from diagonal exhibiting spatial correlation, which, in this example, is the case.

Page 310
Multivariate Wavelet DeNoising The results are satisfactory. Both of the two first signals are correctly recovered, but they can be improved by getting more information about the principal components. Click More on Principal Components. 2241...

Page 311
Using Wavelets A new figure displays information to select the numbers of components to keep for the PCA of approximations and for the final PCA after getting back to the original basis. You can see the percentages of variability explained by each principal component and the corresponding cumulative plot.

Page 312
Multivariate Wavelet DeNoising The results are better than those previously obtained. The first signal, which is irregular, is still correctly recovered. The second signal, which is more regular, is denoised better after this second stage of PCA. You can get more information by clicking Residuals.

Page 313
Using Wavelets Importing and Exporting from the GUI The tool lets you save denoised signals to disk by creating a MATfile in the current folder with a name of your choice. To save the signal denoised in the previous section, Select File >...

Page 314
Multivariate Wavelet DeNoising whos Name Size Bytes Class DEN_Params struct array PCA_Params 1536 struct array 1024x4 32768 double array The denoised signals are in matrix . The parameters ( PCA_Params ) of the twostage denoising process are also available. DEN_Params •...

Page 315
Using Wavelets The thresholds are encoded in . For from contains thrVAL thrVAL(j) the value used to threshold the detail coefficients at level . The thresholding method is given by and the thresholding mode is given by thrMETH thrTYPE 2246...

Page 316: Multiscale Principal Components Analysis, Command Line
• Load a multivariate signal. • Perform a simple multiscale PCA. • Display the original and simplified signals. • Improve the obtained result by retaining less principal components. ® Load a multivariate signal by typing at the MATLAB prompt: load ex4mwden 2247...

Page 317
Using Wavelets whos Name Size Bytes Class covar double array 1024x4 32768 double array x_orig 1024x4 32768 double array The data stored in matrix comes from two test signals, Blocks and HeavySine, and from their sum and difference, to which multivariate Gaussian white noise has been added.

Page 318
Multiscale Principal Components Analysis Display the original and simplified signals: kp = 0; for i = 1:4 subplot(4,2,kp+1), plot(x (:,i)); title(['Original signal ',num2str(i)]) subplot(4,2,kp+2), plot(x_sim(:,i)); title(['Simplified signal ',num2str(i)]) kp = kp + 2; Original signal 1 Simplified signal 1 −5 −5 1000 1000...

Page 319
Using Wavelets Improve the first result by retaining fewer principal components. The results can be improved by suppressing noise, because the details at levels 1 to 3 are composed essentially of noise with small contributions from the signal. Removing the noise leads to a crude, but large, denoising effect. The output argument contains the numbers of retained principal components selected by Kaiser’s rule:...

Page 320
Multiscale Principal Components Analysis kp = kp + 2; Original signal 1 Simplified signal 1 −5 −5 1000 1000 Original signal 2 Simplified signal 2 −5 −10 −10 1000 1000 Original signal 3 Simplified signal 3 −10 −10 1000 1000 Original signal 4 Simplified signal 4 −10...

Page 321
Using Wavelets 2252...

Page 322
Click Multiscale Princ. Comp. Analysis to open the Multiscale Principal Components Analysis GUI. Load data. Select File > Load Signals. In the Select dialog box, select the MATfile from the MATLAB folder ex4mwden.mat toolbox/wavelet/wmultsig1d Click Open to load the multivariate signal into the GUI. The signal is a matrix containing four columns, where each column is a signal to be simplified.

Page 323
Using Wavelets These signals are noisy versions from simple combinations of the two original signals, Blocks and HeavySine and their sum and difference, each with added multivariate Gaussian white noise. Perform a wavelet decomposition and diagonalize each coefficients matrix. Use the default values for the Wavelet , the DWT Extension Mode , and the decomposition Level , and then click Decompose and Diagonalize.

Page 324
Multiscale Principal Components Analysis To get more information about the new bases allowed for performing a PCA for each scale, click More on Adapted Basis. A new figure displays the corresponding eigenvectors and eigenvalues for the matrix of the detail coefficients at level 1.

Page 325
Using Wavelets You can change the level or select the coarser approximations or the reconstructed matrix to investigate the different bases. When you finish, click Close . Perform a simple multiscale PCA. The initial values for PCA lead to retaining all the components. Select from the Provide default using dropdown list, and click Apply.

Page 326
Multiscale Principal Components Analysis The results are good from a compression perspective. Improve the obtained result by retaining fewer principal components. The results can be improved by suppressing the noise, because the details at levels 1 to 3 are composed essentially of noise with small contributions from the signal, as you can see by careful inspection of the detail coefficients.

Page 327
Using Wavelets The results are better than those previously obtained. The first signal, which is irregular, is still correctly recovered, while the second signal, which is more regular, is denoised better after this second stage of PCA. You can get more information by clicking Residuals. 2258...

Page 328
Multiscale Principal Components Analysis Importing and Exporting from the GUI The Multiscale Principal Components Analysis tool lets you save the simplified signals to disk. The toolbox creates a MATfile in the current folder with a name of your choice. To save the simplified signals from the previous section: Select File >...

Page 329
Using Wavelets whos Name Size Bytes Class PCA_Params 2628 struct array 1024x4 32768 double array The simplified signals are in matrix . The parameters of multiscale PCA are available in PCA_Params PCA_Params PCA_Params = 1x7 struct array with fields: variances is a structure array of length (here, the maximum PCA_Params...

Page 330: Onedimensional Multisignal Analysis
OneDimensional Multisignal Analysis OneDimensional Multisignal Analysis This section takes you through the features of onedimensional multisignal wavelet analysis, compression and denoising using the Wavelet Toolbox™ software. The rationale for each topic is the same as in the 1D single signal case (for details, see Chapter 6, “Advanced Concepts”).

Page 331: Command Line
OneDimensional Multisignal Analysis Using the Command Line Load a file, from the MATLAB prompt, by typing load thinker The file contains a single variable . Use to show thinker.mat...

Page 332
OneDimensional Multisignal Analysis Plot some signals. figure; plot(X(1:5,:)','r'); hold on plot(X(21:25,:)','b'); plot(X(31:35,:)','g') set(gca,'Xlim',[1,96]) grid Perform a wavelet decomposition of signals at level 2 of row signals using wavelet dec = mdwtdec('r',X,2,'db2') This generates the decomposition structure dec = dirDec: 'r' level: 2 wname: 'db2' dwtFilters: [1x1 struct]...

Page 333
Using Wavelets Change wavelet coefficients. For each signal change the wavelet coefficients by setting all the coefficients of the detail of level 1 to zero. decBIS = chgwdeccfs(dec,'cd',0,1); This generates a new decomposition structure decBIS Perform a wavelet reconstruction of signals and plot some of the new signals.

Page 334
OneDimensional Multisignal Analysis Set the wavelet coefficients at level 1 and 2 for signals 31 to 35 to the value zero, perform a wavelet reconstruction of signal 31, and compare some of the old and new signals. decTER = chgwdeccfs(dec,'cd',0,1:2,31:35); Y = mdwtrec(decTER,'a',0,31);...

Page 335
Using Wavelets Compute the energy of signals and the percentage of energy for wavelet components. [E,PEC,PECFS] = wdecenergy(dec); Energy of signals 1 and 31: Ener_1_31 = E([1 31]) Ener_1_31 = 1.0e+006 * 3.7534 2.2411 Compute the percentage of energy for wavelet components of signals 1 and PEC_1_31 = PEC([1 31],:) PEC_1_31 = 99.7760...

Page 336
OneDimensional Multisignal Analysis The first column shows the percentage of energy for approximations at level 2. Columns 2 and 3 show the percentage of energy for details at level 2 and 1, respectively. Display the percentage of energy for wavelet coefficients of signals 1 and 31. As we can see in the structure, there are 26 coefficients for the approximation and the detail at level 2, and 49 coefficients for the detail at...

Page 337
Using Wavelets Plot the original signals 1 and 31, and the corresponding compressed signals. figure; plot(X([1 31],:)','r','linewidth',2); hold on plot(XC([1 31],:)','b','linewidth',2); grid; set(gca,'Xlim',[1,96]) Compute thresholds, percentage of energy preserved and percentage of zeros associated with the method preserving at least 95% of energy. L2_perf [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(dec,'L2_perf',95);...

Page 338
OneDimensional Multisignal Analysis N0per = N0_Perf(idxSIG) N0per = 79.2079 86.1386 Compress the signals to obtain a percentage of zeros near 60% for the wavelet coefficients. [XC,decCMP,THRESH] = mswcmp('cmp',dec,'N0_perf',60); signals are the compressed versions of the original signals in the row direction.

Page 339
Using Wavelets Denoise the signals using the universal threshold: [XD,decDEN,THRESH] = mswden('den',dec,'sqtwolog','sln'); figure; plot(X([1 31],:)','r','linewidth',2); hold on plot(XD([1 31],:)','b','linewidth',2); grid; set(gca,'Xlim',[1,96]) signals are the denoised versions of the original signals in the row direction. Denoise the signals in column direction XX = mswden('densig','c',XD,'db2',2,'sqtwolog','sln');...

Page 340
In this section, we explore the same signal as in the previous section, but use the graphical interface tools to analyze it. Start the Wavelet 1D Multisignal Analysis Tool. From the MATLAB prompt, type: wavemenu The Wavelet Toolbox Main Menu appears.

Page 341
Using Wavelets Click Multisignal Analysis 1D to open the Wavelet 1D Multisignal Analysis tool. 2272...

Page 342
Selection of Data pane. Information on Selected Data Load the signals. From the File menu, select Load > Signals . When the Load Signal dialog box appears, select the demo MATfile from the MATLAB thinker.mat folder and click OK . toolbox/wavelet/wmultisig1d The data matrix loads in the Wavelet 1D Multisignal Analysis tool , and the first signal appears.

Page 343
Using Wavelets The Selection of Data pane contains a list of selectable signals. At the beginning, only the originally loaded signals are available. You can generate and add new signals to the list by decomposing, compressing, or denoising original signals. Each row of the list displays the index of selectable signal ( ), the Idx Sel...

Page 344
OneDimensional Multisignal Analysis Highlight a signal. Using the Highlight Sel button in the lowerleft corner of the Visualization pane, select signal 3. of Selected Data Select Different Views. In the Visualization of Selected Data pane, change the view mode using the popup in the lowerright corner.

Page 345
Using Wavelets Decompose a multisignal. Perform an analysis at level 4 using the wavelet and the same file used in the command line section: thinker.mat In the upper right portion of the Wavelet 1D Multisignal Analysis tool, select and level 4 in the Wavelet fields. Click Decompose .

Page 346
OneDimensional Multisignal Analysis In the Selection of Data pane, new information is added for each original signal — the percentage of energy of the wavelet components ( D1 ,…, D4 and ) and the total energy. The Information on Selected Data pane contains information on the single selected signal: Min , Mean , Max and the energy distribution of the signal.

Page 347
Using Wavelets The Selection of Data Sets pane defines the available signals that are now selectable from the Selection of Data pane. The list on the left allows you to select sets of signals and the right list allows you to select sets of corresponding coefficients: original signals ( Orig.

Page 348
OneDimensional Multisignal Analysis The energy of selected signals is primarily concentrated in the approximation , so the box plot is crushed (see figure below on the left). Deselect App. On/Off to see a better representation of details energy (see figure below on the right). Display multisignal decompositions.

Page 349
Using Wavelets Change the Level to Select the signal 7 in Highlight Sel. 2280...

Page 350
OneDimensional Multisignal Analysis Change the visualization modes. Using the second popup from the left at the bottom of the pane, select . The coefficients of the decompositions of the selected Full Dec Mode (Cfs) signals display. At level k, coefficients are duplicated 2k times. Change the view mode to and then, change to Stem Mode (Abs),...

Page 351
Using Wavelets Click the Asc. button in the Sort pane. The selected data are sorted in ascending order with respect to the parameter Idx Sig Note that DWT attributes of each selectable signal have been updated where a stands for approximation, d for detail and s for signal. Click the signal and then shiftclick the signal.

Page 352
OneDimensional Multisignal Analysis Choose Separate Mode Ctrlclick to select two sets of signals from the rightmost list of the pane: Selection of Data Sets APP 1 DET 1 2283...

Page 353
Using Wavelets Note that in this list of coefficients sets, the selected vectors must be of same length, which means that you must select components of the same level. Click the Asc. button in the Sort pane. The selected data are sorted in ascending order with respect to Idx Sig parameter.

Page 354
OneDimensional Multisignal Analysis Compress a multisignal. The graphical interface tools feature a compression option with automatic or manual thresholding. Cick Compress , located in the lowerright side of the window. This displays the Compression window. Note The tool always compresses all the original signals when you click the Compress button.

Page 355
Using Wavelets The thresholds for each level ( ), the energy ratio ( ThrD1 ThrD4 En. Rat. and the sparsity ratio ( ) are displayed in the Selection of Data NbZ Rat. pane. Click the Compress button at the bottom of the Thresholding pane. Now you can select new data sets: compressed Signals, the corresponding approximations, details and coefficients.

Page 356
OneDimensional Multisignal Analysis Click the Close button to close the Compression window. Denoise a multisignal. The graphical user interface offers a denoising option with either a predefined thresholding strategy or a manual thresholding method. Using this tool makes very easy to remove noise from many signals in one step. Display the Denoising window by clicking the Denoise button located in the bottom part of the Command Frame on the right of the window.

Page 357
Using Wavelets A number of options are available for finetuning the denoising algorithm. For this example, accept the defaults: type of thresholding, soft Fixed form as noise structure. method, threshold Scaled white noise Click the ALL button in the Thresholding pane. The threshold for each level , …, ) computes and displays in the Selection of Data pane.

Page 358
OneDimensional Multisignal Analysis Ctrlclick the Denoised item in the list on the left of the Selection of Data pane. The original signals and the corresponding denoised ones are Sets selected (2 x 192 = 384 signals). Click the Asc. button at the bottom of the Selection of Data pane to sort the signals according to the Idx Sig parameter.

Page 359
Using Wavelets To view residuals, Ctrlclick the , the and the Orig. Signal Denoised items in the list on the left of the Selection of Data Sets pane. Residuals Original, denoised and residual signals are selected (3 x 192 = 576 signals). Click the Asc.

Page 360
OneDimensional Multisignal Analysis Click Close to close the denoising tool. Then, click the Yes button to update the synthesized signals. Manual Threshold Tuning Choose a method, select one or several signals in the Selection of Data pane using the mouse and keys. Then click the Selected button. You can select another group of signals using the same method.

Page 361
Using Wavelets You can also use manual threshold tuning. Click the Enable Manual button. Thresholding Tuning The horizontal lines in the wavelet coefficient axes ( , …, ) can be dragged using the mouse. This may be done individually, by group or all together depending on the values in the Select Signal and Selected Level fields in the Manual Threshold Tuning pane.

Page 362
OneDimensional Multisignal Analysis In the Wavelet 1D Multisignal Analysis Compression tool, you can use two methods for threshold tuning: the By level thresholding method which is used in the Wavelet 1D Multisignal Analysis Denoising tool, and the Global thresholding method You can drag the vertical lines in the Energy and Nb.

Page 363
Using Wavelets depending on the values of Select Signal in the Manual Threshold Tuning pane. The threshold value, L2 performance, and number of zeros performance are updated in the corresponding edit buttons in the Manual Threshold pane. Tuning Statistics on Signals You can display various statistical parameters related to the signals and their components.

Page 364
OneDimensional Multisignal Analysis Select the signals 1, 2, 3, 7, 9 and 11 in the Selection of Data pane, and display the corresponding boxplots and correlation plots. 2295...

Page 365
Using Wavelets To display statistics on many wavelet components, in the Selection Data Sets pane, in the left column, select , Denoised Orig. Signals APP 1 DET 1 signals. Then choose , and click the Asc. Residuals Separate Mode button in the Sort pane. The selected data are sorted in ascending order with respect to parameter.

Page 366
OneDimensional Multisignal Analysis Clustering Signals Note To use clustering, you must have Statistics Toolbox™ software installed. Click the Clustering button located in the Command Frame, which is in the lower right of the Wavelet 1D Multisignal Analysis window to open the Clustering tool.

Page 367
Using Wavelets Use the default parameters ( in Data to Cluster, and Original Signal , and in Culstering Ascending Hierarchical, euclidean, ward click the Compute Clusters button. A full dendrogram and a restricted dendrogram display in the Selection by Dendrogram pane.

Page 368
OneDimensional Multisignal Analysis this class display in the Visualization of Selected Data pane. You can see their numbers in the Selection of Data pane. Clicking the line in the restricted or in the full dendrogram lets you select one cluster, several linked clusters, or a part of a cluster. For a more accurate selection, use the and the sliders under the...

Page 369
Using Wavelets Use the Show Clusters button to examine the clusters of the current partition. You can display the mean (or the median) of each cluster, the global standard deviation and the pointwise standard deviation distance around the mean (or the median). The number of the cluster, the number of elements, the percentage of signals, and two indices of quality display for each cluster.

Page 370
OneDimensional Multisignal Analysis suggested. Note that the 1D Wavelet Multisignal Analysis tool stores the partitions and they are not saved on the disk. Partitions Build and store several partitions (for example, partitions with signals, denoised signals approximations at level 1, 2 and 3, and denoised signals). Then, click the Open Partition Manager button below the Store Current button.

Page 371
Using Wavelets To display partitions, select the and the Ori Signals Den Signals partitions, and click the Selected button next to the Show Partitions label. The clusters are almost the same, but it is difficult to see this on the Selected Partitions axis, due to the scaling difference.

Page 372
OneDimensional Multisignal Analysis Select the partitions you want to save and click the Save Partitions button below the Store Current Partition button in the Partitions Management pane. 2303...

Page 373
Using Wavelets Partitions are saved as an array of integers, where each column corresponds to one partition and contains the indices of clusters. When you choose the option, an array object ( ) is saved. Full Partitions wpartobj To load or clear stored partitions use File > Partitions in the Wavelet 1D Multisignal Analysis tool.

Page 374
OneDimensional Multisignal Analysis Select File > Partitions > Load Partition to load one or several partitions from the disk. The loaded partitions are stored in Wavelet 1D Multisignal Analysis tool with any previously stored partitions. A partition can also be a manually created column vector.

Page 375
Using Wavelets For this example, go back to the main window, import the Ori Signals partition and sort the signals in descending order with respect to A4 energy percentage. Click the More on Partitions button at the bottom of the Partitions Management pane to display the Partition tool.

Page 376
OneDimensional Multisignal Analysis Select the in Sel P2 in the upperright corner of the window. Den Signals Then, in the lower left axis, click the yellow text containing the value (the coordinates of the corresponding point are (4,5)). The corresponding signals are displayed together with all related information.

Page 377
Using Wavelets More on Clustering Instead of the Ascending Hierarchical Tree clustering method, you can use the Kmeans method. For this case, the partition cannot be represented by a dendrogram and other representations should be used. In the image representation (see figure below on the left), you can select a cluster by clicking on the corresponding color on the colorbar.

Page 378
OneDimensional Multisignal Analysis Saving Decompositions The Wavelet 1D Multisignal Analysis main tool lets you save the entire set of data from a wavelet analysis to disk. The toolbox creates a MATfile in the current folder with a name you choose. Open the Wavelet 1D Multisignal Analysis main tool and load the example analysis by selecting File >...

Page 379
Using Wavelets whos Name Size Bytes Class 163306 struct dec = dirDec: 'r' level: 4 wname: 'db2' dwtFilters: [1x1 struct] dwtEXTM: 'sym' dwtShift: 0 dataSize: [192 96] ca: [192x8 double] cd: {1x4 cell} The field of the structure gives the coefficients of approximation at level 4, the field is a cell array which contains the coefficients of details.

Page 380
Wavelet 1D Multisignal Analysis tools or errors will occur when you try to load information. Loading Signals. To load a signal you constructed in your MATLAB workspace into the Wavelet 1D Multisignal Analysis tool, save the signal in a MATfile (with extension .

Page 381
Loading Decompositions. To load decompositions that you constructed in the MATLAB workspace into the Wavelet 1D Multisignal Analysis tool, save the signal in a MATfile (with extension For instance, if you design a signal called and want to analyze it in...

Page 382
OneDimensional Multisignal Analysis Note The fields have to be compatible (see the 'wname' 'dwtFilters' function). The sizes of , (for ) must wfilters cD{k} k = 1 dec.level be compatible with the direction, the level of the decomposition, and the extension mode.

Page 383
Using Wavelets Saving Partitions. The Wavelet 1D Multisignal Analysis clustering tool lets you save a set of partitions to disk. For example: Open the Wavelet 1D Multisignal Analysis main tool and load the example analysis using File > Example > Ex 21: Thinker (rows) . Click the Clustering button.

Page 384
OneDimensional Multisignal Analysis Another dialog box appears that lets you specify a folder and filename for storing the partition data. Type the name curPART After saving the partition data to the file , load the variables curPART.mat into your workspace: load curPART whos Name...

Page 385
Using Wavelets Note A partition is a column vector of integers. The values must vary from ), and each cluster must contain at least one NbClusters NbClusters > 1 element. The number of rows must be equal to the number of signals. 2316...

Page 386: Twodimensional True Compression, Command Line
TwoDimensional True Compression TwoDimensional True Compression This section takes you through the features of twodimensional true compression using the Wavelet Toolbox™ software. For more information on the compression methods see “True Compression for Images” on page 6130. For more information on the main function available when using commandline mode, see the reference pages.

Page 387
Using Wavelets A synthetic performance of the compression is given by the compression ratio and the BitPerPixel ratio which are equivalent. The compression ratio CR means that the compressed image is stored using only CR% of the initial storage size. The BitPerPixel ratio BPP gives the number of bits used to store one pixel of the image.

Page 388
TwoDimensional True Compression meth = 'gbl_mmc_h'; % Method name option = 'c'; % 'c' stands for compression [CR,BPP] = wcompress(option,X,'mask.wtc',meth,'bpp',0.5) CR = 6.6925 BPP = 0.5354 The achieved BitPerPixel ratio is actually about 0.53 (closed to the desired one) for a compression ratio of 6.7%. Uncompression Let us uncompress the image retrieved from the file and compare...

Page 389
Using Wavelets Compression by Progressive Methods Let us now illustrate the use of progressive methods starting with the well known EZW algorithm using the Haar wavelet. The key parameter is the number of loops. Increasing it, leads to better recovery but worse compression ratio.

Page 390
TwoDimensional True Compression A too small number of steps (here 6) produces a very coarse compressed image. So let us examine a little better result for 9 steps and a satisfactory result for 12 steps. [CR,BPP] = wcompress('c',X,'mask.wtc',meth,'maxloop',9, ... 'wname','haar'); Xc = wcompress('u','mask.wtc');...

Page 391
Using Wavelets As can be seen, the reached BPP ratio is about 0.92 when using 12 steps. Let us try to improve it by using the wavelet bior4.4 instead of haar and looking at obtained results for steps 12 and 11. [CR,BPP] = wcompress('c',X,'mask.wtc','ezw','maxloop',12, ...

Page 392
TwoDimensional True Compression Starting from the eleventh loop, the result can be considered satisfactory. The reached BPP ratio is now about 0.35. It can even be slightly improved by using a more recent method: SPIHT (Set Partitioning In Hierarchical Trees). [CR,BPP] = wcompress('c',X,'mask.wtc','spiht','maxloop',12, ...

Page 393
Using Wavelets The final compression ratio (2.8%) and the BitPerPixel ratio (0.23) are very satisfactory. Let us recall that the first ratio means that the compressed image is stored using only 2.8% of the initial storage size. Handling Truecolor Images Finally, let us illustrate how to compress the truecolor image.

Page 394
In this section, we explore the different methods for twodimensional true compression, using the graphical interface tools. Start the True Compression 2D Tool. From the MATLAB® prompt, type wavemenu The Wavelet Toolbox Main Menu appears. Click the True Compression item. The true compression tool for images appears.

Page 395
Using Wavelets Load the image. From the File menu, choose the Load Image option and select the Matlab Supported Formats item. When the Load Image dialog box appears, select the MATfile mask.mat which should reside in the MATLAB folder toolbox/wavelet/wavedemo Click the OK button.

Page 396
TwoDimensional True Compression approximation and details coefficients of the decomposition for the three directions, together with the histogram of the original coefficients. The peak of the bin containing zero illustrates the capability of wavelets to concentrate the image energy into a few nonzero coefficients. Try a simple method.

Page 397
Using Wavelets Values of the other parameters are automatically updated. Note that these values are only approximations of the true performances since the quantization step cannot be exactly predicted without performing it. Click the Compress button. 2328...

Page 398
TwoDimensional True Compression Synthetic performance is given by the compression ratio and the computed BitPerPixel (BPP). This last one is actually about 0.53 (close to the desired one 0.5) for a compression ratio of 6.7%. The compressed image, at the bottom left, can be compared with the original image.

Page 399
Using Wavelets Wavelet menu select 8 from the Level menu. Then click the Decompose button. Choose the EZW option from the menu Compression method. The key parameter is the number of loops: increasing it leads to a better recovery but worse compression ratio.

Page 400
TwoDimensional True Compression Refine the result by increasing the number of loops. Too few steps produce a very coarse compressed image. So let us examine a little better result for 9 steps. Set the number of encoding loops to 9 and click the Compress button.

Page 401
Using Wavelets Now try a large enough number of steps to get a satisfactory result. Set the number of encoding loops to 12 and click the Compress button. 2332...

Page 402
TwoDimensional True Compression The result is now acceptable. But for 12 steps, we attain a BitPerPixel ratio about 0.92. Get better compression performance by changing the wavelet and selecting the best adapted number of loops. Let us try to improve the compression performance by changing the wavelet: select bior4.4 instead of haar and then click the Decompose button.

Page 403
Using Wavelets The reached BPP ratio is now about 0.35 which is commonly considered a very satisfactory result. Nevertheless, it can be slightly improved by using a more recent method SPIHT (Set Partitioning In Hierarchical Trees). 2334...

Page 404
TwoDimensional True Compression Obtain a final compressed image by using a third method. Choose the SPIHT option from the menu Compression method, set the number of encoding loops to 12, and click the Compress button. The final compression ratio and the BitPerPixel ratio are very satisfactory: 2.8% and 0.22.

Page 405
From the File menu, choose the Load Image option and select the Matlab Supported Formats item. When the Load Image dialog box appears, select the MATfile which should reside in the MATLAB folder wpeppers.jpg...

Page 406
TwoDimensional True Compression The compression ratio and BitPerPixel (BPP) ratio are very satisfactory: 1.65% and 0.4 together with a very good perceptual result. Inspect the wavelet tree. For both grayscale and truecolor images, more insight on the multiresolution structure of the compressed image can be retrieved by clicking the Inspect Wavelet Trees button and then on the various active menus available from the displayed tree.

Page 407
The Wavelet Toolbox compression tools can create a file using either one of the Matlab Supported Format types or a specific format which can be recognized by the extension of the file: wtc (Wavelet Toolbox Compressed). To save the above compressed image, use the menu option File > Save Compressed Image >...

Page 408: Threedimensional Discrete Wavelet Analysis
ThreeDimensional Discrete Wavelet Analysis ThreeDimensional Discrete Wavelet Analysis This section demonstrates the features of threedimensional discrete wavelet analysis using the Wavelet Toolbox™ software. The toolbox provides these functions for 3D data analysis. (You use the Wavelet 3D GUI to perform all tasks except the first task.

Page 409: Performing Threedimensional Analysis Using The Command Line
Using Wavelets Performing ThreeDimensional Analysis Using the Command Line Both the demo (see ) and the documentation of the wavelet3ddemo AnalysisDecomposition and SynthesisReconstruction functions show how you can analyze 3D arrays efficiently using command line functions dedicated to the threedimensional wavelet analysis. For more information, see the function reference pages.

Page 410: Performing Threedimensional Analysis Using The Graphical Interface
Start the 3D Wavelet Analysis Tool. From the MATLAB prompt, type wavemenu The Wavelet Tool Main Menu appears. Click the Wavelet 3D menu item. The discrete wavelet analysis tool for threedimensional data opens.

Page 411
Using Wavelets Load a 3D array. From the File menu, choose Load > Data . When the Load Data dialog box appears, select the demo MATfile , which is in the MATLAB folder . Click wmri.mat toolbox/wavelet/wavelet to load the 3D data into the Wavelet 3D tool.

Page 412
ThreeDimensional Discrete Wavelet Analysis Review the slices of data and wavelet components in the graphical display. These slices are orthogonal to the zdirection as indicated by Slice Orientation in the command part of the window. This option lets you choose the desired slice orientation. The first row of the graphical display area displays from left to right and for Z = 1: •...

Page 413
Using Wavelets The next two lines of axes, display the wavelet coefficients at level 2, which is the desired level of the analysis. In the first line, the first graph contains the coefficients of approximation at level 2. The remaining seven axes display the seven types of wavelet coefficients at level 2.

Page 414
ThreeDimensional Discrete Wavelet Analysis • The highpass filter in Z direction ( again for detail), leading to the component You use the Displayed Level in the command part of the window to choose the level of the displayed component, from 1 to the decomposition level. You can modify characteristics of the display using the options in the command part of the window.

Page 415
Using Wavelets Using the slider (or by directly editing the values) of Rec. ZSlice, choose slice number twelve. Similarly, choose slice number two using Cfs. ZSlice. The Slice Movie button lets you see a movie of all the slices, first for the reconstructed slices and then for the coefficients slices.

Page 416
ThreeDimensional Discrete Wavelet Analysis Approximation at level 2 Sum of all the components from level 1 to level 2 (different from the lowpass component) Sum of all the highpass components at level 2 A rotated 3D view of the approximation at level 1 opens in a new window. Use the sliders in the 3D tool to examine the 3D data.

Page 417: Importing And Exporting Information From The Graphical Interface
You can import information from and export information either to disk or to the workspace using the Wavelet 3D graphical tool. Loading Information into the Wavelet 3D Tool To load 3D data you have constructed in your MATLAB workspace into the tool, save the 3D data in a MATfile, using Wavelet 3D M = magic(8);...

Page 418
ThreeDimensional Discrete Wavelet Analysis Similarly, you can load information from the workspace using File > Import Data . You then select the variable to load. Saving Information to a File You can save decompositions and approximations from the Wavelet 3D tool to a file or to the workspace.

Page 419
Using Wavelets where wdec Name Size Bytes Class wdec 9182 struct The variable contains the wavelet decomposition structure. wdec wdec = sizeINI: [8 8 8] level: 2 filters: [1x1 struct] mode: 'sym' dec: {15x1 cell} sizes: [3x3 double] Saving Approximations. You can process a 3D data in the Wavelet 3D tool and then save any desired approximation, depending on the level chosen for the decomposition.

Page 420
Wavelet Applications This chapter explores various applications of wavelets by presenting a series of sample analyses. • Introduction to Wavelet Analysis (p. 32) • Detecting Discontinuities and Breakdown Points I (p. 33) • Detecting Discontinuities and Breakdown Points II (p. 36) •...

Page 421: Introduction To Wavelet Analysis
If you want, try loading the corresponding MATfile from the MATLAB command line, and use Wavelet Toolbox™ functions to further investigate the sample signals. The MATfiles are located in the folder...

Page 422: Detecting Discontinuities And Breakdown Points I
Detecting Discontinuities and Breakdown Points I Detecting Discontinuities and Breakdown Points I The purpose of this example is to show how analysis by wavelets can detect the exact instant when a signal changes. The discontinuous signal consists of a slow sine wave abruptly followed by a medium sine wave. Example Analysis Signal and Approximations Signal and Details...

Page 423: Discussion
Wavelet Applications Here is a noteworthy example of an important advantage of wavelet analysis over Fourier. If the same signal had been analyzed by the Fourier transform, we would not have been able to detect the instant when the signal’s frequency changed, whereas it is clearly observable here.

Page 424
Detecting Discontinuities and Breakdown Points I The presence of noise, which is after all a fairly common situation in signal processing, makes identification of discontinuities more complicated. If the first levels of the decomposition can be used to eliminate a large part of the noise, the rupture is sometimes visible at deeper levels in the decomposition.

Page 425: Detecting Discontinuities And Breakdown Points Ii
Wavelet Applications Detecting Discontinuities and Breakdown Points II The purpose of this example is to show how analysis by wavelets can detect a discontinuity in one of a signal’s derivatives. The signal, while apparently a single smooth curve, is actually composed of two separate exponentials that are connected at time = 500.

Page 426
Detecting Discontinuities and Breakdown Points II Discussion Regularity can be an important criterion in selecting a wavelet. We have chosen to use , which is sufficiently regular for this analysis. Had we chosen wavelet, the discontinuity would not have been detected. If you try haar repeating this analysis using at level two, you’ll notice that the details are...

Page 427: Detecting Longterm Evolution
Wavelet Applications Detecting LongTerm Evolution The purpose of this example is to show how analysis by wavelets can detect the overall trend of a signal. The signal in this case is a ramp obscured by “colored” (limitedspectrum) noise. (We have zoomed in along the xaxis to avoid showing edge effects.) Example Analysis Signal and Approximation(s)

Page 428
Detecting LongTerm Evolution Discussion Wavelet analysis is useful in revealing signal trends, a goal that is complementary to the one of revealing a signal hidden in noise. It’s important to remember that the trend is the slowest part of the signal. If the signal itself includes sharp changes, then successive approximations look less and less similar to the original signal.

Page 429: Detecting Selfsimilarity, Wavelet Coefficients And Selfsimilarity
Wavelet Applications Detecting SelfSimilarity The purpose of this example is to show how analysis by wavelets can detect a selfsimilar, or fractal, signal. The signal here is the Koch curve — a synthetic signal that is built recursively. Example Analysis Analyzed Signal (length = 8192) Koch curve MATfile...

Page 430
Detecting SelfSimilarity If a signal is similar to itself at different scales, then the “resemblance index” or wavelet coefficients also will be similar at different scales. In the coefficients plot, which shows scale on the vertical axis, this selfsimilarity generates a characteristic pattern.

Page 431: Identifying Pure Frequencies, Discussion
Wavelet Applications Identifying Pure Frequencies The purpose of this example is to show how analysis by wavelets can effectively perform what is thought of as a Fouriertype function — that is, resolving a signal into constituent sinusoids of different frequencies. The signal is a sum of three pure sine waves.

Page 432
Identifying Pure Frequencies for the graph. Zooming in on detail (see below) reveals that each “belly” is composed of 10 oscillations, and this can be used to estimate the period. We indeed find that it is close to 2. The detail and (to an even greater extent), the detail contain the medium sine frequencies.

Page 433
Wavelet Applications This slow sine still is visible in approximation , but were we to extend this analysis to further levels, we would find that it disappears from the approximation and moves into the details at level 8. Signal Component Found In Period Frequency...

Page 434: Suppressing Signals
Suppressing Signals Suppressing Signals The purpose of this example is to illustrate the property that causes the decomposition of a polynomial to produce null details, provided the number of vanishing moments of the wavelet ( for a Daubechies wavelet ) exceeds the degree of the polynomial.

Page 435
Wavelet Applications Here is what the first three details look like when we perform the same analysis with Detail(s) −10 −20 −5 −1 −2 The peaktopeak magnitudes of the details , and are 2, 10, and 40, respectively. These are much higher detail magnitudes than those obtained using Discussion For the...

Page 436
Suppressing Signals On the other hand, for the analysis, we find the presence of white noise thus indicating that the polynomial does not come into play in any of the details. The wavelet suppresses the polynomial part and analyzes the noise. Suppressing part of a signal allows us to highlight the remainder.

Page 437: Denoising Signals, Discussion
Wavelet Applications DeNoising Signals The purpose of this example is to show how to denoise a signal using wavelet analysis. This example also gives us an opportunity to demonstrate the automatic thresholding feature of the Wavelet 1D graphical interface tool. The signal to be analyzed is a Dopplershifted sinusoid with some added noise.

Page 438
DeNoising Signals Original details coefficients −20 −10 −5 −2 −4 −2 1000 Click the Denoise button. On the screen, the original and denoised signals appear superimposed in red and yellow, respectively. Original and de−noised signals −5 1000 319...

Page 439
Wavelet Applications Note that the denoised signal is flat initially. Some of the highestfrequency signal information was lost during the denoising process, although less was lost here than in the higher level approximations For this signal, wavelet packet analysis does a better job of removing the noise without compromising the highfrequency information.

Page 440: Denoising Images
Open the Wavelet 2D tool, select from the File menu the Load Image option, ® and select the MATfile , which should reside in the MATLAB noiswom.mat folder toolbox/wavelet/wavedemo The image is loaded into the Wavelet 2D tool. Select the...

Page 441
Wavelet Applications The analysis appears in the Wavelet 2D window. Example Analysis Noisy Woman MATfile noiswom.mat Wavelet haar Level Click the Denoise button (located at the middle right) to bring up the Wavelet window. 2D  Denoising Discussion The graphical tool provides automatically generated thresholds. From the Select thresholding method menu, select the item Penalize low and click the button.

Page 442
DeNoising Images The denoised image exhibits some blocking effects. Let's try another wavelet. Click the Close button to go back to the Wavelet 2D window. Select the sym6 wavelet, and then click the Analyze button. Click the Denoise button to bring up the Wavelet 2D  Denoisin g window again.

Page 443
Wavelet Applications For more information, see the section “Discrete Stationary Wavelet Transform (SWT)” on page 644. Click the Close button to go back to the Wavelet 2D window and click the button again. Open the SWT Denoising 2D tool, select from the File Close menu the Load Image option and select the MATfile .

Page 444
DeNoising Images The result is more satisfactory. It’s possible to improve it slightly. Select the wavelet and click the Decompose Image button. Use the sym6 Sparsity slider to adjust the threshold value close to 40.44 (the same as before to facilitate the comparison with the second trial), and then click the Denoise button.

Page 445: Compressing Images
Wavelet Applications Compressing Images The purpose of this example is to show how to compress an image using twodimensional wavelet analysis. Compression is one of the most important applications of wavelets. The image to be compressed is a fingerprint. For this example, open the Wavelet 2D tool and select the menu item ...

Page 446
Compressing Images Discussion The graphical tool provides an automatically generated threshold. From the menu, select Remove near 0 , setting the Select thresholding method threshold to 3.5. Then, click the Compress button. Values under the threshold are forced to zero, achieving about 42% zeros while retaining almost all (99.96%) the energy of the original image.

Page 447: Fast Multiplication Of Large Matrices
Wavelet Applications Fast Multiplication of Large Matrices This section illustrates matrixvector multiplication in the wavelet domain. • The problem is let m be a dense matrix of large size (n, n). We want to perform a large number, L, of multiplications of m by vectors v. •...

Page 448
Fast Multiplication of Large Matrices Example 1: Effective Fast Matrix Multiplication n = 512; lev = 5; wav = 'db1'; % Wavelet based matrix multiplication by a vector: good example % Matrix is magic(512) Vector is (1:512) m = magic(n); v = (1:n)';...

Page 449
Wavelet Applications % Relative square norm error in percent when using wavelets. rnrm = 100 (norm(psp)/norm(p)) rnrm = 2.9744e06 Example 2: Ineffective Fast Matrix Multiplication The commands used are the same as in Example 1, but applied to a new matrix % Wavelet based matrix multiplication by a vector: example with a randn matrix.

Page 450
Wavelets in Action: Examples and Case Studies This chapter presents examples of wavelet decomposition. Suggested areas for further exploration follow most examples, along with a summary of the topics addressed by that example. This chapter also includes a case study that examines the practical uses of wavelet analysis in greater detail, as well as a demonstration of the application of wavelets for fast multiplication of large matrices.

Page 451: Illustrated Examples
Wavelets in Action: Examples and Case Studies Illustrated Examples Fourteen illustrated examples are included in this section, organized as shown: Example Equation Signal MATFile Name Example 1: A Sum of Sines A sum of sines: sumsin on page 48 0.3t 0.03t Example 2: A Frequency A frequency breakdown:...

Page 452
Illustrated Examples Example Equation Signal MATFile Name Example 7: Two Proximal Two proximal discontinuities: nearbrk Discontinuities on page 420 499, 1500 510, 3t 30 – Example 8: A A secondderivative discontinuity: scddvbrk SecondDerivative – Discontinuity on page 422 0, f –...

Page 453
Wavelets in Action: Examples and Case Studies Example Equation Signal MATFile Name Example 12: A Triangle + A A triangle + a sine: trsin Sine on page 430 – 0.3t   500, 1000 t – 0.3t 1000,   Example 13: A Triangle + A A triangle + a sine + a noise: wntrsin...

Page 454: Advice To The Reader
Illustrated Examples • When the approximations do not provide enough information, they are replaced by details obtained by changing wavelets. • The examples include questions for you to think about:  What can be seen on the figure?  What additional questions can be studied? 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.

Page 455
Wavelets in Action: Examples and Case Studies D(i,:) = wrcoef('d',c,l,w,i); Note This loop replaces 10 separate statements defining wrcoef approximations and details. The variable contains the five approximations and the variable contains the five details. % Plots. t = 100:900; subplot(6,2,1);...

Page 456
Illustrated Examples About Further Exploration Tip 1. On all figures, visually check that for j = 0, 1, ..., A 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.

Page 457: Example 1: A Sum Of Sines
Wavelets in Action: Examples and Case Studies Example 1: A Sum of Sines Analyzing wavelet: db3 Decomposition levels: 5 The signal is composed of the sum of three sines: slow, medium, and rapid. With regard to the sampling period equal to 1, the periods are approximately 200, 20, and 2 respectively.

Page 458
Illustrated Examples Signal and Approximations Signal and Details −2 −2 −0.1 −1 −1 −1 −0.5 −2 −0.1 −2 −1 −1 1000 1000 Example 1: A Sum of Sines • Detecting breakdown points Addressed topics • Detecting longterm evolution • Identifying pure frequencies •...

Page 459: Example 2: A Frequency Breakdown
Wavelets in Action: Examples and Case Studies Example 2: A Frequency Breakdown Analyzing wavelet: db5 Decomposition levels: 5 The signal is formed of a slow sine and a medium sine, on either side of 500. These two sines are not connected in a continuous manner: D and D can be used to detect this discontinuity.

Page 460
Illustrated Examples Example 2: A Frequency Breakdown • Suppressing signals Addressed topics • Detecting longterm evolution • Compare to the signal s Further exploration • On a longer signal, select a deeper level of decomposition in such a way that the slow sinusoid appears into the details.

Page 461: Example 3: Uniform White Noise
Wavelets in Action: Examples and Case Studies Example 3: Uniform White Noise Analyzing wavelet: db3 Decomposition levels: 5 At all levels we encounter noisetype signals that are clearly irregular. This is because all the frequencies carry the same energy. The variances, however, decrease regularly between one level and the next as can be seen reading the detail chart (on the right) and the approximations (on the left).

Page 462
Illustrated Examples Example 3: Uniform White Noise • Processing noise Addressed topics • The shapes of the decomposition values • The evolution of these shapes according to level; the correlation increases, the variance decreases • Compare the frequencies included in the details Further exploration with those in the approximations.

Page 463: Example 4: Colored Ar(3) Noise
Wavelets in Action: Examples and Case Studies Example 4: Colored AR(3) Noise Analyzing wavelet: db3 Decomposition levels: 5 Note AR(3) means AutoRegressive model of order 3. This figure can be examined in view of Example 3: Uniform White Noise on page 412, since we are confronted here with a nonwhite noise whose spectrum is mainly at the higher frequencies.

Page 464
Illustrated Examples Example 4: Colored AR(3) Noise • Processing noise Addressed topics • The relative importance of different details • The relative importance of D and A • Compare the detail frequencies with those in the Further approximations. exploration • Compare approximations A , and A with those shown in Example 3: Uniform White Noise on page...

Page 465: Example 5: Polynomial + White Noise
Wavelets in Action: Examples and Case Studies Example 5: Polynomial + White Noise Analyzing wavelets: db2 and db3 Decomposition levels: 4 The purpose of this analysis is to illustrate the property that causes the decomposition by of a degree polynomial to produce null details as long >...

Page 466
Illustrated Examples Signal and Details with db2 Signal and Details with db3 x 10 x 10 −50 −0.5 −0.5 −20 −0.5 −5 −1 −1 −2 Example 5: Polynomial + White Noise • Suppressing signals Addressed topics • Compare the results of the processing for the following wavelets: the short and the longer •...

Page 467: Example 6: A Step Signal
Wavelets in Action: Examples and Case Studies Example 6: A Step Signal Analyzing wavelet: db2 Decomposition levels: 5 In this case, we are faced with the simplest example of a rupture (i.e., a step). The time instant when the jump occurs is equal to 500. The break is detected at all levels, but it is obviously detected with greater precision in the higher resolutions (levels 1 and 2) than in the lower ones (levels 4 and 5).

Page 468
Illustrated Examples Example 6: A Step Signal • Detecting breakdown points Addressed topics • Suppressing signals • Detecting longterm evolution • Identifying the range width of the variations of details and approximations • Use the coefficients of the FIR filter associated Further exploration with the wavelet to check the values of D •...

Page 469: Example 7: Two Proximal Discontinuities
Wavelets in Action: Examples and Case Studies Example 7: Two Proximal Discontinuities Analyzing wavelet: db2 and db7 Decomposition levels: 5 The signal is formed of two straight lines with identical slopes, extending across a very short plateau. On the initial signal, the plateau is in fact barely visible to the naked eye.

Page 470
Illustrated Examples Signal and Details with db2 Signal and Details with db7 1700 1700 1600 1600 1500 1500 1400 1400 1300 1300 −2 −10 −2 −2 −1 −2 −4 −1 −0.5 −0.2 −0.5 Example 7: Two Proximal Discontinuities • Detecting breakdown points Addressed topics •...

Page 471: Example 8: A Secondderivative Discontinuity
Note To produce the figure below you can use the OneDimensional Wavelet ® GUI Tool. Type at the MATLAB prompt and click Wavelet 1D. wavemenu Then, select File Example Analysis...

Page 472
Illustrated Examples Signal and Details with db1 Signal and Details with db4 1.01 0.99 0.99 0.98 0.98 0.97 0.97 0.96 0.96 0.95 0.95 x 10 x 10 x 10 x 10 0.05 0.05 0.05 0.05 Example 8: A SecondDerivative Discontinuity •...

Page 473: Example 9: A Ramp + White Noise
Wavelets in Action: Examples and Case Studies Example 9: A Ramp + White Noise Analyzing wavelet: db3 Decomposition levels: 6 The signal is built from a trend plus noise. The trend is a slow linear rise from 0 to 3, up to t=500, and becoming constant afterwards. The noise is a uniform zeromean white noise, varying between 0.5 and 0.5 (see the analyzed signal b Looking at the figure, in the chart on the right, we again find the decomposition...

Page 474
Illustrated Examples Signal and Approximations Signal and Details −0.1 −0.1 −0.2 −0.2 −0.2 −0.4 −0.5 Example 9: A Ramp + White Noise • Detecting breakdown points Addressed topics • Processing noise • Detecting longterm evolution • Splitting signal components • Identifying noises and approximations •...

Page 475: Example 10: A Ramp + Colored Noise
Wavelets in Action: Examples and Case Studies Example 10: A Ramp + Colored Noise Analyzing wavelet: db3 Decomposition levels: 6 The signal is built in the same manner as in “Example 9: A Ramp + White Noise” on page 424, using a trend plus a noise. The trend is a slow linear increase from 0 to 1, up to t=500.

Page 476
Illustrated Examples Example 10: A Ramp + Colored Noise • Detecting breakdown points Addressed topics • Processing noise • Detecting longterm evolution • Splitting signal components • Compare with the s Further exploration (t) signal shown in Example 9: A Ramp + White Noise on page 424. •...

Page 477: Example 11: A Sine + White Noise
Wavelets in Action: Examples and Case Studies Example 11: A Sine + White Noise Analyzing wavelet: db5 Decomposition levels: 5 The signal is formed of the sum of two previously analyzed signals: the slow sine with a period close to 200 and the uniform white noise b .

Page 478
Illustrated Examples Example 11: A Sine + White Noise • Processing noise Addressed topics • Detecting longterm evolution • Splitting signal components • Identifying the frequency of a sine • Identify the noise characteristics. Use the Further exploration coefficients and the command line mode. 429...

Page 479: Example 12: A Triangle + A Sine
Wavelets in Action: Examples and Case Studies Example 12: A Triangle + A Sine Analyzing wavelet: db5 Decomposition levels: 6 The signal is the sum of a sine having a period of approximately 20 and of a “triangle”. and D are very small.

Page 480
Illustrated Examples Example 12: A Triangle + A Sine • Detecting longterm evolution Addressed topics • Splitting signal components • Identifying the frequency of a sine • Try using sinusoids whose period is a power of 2. Further exploration 431...

Page 481: Example 13: A Triangle + A Sine + Noise
Wavelets in Action: Examples and Case Studies Example 13: A Triangle + A Sine + Noise Noise Analyzing wavelet: db5 Decomposition levels: 7 The signal examined here is the same as the previous signal plus a uniform white noise divided by 3. The analysis can, therefore, be compared to the previous analysis.

Page 482
Illustrated Examples Example 13: A Triangle + A Sine + Noise • Detecting longterm evolution Addressed topics • Splitting signal components • Increase the amplitude of the noise. Further exploration • Replace the triangle by a polynomial. • Replace the white noise by an ARMA noise. 433...

Page 483: Example 14: A Real Electricity Consumption Signal
Wavelets in Action: Examples and Case Studies Example 14: A Real Electricity Consumption Signal Analyzing wavelet: db3 Decomposition levels: 5 The series presents a peak in the center, followed by two drops, a shallow drop, and then a considerably weaker peak. The details for levels 1 and 2 are of the same order of magnitude and give a good expression of the local irregularities caused by the noise.

Page 484
Illustrated Examples Signal and Approximations Signal and Details −10 −10 −10 −10 −10 3600 3620 3640 3660 3680 3700 3600 3620 3640 3660 3680 3700 Example 14: A Real Electricity Consumption Signal • Detecting longterm evolution Addressed topics • Splitting signal components •...

Page 485: Case Study: An Electrical Signal, Data And The External Information
Wavelets in Action: Examples and Case Studies Case Study: An Electrical Signal The goal of this section is to provide a statistical description of an electrical load consumption using the wavelet decompositions as a multiscale analysis. Two problems are addressed. They both deal with signal extraction from the load curve corrupted by noise: What information is contained in the signal, and what pieces of information are useful?

Page 486
Case Study: An Electrical Signal • The fundamental periods are the weeklydaily cycles, linked to economic rhythms. • Daily consumption patterns also change according to rate changes at different times (e.g., relayswitched water heaters to benefit from special night rates). •...

Page 487: Analysis Of The Midday Period
Wavelets in Action: Examples and Case Studies The analyzing wavelet used here is The results are described similarly for the two periods. Analysis of the Midday Period This signal (see “Example 14: A Real Electricity Consumption Signal” on page 434) is also analyzed more crudely in “Example 14: A Real Electricity Consumption Signal”...

Page 488: Analysis Of The End Of The Night Period
Case Study: An Electrical Signal Signal and Approximations Signal and Details −10 −10 −10 −10 −10 3600 3620 3640 3660 3680 3700 3600 3620 3640 3660 3680 3700 Analysis of the End of the Night Period The shape of the curve during the end of the night is a slow descent, globally smooth, but locally highly irregular.

Page 489
Wavelets in Action: Examples and Case Studies In conclusion, none of the time scales brings a significant contribution sufficiently different from the noise level, and no additional correction is needed. The retained approximation is A or A Signal and Approximations Signal and Details −5 −5...

Page 490
Case Study: An Electrical Signal % Reconstruct the details using the decomposition structure. for i = 1:5 D(i,:) = wrcoef('d',c,l,w,i); Note This loop replaces five separate statements defining the details. wrcoef The variable contains the five details. % Avoid edge effects by suppressing edge values and plot. tt = 1+100:length(s)100;...

Page 491: Suggestions For Further Analysis
Wavelets in Action: Examples and Case Studies Suggestions for Further Analysis Let us now make some suggestions for possible further analysis starting from the details of the decomposition at level 5 of 3 days. Identify the Sensor Failure Focus on the wavelet decomposition and try to identify the sensor failure directly on the details D , and D , and not the other ones.

Page 492
Case Study: An Electrical Signal Suppress the Noise Suppress measurement noise. Try by yourself and afterwards use the denoising tools. Indication: study the approximations and compare two successive days, the first without sensor failure and the second corrupted by failure (see figure below).

Page 493
Wavelets in Action: Examples and Case Studies Identify Patterns in the Details The idea here is to identify a pattern in the details typical of relayswitched water heaters. Indication: the figure below gives an example of such a period. Focus on details , and D around abscissa 1350, 1383, and 1415 to detect abrupt changes of the signal induced by automatic switches.

Page 494
Case Study: An Electrical Signal Locate and Suppress Outlying Values Suppress the outliers by setting the corresponding values of the details to 0. Indication: The figure below gives two examples of outliers around 1193 1215 . The effect produced on the details is clear when focusing on the low levels.

Page 495
Wavelets in Action: Examples and Case Studies Study Missing Data Missing data have been crudely substituted (around observation 2870) by the estimation of 30 minutes of sampled data and spline smoothing for the intermediate time points. You can improve the interpolation by using an approximation and portions of the details taken elsewhere, thus implementing a sort of “graft.”...

Page 496
Using Wavelet Packets • About Wavelet Packet Analysis (p. 52) • OneDimensional Wavelet Packet Analysis (p. 57) • TwoDimensional Wavelet Packet Analysis (p. 523) • Importing and Exporting from Graphical Tools (p. 532)

Page 497: About Wavelet Packet Analysis
Using Wavelet Packets About Wavelet Packet Analysis Wavelet Toolbox™ software contains graphical tools and command line functions that let you • Examine and explore characteristics of individual wavelet packets • Perform wavelet packet analysis of one and twodimensional data • Use wavelet packets to compress and remove noise from signals and images This chapter takes you stepbystep through examples that teach you how to use the Wavelet Packet 1D and Wavelet Packet 2D graphical tools.

Page 498
About Wavelet Packet Analysis • Load a signal or image • Perform a wavelet packet analysis of a signal or image • Compress a signal • Remove noise from a signal • Compress an image • Show statistics and histograms The toolbox provides these functions for wavelet packet analysis.

Page 499
Using Wavelet Packets Decomposition Structure Utilities. Function Name Purpose Find best tree besttree Find best level tree bestlevt Update wavelet packets entropy entrupd Get WPTREE object fields contents Read values in WPTREE object fields read Entropy wenergy Extract wavelet tree from wavelet packet tree wp2wtree Cut wavelet packet tree wpcutree...

Page 500
About Wavelet Packet Analysis A single wavelet packet decomposition gives a lot of bases from which you can look for the best representation with respect to a design objective. This can be done by finding the “best tree” based on an entropy criterion. Denoising and compression are interesting applications of wavelet packet analysis.

Page 501
Using Wavelet Packets will have to refine your threshold by trial and error so as to optimize the results to fit your particular analysis and design criteria. The tools facilitate experimentation with different thresholds, and make it easy to alter the tradeoff between amount of compression and retained signal energy.

Page 502: Onedimensional Wavelet Packet Analysis
We now turn to the Wavelet Packet 1D tool to analyze a synthetic signal that is the sum of two linear chirps. Starting the Wavelet Packet 1D Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears.

Page 503
The tool appears on the desktop. Loading a Signal. From the File menu, choose the Load Signal option. When the Load Signal dialog box appears, select the demo MATfile , which should reside in the MATLAB folder sumlichr.mat . Click the OK button. toolbox/wavelet/wavedemo...

Page 504
OneDimensional Wavelet Packet Analysis signal is loaded into the Wavelet Packet 1D tool. sumlichr...

Page 505
Using Wavelet Packets Analyzing a Signal. Make the appropriate settings for the analysis. Select the wavelet, level , entropy , and for the threshold parameter type . Click the threshold button. Analyze The available entropy types are listed below. Type Description Shannon Nonnormalized entropy involving the logarithm of...

Page 506
OneDimensional Wavelet Packet Analysis Type Description SURE (Stein’s A thresholdbased method in which the threshold Unbiased Risk equals Estimate) 2log nlog where 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, userdefined entropy, and threshold parameters, see the reference page and “Choosing the...

Page 507
Using Wavelet Packets After a pause for computation, the Wavelet Packet 1D 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.

Page 508: Compressing A Signal Using Wavelet Packets
OneDimensional Wavelet Packet Analysis Compressing a Signal Using Wavelet Packets Selecting a Threshold for Compression. Click the Compress button. The Wavelet Packet 1D 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...

Page 509
Using Wavelet Packets design criteria, you may want to choose a threshold that retains more of the original signal’s energy. Adjust the threshold by typing in the text field opposite the threshold 0.8938 slider, and then press the Enter key. The value is a number that we have discovered through trial and 0.8938...

Page 510
OneDimensional Wavelet Packet Analysis Compressing a Signal. Click the Compress button. The Wavelet Packet 1D 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.

Page 511: Denoising A Signal Using Wavelet Packets
Using Wavelet Packets DeNoising a Signal Using Wavelet Packets We now use the Wavelet Packet 1D 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 denoising. This technique calls for setting the threshold T to 2log nlog...

Page 512
OneDimensional Wavelet Packet Analysis Starting the Wavelet Packet 1D Tool. From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. Click the Wavelet Packet 1D menu item. The tool appears on the desktop. 517...

Page 513
Using Wavelet Packets Loading a Signal. From the File menu, choose the Load Signal option. When the Load Signal dialog box appears, select the demo MATfile , which should reside in the MATLAB folder noischir.mat . Click the OK button. toolbox/wavelet/wavedemo...

Page 514
OneDimensional Wavelet Packet Analysis signal is loaded into the Wavelet Packet 1D tool. Notice that noischir the signal’s length is 1024. This means we should set the SURE criterion threshold equal to , or 4.2975. sqrt(2.*log(1024.*log2(1024))) Signal length Analyzing a Signal. Make the appropriate settings for the analysis.

Page 515
Using Wavelet Packets There is a pause while the wavelet packet analysis is computed. Note Many capabilities are available using the command area on the right of the Wavelet Packet 1D window. Some of them are used in the sequel. For a more complete description, see “Wavelet Packet Tool Features (1D and 2D)”...

Page 516
OneDimensional Wavelet Packet Analysis Click the Denoise button. This brings up the Wavelet Packet 1D DeNoising window. Click the Denoise button located at the center right side of the Wavelet window. Packet 1D DeNoising The results of the denoising operation are quite good, as can be seen by looking at the thresholded coefficients.

Page 517
Using Wavelet Packets You can also use the function to perform wavelet packet denoising wpdencmp or compression from the command line. 522...

Page 518: Twodimensional Wavelet Packet Analysis
TwoDimensional Wavelet Packet Analysis TwoDimensional Wavelet Packet Analysis In this section, we employ the Wavelet Packet 2D tool to analyze and compress an image of a fingerprint. This is a realworld problem: the Federal Bureau of Investigation (FBI) maintains a large database of fingerprints — about 30 million sets of them.

Page 519
Using Wavelet Packets Starting the Wavelet Packet 2D Tool. ® From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. Click the Wavelet Packet 2D menu item. 524...

Page 520
The tool appears on the desktop. Loading an Image. From the File menu, choose the Load Image option. When the Load Image dialog box appears, select the demo MATfile , which should reside in the MATLAB folder detfingr.mat . Click the OK button. toolbox/wavelet/wavedemo...

Page 521
Using Wavelet Packets The fingerprint image is loaded into the Wavelet Packet 2D tool. Analyzing an Image. Make the appropriate settings for the analysis. Select the wavelet, haar level , and entropy type . Click the Analyze button. shannon 526...

Page 522
TwoDimensional Wavelet Packet Analysis There is a pause while the wavelet packet analysis is computed. Note Many capabilities are available using the command area on the right of the Wavelet Packet 2D window. Some of them are used in the sequel. For a more complete description, see “Wavelet Packet Tool Features (1D and 2D)”...

Page 523: Compressing An Image Using Wavelet Packets
Using Wavelet Packets Compressing an Image Using Wavelet Packets Click the Compress button to bring up the Wavelet Packet 2D window. Select the Bal. sparsitynorm (sqrt) option from Compression the Select thresholding method menu. Notice that the default threshold (7.125) provides about 64% compression while retaining virtually all the energy of the original image.

Page 524
TwoDimensional Wavelet Packet Analysis Setting all wavelet packet coefficients whose value falls below 30 to zero yields much better results. Note that the new threshold achieves around 92% of zeros, while still retaining nearly 98% of the image energy. Compare this wavelet packet analysis to the wavelet analysis of the same image in “Compressing Images”...

Page 525
Using Wavelet Packets Take this opportunity to try out your own compression strategy. Adjust the threshold value, the entropy function, and the wavelet, and see if you can obtain better results. Hint: wavelet is better suited to this analysis than is , and bior6.8 haar...

Page 526
TwoDimensional Wavelet Packet Analysis Approximation, Level 2 Decomposition of the Level 1 Horizontal Detail Vertical Detail, Level 2 Decomposition of the Level 1 Diagonal Detail, Level 1 Vertical Detail Looking at the pattern of small and large squares in the fingerprint analysis shows that the best tree algorithm has apparently singled out the diagonal details, often sparing these from further decomposition.

Page 527: Importing And Exporting From Graphical Tools, Saving Information To Disk
Using Wavelet Packets Importing and Exporting from Graphical Tools The Wavelet Packet 1D and Wavelet Packet 2D tools let you import information from and export information to your disk. If you adhere to the proper file formats, you can • Save decompositions as well as synthesized signals and images from the wavelet packet graphical tools to disk •...

Page 528
Importing and Exporting from Graphical Tools To load the signal into your workspace, simply type load synthsig whos Name Size Bytes Class synthsig 1x1000 8000 double array valTHR double array wname char array The synthesized signal is given by . In addition, the parameters of the synthsig denoising or compression process are given by the wavelet name ( ) and...

Page 529
Using Wavelet Packets To load the image into your workspace, simply type load wpsymage whos Name Size Bytes Class 256x256 524288 double array 255x3 6120 double array valTHR double array wname char array The synthesized image is given by . The variable contains the associated colormap.

Page 530
Importing and Exporting from Graphical Tools Name Size Bytes Class data_name char array tree_struct 11176 wptree object valTHR double array The variable contains the wavelet packet tree structure. The tree_struct variable contains the data name and contains the global data_name valTHR threshold, which is currently empty since the synthesized signal does not exist.

Page 531: Loading Information Into The Graphical Tools
Loading Signals ® To load a signal you’ve constructed in your MATLAB workspace into the tool, save the signal in a MATfile (with extension Wavelet Packet 1D other).

Page 532
by3 matrix called . This is the colormap associated with the image. When MATLAB displays such an image, it uses the values of the matrix to look up the desired color in this colormap. If the colormap is not given, the Wavelet Packet 2D graphical tool uses a monotonic colormap with colors.

Page 533
Using Wavelet Packets Caution The graphical tools allow you to load an image that does not contain integers from 1 to . The computations will be correct since they act directly on the matrix, but the display of the image will be strange. The values less than 1 will be evaluated as 1, the values greater than will be evaluated as and a real value within the interval...

Page 534
Importing and Exporting from Graphical Tools These variables must be saved in a MATfile (with extension or other). Twodimensional data file contains the following variables: Variable Status Description Required Object specifying the tree structure tree_struct Optional String specifying the name of the data_name decomposition Optional...

Page 535
Using Wavelet Packets 540...

Page 536
Advanced Concepts This chapter presents a more advanced treatment of wavelet methods, and focuses on real wavelets, except in the two sections dedicated to wavelet families. • Mathematical Conventions (p. 62) • General Concepts (p. 65) • Fast Wavelet Transform (FWT) Algorithm (p. 619) •...

Page 537: Mathematical Conventions
Advanced Concepts Mathematical Conventions This chapter and the reference pages use certain mathematical conventions. General Notation Interpretation j – Dyadic scale. is the level, 1/ is the resolution. Dyadic translation Continuous time Discrete time Pixel Signal or image. The signal is a function defined on ;...

Page 538
Mathematical Conventions General Notation Interpretation (Continued) Discrete Time Set of signals of finite energy Energy of the signal Scalar product of signals and s n s n Set of images of finite energy Energy of the image ...

Page 539
Advanced Concepts Wavelet Notation Interpretation (Continued) j – 2 j – Family associated with the onedimensional scaling – function for dyadic scales ; it should be noted that j – 2 j – Family associated with the onedimensional – dyadic scales ;...

Page 540: General Concepts, Wavelets: A New Tool For Signal Analysis, Wavelet Decomposition: A Hierarchical Organization
General Concepts General Concepts This section presents a brief overview of wavelet concepts, focusing mainly on the orthogonal wavelet case. It includes the following sections: • “Wavelets: A New Tool for Signal Analysis” on page 65 • “Wavelet Decomposition: A Hierarchical Organization” on page 65 •...

Page 541: Finer And Coarser Resolutions, Wavelet Shapes
Advanced Concepts detail D corresponds to the high frequency correction. Among the figures presented in “Reconstructing Approximations and Details” on page 130, one of them graphically represents this hierarchical decomposition. One way of understanding this decomposition consists of using an optical comparison.

Page 542
General Concepts functions. exhibits some angular points; are quite smooth. coif2 sym6 The Morlet and Mexican hat wavelets are symmetrical. Meyer scaling function Meyer wavelet function Morlet wavelet function Mexican hat wavelet function −0.5 −0.2 −0.5 −0.5 −4 −2 −5 −5 −5 db6 scaling function...

Page 543: Wavelets And Associated Families
Advanced Concepts Wavelets and Associated Families In the onedimensional context, we distinguish the wavelet from the associated function , called the scaling function. Some properties of • The integral of is zero, , and is used to define the details. ...

Page 544
General Concepts To each of these functions, we associate its doubly indexed family, which is used to: • Move the basic shape from one side to the other, translating it to position b (see the following figure). • Keep the shape while changing the onedimensional time scale a ( ) (see Figure 64 on page 610).

Page 545
Advanced Concepts db3(2x + 7) db3(x) db3(x/2  7) a = 0.5 a = 1 a = 2 Figure 64: Time Scaled OneDimensional Wavelet In a twodimensional context, we have the translation by vector and a ( , ) change of scale of parameter Translation and change of scale become: –...

Page 546
General Concepts phi(x) phi(x/2) psi(x/2) phi(x/4) psi(x/4) phi(x/8) psi(x/8) Figure 65: Wavelets Organization In Figure 65, Wavelets Organization, the fourlevel decomposition is shown, progressing from the top to the bottom. We find ; then 2 ; then ; then 2 .

Page 547: Wavelet Transforms: Continuous And Discrete
Advanced Concepts Wavelet Transforms: Continuous and Discrete The wavelet transform of a signal s is the family C(a,b), which depends on two indices a and b. The set to which a and b belong is given below in the table. The studies focus on two transforms: •...

Page 548
General Concepts Analyzed signal. 0.02 0.01 Discrete Transform, absolute coefficients. Continuous Transform, absolute coefficients. time (or space) b Figure 66: Continuous Versus Discrete Transform Using a redundant representation close to the socalled continuous analysis, instead of a nonredundant discrete timescale representation, can be useful for analysis purposes.

Page 549: Local And Global Analysis
Advanced Concepts Local and Global Analysis A small scale value permits us to perform a local analysis; a large scale value is used for a global analysis. Combining local and global is a useful feature of the method. Let us be a bit more precise about the local part and glance at the frequency domain counterpart.

Page 550: Synthesis: An Inverse Transform, Details And Approximations
General Concepts Synthesis: An Inverse Transform In order to be efficient and useful, a method designed for analysis also has to be able to perform synthesis. The wavelet method achieves this. The analysis starts from s and results in the coefficients C(a,b). The synthesis starts from the coefficients C(a,b) and reconstructs s.

Page 551
Advanced Concepts The details have just been defined. Take a reference level called J. There are two sorts of details. Those associated with indices correspond to the scales which are the fine details. The others, which correspond to j > J, are the coarser details.

Page 552
General Concepts The following table contains definitions of details and approximations. Definition of the detail at level j C j k ( , ) The signal is the sum of its details The approximation at level J Link between A and A ...

Page 553
Advanced Concepts Signal and Approximation(s) Signal and Detail(s) −20 −20 −10 −10 −20 1000 2000 3000 4000 1000 2000 3000 4000 Figure 67: Approximations, Details, and Coefficients 618...

Page 554: Fast Wavelet Transform (fwt) Algorithm, Filters Used To Calculate The Dwt And Idwt
Fast Wavelet Transform (FWT) Algorithm Fast Wavelet Transform (FWT) Algorithm In 1988, Mallat produced a fast wavelet decomposition and reconstruction algorithm [Mal89]. The Mallat algorithm for discrete wavelet transform (DWT) is, in fact, a classical scheme in the signal processing community, known as a twochannel subband coder using conjugate quadrature filters or quadrature mirror filters (QMFs).

Page 555
Advanced Concepts • Finite Impulse Response (FIR) • Of length 2N • Of sum 1 • Of norm   • A lowpass filter For example, for the scaling filter, load db3 db3 = 0.2352 0.5706 0.3252 0.0955 0.0604 0.0249 sum(db3) ans = 1.0000...

Page 556
Fast Wavelet Transform (FWT) Algorithm Lo_R = Lo_D = (Lo_R) wrev norm Hi_R = (Lo_R) Hi_D = (Hi_R) wrev where is such that Hi_R and Lo_R are quadrature mirror filters (i.e., Hi_R(k) = (1) Lo_R(2N + 1  k)) for k = 1, 2, ..., 2N. Note that flips the filter coefficients.

Page 557
Advanced Concepts for k=1:N lambda(k) = (k1)/N; XLo_D(k) = exp(2*pi*j*lambda(k)*(nn1))*Lo_D'; XHi_D(k) = exp(2*pi*j*lambda(k)*(nn1))*Hi_D'; fftld = fft(Lo_D); ffthd = fft(Hi_D); subplot(427); plot(lambda,abs(XLo_D),freqfft,abs(fftld),'o'); title('Transfer modulus: lowpass (Lo{\_}D or Lo{\_}R') subplot(428); plot(lambda,abs(XHi_D),freqfft,abs(ffthd),'o'); title('Transfer modulus: highpass (Hi{\_}D or Hi{\_}R') Original scaling filter −0.5 −1 Decomposition lowpass filter Lo_D Decomposition highpass filter Hi_D −0.5...

Page 558: Algorithms
Fast Wavelet Transform (FWT) Algorithm Algorithms Given a signal s of length N, the DWT consists of log N stages at most. Starting from s, the first step produces two sets of coefficients: approximation coefficients cA , and detail coefficients cD .

Page 559
Advanced Concepts OneDimensional DWT Decomposition Step Lo_D Hi_D level j level j+1 Convolve with filter X. where Downsample. = s. Initialization So the wavelet decomposition of the signal s analyzed at level j has the following structure: [cA , cD , ..., cD This structure contains for J = 3 the terminal nodes of the following tree.

Page 560
Fast Wavelet Transform (FWT) Algorithm OneDimensional IDWT Reconstruction Step upsample lowpass Lo_R wkeep Hi_R level j1 level j upsample highpass where Insert zeros at oddindexed elements. Convolve with filter X. wkeep Take the central part of U with the convenient length. •...

Page 561
Advanced Concepts TwoDimensional DWT Decomposition Step columns rows Lo_D Lo_D columns Hi_D horizontal columns rows Lo_D vertical Hi_D columns Hi_D diagonal Downsample columns: keep the even indexed columns. where Downsample rows: keep the even indexed rows. rows Convolve with filter X the rows of the entry. columns Convolve with filter X the columns of the entry.

Page 562
Fast Wavelet Transform (FWT) Algorithm TwoDimensional IDWT Reconstruction Step columns Lo_R rows Lo_R columns Hi_R horizontal wkeep columns Lo_R rows vertical Hi_R columns Hi_R diagonal Upsample columns: insert zeros at oddindexed columns. where Upsample rows: insert zeros at oddindexed rows. rows Convolve with filter X the rows of the entry.

Page 563: Why Does Such An Algorithm Exist?
Advanced Concepts Finally, let us mention that, for biorthogonal wavelets, the same algorithms hold but the decomposition filters on one hand and the reconstruction filters on the other hand are obtained from two distinct scaling functions associated with two multiresolution analyses in duality. In this case, the filters for decomposition and reconstruction are, in general, of different odd lengths.

Page 564
Fast Wavelet Transform (FWT) Algorithm ˜ ˜ , and F – – ˜ The sequence is the filtered output of the sequence by the filter We obtain We have to take the even index values of F. This is downsampling. The sequence is the downsampled version of the sequence The initialization is carried out using...

Page 565
Advanced Concepts The coordinate of is equal to k 2n – These relations supply the ingredients for the algorithm. Up to now we used the filter h. The highpass filter g is used in the twin scales relation linking the and functions.

Page 566
Fast Wavelet Transform (FWT) Algorithm – – – – – – – – – ˜ If we transform the ( ) sequence into a new sequence defined by ..., , 0, , 0, , 0, , 0, ... that is precisely Then ...

Page 567: Onedimensional Wavelet Capabilities
Advanced Concepts OneDimensional Wavelet Capabilities Basic OneDimensional Objects. Objects Description Signal in original time Original signal Approximation at level k Detail at level k Coefficients in scalerelated time Approximation coefficients at level k Detail coefficients at level k , cD , ..., cD Wavelet decomposition at level j, j AnalysisDecomposition Capabilities.

Page 568: Twodimensional Wavelet Capabilities
Fast Wavelet Transform (FWT) Algorithm Decomposition Structure Utilities. Purpose Input Output File Extraction of detail , cD , ..., cD detcoef coefficients Extraction of , cD , ..., cD appcoef approximation coefficients Recomposition of , cD , ..., cD , cD , ..., upwlev the decomposition...

Page 569
Advanced Concepts The same holds for cD , which stands for The twodimensional files are the same as those for the onedimensional case, but with a appended on the end of the command. For example, becomes . For more information, see idwt idwt2 “OneDimensional Wavelet Capabilities”...

Page 570: Dealing With Border Distortion, And Smooth Padding
Dealing with Border Distortion Dealing with Border Distortion Classically, the DWT is defined for sequences with length of some power of 2, and different ways of extending samples of other sizes are needed. Methods for extending the signal include zeropadding, smooth padding, periodic extension, and boundary value replication (symmetrization).

Page 571
Advanced Concepts • Symmetrization ( ): This method assumes that signals or images can 'sym' be recovered outside their original support by symmetric boundary value replication. It is the default mode of the wavelet transform in the toolbox. Symmetrization has the disadvantage of artificially creating discontinuities of the first derivative at the border, but this method works well in general for images.

Page 572
Dealing with Border Distortion The theoretical DWT is applied to signals that are defined on an infinite length time interval (Z). For an orthogonal wavelet, this transform has the following desirable properties: Norm preservation Let cA and cD be the approximation and detail of the DWT coefficients of an infinite length signal X.

Page 573
Advanced Concepts % Set initial signal and get filters. x = sin(0.3*[1:451]); w = 'db9'; [Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(w); % In fact using a slightly redundant scheme, any signal % extension strategy works well. % For example use random padding. Original signal −1 −2 Extended signal...

Page 574
Using the GUI we will examine the effects of zeropadding. ® From the MATLAB prompt, type dwtmode('zpd') From the MATLAB prompt, type wavemenu The Wavelet Toolbox Main Menu appears. Click the Wavelet 1D menu item.The discrete wavelet analysis tool for onedimensional signal data appears.

Page 575
Advanced Concepts Symmetric Extension. From the MATLAB prompt, type dwtmode('sym') Click the Wavelet 1D menu item. The discrete wavelet analysis tool for onedimensional signal data appears. From the File menu, choose the Example Analysis option and select Basic Signals > with db2 at level 5 > Two nearby discontinuities Select Display Mode: Show and Scroll .

Page 576
The detail coefficients show the signal end effects are not present, and the discontinuities are well detected. Let us now consider an image example. Original Image. From the MATLAB prompt, type load geometry; % X contains the loaded image and % map contains the loaded colormap.

Page 577
Now we set the extension mode to zeropadding and perform a decomposition of the image to level 3 using the wavelet. Then we reconstruct the sym4 approximation of level 3. From the MATLAB prompt, type lev = 3; wname = 'sym4'; dwtmode('zpd') [c,s] = wavedec2(X,lev,wname); a = wrcoef2('a',c,s,wname,lev);...

Page 578
Now set the extension mode to smooth padding and perform a decomposition of the image again to level 3 using the wavelet. Then reconstruct the sym4 approximation of level 3. From the MATLAB prompt, type dwtmode('spd') [c,s] = wavedec2(X,lev,wname); a = wrcoef2('a',c,s,wname,lev); image(wcodemat(a,nbcol));...

Page 579: Discrete Stationary Wavelet Transform (swt), Edecimated Dwt
Advanced Concepts Discrete Stationary Wavelet Transform (SWT) We know that the classical DWT suffers a drawback: the DWT is not a time invariant transform. This means that, even with periodic signal extension, the DWT of a translated version of a signal X is not, in general, the translated version of the DWT of X.

Page 580
Discrete Stationary Wavelet Transform (SWT) Let us denote by = 1 or 0 the choice of odd or even indexed elements at step j. Every decomposition is labeled by a sequence of 0s and 1s: = ..., . This transform is called the decimated DWT. You can obtain the basis vectors of the decimated DWT from those of the standard DWT by applying a shift and corresponds to a special choice of the origin of the basis functions.

Page 581
Advanced Concepts The general step j convolves the approximation coefficients at level j1, with upsampled versions of the appropriate original filters, to produce the approximation and detail coefficients at level j. This can be visualized in the following figure. OneDimensional SWT Decomposition step level j level j+1...

Page 582
Discrete Stationary Wavelet Transform (SWT) Step 0 (Original Data). A(0) A(0) A(0) A(0) A(0) A(0) A(0) A(0) Step 1. D(1,0) D(1,1) D(1,0) D(1,1) D(1,0) D(1,1) D(1,0) D(1,1) A(1,0) A(1,1) A(1,0) A(1,1) A(1,0) A(1,1) A(1,0) A(1,1) Step 2. D(1,0) D(1,1) D(1,0) D(1,1) D(1,0) D(1,1)

Page 583
Advanced Concepts Let = [ ,..., ] with = 0 or 1. We have 2 = eight different decimated DWTs at level 3. Choosing , we can retrieve the corresponding decimated DWT from the SWT array. Now, consider the last step, J = 3, and let [C ,L ] denote the wavelet decomposition structure of an decimated DWT for a given .

Page 584
Discrete Stationary Wavelet Transform (SWT) TwoDimensional SWT Decomposition Step columns rows columns horizontal columns rows vertical columns diagonal where rows Convolve with filter X the rows of the entry columns Convolve with filter X the columns of the entry Filter Computation Upsample where: Initialization...

Page 585: Inverse Discrete Stationary Wavelet Transform (iswt), More About Swt
Advanced Concepts Inverse Discrete Stationary Wavelet Transform (ISWT) Each decimated DWT corresponding to a given can be inverted. To reconstruct the original signal using a given decimated DWT characterized by [ ,..., ], we can use the abstract algorithm FOR j = J:1:1 A(j1, ) = ...

Page 586: Lifting Method For Constructing Wavelets, Lifting Background
Lifting Method for Constructing Wavelets Lifting Method for Constructing Wavelets For some applications, you may not be able to find a suitable wavelet among the usual ones widely available. In this case, you can design a new wavelet adapted to the problem to be solved or the task to be processed. For example, you can adapt a wavelet for the continuous wavelet transform (CWT) to a given pattern so that the resulting wavelet allows accurate pattern detection (see “New Wavelet for CWT”...

Page 587
Advanced Concepts The perfect reconstruction property can be expressed by the equality s = e (up to an eventual shift or delay) where the two signals s and e are defined in the following figure: This leads to the following two conditions referred to as perfect reconstruction (PR): (z) H ) + G...

Page 588
Nevertheless, by introducing the polyphase matrix, interesting theoretical and algorithmic results can be derived. The synthesis polyphase matrix P associated with the biorthogonal quadruplet (H ) is the 2by2 matrix ® defined (using the MATLAB conventions) by P(z) = [ even(H )(z) even(G )(z) ;...

Page 589: Lifting Functions
Advanced Concepts Then after a primal lifting the new polyphase matrix P is obtained simply from P the initial one by (z) = P(z) * [1 S(z) ; 0 1] and after a dual lifting by (z) = P(z) * [1 0 ; T(z) 1] P itself can be decomposed, up to a normalization, as a product of matrices of the form [1 S(z) ;...

Page 590
Lifting Method for Constructing Wavelets Lifting Schemes Function Name Description Information about lifting schemes lsinfo Display a lifting scheme displs Add primal or dual elementary lifting steps to a lifting addlift scheme Biorthogonal Quadruplets of Filters and Lifting Schemes These functions connect lifting schemes to biorthogonal quadruplets of filters and associated scaling and wavelet function pairs.

Page 591
Advanced Concepts Lifting Wavelet Transform (LWT) These functions contain the direct and inverse lifting wavelet transform (LWT) files for both 1D and 2D signals. LWT reduces to the polyphase version of the DWT algorithm with zeropadding extension mode and without extracoefficients.

Page 592
Lifting Method for Constructing Wavelets Examples of Lifting Methods These two simple examples illustrate the basic lifting capabilities of Wavelet Toolbox software. For more examples, see “Wavelets in Action: Examples and Case Studies” on page 41 and the demos provided with the toolbox. Example 1: A primal lifting starting from Haar wavelet % Start from the Haar wavelet and get the corresponding...

Page 593
Advanced Concepts bswfun(LoD,HiD,LoR,HiR,'plot'); Analysis scaling function (phiA) Analysis wavelet function (psiA) −0.2 −0.4 −0.6 −0.8 −1 −1.2 Synthesis scaling function (phiS) Synthesis wavelet function (psiS) −0.5 −1 −0.5 −1.5 Illustrating LWT and integer LWT % Perform LWT at level 1 of a simple signal. x = 1:8;...

Page 594
Lifting Method for Constructing Wavelets % Perform integer to integer LWT of the same signal. lshaarInt = liftwave('haar','int2int'); lsnewInt = addlift(lshaarInt,els); [cAint,cDint] = lwt(x,lsnewInt) cAint = cDint = % Invert the two transforms. err = max(max(abs(xilwt(cA,cD,lsnew)))) err = 4.4409e016 errInt = max(max(abs(xilwt(cAint,cDint,lsnewInt)))) errInt = Example 2: Two primal liftings starting from the Haar wavelet...

Page 595
Advanced Concepts [LoDB,HiDB,LoRB,HiRB] = wfilters('bior1.3'); samewavelet = ... isequal([LoDB,HiDB,LoRB,HiRB],[LoDN,HiDN,LoRN,HiRN]) samewavelet = % Visualize the two times two pairs of scaling and wavelet % functions. bswfun(LoDN,HiDN,LoRN,HiRN,'plot'); Analysis scaling function (phiA) Analysis wavelet function (psiA) −0.5 −1 Synthesis scaling function (phiS) Synthesis wavelet function (psiS) −0.5 −1 660...

Page 596: Frequently Asked Questions, Continuous Or Discrete Analysis?, Why Are Wavelets Useful For Spacesaving Coding?
Frequently Asked Questions Frequently Asked Questions Continuous or Discrete Analysis? When is continuous analysis more appropriate than discrete analysis? To answer this, consider the related questions: Do you need to know all values of a continuous decomposition to reconstruct the signal s exactly? Can you perform nonredundant analysis? When the energy of the signal is finite, not all values of a decomposition are needed to exactly reconstruct the original signal, provided that you are using a...

Page 597
Advanced Concepts What Is the Advantage Having Zero Average and Sometimes Several Vanishing Moments? When the wavelet’s k + 1 moments are equal to zero ( ) all the polynomial signals have zero wavelet coefficients. As a consequence, the details are also zero. This property ensures the suppression of signals that are polynomials of a degree lower or equal to k.

Page 598
Frequently Asked Questions The functions are more regular at certain points than at others (see Figure 69 on page 663). Figure 69: Zooming in on a db3 Wavelet Selecting a regularity and a wavelet for the regularity is useful in estimations of the local properties of functions or signals.

Page 599
Advanced Concepts More precisely, the admissibility condition for ˆ s ˆ s  s  s The family of shifts and dilations of allows all finite energy signals to be reconstructed using the details in all scales. This allows only continuous analysis.

Page 600
Chapter 10 of the book Wavelets and Filter Banks, by Strang and Nguyen (see [StrN96] in “References” on page 6155). What Is the Link Between Wavelet and Fourier Analysis? Wavelet analysis complements the Fourier analysis for which there are several ® functions: in MATLAB software and in Signal spectrum sptool Processing Toolbox™ software.

Page 601
Advanced Concepts – s u g t u ( , ) – The analogy of this formula with that of the wavelet coefficients is obvious: – C a t     ( , ) ...

Page 602
Frequently Asked Questions where • a is a scale. • is the sampling period. • F is the center frequency of a wavelet in Hz. • F is the pseudofrequency corresponding to the scale a, in Hz. The idea is to associate with a given wavelet a purely periodic signal of frequency F .

Page 603
Advanced Concepts Wavelet db2 (blue) and Center frequency based approximation Wavelet db7 (blue) and Center frequency based approximation −0.5 −0.5 −1 −1 −1.5 −1.5 Period: 1.5; Cent. Freq: 0.66667 Period: 1.4444; Cent. Freq: 0.69231 coif1 gaus4 Wavelet coif1 (blue) and Center frequency based approximation Wavelet gaus4 (blue) and Center frequency based approximation −0.5 −0.2...

Page 604
Frequently Asked Questions To illustrate the behavior of this procedure, consider the following simple test. We generate sine functions of sensible frequencies F . For each function, we shall try to detect this frequency by a wavelet decomposition followed by a translation of scale to frequency.

Page 605
Advanced Concepts t = 0:delta:100; x = sin((t.*2*pi)/per(i)); % Decompose x at level 9. [c,l] = wavedec(x,9,wname); % Estimate standard deviation of detail coefficients. stdc = wnoisest(c,l,[1:amax]); % Compute identified period. [y,jmax] = max(stdc); idper(i) = per(jmax); % Compare the detected and computed pseudoperiods. subplot(212), plot(per,idper,'o',per,per) title('Detected vs computed pseudoperiod') xlabel('Computed pseudoperiod')

Page 606: Wavelet Families: Additional Discussion
Wavelet Families: Additional Discussion Wavelet Families: Additional Discussion There are different types of wavelet families whose qualities vary according to several criteria. The main criteria are: ˆ ˆ • The support of , (and , ): the speed of convergence to 0 of these functions ( ) when the time t or the frequency goes to infinity,...

Page 607: Daubechies Wavelets: Dbn
In dbN, N is the order. Some authors use 2N instead of N. More about this family can be found in [Dau92] pages 115, 132, 194, 242. By typing at the MATLAB® command prompt, you can obtain a survey waveinfo('db'), of the main properties of this family.

Page 608
Wavelet Families: Additional Discussion Scaling function phi Wavelet function psi Scaling function phi Wavelet function psi −0.5 −0.5 −0.5 −0.5 −1 −1 −1 −1 Decomposition low−pass filter Decomposition high−pass filter Decomposition low−pass filter Decomposition high−pass filter −0.5 −0.5 −0.5 −0.5 Reconstruction low−pass filter Reconstruction high−pass filter Reconstruction low−pass filter...

Page 609: Symlet Wavelets: Symn
More about symlets can be found in [Dau92], pages 194, 254257. By typing at the MATLAB command prompt, you can obtain a survey waveinfo('sym') of the main properties of this family.

Page 610: Coiflet Wavelets: Coifn
In coifN, N is the order. Some authors use 2N instead of N. For the coiflet construction, see [Dau92] pages 258–259. By typing at the waveinfo('coif') MATLAB command prompt, you can obtain a survey of the main properties of this family. Scaling function phi Wavelet function psi...

Page 611: Biorthogonal Wavelet Pairs: Biornr.nd
Biorthogonal Wavelet Pairs: biorNr.Nd More about biorthogonal wavelets can be found in [Dau92] pages 259, 262–85 and in [Coh92]. By typing at the MATLAB command waveinfo('bior') prompt, you can obtain a survey of the main properties of this family, as well as information about Nr and Nd orders and associated filter lengths.

Page 612
Wavelet Families: Additional Discussion The new family extends the wavelet family. It is well known in the subband filtering community that symmetry and exact reconstruction are incompatible (except for the Haar wavelet) if the same FIR filters are used for reconstruction and decomposition.

Page 613: Meyer Wavelet: Meyr
(see [Dau92] pages 117, 119, 137, 152). By typing waveinfo('meyr') at the MATLAB command prompt, you can obtain a survey of the main properties of this wavelet. Meyer scaling function Meyer wavelet function −0.5...

Page 614: Battlelemarie Wavelets
Note Although the Meyer wavelet is not compactly supported, there exists a good approximation leading to FIR filters, and then allowing DWT. By typing at the MATLAB command prompt, you can obtain a survey waveinfo('dmey') of the main properties of this pseudowavelet.

Page 615: Mexican Hat Wavelet: Mexh
N1. Mexican Hat Wavelet: mexh See [Dau92] page 75. By typing at the MATLAB command prompt, you can waveinfo('mexh') obtain a survey of the main properties of this wavelet. Mexican hat wavelet function −0.2 −5...

Page 616: Morlet Wavelet: Morl
Morlet Wavelet: morl See [Dau92] page 76. By typing at the MATLAB command prompt you can obtain waveinfo('morl') a survey of the main properties of this wavelet. Morlet wavelet function −0.5 −4...

Page 617: Additional Real Wavelets
Reverse Biorthogonal Wavelet Pairs: rbioNr.Nd This family is obtained from the biorthogonal wavelet pairs previously described. You can obtain a survey of the main properties of this family by typing from the MATLAB command line. waveinfo('rbio') Decomposition scaling function phi Decomposition wavelet function psi −0.5...

Page 618
This wavelet is a FIR based approximation of the Meyer wavelet, allowing fast wavelet coefficients calculation using DWT. You can obtain a survey of the main properties of this wavelet by typing from the MATLAB command line. waveinfo('dmey') Scaling function phi Wavelet function psi −0.5...

Page 619: Complex Wavelets
You can obtain a survey of the main properties of this family by typing from the MATLAB command line. waveinfo('cgau') Real part of function psi Imaginary part of function psi −0.2 −0.2...

Page 620
• is a wavelet center frequency. You can obtain a survey of the main properties of this family by typing from the MATLAB command line. waveinfo('cmor') Real part of function psi Imaginary part of function psi −0.1...

Page 621
• is a wavelet center frequency. You can obtain a survey of the main properties of this family by typing from the MATLAB command line. waveinfo('fbsp') Real part of function psi Imaginary part of function psi −0.2...

Page 622
• is a wavelet center frequency. You can obtain a survey of the main properties of this family by typing from the MATLAB command line. waveinfo('shan') Real part of function psi Imaginary part of function psi −0.2...

Page 623: Properties (part 1)
Advanced Concepts Summary of Wavelet Families and Associated Properties (Part 1) Property morl mexh meyr haar symN coifN biorNr.Nd • • Crude • • • Infinitely regular • • • • Arbitrary regularity • • • • Compactly supported orthogonal •...

Page 624
Wavelet Families: Additional Discussion Property morl mexh meyr haar symN coifN biorNr.Nd • • • • • Fast algorithm • • • Explicit expression splines — A wavelet is said to be crude when satisfying only the Crude wavelet admissibility condition. See “What Functions Are Candidates to Be a Wavelet?” on page 663.

Page 625: Properties (part 2)
Advanced Concepts Summary of Wavelet Families and Associated Properties (Part 2) rbioNr.Nd gaus dmey cgau cmor fbsp shan Property • • • • • Crude • • • • • Infinitely regular • Arbitrary regularity Compactly supported orthogonal • Compactly supported biothogonal •...

Page 626
Wavelet Families: Additional Discussion rbioNr.Nd gaus dmey cgau cmor fbsp shan Property • • • • Complex valued • • • • Complex continuous transform • FIRbased approximation —A wavelet is said to be crude when satisfying only the Crude wavelet admissibility condition.

Page 627: Wavelet Applications: More Detail, Suppressing Signals
Advanced Concepts Wavelet Applications: More Detail Chapter 3, “Wavelet Applications,” and Chapter 4, “Wavelets in Action: Examples and Case Studies,” illustrate wavelet applications with examples and case studies. This section reexamines some of the applications with additional theory and more detail. Suppressing Signals As shown in “Suppressing Signals”...

Page 628
Wavelet Applications: More Detail Let us illustrate, with the following file, some features of wavelet processing using coefficients (resulting plots can be found in Figure 626 on page 694). % Load original 1D signal. load sumsin; s = sumsin; % Set the wavelet name and perform the decomposition % of s at level 4, using coif3.

Page 629
Advanced Concepts Original signal Original detail cfs from level 4 to level 1 1000 Level 1 Level 2 Level 3 Level 4 Synthesized signal Modified detail cfs from level 4 to level 1 1000 Coefficients One coefficient Coefficients forced to zero forced to 4 divided by 3 Figure 626: Suppress or Modify Signal Components, Acting on Coefficients...

Page 630: Splitting Signal Components, Noise Processing
Wavelet Applications: More Detail Splitting Signal Components Wavelet analysis is a linear technique: the wavelet coefficients of the linear combination of two signals are equal to the linear combination of their wavelet coefficients . The same holds true for the corresponding approximations and details, for example Noise Processing Let us first analyze noise as an ordinary signal.

Page 631
Advanced Concepts • If s is a zero mean ARMA model stationary for each scale j, then C j k ( , ) k is also a stationary, zero mean ARMA process whose characteristics depend on j. • If s is a noise whose  Correlation function is known, we know how to calculate the correlations of C(j,k) and C(j,k ).

Page 632: Denoising
Wavelet Applications: More Detail DeNoising This section discusses the problem of signal recovery from noisy data. This problem is easy to understand looking at the following simple example, where a slow sine is corrupted by a white noise. Original signal −1 −2 −3...

Page 633
Advanced Concepts In the simplest model we suppose that e(n) is a Gaussian white noise N(0,1) and the noise level is supposed to be equal to 1. The denoising objective is to suppress the noise part of the signal s and to recover f.

Page 634
Wavelet Applications: More Detail Soft or Hard Thresholding? Thresholding can be done using the function yt = wthresh(y,sorh,thr) which returns soft or hard thresholding of input , depending on the sorh option. Hard thresholding is the simplest method. Soft thresholding has nice mathematical properties and the corresponding theoretical results are available (For instance, see [Don95] in “References”...

Page 635
Advanced Concepts elements whose absolute values are lower than the threshold, and then shrinking the nonzero coefficients toward 0 (see Figure 628). As can be seen in the comment of Figure 628 on page 699, the hard procedure creates discontinuities at x = t, while the soft procedure does not. Threshold Selection Rules According to the basic noise model, four threshold selection rules are implemented in the file...

Page 636
Wavelet Applications: More Detail minimax estimator is the option that realizes the minimum, over a given set of functions, of the maximum mean square error. Typically it is interesting to show how works if is a Gaussian white thselect noise N(0,1) signal. y = randn(1,1000);...

Page 637
Advanced Concepts Dealing with Unscaled Noise and Nonwhite Noise Usually in practice the basic model cannot be used directly. We examine here the options available to deal with model deviations in the main denoising function wden The simplest use of wden sd = wden(s,tptr,sorh,scal,n,wav) which returns the denoised version...

Page 638
Wavelet Applications: More Detail • When you suspect a nonwhite noise e, thresholds must be rescaled by a leveldependent estimation of the level noise. The same kind of strategy as in the previous option is used by estimating level by level. This estimation is implemented in the file , directly handling the wnoisest...

Page 639
Advanced Concepts Original signal −10 −20 Noisy signal −10 −20 De−noised signal − Signal to noise ratio = 4 −10 −20 Figure 629: Blocks Signal DeNoising Since only a small number of large coefficients characterize the original signal, the method performs very well (see Figure 629). If you want to see more about how the thresholding works, use the GUI (see “DeNoising Signals”...

Page 640
Wavelet Applications: More Detail % Load electrical signal and select part of it. load leleccum; indx = 2000:3450; x = leleccum(indx); % Find first value in order to avoid edge effects. deb = x(1); % Denoise signal using soft fixed form thresholding % and unknown noise option.

Page 641
Advanced Concepts Extension to Image DeNoising The denoising method described for the onedimensional case applies also to images and applies well to geometrical images. A direct translation of the onedimensional model is s i j f i j e i j where e is a white Gaussian noise with unit variance.

Page 642
Wavelet Applications: More Detail subplot(221), image(wcodemat(X,sm)), title('Original Image') subplot(222), image(wcodemat(x,sm)), title('Noisy Image') subplot(223), image(wcodemat(xd,sm)), title('DeNoised Image') The result shown below is acceptable. Original Image Noisy Image 50 100 150 200 250 50 100 150 200 250 De−noised Image 50 100 150 200 250 Figure 631: Image DeNoising OneDimensional Variance Adaptive Thresholding of Wavelet Coefficients Local thresholding of wavelet coefficients, for one or twodimensional data, is...

Page 643
Advanced Concepts But the noise variance can vary with time. There are several different variance values on several time intervals. The values as well as the intervals are unknown. Let us focus on the problem of estimating the change points or equivalently the intervals.

Page 644
Wavelet Applications: More Detail x = sort(abs(det)); v2p100 = x(fix(length(x)*0.98)); ind = find(abs(det)>v2p100); det(ind) = mean(det); Use the function to estimate the change points with the Step 3. wvarchg following parameters: • The minimum delay between two change points is d = 10. •...

Page 645: Data Compression
Advanced Concepts More About DeNoising The denoising methods based on wavelet decomposition appear mainly initiated by Donoho and Johnstone in the USA, and Kerkyacharian and Picard in France. Meyer considers that this topic is one of the most significant applications of wavelets (cf. [Mey93] page 173). This chapter and the corresponding files follow the work of the above mentioned researchers.

Page 646
Wavelet Applications: More Detail Thus, only a single parameter needs to be selected. The second approach consists of applying visually determined leveldependent thresholds. Let us examine two reallife examples of compression using global thresholding, for a given and unoptimized wavelet choice, to produce a nearly complete square norm recovery for a signal (see Figure 632 on page 6112) and for an image (see Figure 633 on page 6113).

Page 647
Advanced Concepts Original signal 2600 2650 2700 2750 2800 2850 2900 2950 3000 3050 3100 Compressed signal 2600 2650 2700 2750 2800 2850 2900 2950 3000 3050 3100 2−norm rec.: 99.95 % −− zero cfs: 85.08 Figure 632: Signal Compression The result is quite satisfactory, not only because of the norm recovery criterion, but also on a visual perception point of view.

Page 648
Wavelet Applications: More Detail Original image threshold = 20 2−norm rec.: 99.14 % −− nul cfs : 79.51 Figure 633: Image Compression If the wavelet representation is too dense, similar strategies can be used in the wavelet packet framework to obtain a sparser representation. You can then determine the best decomposition with respect to a suitably selected entropylike criterion, which corresponds to the selected purpose (denoising or compression).

Page 649: Function Estimation: Density And Regression
Advanced Concepts 100*(vectornorm(coeffs of the current decomposition,2))   (vectornorm(coeffs of the original decomposition,2)) The Number of zeros in percentage is defined by 100*(number of zeros of the current decomposition)   (number of coefficients) Function Estimation: Density and Regression In this section we present two problems of functional estimation: •...

Page 650
Wavelet Applications: More Detail Density Estimators. As in the regression context, the wavelets are useful in a nonparametric context, when very little information is available concerning the shape of the unknown density, or when you don’t want to tell the statistical estimator what you know about the shape.

Page 651
Advanced Concepts a bandwidth parameter. In density estimation, nb is generally small with respect to the number of observations (equal to the length of X), since the binning step is a presmoother. A typical default value is nb = length(X) / 4. For more information, you can refer for example to [AntP98], [HarKPT98], and [Ogd97] in “References”...

Page 652
Wavelet Applications: More Detail The expression of the has a very funny interpretation. Because h is a density x h x , the mean value of the random variable Usually such an expectation is estimated very simply by the mean value: ...

Page 653
Advanced Concepts Yb r H ˆ x on the rth bin   H ˆ We can write, using ˆ x H ˆ x     Yb r Xb r   where is the length of each bin. The signs occur because we lose some information when using histogram instead of the values X...

Page 654
Wavelet Applications: More Detail taken in account or explained by the variation of X. A function f represents the central part of the knowledge. The remaining part is dedicated to the residuals, which are similar to a noise. The model is Y = f Regression Models.

Page 655
Advanced Concepts between a variable Y and a general variable X, as well as the analysis of the evolution of Y as a function of time X when X is randomized. How to Perform WaveletBased Regression Estimation. The key idea is to reduce a general problem of regression to a fixeddesign regression model.

Page 656
Wavelet Applications: More Detail There is another difference with the density step: we have here two variables X and Y instead of one in the density scheme. The regression model is where is a sequence of independent and identically distributed (i.i.d.) random variables and where the are randomly generated according to an unknown density h.

Page 657: Compression Using Gui Tools
Advanced Concepts a ˆ   Yb l Xb l The usual simple algorithms can be used. You can see the different steps of the procedure using the Regression Estimation Graphical User Interface by typing , and clicking the wavemenu option.

Page 658
Wavelet Applications: More Detail  Empirical methods  Equal balance sparsitynorm  Remove near 0 Global hard thresholding methods with GUIdriven choice are available. Predefined thresholding strategies are:  Empirical methods  Balance sparsitynorm (default = equal)  Remove near 0 TwoDimensional DWT and SWT DeNoising Leveldependent and orientationdependent (horizontal, vertical, and diagonal) thresholding methods are available.

Page 659
Advanced Concepts  Empirical methods  Equal balance sparsitynorm  Square root of the threshold associated with Equal balance sparsitynorm  Remove near 0 Global hard thresholding methods with GUIdriven choice are available. Predefined thresholding strategies are:  Empirical methods  Balance sparsitynorm (default = equal);...

Page 660
Wavelet Applications: More Detail • Thresholds values:  DonohoJohnstone methods: Fixed form (unscaled noise) (default); Fixed form (scaled noise)  BirgéMassart method: Penalized high, Penalized medium, Penalized low The last three choices include a sparsity parameter a (a > 1). See “OneDimensional DWT and SWT DeNoising”...

Page 661
Advanced Concepts Scarce High, Medium, and Low. These strategies are based on an approximation result from Birgé and Massart (for more information, see [BirM97]) and are well suited for compression. Three parameters characterize the strategy: • J, the level of the decomposition •...

Page 662
Wavelet Applications: More Detail The related files are , and (for more information, see wdcbm wdcbm2 wthrmngr the corresponding reference pages). Penalized High, Medium, and Low. These strategies are based on a recent denoising result by Birgé and Massart, and can be viewed as a variant of the fixed form strategy (see “DeNoising” on page 697) of the wavelet shrinkage.

Page 663
Advanced Concepts Balance SparsityNorm. Let c denote all the detail coefficients; two curves are built associating, for each possible threshold value t, two percentages: • The 2norm recovery in percentage • The relative sparsity in percentage, obtained from the compressed signal by setting to 0 the coefficients less than t in absolute value A default is provided for the 1D case taking t such that the two percentages are equal.

Page 664
Wavelet Applications: More Detail See [HalPKP97], [AntG99], [Ogd97], and [HarKPT98] in “References” on page 6155 for more details. Note that: • c is all the detail coefficients of the binned data. • d is the detail coefficients at level j. •...

Page 665: True Compression For Images
Advanced Concepts True Compression for Images In “Data Compression” on page 6110, we addressed the aspects specifically related to compression using wavelets. However, in addition to the algorithms related to wavelets like DWT and IDWT, it is necessary to use other ingredients concerning the quantization mode and the coding type in order to deal with true compression.

Page 666
Wavelet Applications: More Detail The next figure illustrates how to decrease from 256 to 16 colors by working on the values of the original image. Quantization We can see on this figure: • At the top  On the left: the original image  On the right: the corresponding histogram of values •...

Page 667
Advanced Concepts The next figure illustrates how to decrease information by binning on the wavelet coefficient values of the original image. Quantization We can see on this figure: • At the top  On left: the original image  On the right: the corresponding histogram (central part) of coefficient values •...

Page 668
Wavelet Applications: More Detail The following table summarizes these methods, often called Coefficients Thresholding Methods (CTM), and gives the MATLAB® name used by the true compression tools for each of them. MATLAB Name Compression Method Name 'gbl_mmc_f' Global thresholding of coefficients and fixed...

Page 669
A complete review of these progressive methods is in the Walker reference [Wal99] in “References” on page 6155. The following table summarizes these methods, often called Progressive Coefficients Significance Methods (PCSM), and gives the MATLAB coded name used by the true compression tools for each of them. MATLAB Name...

Page 670
Wavelet Applications: More Detail • The Mean Square Error (MSE). It represents the mean squared error between the compressed and the original image and is given by: – –   X i j – The lower the value of MSE, the lower the error. •...

Page 671: Wavelet Packets, From Wavelets To Wavelet Packets: Decomposing The Details
Advanced Concepts Wavelet Packets The wavelet packet method is a generalization of wavelet decomposition that offers a richer signal analysis. Wavelet packet atoms are waveforms indexed by three naturally interpreted parameters: position, scale (as in wavelet decomposition), and frequency. For a given orthogonal wavelet function, we generate a library of bases called wavelet packet bases.

Page 672: Wavelet Packets In Action: An Introduction
Wavelet decomposition localizes the period of the sine within the interval [8,16]. Wavelet packets provide a more precise estimation of the actual period. How to Obtain and Explain These Graphs? You can reproduce these graphs by typing at the MATLAB® prompt wavemenu 6137...

Page 673
Advanced Concepts Then click the Wavelet Packet 1D option and select the Example Analysis using the demo signal. For more information on using this GUI tool, sinper8 see “OneDimensional Wavelet Packet Analysis” on page 57. The length of the WP tree leaves is 2; there are 128 leaves, labeled from (7,0) to (7,127) and indexed from 127 to 254.

Page 674
Wavelet Packets Wavelet frequency localization Wavelet packets frequency localization Figure 635: Wavelets (Left) Versus Wavelet Packets (Right): A Sine Function 6139...

Page 675
Advanced Concepts Example 2: Analyzing a Chirp Signal The signal to be analyzed is a chirp: an oscillatory signal with increasing modulation sin (250 t ) sampled 512 times on [0, 1]. For this “linear” chirp, the derivative of the phase is linear. On the left of Figure 636, a wavelet analysis does not easily detect this timefrequency property of the signal.

Page 676: Building Wavelet Packets
Wavelet Packets Building Wavelet Packets The computation scheme for wavelet packets generation is easy when using an orthogonal wavelet. We start with the two filters of length 2N, where h , corresponding to the wavelet. Now by induction let us define the following sequence of functions: (x), n = 0, 1, 2, ...) 2N 1 –...

Page 677
Advanced Concepts For n = 0 to 7, we have the Wfunctions shown in Figure 637. −0.5 −0.5 −0.5 −1 −1 −1 −1.5 −1.5 −1.5 −0.5 −0.5 −0.5 −0.5 −1 −1 −1 −1 −1.5 −1.5 −1.5 −1.5 Figure 637: Haar Wavelet Packets This can be obtained using the following command: [wfun,xgrid] = wpfun('db1',7,5);...

Page 678: Wavelet Packet Atoms
Wavelet Packets −0.5 −0.5 −1 −1 −1 −0.5 −1.5 −2 −1.5 −1 −1 −1 −1 −2 −2 −2 −2 Figure 638: db2 Wavelet Packets Wavelet Packet Atoms Starting from the functions and following the same line leading to orthogonal wavelets, we consider the threeindexed family of analyzing functions (the waveforms): j –...

Page 679
Advanced Concepts scale and at various frequencies for the different admissible values of the last parameter n. In fact, examining carefully the wavelet packets displayed in Figure 637 on page 6142 and Figure 638 on page 6143, the naturally ordered W for n = 0, 1, ..., 7, does not match exactly the order defined by the number of oscillations.

Page 680
Wavelet Packets Figure 639: Natural and Frequency Ordered Wavelet Packets Coefficients When plotting the coefficients, the various options related to the “Frequency” or “Natural” order choice are available using the GUI tools. These options are also available from commandline mode when using the function.

Page 681: Organizing The Wavelet Packets
Advanced Concepts Organizing the Wavelet Packets The set of functions W is the (j,n) wavelet packet. For j,n,k positive values of integers j and n, wavelet packets are organized in trees. The tree in Figure 640 is created to give a maximum level decomposition equal to 3.

Page 682: Choosing The Optimal Decomposition
Wavelet Packets We also know that the family of functions {(W ), (W )} is an j+1,2n j+1,2n+1 orthogonal basis of the space spanned by W , which is split into two subspaces: W spans the first subspace, and W the second one.

Page 683
Advanced Concepts a common concept in many fields, mainly in signal processing. Let us list four different entropy criteria (see [CoiW92]); many others are available and can be easily integrated (type ). In the following expressions s is the help wentropy signal and (s ) are the coefficients of s in an orthonormal basis.

Page 684
Wavelet Packets Example 1: Compute Various Entropies. Generate a signal of energy equal to 1. = ones(1,16)*0.25; Compute the Shannon entropy of s. e1 = wentropy(s,'shannon') e1 = 2.7726 Compute the l entropy of s, equivalent to norm(s,1.5) e2 = wentropy(s,'norm',1.5) e2 = 2 Compute the “log energy”...

Page 685
Advanced Concepts e10 = wentropy(w10,'shannon') e10 = 2.0794 The detail of level 1, , is zero; the entropy is zero. Due to the additivity property the entropy of decomposition is given by . This has to be compared to the initial entropy e10+e11=2.0794 e00=2.7726 We have...

Page 686
Wavelet Packets Perform wavelet packets decomposition of the signal s defined in example 1. t = wpdec(s,4,'haar','shannon'); The wavelet packet tree in Figure 642 shows the nodes labeled with original entropy numbers. Figure 642: Entropy Values Compute the best tree. bt = besttree(t);...

Page 687: Some Interesting Subtrees
Advanced Concepts Some Interesting Subtrees Using wavelet packets requires treerelated actions and labeling. The implementation of the user interface is built around this consideration. For more information on the technical details, see the reference pages. The complete binary tree of depth D corresponding to a wavelet packet decomposition tree developed at level D is denoted by WPT.

Page 688: Wavelet Packets 2d Decomposition Structure
Wavelet Packets For any nonterminal node, we use the following basic step to find the optimal subtree with respect to a given entropy criterion E (where Eopt denotes the optimal entropy value). Entropy Condition Action on Tree and on Entropy Labeling ...

Page 689: Wavelet Packets For Compression And Denoising
Advanced Concepts Wavelet Packets for Compression and DeNoising In the wavelet packet framework, compression and denoising ideas are identical to those developed in the wavelet framework. The only new feature is a more complete analysis that provides increased flexibility. A single decomposition using wavelet packets generates a large number of bases.

Page 690: References
References References [Abr97] Abry, P. (1997), Ondelettes et turbulence. Multirésolutions, algorithmes de décomposition, invariance d’échelles, Diderot Editeur, Paris. Abry, P., P. Flandrin, M.S. Taqqu, D. Veitch (2003), “Selfsimilarity [Abr03] and longrange dependence through the wavelet lens,” Theory and applications of longrange dependence, Birkhäuser, pp. 527–556. [Ant94] Antoniadis, A.

Page 691
Advanced Concepts coding,” EURASIP Journal on Image and Video Processing, 2007, to appear in the special issue on Wavelets in Source Coding, Communications, and Networks, Paper ID 54679. ] Chui, C.K. (1992a), Wavelets: a tutorial in theory and applications, [Chu92a Academic Press.

Page 692
References [Don95] Donoho, D.L. (1995), “DeNoising by softthresholding,” IEEE Trans. on Inf. Theory, vol. 41, 3, pp. 613–627. [DonJ94a] Donoho, D.L., I.M. Johnstone (1994),“Ideal spatial adaptation by wavelet shrinkage,” Biometrika, vol. 81, pp. 425–455. [DonJ94b] Donoho, D.L., I.M. Johnstone (1994), “Ideal denoising in an orthonormal basis chosen from a library of bases,”...

Page 693
Advanced Concepts [Mal89] Mallat, S. (1989), “A theory for multiresolution signal decomposition: the wavelet representation,” IEEE Pattern Anal. and Machine Intell., vol. 11, no. 7, pp. 674–693. [Mal98] Mallat, S. (1998), A wavelet tour of signal processing, Academic Press. [Mey90] Meyer, Y. (1990), Ondelettes et opéateurs, Tome 1, Hermann Ed. (English translation: Wavelets and operators), Cambridge Univ.

Page 694
References [Sai96] Said A., W.A. Pearlman (1996), “A new, fast, and efficient image codec based on set partitioning in hierarchical trees,” IEEE Trans. on Circuits and Systems for Video Technology, Vol. 6, No. 3, pp. 243–250. [Sha93] Shapiro J.M. (1993), “Embedded image coding using zerotrees of wavelet coefficients,”...

Page 695
Advanced Concepts 6160...

Page 696
Adding Your Own Wavelets This chapter discusses how to add your own wavelet families to the toolbox. • Preparing to Add a New Wavelet Family (p. 72) • Adding a New Wavelet Family (p. 78) • After Adding a New Wavelet Family (p. 716)

Page 697: Preparing To Add A New Wavelet Family, Choose The Wavelet Family Full Name
Choose the short name of the wavelet family ( Determine the wavelet type ( Define the orders of wavelets within the given family ( nums Build a MATfile or a MATLAB file ( file For wavelets without FIR filters: Define the effective support. These steps are described below.

Page 698: Choose The Wavelet Family Short Name, Determine The Wavelet Type
Preparing to Add a New Wavelet Family Choose the Wavelet Family Short Name The short name of the wavelet family, , must be a string of four characters or less. Predefined wavelet family short names are haar coif bior , and rbio meyr dmey...

Page 699: Define The Orders Of Wavelets Within The Given Family, Build A Matfile Or Code File
MATLAB code file or MATfile name. If a family contains many wavelets, a MATLAB code file (with a extension) must be defined and must be of a specific form that depends on the wavelet type. The specific file formats are described in the remainder of this section.

Page 700
Preparing to Add a New Wavelet Family where the input argument is a string containing the wavelet name, and wname the output argument is the corresponding scaling filter. The filter must be of even length; otherwise, it is zeropadded by the toolbox. For predefined wavelets, the scaling filter is of sum 1.

Page 701: Define The Effective Support
Adding Your Own Wavelets Type 4 or Type 5 (No FIR Filter; No Scale Function) The syntax of the first line in the code file must be function [psi,t] = file(lb,ub,n,wname) function [psi,t] = file(lb,ub,n,wname, additional arguments ) which returns values of the wavelet function , a regular point grid of the interval...

Page 702
Preparing to Add a New Wavelet Family Note For wavelets of type 3, 4, and 5, [4 4] are the correct effective support theoretical values, but a wider effective support, [8 8], is used in computation to provide more accurate results.

Page 703: Adding A New Wavelet Family, Example 1
Adding Your Own Wavelets Adding a New Wavelet Family To add a new wavelet, use the command in one of two forms: wavemngr wavemngr('add',fn,fsn,wt,nums,file) wavemngr('add',fn,fsn,wt,nums,file,b). Here are a few examples to illustrate how you would use to add some wavemngr of the predefined wavelet families: Type Syntax...

Page 704
Adding a New Wavelet Family The order of the wavelet within the family is (we just use one in this example). The file used to generate the filters is binlwavf.m Then to add the new wavelet, type % Add new family of biorthogonal wavelets. wavemngr('add','Binlets','binl',2,'7.9','binlwavf') % List wavelets families.

Page 705
Adding Your Own Wavelets If you want to get online information on this new family, you can build an associated help file which would look like the following: function binlinfo %BINLINFO Information on biorthogonal wavelets (binlets). Biorthogonal Wavelets (Binlets) Family Binlets Short name binl...

Page 706
Adding a New Wavelet Family Nr = 7; Nd = 9; % for possible extension % more wavelets in 'Binlets' family % if nargin==0 Nr = 7; Nd = 9; elseif isempty(wname) Nr = 7; Nd = 9; else if ischar(wname) lw = length(wname);...

Page 707: Example 2
Adding Your Own Wavelets if Nd == 9 Rf = [1 0 9 16 9 0 1]/32; Df = [ 1 0 8 16 46 16 8 0 1]/64; Example 2 In the following example, new compactly supported orthogonal wavelets are added to the toolbox.

Page 708
Adding a New Wavelet Family ans = =================================== Haar haar =================================== Daubechies  db10 db** =================================== Symlets  sym2 sym3 sym4 sym5 sym6 sym7 sym8 sym** =================================== Coiflets coif  coif1 coif2 coif3 coif4 coif5 =================================== BiorSplines bior  bior1.1 bior1.3 bior1.5 bior2.2...

Page 709
Adding Your Own Wavelets Gaussian gaus  gaus1 gaus2 gaus3 gaus4 gaus5 gaus6 gaus7 gaus8 gaus** =================================== Mexican_hat mexh =================================== Morlet morl =================================== Complex Gaussian cgau  cgau1 cgau2 cgau3 cgau4 cgau5 cgau** =================================== Shannon shan  shan11.5 shan11 shan10.5 shan10.1 shan23 shan**...

Page 710
Adding a New Wavelet Family The function lemwavf.m must be as follow: function w = lemwavf(wname) where the input argument wname is a string: wname = 'lem1' or 'lem2' ... i.e., wname = sh.name + number and w the corresponding scaling filter. The addition is obtained using: wavemngr('add','Lemarie','lem',1,'1 2 3 4 5','lemwavf');...

Page 711: After Adding A New Wavelet Family
Toolbox™ software, you should Create a new folder specifically to hold the wavelet extension files. Move the previously mentioned files into this new folder. ® Prepend this folder to the MATLAB folder search path (see the reference entry for the command).

Page 712
Function Reference • General Wavelet Functions (p. 82) • Wavelet Families (p. 83) • 1D Continuous Wavelets (p. 84) • 1D Discrete Wavelets (p. 85) • 2D Discrete Wavelets (p. 86) • 3D Discrete Wavelets (p. 87) • Wavelet Packet Algorithms (p. 88) •...

Page 713: General Wavelet Functions
Function Reference General Wavelet Functions Biorthogonal wavelet filter set biorfilt Wavelet center frequency centfrq Dyadic downsampling dyaddown Dyadic upsampling dyadup Integrate wavelet function psi ( intwave Orthogonal wavelet filter set orthfilt Quadrature mirror filter Scale to frequency scal2frq Wavelet and scaling functions wavefun Wavelet and scaling functions 2D wavefun2...

Page 714: Wavelet Families
Wavelet Families Wavelet Families Biorthogonal spline wavelet filters biorwavf Complex Gaussian wavelet cgauwavf Complex Morlet wavelet cmorwavf Coiflet wavelet filter coifwavf Daubechies wavelet filter computation dbaux Daubechies wavelet filter dbwavf Complex frequency Bspline wavelet fbspwavf Gaussian wavelet gauswavf Mexican hat wavelet mexihat Meyer wavelet meyer...

Page 715: D Continuous Wavelets
Function Reference 1D Continuous Wavelets Real or complex continuous 1D wavelet coefficients Real or complex continuous 1D wavelet coefficients using extension parameter cwtext Build wavelet from pattern pat2cwav Scalogram for continuous wavelet transform wscalogram...

Page 716: D Discrete Wavelets
1D Discrete Wavelets 1D Discrete Wavelets 1D approximation coefficients appcoef 1D detail coefficients detcoef Singlelevel discrete 1D wavelet transform Discrete wavelet transform extension mode dwtmode Singlelevel inverse discrete 1D wavelet transform idwt Direct reconstruction from 1D wavelet coefficients upcoef Singlelevel reconstruction of 1D wavelet decomposition upwlev Multilevel 1D wavelet decomposition wavedec...

Page 717
Function Reference 2D Discrete Wavelets 2D approximation coefficients appcoef2 2D detail coefficients detcoef2 Singlelevel discrete 2D wavelet transform dwt2 Discrete wavelet transform extension mode dwtmode Singlelevel inverse discrete 2D wavelet transform idwt2 Direct reconstruction from 2D wavelet coefficients upcoef2 Singlelevel reconstruction of 2D wavelet decomposition upwlev2 Multilevel 2D wavelet decomposition wavedec2...

Page 718
3D Discrete Wavelets 3D Discrete Wavelets Singlelevel discrete 3D wavelet transform dwt3 Discrete wavelet transform extension mode dwtmode Singlelevel inverse discrete 3D wavelet transform idwt3 Multilevel 3D wavelet decomposition wavedec3 Multilevel 3D wavelet reconstruction waverec3...

Page 719: Wavelet Packet Algorithms
Function Reference Wavelet Packet Algorithms Best level tree wavelet packet analysis bestlevt Best tree wavelet packet analysis besttree Entropy update (wavelet packet) entrupd Energy for wavelet packet decomposition wenergy Entropy (wavelet packet) wentropy Extract wavelet tree from wavelet packet tree wp2wtree Wavelet packet coefficients wpcoef...

Page 720: Discrete Stationary Wavelet Transform Algorithms
Discrete Stationary Wavelet Transform Algorithms Discrete Stationary Wavelet Transform Algorithms Inverse discrete stationary wavelet transform 1D iswt Inverse discrete stationary wavelet transform 2D iswt2 Discrete stationary wavelet transform 1D Discrete stationary wavelet transform 2D swt2...

Page 721: Nondecimated Wavelet Transform Algorithms
Function Reference NonDecimated Wavelet Transform Algorithms Inverse nondecimated wavelet transform 1D indwt Inverse nondecimated wavelet transform 2D indwt2 Nondecimated wavelet transform 1D ndwt Nondecimated wavelet transform 2D ndwt2 810...

Page 722: Lifting Wavelet Transforms
Lifting Wavelet Transforms Lifting Wavelet Transforms Add lifting steps to lifting scheme addlift Biorthogonal scaling and wavelet functions bswfun Display lifting scheme displs Transform quadruplet of filters to lifting scheme filt2ls Inverse 1D lifting wavelet transform ilwt Inverse 2D lifting wavelet transform ilwt2 Apply elementary lifting steps on quadruplet of filters liftfilt...

Page 723: Denoising And Compression
Function Reference DeNoising and Compression Interval dependent denoising cmddenoise Default values for denoising or compression ddencmp Threshold selection for denoising thselect Penalized threshold for wavelet 1D or 2D denoising wbmpen Thresholds for wavelet 1D using BirgeMassart strategy wdcbm Thresholds for wavelet 2D using BirgeMassart strategy wdcbm2 Automatic 1D denoising wden...

Page 724: D Multisignal Wavelet Analysis
1D Multisignal Wavelet Analysis 1D Multisignal Wavelet Analysis Multiscale Principal Components Analysis wmspca Wavelet multivariate denoising wmulden Change multisignal 1D decomposition coefficients chgwdeccfs Multisignal 1D clustering mdwtcluster Multisignal 1D wavelet decomposition mdwtdec Multisignal 1D wavelet reconstruction mdwtrec Multisignal 1D compression using wavelets mswcmp Multisignal 1D wavelet compression scores mswcmpscr...

Page 725
Function Reference True Compression for Image wcompress True compression of images using wavelets 814...

Page 726: Other Wavelet Applications
Other Wavelet Applications Other Wavelet Applications Fractional Brownian motion synthesis wfbm Parameter estimation of fractional Brownian motion wfbmesti Fusion of two images wfusimg Fusion of two matrices or arrays wfusmat 815...

Page 727: Tree Management Utilities
Function Reference Tree Management Utilities Tree nodes allnodes Wavelet packet tree construction from coefficients cfs2wpt Node depthposition to node index depo2ind WPTREE information disp Draw wavelet packet decomposition tree (GUI) drawtree DTREE constructor dtree WPTREE contents Node index to node depthposition ind2depo Existing node test isnode...

Page 728
Tree Management Utilities Tree order treeord Constructor for class WPTREE wptree Plot wavelet packets colored coefficients wpviewcf Write values in WPTREE fields write WTBO constructor wtbo NTREE manager wtreemgr 817...

Page 729: General Utilities And Demos
Function Reference General Utilities and Demos Extended pseudocolor matrix scaling wcodemat Compute local maxima positions localmax Extend vector or matrix wextend Keep part of vector or matrix wkeep Flip vector wrev Wavelet Toolbox manager wtbxmngr Wavelet GUI tools wavemenu Find variance change points wvarchg Wavelet information waveinfo...

Page 730
Functions — Alphabetical List Functions — Alphabetical List This section contains function reference pages listed alphabetically. 819...

Page 731
820...

Page 732
addlift Purpose 8addlift Add lifting steps to lifting scheme Syntax LSN = addlift(LS,ELS) LSN = addlift(LS,ELS,'begin') LSN = addlift(LS,ELS,'end') Description returns the new lifting scheme obtained by LSN = addlift(LS,ELS) appending the elementary lifting step to the lifting scheme prepends the specified elementary lifting LSN = addlift(LS,ELS,'begin') step.

Page 733
addlift % Add a primal ELS to the lifting scheme. els = {'p',[0.125 0.125],0}; lsnew = addlift(lshaar,els); displs(lsnew); lsnew = {... [ 1.00000000] 0.50000000] [ 0.12500000 0.12500000] 1.41421356] 0.70710678] See Also liftfilt 822...

Page 734
allnodes Purpose 8allnodes Tree nodes Syntax N = allnodes(T) N = allnodes(T,'deppos') Description is a tree management utility that returns one of two node allnodes descriptions: either indices, or depths and positions. The nodes are numbered from left to right and from top to bottom. The root index is 0.

Page 735
allnodes (13) (14) % List t nodes (index). aln_ind = allnodes(t) aln_ind = % List t nodes (Depth_Position). aln_depo = allnodes(t,'deppos') aln_depo = 824...

Page 736
appcoef Purpose 8appcoef 1D approximation coefficients Syntax A = appcoef(C,L,'wname',N) A = appcoef(C,L,'wname') A = appcoef(C,L,Lo_R,Hi_R) A = appcoef(C,L,Lo_R,Hi_R,N) Description is a onedimensional wavelet analysis function. appcoef computes the approximation coefficients of a onedimensional signal. appcoef computes the approximation coefficients at level A = appcoef(C,L,'wname',N) using the wavelet decomposition structure (see...

Page 737
appcoef % Using some plotting commands, % the following figure is generated. Algorithm The input vectors contain all the information about the signal decomposition. ; then where NMAX = length(L)2 C = [A(NMAX) D(NMAX) ... D(1)] are vectors. , then a simple extraction is done; otherwise, computes N = NMAX appcoef...

Page 738
appcoef2 Purpose 8appcoef2 2D approximation coefficients Syntax A = appcoef2(C,S,'wname',N) A = appcoef2(C,S,'wname') A = appcoef2(C,S,Lo_R,Hi_R) A = appcoef2(C,S,Lo_R,Hi_R,N) Description is a twodimensional wavelet analysis function. It computes the appcoef2 approximation coefficients of a twodimensional signal. The syntaxes allow you to give the wavelet name or the filters as inputs.

Page 739
appcoef2 sizex = size(X) sizex = 256 256 sizec = size(c) sizec = 65536 val_s = s val_s = % Extract approximation coefficients % at level 2. ca2 = appcoef2(c,s,'db1',2); sizeca2 = size(ca2) sizeca2 = % Compute approximation coefficients % at level 1. ca1 = appcoef2(c,s,'db1',1);...

Page 740
bestlevt Purpose 8bestlevt Best level tree wavelet packet analysis Syntax T = bestlevt(T) [T,E] = bestlevt(T) Description is a one or twodimensional wavelet packet analysis function. bestlevt computes the optimal complete subtree of an initial tree with respect bestlevt to an entropy type criterion. The resulting complete tree may be of smaller depth than the initial one.

Page 741
bestlevt % Plot wavelet packet tree wpt. plot(wpt) (0,0) (1,0) (1,1) (2,0) (2,1) (2,2) (2,3) (3,0) (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) (3,7) (4,0) (4,1) % Compute best level tree. blt = bestlevt(wpt); % Plot best level tree blt. plot(blt) (0,0) (1,0) (1,1)

Page 742
besttree Purpose 8besttree Best tree wavelet packet analysis Syntax T = besttree(T) [T,E] = besttree(T) [T,E,N] = besttree(T) Description is a one or twodimensional wavelet packet analysis function that besttree computes the optimal subtree of an initial tree with respect to an entropy type criterion.

Page 743
besttree Examples % The current extension mode is zeropadding (see dwtmode). % Load signal. load noisdopp; x = noisdopp; % Decompose x at depth 3 with db1 wavelet, using default % entropy (shannon). wpt = wpdec(x,3,'db1'); % Decompose the packet [3 0]. wpt = wpsplt(wpt,[3 0]);...

Page 744
besttree (0,0) (1,0) (1,1) (2,0) (2,1) (3,0) (3,1) (3,2) (3,3) (4,0) (4,1) Algorithm Consider the onedimensional case. Starting with the root node, the best tree is calculated using the following scheme. A node N is split into two nodes N1 and N2 if and only if the sum of the entropy of N1 and N2 is lower than the entropy of N.

Page 745
biorfilt Purpose 8biorfilt Biorthogonal wavelet filter set Syntax [Lo_D,Hi_D,Lo_R,Hi_R] = biorfilt(DF,RF) [Lo_D1,Hi_D1,Lo_R1,Hi_R1,Lo_D2,Hi_D2,Lo_R2,Hi_R2] = biorfilt(DF,RF,'8') Description command returns either four or eight filters associated with biorfilt biorthogonal wavelets. computes four filters associated [Lo_D,Hi_D,Lo_R,Hi_R] = biorfilt(DF,RF) with the biorthogonal wavelet specified by decomposition filter reconstruction filter .

Page 746
biorfilt Furthermore, the two wavelets are related by duality in the following sense: ˜ as soon as j k , j k , ˜ as soon as 0 k , 0 k , It becomes apparent, as A. Cohen pointed out in his thesis (p. 110), that “the useful properties for analysis (e.g., oscillations, null moments) can be ˜...

Page 747
biorfilt % Editing some graphical properties, % the following figure is generated. Dec. low−pass filter bior3.5 Dec. high−pass filter bior3.5 −0.5 −0.5 −1 −1 Rec. low−pass filter bior3.5 Rec. high−pass filter bior3.5 −0.5 −0.5 −1 −1 % Orthogonality by dyadic translation is lost. nzer = [Lo_D 0 0]*[0 0 Lo_D]' nzer = 0.6881...

Page 748
biorfilt err = 5.0218e15 % High and low frequency illustration. fftld = fft(Lo_D); ffthd = fft(Hi_D); freq = [1:length(Lo_D)]/length(Lo_D); subplot(221); plot(freq,abs(fftld),freq,abs(ffthd)); title('Transfer modulus for dec. filters') fftlr = fft(Lo_R); ffthr = fft(Hi_R); freq = [1:length(Lo_R)]/length(Lo_R); subplot(222); plot(freq,abs(fftlr),freq,abs(ffthr)); title('Transfer modulus for rec. filters') subplot(223);...

Page 749
biorfilt Note For biorthogonal wavelets, the filters for decomposition and reconstruction are generally of different odd lengths. This situation occurs, for example, for “splines” biorthogonal wavelets used in the toolbox where the four filters are zeropadded to have the same even length. See Also biorwavf orthfilt...

Page 750
biorwavf Purpose 8biorwavf Biorthogonal spline wavelet filters Syntax [RF,DF] = biorwavf(W) Description returns two scaling filters associated with the [RF,DF] = biorwavf(W) biorthogonal wavelet specified by the string where possible values for W = 'biorNr.Nd' Nr = 1 Nd = 1 , 3 Nr = 2 Nd = 2 , 4 , 6 Nr = 3...

Page 751
bswfun Purpose 8bswfun Biorthogonal scaling and wavelet functions Syntax [PHIS,PSIS,PHIA,PSIA,XVAL] = bswfun(LoD,HiD,LoR,HiR) [PHIS,PSIS,PHIA,PSIA,XVAL] = bswfun(LoD,HiD,LoR,HiR,ITER) [PHIS,PSIS,PHIA,PSIA,XVAL] = bswfun(LoD,HiD,LoR,HiR, plot [PHIS,PSIS,PHIA,PSIA,XVAL] = bswfun(LoD,HiD,LoR,HiR,ITER,'plot') Description returns [PHIS,PSIS,PHIA,PSIA,XVAL] = bswfun(LoD,HiD,LoR,HiR) approximations on the grid of the two pairs of scaling function and XVAL wavelet ( ), ( ) associated with the two pairs of filters...

Page 752
bswfun Analysis scaling function (phiA) Analysis wavelet function (psiA) −0.5 −1 Synthesis scaling function (phiS) Synthesis wavelet function (psiS) −100 −200 −300 −500 Algorithm This function uses the cascade algorithm. See Also wavefun 841...

Page 753
centfrq Purpose 8centfrq Wavelet center frequency Syntax FREQ = centfrq('wname') FREQ = centfrq('wname',ITER) [FREQ,XVAL,RECFREQ] = centfrq('wname',ITER,'plot') Description returns the center frequency in herz of the wavelet FREQ = centfrq('wname') function, (see for more information). 'wname' wavefun is the number of iterations FREQ = centfrq('wname',ITER) ITER performed by the function...

Page 754
centfrq Wavelet db2 (in bold) and Center frequency based approximation −0.5 −1 −1.5 Period: 1.5; Cent. Freq: 0.66667 % Example 2: a complex wavelet wname = 'cgau6'; % Compute the center frequency and display % the wavelet function and the associated % center frequency based approximation.

Page 755
centfrq Wavelet cgau6 (in bold) and Center frequency based approximation −0.5 −1 −5 Period: 1.6667; Cent. Freq: 0.6 −0.5 −1 −5 Period: 1.6667; Cent. Freq: 0.6 See Also scal2frq wavefun 844...

Page 756
cfs2wpt Purpose 8cfs2wpt Wavelet packet tree construction from coefficients Syntax T = cfs2wpt(WNAME,SIZE_OF_DATA,TN_OF_TREE,ORDER,CFS) Description builds a wavelet packet tree ( ) and the related analyzed signal or CFS2WPT image ( ) using the following input information: : name of the wavelet used for the analysis WNAME : size of the analyzed signal or image SIZE_OF_DATA...

Page 757
cfs2wpt % Example 2: Using cfs2wpt without the CFS argument % Building an empty wavelet packet tree object t = cfs2wpt('sym4',[1 1024],[3 9 10 2]',2); % Getting the terminal node sizes sN = read(t,'sizes',[3,9]); sN3 = sN(1,:); sN9 = sN(2,:); % Building coefficient values vectors and writing them in the tree cfsN3 = ones(sN3);...

Page 758
cfs2wpt 847...

Page 759
cgauwavf Purpose 8cgauwavf Complex Gaussian wavelet Syntax [PSI,X] = cgauwavf(LB,UB,N,P) Description returns values of the th derivative of the [PSI,X] = cgauwavf(LB,UB,N,P) complex Gaussian function on an point regular grid for the interval [ Cp is such that the 2norm of the th derivative of F is equal to 1.

Page 760
cgauwavf subplot(212) plot(x,imag(psi)) xlabel('Imaginary part'), grid Complex Gaussian wavelet of order 4 −0.5 −1 −5 Real part −0.5 −1 −5 Imaginary part See Also waveinfo 849...

Page 761
chgwdeccfs Purpose 8chgwdeccfs Change multisignal 1D decomposition coefficients Syntax DEC = chgwdeccfs(DEC,'ca',COEFS) DEC = chgwdeccfs(DEC,'cd',COEFS,LEV) DEC = chgwdeccfs(DEC,'all',CA,CD) DEC = chgwdeccfs(DEC,'all',V) DEC = chgwdeccfs(...,IDXSIG) Description replaces the approximation coefficients DEC = chgwdeccfs(DEC,'ca',COEFS) at level with those contained in the matrix .

Page 762
chgwdeccfs % Change the coefficients of details at level 1. % Replace all values by 0. decBIS = chgwdeccfs(dec,'cd',0,1); % Change the coefficients of details at level 1 and % level 2 for signals 31 to 35. Replace all values by 0. decTER = chgwdeccfs(dec,'cd',0,1:2,31:35);...

Page 763
cmddenoise Purpose 8cmddenoise Intervaldependent denoising Syntax [SIGDEN,COEFS,thrParams,int_DepThr_Cell,BestNbOfInt] = cmddenoise(SIG,WNAME,LEVEL) [...] = cmddenoise(SIG,WNAME,LEVEL,SORH) [...] = cmddenoise(SIG,WNAME,LEVEL,SORH,NB_INTER) [...] = cmddenoise(SIG,WNAME,LEVEL,SORH,NB_INTER,thrParams) Description performs an intervaldependent SIGDEN = cmddenoise(SIG,WNAME,LEVEL) denoising of the signal , using a wavelet decomposition at level with LEVEL a wavelet named .

Page 764
cmddenoise Examples Denoise a signal, and plot the original and denoised signals. load nbumpr3.mat; sig = nbumpr3; [sden,cfs] = cmddenoise(sig,'sym4',5,'s'); subplot(2,1,1); plot(sig,'r'); axis tight hold on; plot(sden,'k'); title('Original and denoised superimposed signals') subplot(2,1,2); plot(sden,'k'); axis tight title('Denoised signal') 853...

Page 765
cmddenoise Denoise a signal, and plot the superimposes original and denoised signals. [sden,cfs] = cmddenoise('nbumpr2','sym4',5,'s'); load nbumpr2; plot(nbumpr2,'r'); axis tight hold on; plot(sden,'k','linewidth',2); title('Original and denoised superimposed signals') 854...

Page 766
cmddenoise Denoise a signal and show the effect of specifying the number of intervals. load nblocr1; sig = nblocr1; [sden,cfs] = cmddenoise('nblocr1','db5',5,'s',3); subplot(2,1,1); plot(sig,'r'); axis tight hold on; plot(sden,'k'); title('Original and denoised superimposed signals') subplot(2,1,2); plot(sden,'k'); axis tight title('Denoised signal') 855...

Page 767
cmddenoise Denoise a signal using thresholds for intervals obtained from the wavelet 1D denoising GUI tool. % Fine tuning thresholds using the GUI and saving % the thrParams variable which contains the desired % intervals and thresholds, allows to reuse this variable: File >...

Page 768
cmddenoise See Also wdencmp wden wthrmngr 857...

Page 769
cmorwavf Purpose 8cmorwavf Complex Morlet wavelet Syntax [PSI,X] = cmorwavf(LB,UB,N,FB,FC) Description returns values of the complex Morlet [PSI,X] = cmorwavf(LB,UB,N,FB,FC) wavelet defined by a positive bandwidth parameter , a wavelet center frequency and the expression PSI(X) = ((pi*FB)^(0.5))*exp(2*i*pi*FC*X)*exp(X^2/FB) on an point regular grid for the interval [LB,UB] Output arguments are the wavelet function...

Page 770
cmorwavf subplot(212) plot(x,imag(psi)) xlabel('Imaginary part'), grid Complex Morlet wavelet cmor1.5−1 −0.5 −10 −5 Real part −0.5 −10 −5 Imaginary part See Also waveinfo References Teolis, A. (1998), Computational signal processing with wavelets, Birkhauser, p. 65. 859...

Page 771
coifwavf Purpose 8coifwavf Coiflet wavelet filter Syntax F = coifwavf(W) Description returns the scaling filter associated with the Coiflet wavelet F = coifwavf(W) specified by the string where . Possible values for are 1, 2, 3, 4, W = 'coifN' or 5.

Page 772
Purpose 8cwt Continuous 1D wavelet transform Syntax coefs = cwt(x,scales,'wname') coefs = cwt(x,scales,'wname','plot') coefs = cwt(x,scales,'wname','coloration') [coefs, sgram] = cwt(x,scales,'wname','scal') [coefs, sgram] = cwt(x,scales,'wname','scalCNT') coefs = cwt(x,scales,'wname','coloration',xlim) Description computes the continuous wavelet coefs = cwt(x,scales,'wname') coefficients of the signal vector at real, positive , using wavelet scales...

Page 773
Coloration Coloration is the method used to scale the coefficient values for plotting. Each coefficient is divided by the resulting coloration value. • — uses maximum value in each scale 'lvl' • — uses maximum value in all scales 'glb' •...

Page 774
for k=1:5 d=detcoef(c,l,k); d=d(ones(1,2^k),:); cfd(k,:)=wkeep(d(:)',len); cfd=cfd(:); I=find(abs(cfd) <sqrt(eps)); cfd(I)=zeros(size(I)); cfd=reshape(cfd,5,len); % Plot DWT. subplot(311); plot(vonkoch); title('Analyzed signal.'); set(gca,'xlim',[0 510]); subplot(312); image(flipud(wcodemat(cfd,255,'row'))); colormap(pink(255)); set(gca,'yticklabel',[]); title('Discrete Transform,absolute coefficients'); ylabel('Level'); % Compute CWT and compare with DWT subplot(313); ccfs=cwt(vonkoch,1:32,'sym2','plot'); title('Continuous Transform, absolute coefficients'); set(gca,'yticklabel',[]);...

Page 775
References Daubechies, I. Ten Lectures on Wavelets, Philadelphia, PA: Society for Industrial and Applied Mathematics (SIAM), 1992. Mallat, S. A Wavelet Tour of Signal Processing, San Diego, CA: Academic Press, 1998. See Also cwtext wavedec wavefun waveinfo wcodemat How To “Continuous Wavelet Transform”...

Page 776
cwtext Purpose 8cwtext Real or complex continuous 1D wavelet coefficients using extension parameters Syntax COEFS = cwtext(S,SCALES,'wname') COEFS = cwtext(S,SCALES,'wname',PropName1,ProVal1, ...) Description computes the continuous wavelet COEFS = cwtext(S,SCALES,'wname') coefficients of the vector at real, positive , using a wavelet named SCALES .

Page 777
cwtext • for extension on both sides ExtSide = 'b' • null extension ExtSide = 'n' For the complete list of valid values for ExtMode ExtSide, wextend is the length of extension. ExtLen Default values for extension parameters are 'zpd' 'b'.

Page 778
cwtext For each given scale within the vector , the wavelet coefficients SCALES C(a,b) are computed for , and are stored in b = 1 ls = length(S) COEFS(i,:) a = SCALES(i) Output argument is a by matrix where is the length of COEFS SCALES is a real or complex matrix depending on the wavelet type.

Page 779
cwtext % Compute and plot the coefficients cwt(wcantor,(1:256),'mexh','absglb'); colormap(pink(4)) 868...

Page 780
cwtext In this figure above, which is produced by the function, the values of coefficients are tremendously affected by the boundary effect due to the discontinuity of the signal on the right. The default (zeropadding) extension mode on the right explains this important discontinuity because the last value is 1.

Page 781
dbaux Purpose 8dbaux Daubechies wavelet filter computation Syntax W = dbaux(N,SUMW) W = dbaux(N) Description is the order Daubechies scaling filter such that W = dbaux(N,SUMW) . Possible values for are 1, 2, 3, ... sum(W) = SUMW Note Instability may occur when is too large.

Page 782
dbaux % Check that ww is correct and equal to % the db2 Daubechies scaling filter w. w = dbaux(2) 0.3415 0.5915 0.1585 0.0915 Algorithm The algorithm used is based on a result obtained by Shensa (see “References”), showing a correspondence between the “Lagrange à trous” filters and the convolutional squares of the Daubechies wavelet filters.

Page 783
dbaux Limitations The computation of the Daubechies scaling filter requires the extraction of the roots of a polynomial of order . Instability may occur when is too large. See Also dbwavf wfilters References Daubechies, I. (1992), Ten lectures on wavelets, CBMSNSF conference series in applied mathematics, SIAM Ed.

Page 784
dbwavf Purpose 8dbwavf Daubechies wavelet filter Syntax F = dbwavf(W) Description returns the scaling filter associated with Daubechies wavelet F = dbwavf(W) specified by the string where . Possible values for are 1, 2, 3, ..., W = 'dbN' Examples % Set Daubechies wavelet name.

Page 785
ddencmp Purpose 8ddencmp Default values for denoising or compression Syntax [THR,SORH,KEEPAPP,CRIT] = ddencmp(IN1,IN2,X) [THR,SORH,KEEPAPP] = ddencmp(IN1,'wv',X) [THR,SORH,KEEPAPP,CRIT] = ddencmp(IN1,'wp',X) Description is a denoising and compressionoriented function. ddencmp gives default values for all the general procedures related to ddencmp denoising and compression of one or twodimensional signals, using wavelets or wavelet packets.

Page 786
ddencmp % Find default values for wavelets (3 output arguments). % These values can be used for wdencmp with option 'gbl'. % default for denoising: % soft thresholding and approximation coefficients kept % thr = sqrt(2*log(n)) * s % where s is an estimate of level noise % and n is equal to prod(size(x)).

Page 787
ddencmp thr = 4.2911 sorh = keepapp = crit = sure % default for compression. % hard thresholding and approximation coefficients kept % thr = median(abs(detail at level 1)) % default entropy is 'threshold' criterion. [thr,sorh,keepapp,crit] = ddencmp('cmp','wp',x) thr = 0.7003 sorh = keepapp =...

Page 788
depo2ind Purpose 8depo2ind Node depthposition to node index Syntax N = depo2ind(ORD,[D P]) Description is a treemanagement utility. depo2ind For a tree of order computes the indices N = depo2ind(ORD,[D P]) the nodes whose depths and positions are encoded within [D,P] The nodes are numbered from left to right and from top to bottom.

Page 789
depo2ind % List t nodes (Depth_Position). aln_depo = allnodes(t,'deppos') aln_depo = % Switch from Depth_Position to index. aln_ind = depo2ind(ord,aln_depo) aln_ind = See Also ind2depo 878...

Page 790
detcoef Purpose 8detcoef 1D detail coefficients Syntax D = detcoef(C,L,N) D = detcoef(C,L) Description is a onedimensional wavelet analysis function. detcoef extracts the detail coefficients at level from the wavelet D = detcoef(C,L,N) decomposition structure . See for more information on [C,L] wavedec Level...

Page 791
detcoef % Extract detail coefficients at levels % 1, 2 and 3, from wavelet decomposition % structure [c,l]. [cd1,cd2,cd3] = detcoef(c,l,[1 2 3]); % Using some plotting commands, % the following figure is generated. Original signal s 1000 1000 1500 2000 2500 3000...

Page 792
detcoef2 Purpose 8detcoef2 2D detail coefficients Syntax D = detcoef2(O,C,S,N) Description is a twodimensional wavelet analysis function. detcoef2 extracts from the wavelet decomposition structure D = detcoef2(O,C,S,N) the horizontal, vertical, or diagonal detail coefficients for [C,S] O = 'h' , respectively), at level , where must be an integer such that .

Page 793
detcoef2 sizec = size(c) sizec = 65536 val_s = s val_s = % Extract details coefficients at level 2 % in each orientation, from wavelet decomposition % structure [c,s]. [chd2,cvd2,cdd2] = detcoef2('all',c,s,2); sizecd2 = size(chd2) sizecd2 = % Extract details coefficients at level 1 % in each orientation, from wavelet decomposition % structure [c,s].

Page 794
disp Purpose 8disp WPTREE information Syntax disp(T) Description displays the content of the WPTREE object disp(T) Examples % Compute a wavelet packets tree x = rand(1,1000); t = wpdec(x,2,'db2'); disp(t) Wavelet Packet Object Structure ================================= Size of initial data : [1 1000] Order Depth Terminal nodes...

Page 795
displs Purpose 8displs Display lifting scheme Syntax S = displs(LS,FRM) Description returns a string describing the lifting scheme . The S = displs(LS,FRM) format string (see ) builds sprintf is equivalent to displs(LS) DISPLS(LS,'%12.8f') For more information about lifting schemes, see lsinfo Examples % Start from the Haar wavelet and get the...

Page 796
drawtree Purpose 8drawtree Draw wavelet packet decomposition tree (GUI) Syntax drawtree(T) drawtree(T,F) F = drawtree(T) Description draws the wavelet packet tree , and also drawtree(T) F = drawtree(T) returns the figure’s handle. For an existing figure produced by a previous call to the function, drawtree draws the wavelet packet tree...

Page 797
drawtree % % Use command line function to modify t. % = wpjoin(t,2); drawtree(t,fig); 886...

Page 798
drawtree See Also readtree 887...

Page 799
dtree Purpose 8dtree DTREE constructor Syntax T = dtree(ORD,D,X) T = dtree(ORD,D,X,U) [T,NB] = dtree(...) T = dtree('PropName1',PropValue1,'PropName2',PropValue2, ...) Description returns a complete data tree ( ) object of order T = dtree(ORD,D,X) DTREE and depth . The data associated with the tree With you can set a user data field.

Page 800
dtree Examples % Create a data tree. x = [1:10]; t = dtree(3,2,x); t = nodejoin(t,2); See Also ntree wtbo 889...

Page 801
Purpose 8dwt Singlelevel discrete 1D wavelet transform Syntax [cA,cD] = dwt(X,'wname') [cA,cD] = dwt(X,'wname','mode',MODE) [cA,cD] = dwt(X,Lo_D,Hi_D) [cA,cD] = dwt(X,Lo_D,Hi_D,'mode',MODE) Description command performs a singlelevel onedimensional wavelet decomposition with respect to either a particular wavelet ( , see 'wname' for more information) or particular wavelet decomposition filters wfilters ) that you specify.

Page 802
Examples % The current extension mode is zeropadding (see dwtmode). % Construct elementary original onedimensional signal. randn('seed',531316785) s = 2 + kron(ones(1,8),[1 1]) + ... ((1:16).^2)/32 + 0.2*randn(1,16); % Perform singlelevel discrete wavelet transform of s by haar. [ca1,cd1] = dwt(s,'haar'); subplot(311);...

Page 803
% Editing some graphical properties, % the following figure is generated. Original signal Approx. coef. for haar Detail coef. for haar Approx. coef. for db2 Detail coef. for db2 −5 Algorithm Starting from a signal s, two sets of coefficients are computed: approximation coefficients CA , and detail coefficients CD .

Page 804
® MATLAB command prompt. To match the latency of the DWT block, which is implemented using FIR filters, add zeros to the input of the function. The number of zeros you add must be equal to half the filter length.

Page 805
dwt2 Purpose 8dwt2 Singlelevel discrete 2D wavelet transform Syntax [cA,cH,cV,cD] = dwt2(X,'wname') [cA,cH,cV,cD] = dwt2(X,Lo_D,Hi_D) Description command performs a singlelevel twodimensional wavelet dwt2 decomposition with respect to either a particular wavelet ( , see 'wname' for more information) or particular wavelet decomposition filters wfilters ) you specify.

Page 806
dwt2 Remarks When represents an indexed image, then , as well as the output arrays by matrices. When represents a truecolor image, it is an cA,cH,cV,cD by by3 array, where each by matrix represents a red, green, or blue color plane concatenated along the third dimension. For more information on image formats, see the reference image...

Page 807
dwt2 Original image X. One step decomposition 150 200 150 200 Algorithm For images, there exist an algorithm similar to the onedimensional case for twodimensional wavelets and scaling functions obtained from one dimensional ones by tensorial product. This kind of twodimensional DWT leads to a decomposition of approximation coefficients at level j in four components: the approximation at level j + 1, and the details in three orientations (horizontal, vertical, and diagonal).

Page 808
dwt2 TwoDimensional DWT Decomposition step columns rows Lo_D Lo_D columns Hi_D horizontal columns Lo_D rows vertical Hi_D columns Hi_D diagonal Downsample columns: keep the even indexed columns Where Downsample rows: keep the even indexed rows rows Convolve with filter X the rows of the entry columns Convolve with filter X the columns of the entry Initialization...

Page 809
dwt2 References Daubechies, I. (1992), Ten lectures on wavelets, CBMSNSF conference series in applied mathematics. SIAM Ed. Mallat, S. (1989),”A theory for multiresolution signal decomposition: the wavelet representation,” IEEE Pattern Anal. and Machine Intell., vol. 11, no. 7, pp. 674–693. Meyer, Y.

Page 810
dwt3 Purpose 8dwt3 Singlelevel discrete 3D wavelet transform Syntax WT = dwt3(X,'wname') WT = dwt3(X,'wname','mode','ExtM') WT = dwt3(X,W,...) WT = dwt3(X,WF,...) Description performs a singlelevel threedimensional wavelet decomposition using dwt3 either a particular wavelet ( ) or the wavelet decomposition and 'wname' reconstruction filters you specify.

Page 811
dwt3 Examples % Define the original 3D data. X = reshape(1:64,4,4,4) X(:,:,1) = X(:,:,2) = X(:,:,3) = 8100...

Page 812
dwt3 X(:,:,4) = % Perform single level decomposition of X using db1. wt = dwt3(X,'db1') wt = sizeINI: [4 4 4] filters: [1x1 struct] mode: 'sym' dec: {2x2x2 cell} % Decompose X using db2. [LoD,HiD,LoR,HiR] = wfilters('db2'); wt = dwt3(X,{LoD,HiD,LoR,HiR}) wt = sizeINI: [4 4 4] filters: [1x1 struct]...

Page 813
dwt3 WF = wt.filters; % Decompose X using the filters given by WF and % set the extension mode to symmetric. wtBIS = dwt3(X,WF,'mode','sym') wtBIS = sizeINI: [4 4 4] filters: [1x1 struct] mode: 'sym' dec: {2x2x2 cell} See Also dwtmode idwt3 wavedec3...

Page 814
ST = dwtmode('status') current mode. returns in the current mode and no ST = dwtmode('status','nodisp') ® text (status or warning) is displayed in the MATLAB Command Window. sets the DWT extension mode according to the value of dwtmode('mode') 'mode' DWT Extension Mode...

Page 815
In these last two cases, the new default mode saved in the file will DWTMODE.DEF be active as default mode in the next MATLAB session. 8104...

Page 816
dwtmode Examples % If the DWT extension mode global variable does not % exist, default is Symmetrization. clear global dwtmode ****************************************** DWT Extension Mode: Symmetrization ****************************************** % Display current DWT signal extension mode. dwtmode ****************************************** DWT Extension Mode: Symmetrization ****************************************** % Change to Periodization extension mode.

Page 817
dwtmode References Strang, G.; T. Nguyen (1996), Wavelets and filter banks, Wellesley Cambridge Press. 8106...

Page 818
dyaddown Purpose 8dyaddown Dyadic downsampling Syntax Y = dyaddown(X,EVENODD) Y = dyaddown(X) Y = dyaddown(X,EVENODD,'type') Y = dyaddown(X,'type',EVENODD) Description where is a vector, returns a version of that has Y = dyaddown(X,EVENODD) been downsampled by 2. Whether contains the even or oddindexed samples depends on the value of positive integer EVENODD •...

Page 819
dyaddown dse = % or equivalently dse = dyaddown(s,0) dse = dso = dyaddown(s,1) % Downsample elements with odd indices. dso = % For a matrix. s = (1:3)'*(1:4) dec = dyaddown(s,0,'c') % Downsample columns with even indices. dec = der = dyaddown(s,1,'r') % Downsample rows with odd indices.

Page 820
dyadup Purpose 8dyadup Dyadic upsampling Syntax Y = dyadup(X,EVENODD) Y = dyadup(X) Y = dyadup(X,EVENODD,'type') Y = dyadup(X,'type',EVENODD) Description implements a simple zeropadding scheme very useful in the wavelet dyadup reconstruction algorithm. , where is a vector, returns an extended copy of vector Y = dyadup(X,EVENODD) obtained by inserting zeros.

Page 821
dyadup Examples % For a vector. s = 1:5 1 2 3 4 5 dse = dyadup(s) % Upsample elements at odd indices. dse = 0 1 0 2 0 3 0 4 0 5 0 % or equivalently dse = dyadup(s,1) dse = 0 1 0 2 0 3 0 4 0 5 0 dso = dyadup(s,0) % Upsample elements at even indices.

Page 822
dyadup dem = dyadup(s,1,'m') % Upsample rows and columns % at even indices. dem = % Using default values for dyadup and dyaddown, we have: % dyaddown(dyadup(s)) = s. s = 1:5 1 2 3 4 5 uds = dyaddown(dyadup(s)) uds = 1 2 3 4 5 % In general reversed identity is false.

Page 823
entrupd Purpose 8entrupd Entropy update (wavelet packet) Syntax T = entrupd(T,ENT) T = entrupd(T,ENT,PAR) Description is a one or twodimensional wavelet packet utility. entrupd returns for a given wavelet T = entrupd(T,ENT) T = entrupd(T,ENT,PAR) packet tree , the updated tree using the entropy function with the optional parameter (see...

Page 824
fbspwavf Purpose 8fbspwavf Complex frequency Bspline wavelet Syntax [PSI,X] = fbspwavf(LB,UB,N,M,FB,FC) Description returns values of the complex [PSI,X] = fbspwavf(LB,UB,N,M,FB,FC) frequency BSpline wavelet defined by the order parameter is an integer such that 1 ), a bandwidth parameter , and a wavelet center frequency The function is computed using the explicit expression PSI(X) = (FB^0.5)*((sinc(FB*X/M).^M).*exp(2*i*pi*FC*X))

Page 825
fbspwavf % Plot complex Frequency BSpline wavelet. subplot(211) plot(x,real(psi)) title('Complex Frequency BSpline wavelet fbsp20.51') xlabel('Real part'), grid subplot(212) plot(x,imag(psi)) xlabel('Imaginary part'), grid Complex Frequency B−Spline wavelet fbsp2−0.5−1 −0.5 −1 −20 −15 −10 −5 Real part −0.5 −1 −20 −15 −10 −5 Imaginary part See Also...

Page 826
filt2ls Purpose 8filt2ls Transform quadruplet of filters to lifting scheme Syntax LS = filt2ls(LoD,HiD,LoR,HiR) Description returns the lifting scheme associated LS = filt2lsv(LoD,HiD,LoR,HiR) with the four input filters , and that verify the perfect reconstruction condition. Examples [LoD,HiD,LoR,HiR] = wfilters('db2') LoD = 0.1294 0.2241...

Page 827
filt2ls LSref = {... [ 1.73205081] [ 0.06698730 0.43301270] 1.00000000] [1] 1.93185165] 0.51763809] See Also ls2filt lsinfo 8116...

Page 828
gauswavf Purpose 8gauswavf Gaussian wavelet Syntax [PSI,X] = gauswavf(LB,UB,N,P) Description returns values of the th derivative of the [PSI,X] = gauswavf(LB,UB,N,P) Gaussian function on an point regular grid for the interval . Cp is [LB,UB] such that the 2norm of the th derivative of F is equal to 1.

Page 829
gauswavf % Plot Gaussian wavelet of order 8. plot(x,psi), title('Gaussian wavelet of order 8'), grid Gaussian wavelet of order 8 −0.5 −1 −5 See Also waveinfo 8118...

Page 830
Purpose 8get WPTREE contents Syntax [FieldValue1,FieldValue2, ] = get(T,'FieldName1','FieldName2', [FieldValue1,FieldValue2, ] = get(T) Description [FieldValue1,FieldValue2, ] = get(T,'FieldName1','FieldName2', returns the content of the specified fields for the WPTREE object For the fields that are objects or structures, you can get the subfield contents, giving the name of these subfields as values.

Page 831
Or fields of DTREE parent object: 'ntree' NTREE parent object 'allNI' All nodes information Terminal nodes information 'terNI' Or fields of NTREE parent object: WTBO parent object 'wtbo' 'order' Order of the tree 'depth' Depth of the tree Split scheme for nodes 'spsch' 'tn' Array of terminal nodes of the tree...

Page 832
idwt Purpose 8idwt Singlelevel inverse discrete 1D wavelet transform Syntax X = idwt(cA,cD,'wname') X = idwt(cA,cD,Lo_R,Hi_R) X = idwt(cA,cD,'wname',L) X = idwt(cA,cD,Lo_R,Hi_R,L) X = idwt(...,'mode',MODE) Description command performs a singlelevel onedimensional wavelet idwt reconstruction with respect to either a particular wavelet ( , see 'wname' for more information) or particular wavelet reconstruction filters...

Page 833
idwt returns the singlelevel reconstructed detail coefficients X = idwt([],cD,...) vector based on detail coefficients vector is the inverse function of in the sense that the abstract statement idwt would give back dwt(dwt(X,'wname'),'wname') Examples % The current extension mode is zeropadding (see dwtmode). % Construct elementary onedimensional signal s.

Page 834
idwt % Using some plotting commands, % the following figure is generated. Approx. coef. for db2 Detail coef. for db2 −1 Original and reconstructed signals Error norm = 1.435e−12 Algorithm Starting from the approximation and detail coefficients at level j, cA and cD the inverse discrete wavelet transform reconstructs cA , inverting the...

Page 835
idwt OneDimensional IDWT Reconstruction step lowpass upsample Lo_R wkeep Hi_R level j1 upsample level j highpass Where Insert zeros at oddindexed elements Convolve with filter Take the central part of with the wkeep convenient length See Also dwtmode upwlev References Daubechies, I.

Page 836
idwt2 Purpose 8idwt2 Singlelevel inverse discrete 2D wavelet transform Syntax X = idwt2(cA,cH,cV,cD,'wname') X = idwt2(cA,cH,cV,cD,Lo_R,Hi_R) X = idwt2(cA,cH,cV,cD,'wname',S) X = idwt2(cA,cH,cV,cD,Lo_R,Hi_R,S) X = idwt2(...,'mode',MODE) Description command performs a singlelevel twodimensional wavelet idwt2 reconstruction with respect to either a particular wavelet ( , see 'wname' for more information) or particular wavelet reconstruction filters...

Page 837
idwt2 returns the singlelevel reconstructed X = idwt2(cA,[],[],[],...) approximation coefficients matrix based on approximation coefficients matrix returns the singlelevel reconstructed detail X = idwt2([],cH,[],[],...) coefficients matrix based on horizontal detail coefficients matrix The same result holds for X = idwt2([],[],cV,[],...) , based on vertical and diagonal details.

Page 838
idwt2 3.4176e10 Algorithm TwoDimensional IDWT Reconstruction step columns Lo_R rows Lo_R columns Hi_R horizontal wkeep columns Lo_R rows vertical Hi_R columns Hi_R diagonal Upsample columns: insert zeros at oddindexed columns. Where Upsample rows: insert zeros at oddindexed rows. rows Convolve with filter X the rows of the entry. columns Convolve with filter X the columns of the entry.

Page 839
idwt3 Purpose 8idwt3 Singlelevel inverse discrete 3D wavelet transform Syntax X = idwt3(WT) C = idwt3(WT,TYPE) Description command performs a singlelevel threedimensional wavelet idwt3 reconstruction starting from a singlelevel threedimensional wavelet decomposition. computes the singlelevel reconstructed 3D array , based on X = idwt3(WT) the threedimensional wavelet decomposition stored in the structure.

Page 840
idwt3 Examples % Define original 3D data. = reshape(1:64,4,4,4); % Decompose X using db1. wt = dwt3(X,'db1'); % Reconstruct X from coefficients. XR = idwt3(wt); % Compute reconstructed approximation, i.e. the % lowpass component. = idwt3(wt,'aaa'); % Compute the sum of all the components different % from the lowpass component.

Page 841
ilwt Purpose 8ilwt Inverse 1D lifting wavelet transform Syntax X = ilwt(AD_In_Place,W) X = ilwt(CA,CD,W) X = ilwt(AD_In_Place,W,LEVEL) X = ilwt(CA,CD,W,LEVEL) X = ilwt(AD_In_Place,W,LEVEL,'typeDEC',typeDEC) X = ilwt(CA,CD,W,LEVEL,'typeDEC',typeDEC) Description performs a 1D lifting wavelet reconstruction with respect to a particular ilwt lifted wavelet that you specify.

Page 842
ilwt % Perform LWT at level 1 of a simple signal. x = 1:8; [cA,cD] = lwt(x,lsnew); % Perform integer LWT of the same signal. lshaarInt = liftwave('haar','int2int'); lsnewInt = addlift(lshaarInt,els); [cAint,cDint] = lwt(x,lsnewInt); % Invert the two transforms. xRec = ilwt(cA,cD,lsnew); err = max(max(abs(xxRec))) err = 4.4409e016...

Page 843
ilwt2 Purpose 8ilwt2 Inverse 2D lifting wavelet transform Syntax X = ilwt2(AD_In_Place,W) X = ilwt2(CA,CH,CV,CD,W) X = ilwt2(AD_In_Place,W,LEVEL) X = ilwt2(CA,CH,CV,CD,W,LEVEL) X = ilwt2(AD_In_Place,W,LEVEL,'typeDEC',typeDEC) X = ilwt2(CA,CH,CV,CD,W,LEVEL,'typeDEC',typeDEC) Description performs a 2D lifting wavelet reconstruction with respect to a particular ilwt2 lifted wavelet that you specify.

Page 844
ilwt2 % corresponding lifting scheme. lshaar = liftwave('haar'); % Add a primal ELS to the lifting scheme. els = {'p',[0.125 0.125],0}; lsnew = addlift(lshaar,els); % Perform LWT at level 1 of a simple image. x = reshape(1:16,4,4); [cA,cH,cV,cD] = lwt2(x,lsnew); % Perform integer LWT of the same image.

Page 845
ind2depo Purpose 8ind2depo Node index to node depthposition Syntax [D,P] = ind2depo(ORD,N) Description is a treemanagement utility. ind2depo For a tree of order computes the depths [D,P] = ind2depo(ORD,N) the positions (at these depths ) for the nodes with indices The nodes are numbered from left to right and from top to bottom.

Page 846
ind2depo % List t nodes (index). aln_ind = allnodes(t) aln_ind = % Switch from index to Depth_Position. [depth,pos] = ind2depo(ord,aln_ind); aln_depo = [depth,pos] aln_depo = See Also depo2ind 8135...

Page 847
indwt Purpose 8indwt Inverse nondecimated 1D wavelet transform Syntax C = indwt(W,TYPE,N) X = indwt(W), X = indwt(W,'a',0) X = indwt(W,'ca',0) Description performs a multilevel nondecimated 1D wavelet reconstruction starting indwt from a multilevel nondecimated 1D wavelet decomposition. You can also use to extract coefficients from a multilevel nondecimated 1D wavelet indwt decomposition.

Page 848
indwt Examples % Load the signal load noissin; x = noissin; % Decompose X at level 3 using db1. W1 = ndwt(x,3,'db1'); % Reconstruct the original signal from the % decomposition W1 structure. a0 = indwt(W1,'a',0); % Check for perfect reconstruction. err = max(abs(x(:)a0(:))) err = 8.8818e016...

Page 849
indwt2 Purpose 8indwt2 Inverse nondecimated 2D wavelet transform Syntax C = indwt2(W,TYPE,N) X = indwt2(W), X = indwt2(W,'a',0) X = indwt2(W,'ca',0) Description performs a multilevel nondecimated 2D wavelet reconstruction indwt2 starting from a multilevel nondecimated 2D wavelet decomposition. You can also use to extract coefficients from a multilevel nondecimated 2D indwt2...

Page 850
indwt2 Examples % Load original image. load noiswom % Decompose X at level 3 using db1. W = ndwt2(X,3,'db1'); % Reconstruct approximations at levels 1 to 3. A = cell(1,3); for k=1:3, A{k} = indwt2(W,'aa',k); end % Plot original image at the top and approximations % at the bottom.

Page 851
indwt2 % Compute reconstructed approximation and detail at level 1. A1 = indwt2(W,'aa',1); D1 = indwt2(W,'d',1); % Check that X = A1 + D1. E1 = XA1D1; err1 = max(abs(E1(:))) err1 = 2.6645e013 % Compute reconstructed approximation and detail at level 2. A2 = indwt2(W,'aa',2);...

Page 852
indwt2 err2 = 2.5668e013 See Also dwtmode ndwt2 waveinfo 8141...

Page 853
intwave Purpose 8intwave Integrate wavelet function psi ( Syntax [INTEG,XVAL] = intwave('wname',PREC) [INTEG,XVAL] = intwave('wname',PREC,PFLAG) [INTEG,XVAL] = intwave('wname') Description computes the integral, , of the [INTEG,XVAL] = intwave('wname',PREC) INTEG wavelet function (from values): for x in – XVAL XVAL –...

Page 854
intwave Examples % Set wavelet name. wname = 'db4'; % Plot wavelet function. [phi,psi,xval] = wavefun(wname,7); subplot(211); plot(xval,psi); title('Wavelet'); % Compute and plot wavelet integrals approximations % on a dyadic grid. [integ,xval] = intwave(wname,7); subplot(212); plot(xval,integ); title(['Wavelet integrals over [Inf x] ' ... 'for each value of xval']);...

Page 855
isnode Purpose 8isnode Existing node test Syntax R = isnode(T,N) Description is a treemanagement utility. isnode returns 1’s for nodes , which exist in the tree , and 0’s for R = isnode(T,N) others. can be a column vector containing the indices of nodes or a matrix, that contains the depths and positions of nodes.

Page 856
isnode % Change Node Label from Depth_Position to Index % (see the plot function). (13) (14) % Check node index. isnode(t,[1;3;25]) ans = % Check node Depth_Position. isnode(t,[1 0;3 1;4 5]) ans = See Also istnode wtreemgr 8145...

Page 857
istnode Purpose 8istnode Terminal nodes indices test Syntax R = istnode(T,N) Description is a treemanagement utility. istnode returns ranks (in left to right terminal nodes ordering) for R = istnode(T,N) terminal nodes belonging to the tree , and 0’s for others. can be a column vector containing the indices of nodes or a matrix that contains the depths and positions of nodes.

Page 858
istnode (13) (14) % Find terminal nodes and return indices for terminal % nodes in the tree. istnode(t,[14]) ans = istnode(t,[15]) ans = istnode(t,[1;7;14;25]) ans = istnode(t,[1 0;3 1;4 5]) ans = See Also isnode, wtreemgr 8147...

Page 859
iswt Purpose 8iswt Inverse discrete stationary wavelet transform 1D Syntax X = iswt(SWC,'wname') X = iswt(SWA,SWD,'wname') X = iswt(SWC,Lo_R,Hi_R) X = iswt(SWA,SWD,Lo_R,Hi_R) Description performs a multilevel 1D stationary wavelet reconstruction using either iswt a specific orthogonal wavelet ( , see for more information) or 'wname' wfilters...

Page 860
iswt % Check for perfect reconstruction. err = norm(sa0) err = 9.6566e014 errbis = norm(sa0bis) errbis = 9.6566e014 Algorithm See the section “Stationary Wavelet Transform” in Chapter 6, “Advanced Concepts”, of the User’s Guide. See Also idwt waverec References Nason, G.P.; B.W. Silverman (1995), “The stationary wavelet transform and some statistical applications,”...

Page 861
iswt2 Purpose 8iswt2 Inverse discrete stationary wavelet transform 2D Syntax X = iswt2(SWC,'wname') X = iswt2(A,H,V,D,'wname') X = iswt2(SWC,Lo_R,Hi_R) X = iswt2(A,H,V,D,Lo_R,Hi_R) Description performs a multilevel 2D stationary wavelet reconstruction using either iswt2 a specific orthogonal wavelet ( for more information) or 'wname' wfilters specific reconstruction filters (...

Page 862
iswt2 % Reconstruct s from the stationary wavelet % decomposition structure swc. a0 = iswt2(swc,'sym4'); % Second usage. a0 = iswt2(ca,chd,cvd,cdd,'sym4'); 8151...

Page 863
iswt2 % Check for perfect reconstruction. err = max(max(abs(Xa0))) ans = 2.3482e010 errbis = max(max(abs(Xa0bis))) ans = 2.3482e010 Algorithm See the section “Stationary Wavelet Transform” in Chapter 6, “Advanced Concepts”, of the User’s Guide. See Also idwt2 swt2 waverec2 References Nason, G.P.;...

Page 864
laurmat Purpose 8laurmat Laurent matrices constructor Syntax M = laurmat(V) Description returns the Laurent matrix object associated with which M = laurmat(V) can be a cell array (at most two dimensional) of Laurent polynomials (see ) or an ordinary matrix. laurpoly Examples % Define Laurent matrices.

Page 865
laurmat References Strang, G.; T. Nguyen (1996), Wavelets and filter banks, WellesleyCambridge Press. Sweldens, W. (1998), “The Lifting Scheme: a Construction of Second Generation of Wavelets,” SIAM J. Math. Anal., 29 (2), pp. 511–546. See Also laurpoly 8154...

Page 866
laurpoly Purpose 8laurpoly Laurent polynomials constructor Syntax P = laurpoly(C,d) P = laurpoly(C,'dmin',d) P = laurpoly(C,'dmax',d) Description returns a Laurent polynomial object. is a vector whose P = laurpoly(C,d) elements are the coefficients of the polynomial is the highest degree of the monomials of is the length of the vector represents the following Laurent polynomial:...

Page 867
laurpoly R = Z^1  Z^1 R(z) = + z^(+1)  z^(1) References Strang, G.; T. Nguyen (1996), Wavelets and filter banks, WellesleyCambridge Press. Sweldens, W. (1998), “The Lifting Scheme: a Construction of Second Generation of Wavelets,” SIAM J. Math. Anal., 29 (2), pp. 511–546. See Also laurmat 8156...

Page 868
leaves Purpose 8leaves Determine terminal nodes Syntax N = leaves(T) N = leaves(T,'dp') [N,K] = leaves(T,'sort') [N,K] = leaves(T,'sortdp') Description returns the indices of terminal nodes of the tree where is a N = leaves(T) column vector. The nodes are ordered from left to right as in tree returns sorted indices.

Page 869
leaves % List terminal nodes (index). tnodes_ind = leaves(t) tnodes_ind = % List terminal nodes (sorted on index). [tnodes_ind,Ind] = leaves(t,'sort') tnodes_ind = Ind = % List terminal nodes (Depth_Position). tnodes_depo = leaves(t,'dp') tnodes_depo = % List terminal nodes (sorted on Depth_Position). [tnodes_depo,Ind] = leaves(t,'sortdp') 8158...

Page 870
leaves tnodes_depo = Ind = See Also tnodes noleaves 8159...

Page 871
liftfilt Purpose 8liftfilt Apply elementary lifting steps on quadruplet of filters Syntax [LoDN,HiDN,LoRN,HiRN] = liftfilt(LoD,HiD,LoR,HiR,ELS) [LoDN,HiDN,LoRN,HiRN] = liftfilt(LoD,HiD,LoR,HiR,ELS,TYPE,VALUE) Description returns the four [LoDN,HiDN,LoRN,HiRN] = liftfilt(LoD,HiD,LoR,HiR,ELS) filters , and obtained by an elementary lifting step ( LoDN HiDN LoRN HiRN starting from the four filters , and .

Page 872
liftfilt twoels(2) = struct('type','p','value',... laurpoly([0.125 0.125],1)); [LoDN,HiDN,LoRN,HiRN] = liftfilt(LoD,HiD,LoR,HiR,twoels); % The biorthogonal wavelet bior1.3 is obtained up to % an unsignificant sign. [LoDB,HiDB,LoRB,HiRB] = wfilters('bior1.3'); samewavelet = ... isequal([LoDB,HiDB,LoRB,HiRB],[LoDN,HiDN,LoRN,HiRN]) samewavelet = See Also laurpoly 8161...

Page 873
liftwave Purpose 8liftwave Lifting schemes Syntax LS = liftwave(WNAME) LS = liftwave(WNAME,'Int2Int') Description returns the lifting scheme associated with the wavelet LS = liftwave(WNAME) specified by is a structure, not an integer, and used by WNAME ilwt , etc. lwt2 performs an integer to integer wavelet LS = liftwave(WNAME,'Int2Int') transform.

Page 874
liftwave WNAME Values Comments CohenDaubechiesFeauveau wavelets same as 'cdfX.Y' 'cdf1.1','cdf1.3','cdf1.5' except for 'biorX.Y' 'cdf3.1','cdf3.3','cdf3.5' bior4.4 'cdf5.1','cdf5.3','cdf5.5' bior5.5 'cdf2.2','cdf2.4','cdf2.6' 'cdf4.2','cdf4.4','cdf4.6' 'cdf6.2','cdf6.4','cdf6.6' 'biorX.Y' waveinfo 'rbioX.Y' Reverse of 'biorX.Y' waveinfo Same as 'bs3' 'cdf4.2' Reverse of 'rbs3' 'bs3' Same as '9.7' 'bior4.4' Reverse of 'r9.7' '9.7' For more information about lifting schemes, see...

Page 875
localmax Purpose 8localmax Compute local maxima positions Syntax [Y,I] = localmax(X,ROWINIT,REGFLAG) [Y,I] = localmax(X,ROWINIT) [Y,I] = localmax(X) Description For a matrix computes and chains the local maxima along the localmax rows. The default values are ROWINIT = size(X,1) REGFLAG = true First, computes the local maxima positions on each row of .

Page 876
ls2filt Purpose 8ls2filt Transform lifting scheme to quadruplet of filters Syntax [LoD,HiD,LoR,HiR] = ls2filt(LS) Description returns the four filters , and [LoD,HiD,LoR,HiR] = ls2filt(LS) associated with the lifting scheme Examples % Start from the db2 wavelet and get the % corresponding lifting scheme. LS = liftwave('db2') LS = 1.7321]...

Page 877
ls2filt 0.4830 0.8365 0.2241 0.1294 LoR = 0.4830 0.8365 0.2241 0.1294 HiR = 0.1294 0.2241 0.8365 0.4830 % Get the db2 filters using wfilters. % You can check the equality. [LoDref,HiDref,LoRref,HiRref] = wfilters('db2') LoDref = 0.1294 0.2241 0.8365 0.4830 HiDref = 0.4830 0.8365 0.2241...

Page 878
lsinfo Purpose 8lsinfo Lifting schemes information Syntax lsinfo Description displays the following information about lifting schemes. A lifting lsinfo scheme is a x 3 cell array. The N1 first rows of the array are elementary lifting steps ( ). The last row gives the normalization of Each has this format: {type, coefficients, max_degree}...

Page 879
lsinfo See Also displs laurpoly 8168...

Page 880
Purpose 8lwt 1D lifting wavelet transform Syntax [CA,CD] = lwt(X,W) X_InPlace = lwt(X,W) lwt(X,W,LEVEL) X_InPlace = lwt(X,W,LEVEL,'typeDEC',typeDEC) [CA,CD] = lwt(X,W,LEVEL,'typeDEC',typeDEC) Description performs a 1D lifting wavelet decomposition with respect to a particular lifted wavelet that you specify. computes the approximation coefficients vector [CA,CD] = lwt(X,W) detail coefficients vector , obtained by a lifting wavelet decomposition, of the...

Page 881
[cA,cD] = lwt(x,lsnew) cA = 1.9445 4.9497 7.7782 10.6066 cD = 0.7071 0.7071 0.7071 0.7071 % Perform integer LWT of the same signal. lshaarInt = liftwave('haar','int2int'); lsnewInt = addlift(lshaarInt,els); [cAint,cDint] = lwt(x,lsnewInt) cAint = cDint = Algorithm This function uses the polyphase algorithm. reduces to with zeropadding extension mode and without extracoefficients.

Page 882
lwt2 Purpose 8lwt2 2D lifting wavelet transform Syntax [CA,CH,CV,CD] = lwt2(X,W) X_InPlace = lwt2(X,LS) lwt2(X,W,LEVEL) X_InPlace = lwt2(X,W,LEVEL,'typeDEC',typeDEC) [CA,CD] = lwt2(X,W,LEVEL,'typeDEC',typeDEC) Description performs a 2D lifting wavelet decomposition with respect to a particular lwt2 lifted wavelet that you specify. computes the approximation coefficients matrix [CA,CH,CV,CD] = lwt2(X,W) and detail coefficients matrices , and...

Page 883
lwt2 Examples % Start from the Haar wavelet and get the % corresponding lifting scheme. lshaar = liftwave('haar'); % Add a primal ELS to the lifting scheme. els = {'p',[0.125 0.125],0}; lsnew = addlift(lshaar,els); % Perform LWT at level 1 of a simple image. x = reshape(1:16,4,4);...

Page 884
lwt2 cAint = cHint = cVint = cDint = Algorithm This function implements the polyphase algorithm. reduces to with zeropadding extension mode and without extracoefficients. See Also ilwt2 References Strang, G.; T. Nguyen (1996), Wavelets and filter banks, WellesleyCambridge Press. Sweldens, W.

Page 885
lwtcoef Purpose 8lwtcoef Extract or reconstruct 1D LWT wavelet coefficients Syntax Y = lwtcoef(TYPE,XDEC,LS,LEVEL,LEVEXT) Y = lwtcoef(TYPE,XDEC,W,LEVEL,LEVEXT) Description returns the coefficients or the Y = lwtcoef(TYPE,XDEC,LS,LEVEL,LEVEXT) reconstructed coefficients of level , extracted from , the LWT LEVEXT XDEC decomposition at level obtained with the lifting scheme LEVEL The valid values for...

Page 886
lwtcoef % Extract approximation coefficients of level 1. ca1 = lwtcoef('ca',xDec,lsnew,2,1) ca1 = 1.9445 4.9497 7.7782 10.6066 % Reconstruct approximations and details. a1 = lwtcoef('a',xDec,lsnew,2,1) a1 = 1.3750 1.3750 3.5000 3.5000 5.5000 5.5000 7.5000 7.5000 a2 = lwtcoef('a',xDec,lsnew,2,2) a2 = 2.1719 2.1719 2.1719...

Page 887
lwtcoef err = 9.9920e016 See Also ilwt 8176...

Page 888
lwtcoef2 Purpose 8lwtcoef2 Extract or reconstruct 2D LWT wavelet coefficients Syntax Y = lwtcoef2(TYPE,XDEC,LS,LEVEL,LEVEXT) Y = lwtcoef2(TYPE,XDEC,W,LEVEL,LEVEXT) Description returns the coefficients or the Y = lwtcoef2(TYPE,XDEC,LS,LEVEL,LEVEXT) reconstructed coefficients of level , extracted from , the LWT LEVEXT XDEC decomposition at level obtained with the lifting scheme LEVEL The valid values for...

Page 889
lwtcoef2 % Add a primal ELS to the lifting scheme. els = {'p',[0.125 0.125],0}; lsnew = addlift(lshaar,els); % Perform LWT at level 2 of a simple image. x = reshape(1:16,4,4); xDec = lwt2(x,lsnew,2) xDec = 27.4375 4.0000 17.0000 4.0000 1.0000 1.0000 4.2500 4.0000...

Page 890
lwtcoef2 6.8594 6.8594 6.8594 6.8594 6.8594 6.8594 6.8594 6.8594 h1 = lwtcoef2('h',xDec,lsnew,2,1) h1 = 0.3750 0.3750 0.3750 0.3750 0.6250 0.6250 0.6250 0.6250 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 v1 = lwtcoef2('v',xDec,lsnew,2,1) v1 = 1.5000 2.5000 2.0000 2.0000 1.5000 2.5000 2.0000 2.0000...

Page 891
lwtcoef2 v2 = 3.1875 3.1875 5.3125 5.3125 3.1875 3.1875 5.3125 5.3125 3.1875 3.1875 5.3125 5.3125 3.1875 3.1875 5.3125 5.3125 d2 = lwtcoef2('d',xDec,lsnew,2,2) d2 = 1.0e015 * 0.2498 0.2498 0.4163 0.4163 0.2498 0.2498 0.4163 0.4163 0.4163 0.4163 0.6939 0.6939 0.4163 0.4163 0.6939 0.6939 % Check perfect reconstruction.

Page 892
mdwtcluster Purpose 8mdwtcluster Multisignals 1D clustering Syntax S = mdwtcluster(X) S = mdwtcluster(X,'PropName1',PropVal1,'PropName2',PropVal2,...) Description constructs clusters from a hierarchical cluster tree. The S = mdwtcluster(X) input matrix is decomposed in row direction using the DWT function with the wavelet and the maximum allowed level. haar S = mdwtcluster(X,'PropName1',PropVal1,'PropName2',PropVal2,...) allows you to modify some properties.

Page 893
mdwtcluster 'maxclust' Number of clusters. Default value is 6. The input variable can be a vector. 'lst2clu' Cell array that contains the list of data to classify. is the level of decomposition, the allowed name values for the cells are: •...

Page 894
mdwtcluster % Compute the structure resulting from multisignal clustering S = mdwtcluster(signals,'maxclust',4,'lst2clu',lst2clu) IdxCLU: [70x4 double] Incons: [69x4 double] Corr: [0.7920 0.7926 0.7947 0.7631] % Retrieve indices of clusters IdxCLU = S.IdxCLU; % Plot the first cluster plot(signals(IdxCLU(:,1)==1,:)','r'); hold on; % Plot the third clustering plot(signals(IdxCLU(:,1)==3,:)','b') % Check the equality of partitions equalPART = isequal(IdxCLU(:,1),IdxCLU(:,3))

Page 895
mdwtcluster equalPART = % So we can see that we obtain the same partitions using % coefficents of approximation at level 3 instead of original % signals. Much less information is then used. See Also mdwtdec wavedec 8184...

Page 896
mdwtdec Purpose 8mdwtdec Multisignal 1D wavelet decomposition Syntax DEC = mdwtdec(DIRDEC,X,LEV,WNAME) DEC = mdwtdec(DIRDEC,X,LEV,LoD,HiD,LoR,HiR) DEC = mdwtdec(...,'mode',EXTMODE) Description returns the wavelet decomposition at DEC = mdwtdec(DIRDEC,X,LEV,WNAME) level of each row (if ) or each column (if ) of DIRDEC = 'r' DIRDEC = 'c' matrix , using the wavelet...

Page 897
mdwtdec dec = dirDec: 'r' level: 2 wname: 'db2' dwtFilters: [1x1 struct] dwtEXTM: 'sym' dwtShift: 0 dataSize: [192 96] ca: [192x26 double] cd: {[192x49 double] [192x26 double]} % Compute the associated filters of db2 wavelet. [LoD,HiD,LoR,HiR] = wfilters('db2'); % Perform a decomposition at level 2 using filters. decBIS = mdwtdec('r',X,2,LoD,HiD,LoR,HiR) decBIS = dirDec: 'r'...

Page 898
mdwtrec Purpose 8mdwtrec Multisignal 1D wavelet reconstruction Syntax X = mdwtrec(DEC) X = mdwtrec(DEC,IDXSIG) Y = mdwtrec(DEC,TYPE,LEV) A = mdwtrec(DEC,'a') A = mdwtrec(DEC,'a',LEVDEC) D = mdwtrec(DEC,'d') CA = mdwtrec(DEC,'ca') CA = mdwtrec(DEC,'ca',LEVDEC) CD = mdwtrec(DEC,'cd',MODE) CFS = mdwtrec(DEC,'cfs',MODE) Y = mdwtrec(...,IDXSIG) Description returns the original matrix of signals, starting from the X = mdwtrec(DEC)

Page 899
mdwtrec returns a matrix containing all the detail CD = mdwtrec(DEC,'cd',MODE) coefficients. returns a matrix containing all the CFS = mdwtrec(DEC,'cfs',MODE) coefficients. the coefficients are concatened from level MODE = 'descend' LEVDEC level 1 and concatenates from level 1 to level ).

Page 900
mdwtrec errREC = 6.8390e014 References Daubechies, I., Ten lectures on wavelets, CBMSNSF conference series in applied mathematics. SIAM Ed., 1992. Mallat, S., “A theory for multiresolution signal decomposition: the wavelet representation,” IEEE Pattern Anal. and Machine Intell., vol. 11, no. 7, 1989, pp. 674–693. Meyer, Y., Ondelettes et opérateurs, Tome 1, Hermann Ed.

Page 901
mexihat Purpose 8mexihat Mexican hat wavelet Syntax [PSI,X] = mexihat(LB,UB,N) Description returns values of the Mexican hat wavelet on an [PSI,X] = mexihat(LB,UB,N) point regular grid, , in the interval [LB,UB] Output arguments are the wavelet function computed on the grid This wavelet has [5 5] as effective support.

Page 902
mexihat Mexican hat wavelet −0.2 −0.4 −5 See Also waveinfo 8191...

Page 903
meyer Purpose 8meyer Meyer wavelet Syntax [PHI,PSI,T] = meyer(LB,UB,N) [PHI,T] = meyer(LB,UB,N,'phi') [PSI,T] = meyer(LB,UB,N,'psi') Description returns Meyer scaling and wavelet functions [PHI,PSI,T] = meyer(LB,UB,N) evaluated on an point regular grid in the interval [LB,UB] must be a power of two. Output arguments are the scaling function and the wavelet function computed on the grid...

Page 904
meyer • Scaling function ˆ –  ˆ –      – ˆ  By changing the auxiliary function (see for more information), you meyeraux get a family of different wavelets. For the required properties of the auxiliary function , see “References”...

Page 905
meyer ˆ Algorithm Starting from an explicit form of the Fourier transform of , computes meyer ˆ the values of on a regular grid, and then the values of are computed using , the inverse nonstandard discrete FFT. instdfft The procedure for is along the same lines.

Page 906
meyeraux Purpose 8meyeraux Meyer wavelet auxiliary function Syntax Y = meyeraux(X) Description returns values of the auxiliary function used for Meyer Y = meyeraux(X) wavelet generation evaluated at the elements of the vector or matrix The function is – – See Also meyer 8195...

Page 907
morlet Purpose 8morlet Morlet wavelet Syntax [PSI,X] = morlet(LB,UB,N) Description returns values of the Morlet wavelet on an point [PSI,X] = morlet(LB,UB,N) regular grid in the interval [LB,UB] Output arguments are the wavelet function computed on the grid , and the grid This wavelet has [4 4] as effective support.

Page 908
mswcmp Purpose 8mswcmp Multisignal 1D compression using wavelets Syntax [XC,DECCMP,THRESH] = mswcmp('cmp',DEC,METH) [XC,DECCMP,THRESH] = mswcmp('cmp',DEC,METH,PARAM) [XC,THRESH] = mswcmp('cmpsig',...) [DECCMP,THRESH] = mswcmp('cmpdec',...) THRESH = mswcmp('thr',...) [...] = mswcmp(OPTION,DIRDEC,X,WNAME,LEV,METH) [...] = mswcmp(OPTION,DIRDEC,X,WNAME,LEV,METH,PARAM) [...] = mswcmp(...,S_OR_H) [...] = mswcmp(...,S_OR_H,KEEPAPP) [...] = mswcmp(...,S_OR_H,KEEPAPP,IDXSIG) Description computes thresholds and, depending on the selected option, performs mswcmp compression of 1D signals using wavelets.

Page 909
mswcmp is a sparsity parameter, and it should be such that: . For PARAM PARAM scarce method no control is done. Energy ratio 'L2_perf' 'N0_perf' Zero coefficients ratio is a real number which represents the required performance: PARAM PARAM Global threshold 'glb_thr' is a real positive number.

Page 910
mswcmp [...] = mswcmp(...,S_OR_H) [...] = mswcmp(...,S_OR_H,KEEPAPP) Three more optional inputs [...] = mswcmp(...,S_OR_H,KEEPAPP,IDXSIG) may be used: • stands for soft or hard thresholding (see S_OR_H ('s' or 'h') mswthresh for more details). Default is • indicates whether to keep approximation KEEPAPP (true or false) coefficients ( ) or not (...

Page 911
mswcmp References Birgé L.; P. Massart (1997), “From Model Selection to Adaptive Estimation,” in D. Pollard (ed), Festchrift for L. Le Cam, Springer, pp. 55–88. DeVore, R.A.; B. Jawerth, B.J. Lucier (1992), “Image Compression Through Wavelet Transform Coding,” IEEE Trans. on Inf. Theory, vol. 38, No 2, pp.

Page 912
mswcmpscr Purpose 8mswcmpscr Multisignal 1D wavelet compression scores Syntax [THR,L2SCR,NOSCR,IDXSORT] = mswcmpscr(DEC) [THR,L2SCR,NOSCR,IDXSORT] = mswcmpscr(DEC,S_OR_H,KEEPAPP,IDXSIG) Description computes four matrices: [THR,L2SCR,NOSCR,IDXSORT] = mswcmpscr(DEC) thresholds , compression scores and indices . The L2SCR NOSCR, IDXSORT decomposition corresponds to a matrix of wavelet coefficients obtained by concatenation of detail and (optionally) approximation coefficients, where CFS = [cd{DEC.level}, ...

Page 913
mswcmpscr Three more optional inputs may be used: [...] = mswcmpscr(...,S_OR_H,KEEPAPP,IDXSIG) • stands for soft or hard thresholding (see S_OR_H ('s' or 'h') mswthresh more details). • indicates whether to keep approximation KEEPAPP (true or false) coefficients ( ) or not ( true false •...

Page 914
mswcmptp Purpose 8mswcmptp Multisignal 1D compression thresholds and performances Syntax [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH) [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH,PARAM) [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(...,S_OR_H) [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(...,S_OR_H,KEEPAPP) [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(...,S_OR_H,KEEPAPP,IDXSIG) Description [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH) computes the [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH,PARAM) vectors obtained after a compression using the THR_VAL L2_Perf N0_Perf...

Page 915
mswcmptp dec = mdwtdec('r',X,2,'db2'); % Compute compression thresholds and exact performances % obtained after a compression using the method 'N0_perf' and % requiring a percentage of zeros near 95% for the wavelet % coefficients. [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(dec,'N0_perf',95); References Daubechies, I. (1992), Ten lectures on wavelets, CBMSNSF conference series in applied mathematics.

Page 916
mswden Purpose 8mswden Multisignal 1D denoising using wavelets Syntax [XD,DECDEN,THRESH] = mswden('den',DEC,METH) [XD,DECDEN,THRESH] = mswden('den',DEC,METH,PARAM) [XD,THRESH] = mswden('densig',...) [DECDEN,THRESH] = mswden('dendec',...) THRESH = mswden('thr',...) [...] = mswden(OPTION,DIRDEC,X,WNAME,LEV,METH,PARAM) [...] = mswden(...,S_OR_H) [...] = mswden(...,S_OR_H,KEEPAPP) [...] = mswden(...,S_OR_H,KEEPAPP,IDXSIG) Description computes thresholds and, depending on the selected option, performs mswden denoising of 1D signals using wavelets.

Page 917
mswden Penalization methods 'penal' Penal 'penalhi' Penal high, PARAM Penal medium, 'penalme' PARAM 'penallo' Penal low, PARAM is a sparsity parameter, and it should be such that: . For PARAM PARAM method, no control is done. penal Manual method 'man_thr' Manual method is an by...

Page 918
mswden You can use three more optional inputs: [...] = mswden(...,S_OR_H) [...] = mswden(...,S_OR_H,KEEPAPP) [...] = mswden(...,S_OR_H,KEEPAPP,IDXSIG) • stands for soft or hard thresholding (see S_OR_H ('s' or 'h') mswthresh for more details). • indicates whether to keep approximation KEEPAPP (true or false) coefficients ( ) or not ( true...

Page 919
mswden References Birgé, L.; P. Massart (1997), “From model selection to adaptive estimation,” in D. Pollard (ed), Festchrift for L. Le Cam, Springer, pp. 55–88. DeVore, R.A.; B. Jawerth, B.J. Lucier (1992), “Image compression through wavelet transform coding,” IEEE Trans. on Inf. Theory, vol. 38, No 2, pp.

Page 920
ndwt Purpose 8ndwt Nondecimated 1D wavelet transform Syntax WT = ndwt(X,N,'wname') WT = ndwt(X,N,'wname','mode','ExtM') WT = ndwt(X,N,WF,...) Description performs a multilevel 1D nondecimated wavelet decomposition using ndwt either a particular wavelet ( or the wavelet filters you specify. The 'wname') decomposition also uses the specified DWT extension mode (see dwtmode returns a structure which contains the...

Page 921
ndwt Instead of a wavelet you can specify four filters (two for decomposition and two for reconstruction). specifies four filters (two for decomposition and two WT = ndwt(X,N,WF,...) for reconstruction) instead of a wavelet. is a 1 x 4 cell array or a structure with the four fields {LoD,HiD,LoR,HiR} 'LoD'...

Page 922
ndwt2 Purpose 8ndwt2 Nondecimated 2D wavelet transform Syntax WT = ndwt2(X,N,'wname') WT = ndwt2(X,N,'wname','mode','ExtM') WT = ndwt2(X,W,...) WT = ndwt2(X,WF,...) Description performs a multilevel 2D nondecimated wavelet decomposition using a ndwt2 particular wavelet ( ) or the wavelet filters you specify. The 'wname' decomposition also uses the specified DWT extension mode (see dwtmode...

Page 923
ndwt2 Instead of one or two wavelets, you may specify four filters (two for decomposition and two for reconstruction) or 2 x 4 filters (one quadruplet per direction): specifies four filters (two for decomposition and two for WT = ndwt2(X,WF,...) reconstruction) or 2 x 4 filters (one quadruplet per direction).

Page 924
ndwt2 % Decompose X at level 3 using db1 for rows, and db2 for % columns, using symmetric extension mode. W3 = ndwt2(X,3,{'db1','db2'},'mode','sym') W3 = sizeINI: [96 96] level: 3 filters: [1x1 struct] mode: 'sym' dec: {10x1 cell} sizes: [4x2 double] WF = W3.filters WF = LoD: {[0.7071 0.7071]...

Page 925
mswthresh Purpose 8mswthresh Perform multisignal 1D thresholding Syntax Y = mswthresh(X,SORH,T) Y = mswthresh(X,SORH,T,'c') Y = mswthresh(X,'s',T) Y = mswthresh(X,'h',T) Description returns soft (if ) or hard (if Y = mswthresh(X,SORH,T) SORH='s' SORH='h' thresholding of the input matrix can be a single value, a matrix of the same size as or a vector.

Page 926
nodeasc Purpose 8nodeasc Node ascendants Syntax A = nodeasc(T,N) A = nodeasc(T,N,'deppos') Description is a treemanagement utility. nodeasc returns the indices of all the ascendants of the node in the A = nodeasc(T,N) tree where can be the index node or the depth and position of the node. a column vector with (1) = index of node is a matrix, which contains the depths and...

Page 927
nodeasc % Change Node Label from Depth_Position to Index % (see the plot function). (13) (14) nodeasc(t,[2 2]) ans = nodeasc(t,[2 2],'deppos') ans = See Also nodedesc nodepar wtreemgr 8216...

Page 928
nodedesc Purpose 8nodedesc Node descendants Syntax D = nodedesc(T,N) D = nodedesc(T,N,'deppos') Description is a treemanagement utility. nodedesc returns the indices of all the descendants of the node D = nodedesc(T,N) the tree where can be the index node or the depth and position of node. a column vector with = index of node D(1)

Page 929
nodedesc % Change Node Label from Depth_Position to Index % (see the plot function). (13) (14) % Node descendants. nodedesc(t,2) ans = nodedesc(t,2,'deppos') ans = nodedesc(t,[1 1],'deppos') ans = 8218...

Page 930
nodedesc nodedesc(t,[1 1]) ans = See Also nodeasc nodepar wtreemgr 8219...

Page 931
nodejoin Purpose 8nodejoin Recompose node Syntax T = nodejoin(T,N) T = nodejoin(T) Description is a treemanagement utility. nodejoin returns the modified tree corresponding to a T = nodejoin(T,N) recomposition of the node The nodes are numbered from left to right and from top to bottom. The root index is 0.

Page 932
nodejoin % Plot new tree t. plot(t) % Change Node Label from Depth_Position to Index % (see the plot function). (13) (14) See Also nodesplt 8221...

Page 933
nodepar Purpose 8nodepar Node parent Syntax F = nodepar(T,N) F = nodepar(T,N,'deppos') Description is a treemanagement utility. nodepar returns the indices of the ‚Äúparent(s)‚Äù of the nodes F = nodepar(T,N) the tree where can be a column vector containing the indices of nodes or a matrix that contains the depths and positions of nodes.

Page 934
nodepar % Change Node Label from Depth_Position to Index % (see the plot function). (13) (14) % Nodes parent. nodepar(t,[2 2],'deppos') ans = nodepar(t,[1;7;14]) ans = See Also nodeasc nodedesc wtreemgr 8223...

Page 935
nodesplt Purpose 8nodesplt Split (decompose) node Syntax T = nodesplt(T,N) Description is a treemanagement utility. nodesplt returns the modified tree corresponding to the T = nodesplt(T,N) decomposition of the node The nodes are numbered from left to right and from top to bottom. The root index is 0.

Page 936
nodesplt % Plot new tree t. plot(t) % Change Node Label from Depth_Position to Index % (see the plot function). (10) (11) (12) (13) (14) (21) (22) See Also nodejoin 8225...

Page 937
noleaves Purpose 8noleaves Determine nonterminal nodes Syntax N = noleaves(T) N = noleaves(T,'dp') Description returns the indices of nonterminal nodes of the tree (i.e., N = noleaves(T) nodes that are not leaves). is a column vector. The nodes are ordered from left to right as in tree returns a matrix , which contains the depths and N = noleaves(T,'dp')

Page 938
noleaves % List nonterminal nodes (index). ntnodes_ind = noleaves(t) ntnodes_ind = % List nonterminal nodes (Depth_Position). ntnodes_depo = noleaves(t,'dp') ntnodes_depo = See Also leaves 8227...

Page 939
ntnode Purpose 8ntnode Number of terminal nodes Syntax NB = ntnode(T) Description is a treemanagement utility. ntnode returns the number of terminal nodes in the tree NB = ntnode(T) The nodes are numbered from left to right and from top to bottom. The root index is 0.

Page 940
ntree Purpose 8ntree NTREE constructor Syntax T = ntree(ORD,D) T = ntree T = ntree(ORD) T = ntree(ORD,D,S,U) T = ntree('PropName1',PropValue1,'PropName2',PropValue2, ...) Description returns an NTREE object, which is a complete tree of order T = ntree(ORD,D) and depth is equivalent to T = ntree T = ntree(2,0) is equivalent to...

Page 941
ntree Class NTREE (Parent class: WTBO) Fields Parent object wtbo order Tree order depth Tree depth spsch Split scheme for nodes Column vector with terminal node indices Examples % Create binary tree (tree of order 2) of depth 3. t2 = ntree(2,3); % Plot tree t2.

Page 942
ntree (0,0) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (2,7) (2,12)(2,13)(2,14)(2,15) % Split and merge some nodes using the gui % generated by plot (see the plot function). % The figure becomes: (0,0) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1)

Page 943
orthfilt Purpose 8orthfilt Orthogonal wavelet filter set Syntax [Lo_D,Hi_D,Lo_R,Hi_R] = orthfilt(W) Description computes the four filters associated [Lo_D,Hi_D,Lo_R,Hi_R] = orthfilt(W) with the scaling filter corresponding to a wavelet: Lo_D Decomposition lowpass filter Hi_D Decomposition highpass filter Reconstruction lowpass filter Lo_R Hi_R Reconstruction highpass filter For an orthogonal wavelet, in the multiresolution framework, we start with the...

Page 944
orthfilt 1.000 norm(db3) ans = 0.7071 From filter , we define four FIR filters, of length 2N and norm 1, organized as follows: Filters LowPass HighPass Decomposition Lo_D Hi_D Reconstruction Lo_R Hi_R The four filters are computed using the following scheme: Lo_R = Lo_D = wrev(Lo_R) norm(W)

Page 945
orthfilt subplot(424); stem(Hi_D); title('Decomposition highpass filter'); subplot(425); stem(Lo_R); title('Reconstruction lowpass filter'); subplot(426); stem(Hi_R); title('Reconstruction highpass filter'); % Check for orthonormality. df = [Lo_D;Hi_D]; rf = [Lo_R;Hi_R]; id = df*df' id = 1.0000 1.0000 id = rf*rf' id = 1.0000 1.0000 % Check for orthogonality by dyadic translation, for example: df = [Lo_D 0 0;Hi_D 0 0];...

Page 946
orthfilt % Editing some graphical properties, % the following figure is generated. Original scaling filter −0.5 −1 Decomposition lowpass filter Lo_D Decomposition highpass filter Hi_D −0.5 −0.5 −1 −1 Reconstruction lowpass filter Lo_R Reconstruction highpass filter Hi_R −0.5 −0.5 −1 −1 Transfer modulus: lowpass (Lo _D or Lo_R) Transfer modulus: highpass (Hi _ D or Hi_R)

Page 947
pat2cwav Purpose 8pat2cwav Build wavelet from pattern Syntax [PSI,XVAL,NC] = pat2cwav(YPAT,METHOD,POLDEGREE,REGULARITY) Description computes [PSI,XVAL,NC] = pat2cwav(YPAT,METHOD,POLDEGREE,REGULARITY) an admissible wavelet for CWT (given by ) adapted to the pattern XVAL defined by the vector , and of norm equal to 1. YPAT The underlying xvalues pattern is set to xpat = linspace(0,1,length(YPAT))

Page 948
pat2cwav IntVAL double array 1x256 2048 double array 1x256 2048 double array caption 1x35 char array Grand total is 548 elements using 4174 bytes % This example is a demoexample, so we have the value of the % integral of the pattern as well as the details about its % construction in the caption variable.

Page 949
pat2cwav [psi,xval,nc] = pat2cwav(Y, 'polynomial',6, 'continuous') ; % The new wavelet is given by xval and nc*psi. plot(X,Y,'',xval,nc*psi,''), title('Original Pattern and Adapted Wavelet (dashed line)') Original Pattern and Adapted Wavelet (dashed line) −0.5 −1 % Note that the version of the wavelet is correctly % defined in order to be used in the CWT algorithm must be of % square norm equal to 1.

Page 950
plot Purpose 8plot Plot tree GUI Syntax plot(T) plot(T,FIG) FIG = plot(T) NEWT = plot(T,'read',FIG) NEWT = plot(DUMMY,'read',FIG) Description is a graphical treemanagement utility. plot plots the tree plot(T) The figure that contains the tree is a GUI tool. It lets you change the Node to Depth_Position or Index , and Node Action to SplitMerge or Label Visualize...

Page 951
plot Examples % Create a wavelet packets tree (1D) load noisbloc x = noisbloc; t = wpdec(x,2,'db2'); % Plot tree t. plot(t) % Change Node Label from Depth_Position to Index. 8240...

Page 952
plot % Click the node (3). You get the following figure. % Change Node Action from Visualize to Split_Merge. 8241...

Page 953
plot % Merge the node (2) and split the node (3). % Change Node Action from Split_Merge to Visualize. % Click the node (7). You obtain the following figure, % which represents the wavelet decomposition at level 3. % Create a wavelet packets tree (2D) load woman2 t = wpdec2(X,1,'sym4');...

Page 954
plot % Plot tree t. plot(t) % Change Node Label from Depth_Position to Index. % Click the node (1). You get the following figure. 8243...

Page 955
Purpose 8qmf Quadrature mirror filter Syntax Y = qmf(X,P) Y = qmf(X) Description changes the signs of the even index entries of the reversed vector Y = qmf(X,P) filter coefficients is even. If is odd the same holds for odd index entries. is equivalent to Y = qmf(X) Y = qmf(X,0)

Page 956
subplot(323); plot(freq,abs(m)); title('Transfer modulus of db10') subplot(324); plot(freq,abs(mt)); title('Transfer modulus of QMF db10') subplot(325); plot(freq,abs(m).^2 + abs(mt).^2); title('Check QMF condition for db10 and QMF db10') xlabel(' abs(fft(db10))^2 + abs(fft(qmf(db10))^2 = 1') % Editing some graphical properties, % the following figure is generated. db10 low−pass filter QMF db10 filter −0.5...

Page 957
rbiowavf Purpose 8rbiowavf Reverse biorthogonal spline wavelet filters Syntax [RF,DF]= rbiowavf(W) Description returns two scaling filters associated with the [RF,DF] = rbiowavf(W) biorthogonal wavelet specified by the string where possible values for W = 'rbioNr.Nd' Nr = 1 Nd = 1 , 3 or 5 Nr = 2 Nd = 2 , 4 , 6 or 8 Nr = 3...

Page 958
read Purpose 8read Read values of WPTREE Syntax VARARGOUT = read(T,VARARGIN) Description is the most general syntax to read one or more VARARGOUT = read(T,VARARGIN) property values from the fields of a WPTREE object . The different ways to call the function are read PropValue = read(T,'PropName')

Page 959
read PropName PropParam (see 'wfilters' Without or with 'PropParam' 'PropParam' = wfilters 'd','r','l','h'. Without or with 'data' 'PropParam' = One terminal node index or 'PropParam' = Column vector of terminal node 'PropParam' indices.In this last case, is a cell array. PropValue Without contains the...

Page 960
read % Read values. data for node: (7) or (3,0). (0,0) (1,0) (1,1) (2,0) (2,1) (2,2) (2,3) (3,0) (3,1) (3,6) (3,7) sAll = read(t,'sizes'); sNod = read(t,'sizes',[0,4,5]); eAll = read(t,'ent'); eNod = read(t,'ent',[0,4,5]); dAll = read(t,'data'); dNod = read(t,'data',[4;5]); [lo_D,hi_D,lo_R,hi_R] = read(t,'wfilters'); [lo_D,lo_R,hi_D,hi_R] = read(t,'wfilters','l','wfilters','h');...

Page 961
readtree Purpose 8readtree Read wavelet packet decomposition tree from figure Syntax T = readtree(F) Description reads the wavelet packet decomposition tree from the figure T = readtree(F) whose handle is For more information, see Chapter 5, “Using Wavelet Packets”, and Appendix B, “ObjectOriented Programming”.

Page 962
readtree t = readtree(fig); plot(t) % Click the node (3,0), (see the plot function). data for node: (7) or (3,0). (0,0) (1,0) (1,1) (2,0) (2,1) −1 −2 (3,0) (3,1) (3,2) (3,3) −3 See Also drawtree 8251...

Page 963
scal2frq Purpose 8scal2frq Scale to frequency Syntax F = scal2frq(A,'wname',DELTA) Description returns the pseudofrequencies F = scal2frq(A,'wname',DELTA) corresponding to the scales given by , the wavelet function (see 'wname' for more information) and the sampling period wavefun DELTA is equivalent to scal2frq(A,'wname') scal2frq(A,'wname',1) One of the most frequently asked questions is “How does one map a scale, for a...

Page 964
scal2frq Wavelet db7 (blue) and Center frequency based approximation Wavelet db2 (blue) and Center frequency based approximation −0.5 −0.5 −1 −1 −1.5 −1.5 Period: 1.4444; Cent. Freq: 0.69231 Period: 1.5; Cent. Freq: 0.66667 coif1 gaus4 Wavelet gaus4 (blue) and Center frequency based approximation Wavelet coif1 (blue) and Center frequency based approximation −0.5 −0.2...

Page 965
scal2frq As you can see, the center frequency based approximation captures the main wavelet oscillations. So the center frequency is a convenient and simple characterization of the leading dominant frequency of the wavelet. If we accept to associate the frequency F to the wavelet function then, when the wavelet is dilated by a factor a, this center frequency becomes F / a.

Page 966
scal2frq % Display information. disp(' Scale Frequency Period') disp([a' f' per']) Scale Frequency Period 2.0000 3.5294 0.2833 4.0000 1.7647 0.5667 8.0000 0.8824 1.1333 16.0000 0.4412 2.2667 32.0000 0.2206 4.5333 64.0000 0.1103 9.0667 128.0000 0.0551 18.1333 Example 2 % Set sampling period and wavelet name. delta = 0.1;...

Page 967
scal2frq for i = 1:amax % Generate sine function of period % per(i) at sampling period delta. t = 0:delta:100; x = sin((t.*2*pi)/per(i)); % Decompose x at level 9. [c,l] = wavedec(x,9,wname); % Estimate standard deviation of detail coefficients. stdc = wnoisest(c,l,[1:amax]); % Compute identified period.

Page 968
scal2frq Example 3 This example demonstrates that, starting from the periodic function , the function translates the scale corresponding to x(t) = cos(5t) scal2frq the maximum value of the CWT coefficients to a pseudofrequency (0.795), which is near to the true frequency ( 5/(2*pi) =~ 0.796 % Set wavelet name, interval and number of samples.

Page 969
scal2frq clc ; disp(char(' ',str1,' ',str2,str3,' ',str4,str5)) 224 samples of x = cos(5t) on [64,64]  True frequency = 5/(2*pi) =~ 0.796 Array of pseudofrequencies and scales: 4.77 0.25 2.38 1.59 0.75 1.19 0.954 1.25 0.795 0.681 1.75 0.596 ..0.341 0.318 3.75...

Page 970
scal2frq Example 4 This example demonstrates that, starting from the periodic function , the function translates x(t) = 5*sin(5t)+3*sin(2t)+2*sin(t) scal2frq the scales corresponding to the maximum values of the CWT coefficients to pseudofrequencies ( ), which are near to the true [0.796 0.318 0.159] frequencies ([5 2 1] / (2*pi) =~ [0.796 0.318 0.159])

Page 971
scal2frq num2str(tab_FREQ,3) ']' ] str2 = ['Array of pseudofrequencies and scales: ']; str3 = [num2str([tab_PF',scales'],3)]; str4 = ['Pseudofrequencies = ' num2str(PF_app,3)]; str5 = ['Corresponding scales = ' num2str(SC_app,3)]; figure; cwt(x,scales,wname,'plot'); ax = gca; colorbar axTITL = get(ax,'title'); axXLAB = get(ax,'xlabel'); set(axTITL,'String',str1) set(axXLAB,'String',char(str4, str5)) clc;...

Page 972
scal2frq Pseudofrequencies = 0.792 0.317 0.158 Corresponding scales = 8 500 samples of x = 5*sin(5t)+3*sin(2t)+2*sin(t) on [0,64] True frequencies: [5 2 1]/(2*pi) =~ [0.796 0.318 0.159] Pseudo−frequencies = 0.792 0.317 0.158 Corresponding scales = 8 References Abry, P. (1997), Ondelettes et turbulence. Multirésolutions, algorithmes de décomposition, invariance d’échelles, Diderot Editeur, Paris.

Page 973
Purpose 8set WPTREE field contents Syntax T = set(T,'FieldName1',FieldValue1,'FieldName2',FieldValue2, ...) Description T = set(T,'FieldName1',FieldValue1,'FieldName2',FieldValue2, ...) sets the content of the specified fields for the WPTREE object For the fields that are objects or structures, you can set the subfield contents, giving the name of these subfields as values.

Page 974
Or fields of DTREE parent object: 'ntree' NTREE parent object 'allNI' All nodes information Terminal nodes information 'terNI' Or fields of NTREE parent object: WTBO parent object 'wtbo' 'order' Order of the tree 'depth' Depth of the tree Split scheme for nodes 'spsch' 'tn' Array of terminal nodes of the tree...

Page 975
shanwavf Purpose 8shanwavf Complex Shannon wavelet Syntax [PSI,X] = shanwavf(LB,UB,N,FB,FC) Description returns values of the complex Shannon [PSI,X] = shanwavf(LB,UB,N,FB,FC) wavelet defined by a bandwidth parameter , a wavelet center frequency and the expression PSI(X) = (FB^0.5)*(sinc(FB*X).*exp(2*i*pi*FC*X)) on an point regular grid in the interval [LB,UB] must be such that FC >...

Page 976
shanwavf subplot(212) plot(x,imag(psi)) xlabel('Imaginary part'), grid Complex Shannon wavelet shan1.5−1 −0.5 −20 −15 −10 −5 Real part −0.5 −1 −20 −15 −10 −5 Imaginary part References Teolis, A. (1998), Computational signal processing with wavelets, Birkäuser, p. 62. See Also waveinfo 8265...

Page 977
Purpose 8swt Discrete stationary wavelet transform 1D Syntax SWC = swt(X,N,'wname') SWC = swt(X,N,Lo_D,Hi_D) [SWA,SWD] = swt(X,N,'wname') [SWA,SWD] = swt(X,N,Lo_D,Hi_D) Description performs a multilevel 1D stationary wavelet decomposition using either a specific orthogonal wavelet ( , see for more information) or 'wname' wfilters specific orthogonal wavelet decomposition filters.

Page 978
Examples % Load original 1D signal. load noisbloc; s = noisbloc; 8267...

Page 979
% Perform SWT decomposition at level 3 of s using db1. [swa,swd] = swt(s,3,'db1'); % Plots of SWT coefficients of approximations and details % at levels 3 to 1. % Using some plotting commands, % the following figure is generated. Original signal s.

Page 980
More precisely, the first step is lowpass approximation coefs Lo_D Hi_D detail coefs highpass where Convolve with filter X Note cA and cD are of length instead of as in the DWT case. The next step splits the approximation coefficients cA in two parts using the same scheme, but with modified filters obtained by upsampling the filters used for the previous step and replacing s by cA...

Page 981
References Nason, G.P.; B.W. Silverman (1995), “The stationary wavelet transform and some statistical applications,” Lecture Notes in Statistics, 103, pp. 281–299. Coifman, R.R.; Donoho, D.L. (1995), “Translation invariant denoising,” Lecture Notes in Statistics, 103, pp. 125–150. Pesquet, J.C.; H. Krim, H. Carfatan (1996), “Timeinvariant orthonormal wavelet representations,”...

Page 982
swt2 Purpose 8swt2 Discrete stationary wavelet transform 2D Syntax SWC = swt2(X,N,'wname') [A,H,V,D] = swt2(X,N,'wname') SWC = swt2(X,N,Lo_D,Hi_D) [A,H,V,D] = swt2(X,N,Lo_D,Hi_D) Description performs a multilevel 2D stationary wavelet decomposition using either swt2 a specific orthogonal wavelet ( — see for more information) or 'wname' wfilters specific orthogonal wavelet decomposition filters.

Page 983
swt2 When represents a truecolor image, it becomes an by by3 array. This array is an by by3 array, where each by matrix represents a red, green, or blue color plane concatenated along the third dimension. The output arrays , and by by by3 arrays.

Page 984
swt2 title(['SWT dec.: approx. ', ... 'and det. coefs (lev. ',num2str(k),')']); colormap(map) % Editing some graphical properties, % the following figure is generated. Original image SWT dec.: approx. and det. coefs (lev. 1) 80 100 120 SWT dec.: approx. and det. coefs (lev. 2) SWT dec.: approx.

Page 985
swt2 The following chart describes the basic decomposition step for images: TwoDimensional SWT Decomposition step columns rows columns horizontal columns rows vertical columns diagonal where rows Convolve with filter X the rows of the entry columns Convolve with filter X the columns of the entry = s for the decomposition initialization Initialization Upsample...

Page 986
swt2 References Nason, G.P.; B.W. Silverman (1995), “The stationary wavelet transform and some statistical applications,” Lecture Notes in Statistics, 103, pp. 281–299. Coifman, R.R.; Donoho, D.L. (1995), “Translation invariant denoising,” Lecture Notes in Statistics, 103, pp. 125–150. Pesquet, J.C.; H. Krim, H. Carfatan (1996), “Timeinvariant orthonormal wavelet representations,”...

Page 987
symaux Purpose 8symaux Symlet wavelet filter computation Syntax W = SYMAUX(N,SUMW) W = SYMAUX(N) Description Symlets are the ‚Äúleast asymmetric‚Äù Daubechies wavelets. is the order Symlet scaling filter such that W = SYMAUX(N,SUMW) . Possible values for are 1, 2, 3, … SUM(W) = SUMW Note Instability may occur when is too large.

Page 988
symaux % Generate wsym4 the order 4 symlet scaling filter. % The Symlets are the "least asymmetric" Daubechies' % wavelets obtained from another choice between the roots of P. wsym4 = symaux(4) wsym4 = Columns 1 through 7 0.0228 0.0089 0.0702 0.2106 0.5683...

Page 989
symwavf Purpose 8symwavf Symlet wavelet filter Syntax F = symwavf(W) Description returns the scaling filter associated with the symlet wavelet F = symwavf(W) specified by the string where . Possible values for are 2, 3, …, 45. W = 'symN' Examples % Compute the scaling filter corresponding to wavelet sym4.

Page 990
thselect Purpose 8thselect Threshold selection for denoising Syntax THR = thselect(X,TPTR) Description is a onedimensional denoising oriented function. thselect returns threshold adapted value using selection THR = thselect(X,TPTR) rule defined by string TPTR Available selection rules are • , adaptive threshold selection using principle of Stein’s TPTR = 'rigrsure' Unbiased Risk Estimate.

Page 991
thselect minimum of the maximum mean square error obtained for the worst function in a given set. Examples % The current extension mode is zeropadding (see dwtmode). % Generate Gaussian white noise. init = 2055415866; randn('seed',init); x = randn(1,1000); % Find threshold for each selection rule. % Adaptive threshold using SURE.

Page 992
tnodes Purpose 8tnodes Determine terminal nodes Syntax N = tnodes(T) N = tnodes(T,'deppos') [N,K] = tnodes(T) [N,K] = tnodes(T,'deppos') Description is a treemanagement utility. tnodes returns the indices of terminal nodes of the tree is a column N = tnodes(T) vector.

Page 993
tnodes % Change Node Label from Depth_Position to Index % (see the plot function). (13) (14) % List terminal nodes (index). tnodes(t) ans = % List terminal nodes (Depth_Position). tnodes(t,'deppos') ans = See Also leaves noleaves wtreemgr 8282...

Page 994
treedpth Purpose 8treedpth Tree depth Syntax D = treedpth(T) Description is a treemanagement utility. treedpth returns the depth of the tree D = treedpth(T) Examples % Create binary tree (tree of order 2) of depth 3. t = ntree(2,3); % Plot tree t. plot(t) (0,0) (1,0)

Page 995
treeord Purpose 8treeord Tree order Syntax ORD = treeord(T) Description is a treemanagement utility. treeord returns the order of the tree ORD = treeord(T) Examples % Create binary tree (tree of order 2) of depth 3. t = ntree(2,3); % Plot tree t. plot(t) (0,0) (1,0)

Page 996
upcoef Purpose 8upcoef Direct reconstruction from 1D wavelet coefficients Syntax Y = upcoef(O,X,'wname',N) Y = upcoef(O,X,'wname',N,L) Y = upcoef(O,X,Lo_R,Hi_R,N) Y = upcoef(O,X,Lo_R,Hi_R,N,L) Y = upcoef(O,X,'wname') Y = upcoef(O,X,Lo_R,Hi_R) Description is a onedimensional wavelet analysis function. upcoef computes the step reconstructed coefficients of Y = upcoef(O,X,'wname',N) vector is a string containing the wavelet name.

Page 997
upcoef for i=1:6 % Reconstruct at the top level an approximation % which is equal to zero except at level i where only % one coefficient is equal to 1. rec = upcoef('a',cfs,'db6',i); % essup is the essential support of the % reconstructed signal.

Page 998
upcoef % The same can be done for details. % Details signals, obtained from a single coefficient % at levels 1 to 6. cfs = [1]; mi = 12; ma = 30; % Essential support of % the wavelet filter db6. rec = upcoef('d',cfs,'db6',1);...

Page 999
upcoef % Editing some graphical properties, % the following figure is generated. Detail signals obtained from a single coefficient at levels 1 to 6 −1 −1 −0.5 −0.5 −0.2 −0.2 Algorithm is equivalent to an time repeated use of the inverse wavelet upcoef transform.

Page 1000
upcoef2 Purpose 8upcoef2 Direct reconstruction from 2D wavelet coefficients Syntax Y = upcoef2(O,X,'wname',N,S) Y = upcoef2(O,X,Lo_R,Hi_R,N,S) Y = upcoef2(O,X,'wname',N) Y = upcoef2(O,X,Lo_R,Hi_R,N) Y = upcoef2(O,X,'wname') Y = upcoef2(O,X,Lo_R,Hi_R) Description is a twodimensional wavelet analysis function. upcoef2 computes the step reconstructed Y = upcoef2(O,X,'wname',N,S) coefficients of matrix and takes the central part of size...
Comments to this Manuals
Latest comments: