Chapter 11Signal Processing with Wavelets
ObjectivesDefine and illustrate the difference between a stationary and non-stationary signal.Describe the relationship between wavelets and sub-band coding of a signal using quadrature mirror filters with the property of perfect reconstruction.Illustrate the multi-level decomposition of a signal into approximation and detail components using wavelet decomposition filters.Illustrate the application of wavelet analysis using MATLAB to noise suppression, signal compression, and the identification of transient features in a signal.
Motivation for Wavelet AnalysisSignals of practical interest are usually non-stationary, meaning that their time-domain and frequency-domain characteristics vary over short time intervals (i.e., music, seismic data, etc)Classical Fourier analysis (Fourier transforms) assumes a signal that is either infinite in extent or stationary within the analysis window.Non-stationary analysis requires a different approach: Wavelet AnalysisWavelet analysis also produces better solutions to important problems such as the transform compression of images (jpeg versus jpeg2000)
Basic Theory of WaveletsWavelet analysis can be understood as a form of sub-band coding with quadrature mirror filtersThe two basic wavelet processes are decomposition and reconstruction
Wavelet DecompositionA single level decomposition puts a signal through 2 complementary low-pass and high-pass filters The output of the low-pass filter gives the approximation (A) coefficients, while the high pass filter gives the detail (D) coefficientsDecomposition Filters for Daubechies-8 Wavelets
Wavelet ReconstructionThe A and D coefficients can be used to reconstruct the signal perfectly when run through the mirror reconstruction filters of the wavelet family
Wavelet FamiliesWavelet families consist of a particular set of quadrature mirror filters with the property of perfect reconstruction. These families are completely determined by the impulse responses of the set of 4 filters.
Example:Filter Set for the Daubechies-5 Wavelet Family % Set wavelet name. >> wname = 'db5';% Compute the four filters associated with wavelet name given % by the input string wname. >> [Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(wname); >> subplot(221); stem(Lo_D); >> title('Decomposition low-pass filter'); >> subplot(222); stem(Hi_D); >> title('Decomposition high-pass filter'); >> subplot(223); stem(Lo_R); >> title('Reconstruction low-pass filter'); >> subplot(224); stem(Hi_R); >> title('Reconstruction high-pass filter'); >> xlabel('The four filters for db5')
Example:Filter Set for the Daubechies-5 Wavelet Family
Example:Filter Set for the Daubechies-5 Wavelet FamilyDecomposition FiltersReconstruction Filters>> fvtool(Lo_D,1,Hi_D,1)>> fvtool(Lo_R,1,Hi_R,1)
Multi-level Decomposition of a Signal with WaveletsThe decomposition tree can be schematically described as:
Multi-level Decomposition of a Signal with WaveletsFrequency Domain (Sub-band Coding)
Example: One-level Decomposition of a Noisy Signal>> x=analog(100,4,40,10000); % Construct a 100 Hz sinusoid of amplitude 4>> xn=x+0.5*randn(size(x)); % Add Gaussian noise>> [cA,cD]=dwt(xn,'db8'); % Compute the first level decomposition with dwt % and the Daubechies-8 wavelet>> subplot(3,1,1),plot(xn),title('Original Signal')>> subplot(3,1,2),plot(cA),title('One Level Approximation')>> subplot(3,1,3),plot(cD),title('One Level Detail')Single level discrete wavelet decomposition with the Daubechies-8 wavelet family
One-Level Decomposition of a Non-Stationary Signal>> fs=2500;>> len=100;>> [x1,t1]=analog(50,.5,len,fs); % The time vector t1 is in milliseconds>> [x2,t2]=analog(100,.25,len,fs);>> [x3,t3]=analog(200,1,len,fs);>> y1=cat(2,x1,x2,x3); % Concatenate the signals>> ty1=[t1,t2+len,t3+2*len]; %Concatenate the time vectors 1 to len, len to 2*len, etc.>> [A1,D1]=dwt(y1,'db8');>> subplot(3,1,1),plot(y1),title('Original Signal')>> subplot(3,1,2),plot(A1),title('One Level Approximation')>> subplot(3,1,3),plot(D1),title('One Level Detail')The detail coefficients reveal the transitions in the non-stationary signal
De-Noising a Signal with Multilevel Wavelet Decomposition>> x=analog(100,4,40,10000);>> xn=x+0.5*randn(size(x));>> [C,L] = wavedec(xn,4,'db8'); % Do a multi-level analysis to four levels with the % Daubechies-8 wavelet>> A1 = wrcoef('a',C,L,'db8',1); % Reconstruct the approximations at various levels>> A2 = wrcoef('a',C,L,'db8',2);>> A3 = wrcoef('a',C,L,'db8',3);>> A4 = wrcoef('a',C,L,'db8',4);>> subplot(5,1,1),plot(xn),title('Original Signal')>> subplot(5,1,2),plot(A1),title('Reconstructed Approximation - Level 1')>> subplot(5,1,3),plot(A2),title(' Reconstructed Approximation - Level 2')>> subplot(5,1,4),plot(A3),title(' Reconstructed Approximation - Level 3')>> subplot(5,1,5),plot(A4),title(' Reconstructed Approximation - Level 4')Significant de-noising occurs with the level-4 approximation coefficients (Daubechies-8 wavelets)
Finding Signal Discontinuities >> x=analog(100,4,40,10000);>> x(302:305)=.25;>> [A,D]=dwt(x,'db8');>> subplot(3,1,1),plot(x),title('Original Signal')>> subplot(3,1,2),plot(A),title('First Level Approximation')>> subplot(3,1,3),plot(D),title('First Level Detail')3 sample discontinuity at sample 302Discontinuity response in the 1st level detail coefficients (sample 151 because of the 2X down-sampling)Daubechies-8 wavelets
Simple Signal Compression Using a Wavelet Approximation>> load leleccum>> x=leleccum;>> w = 'db3';>> [C,L] = wavedec(x,4,w);>> A4 = wrcoef('a',C,L,'db3',4);>> A3 = wrcoef('a',C,L,'db3',3);>> A2 = wrcoef('a',C,L,'db3',2);>> A1 = wrcoef('a',C,L,'db3',1);>> a3 = appcoef(C,L,w,3);>> subplot(2,1,1),plot(x),axis([0,4000,100,600])>> title('Original Signal')>> subplot(2,1,2),plot(A3),axis([0,4000,100,600])>> title('Approximation Reconstruction at Level 3 Using the Daubechies-3 Wavelet')>> (length(a3)/length(x))*100ans = 12.5926The wavelet approximation at level-3 contains only 13 % of the original signal values because of the wavelet down-sampling, but still retains the important signal characteristics.
Compression by Thresholding >> load leleccum>> x=leleccum;>> w = 'db3'; % Specify the Daubechies-4 wavelet>> [C,L] = wavedec(x,4,w); % Multi-level decomposition to 4 levels.>> a3 = appcoef(C,L,w,3); % Extract the level 3 approximation coefficients>> d3 = detcoef(C,L,3); % Extract the level 3 detail coefficients.>> subplot(2,1,1), plot(a3),title('Approximation Coefficients at Level 3')>> subplot(2,1,2), plot(d3),title('Detail Coefficients at Level 3')These are the A3 and D3 coefficients for the signal. Many of the D3 coefficients could be zeroed without losing much signal information or power
Compression by Thresholding>> load leleccum>> x=leleccum; % Uncompressed signal>> w = 'db3'; % Set wavelet family>> n=3; % Set decomposition level>> [C,L] = wavedec(x,n,w); % Find the decomposition structure of x to level n using w.>> thr = 10; % Set the threshold value>> keepapp = 1; %Logical parameter = do not threshold approximation coefficients>> sorh='h'; % Use hard thresholding>> [xd,cxd,lxd, perf0,perfl2] =wdencmp('gbl',C,L,w,n,thr,sorh,keepapp);>> subplot(2,1,1), plot(x),title('Original Signal')>> subplot(2,1,2),plot(xd),title('Compressed Signal (Detail Thresholding)')>> perf0 % Percent of coefficients set to zero>> perfl2 % Percent retained energy in the compressed signalperf0 = 83.4064perfl2 = 99.9943In this compression 83% of the coefficients were set to zero, but 99% of the energy in the signal was retained.
Compression by Thresholding>> D1 = wrcoef('d',C,L,w,1);>> D2 = wrcoef('d',C,L,w,2);>> D3 = wrcoef('d',C,L,w,3);>> d1 = wrcoef('d',cxd,lxd,w,1);>> d2 = wrcoef('d',cxd,lxd,w,2);>> d3 = wrcoef('d',cxd,lxd,w,3);>> subplot(3,2,1),plot(D3),title('Original Detail - Levels 3 to 1')>> subplot(3,2,2),plot(d3),title('Thresholded Detail - Levels 3 to 1')>> subplot(3,2,3),plot(D2)>> subplot(3,2,4),plot(d2)>> subplot(3,2,5),plot(D1)>> subplot(3,2,6),plot(d1)Zeroing of coefficients by thresholding results in effective signal compression
SummaryWavelet processing is based on the idea of sub-band decomposition and coding.Wavelet families are characterized by the low-pass and high-pass filters used for decomposition and perfect reconstruction of signals.Typical applications of wavelet processing include elimination of noise, signal compression, and the identification of transient signal features.
Top Related