Main Content

Effect of Wavelet Support on Noisy Data

In this example you demonstrate an instance of discontinuities in noisy data being represented more sparsely using a Haar wavelet than when using a wavelet with larger support.

Create a noisy square wave with 512 samples. Plot the square wave.

n = 512;
t = 0:0.001:(n*0.001)-0.001;
yn = square(2*pi*10*t)+0.02*randn(size(t));
plot(yn)
grid on
title('Noisy Signal')

Figure contains an axes object. The axes object with title Noisy Signal contains an object of type line.

Obtain the maximal overlap discrete wavelet transform (MODWT) of the signal using the haar wavelet. The haar wavelet has a support of length equal to 1

modhaar = modwt(yn,'haar');

Obtain the multiresolution analysis from the haar MODWT matrix and plot the first-level details.

mrahaar = modwtmra(modhaar,'haar');
stem(mrahaar(1,:),'Marker','none','ShowBaseLine','off');
grid on
title('First-Level MRA Details Using Haar Wavelet')

Figure contains an axes object. The axes object with title First-Level MRA Details Using Haar Wavelet contains an object of type stem.

Obtain the MODWT of the signal using the db6 wavelet. The db6 wavelet has a support of length equal to 11.

moddb6 = modwt(yn,'db6');

Obtain the multiresolution analysis from the db6 MODWT matrix and plot the first-level details. The discontinuities are represented less sparsely using the db6 wavelet than the haar wavelet.

mradb6 = modwtmra(moddb6,'db6');
stem(mradb6(1,:),'Marker','none','ShowBaseLine','off');
grid on
title('First-Level MRA Details Using db6 Wavelet')

Figure contains an axes object. The axes object with title First-Level MRA Details Using db6 Wavelet contains an object of type stem.

Zoom in. Using the Haar wavelet results in fewer coefficients necessary to identify the change in the signal.

ind = 40:110;
subplot(311)
plot(ind,yn(ind))
title('Close Up')
subplot(312)
stem(ind,mrahaar(1,ind),'Marker','none','ShowBaseLine','off','LineWidth',2)
title('Using Haar')
subplot(313)
stem(ind,mradb6(1,ind),'Marker','none','ShowBaseLine','off','LineWidth',2)
title('Using db6')

Figure contains 3 axes objects. Axes object 1 with title Close Up contains an object of type line. Axes object 2 with title Using Haar contains an object of type stem. Axes object 3 with title Using db6 contains an object of type stem.

See Also

| |