MATLAB Examples

# Nondecimated Discrete Wavelet Analysis

This example shows how to obtain the nondecimated (stationary) wavelet transform of a noisy frequency-modulated signal.

Load the noisy Doppler signal and obtain the stationary wavelet transform down to level 4.

```load noisdopp; swc = swt(noisdopp,4,'sym8'); ```

Plot the original signal and the level 1 and 3 wavelet coefficients. Plot the level 4 approximation.

```subplot(411) plot(noisdopp); subplot(412); plot(swc(1,:)); ylabel('D1'); set(gca,'ytick',[]); subplot(413) plot(swc(3,:)); ylabel('D3'); set(gca,'ytick',[]); subplot(414); plot(swc(5,:)); ylabel('A4'); set(gca,'ytick',[]); ```

The wavelet and approximation coefficients at each level are equal in length to the input signal. The additive noise is almost entirely localized in the level one detail coefficients. The level 3 details coefficients captures the high-frequency oscillations at the beginning of the Doppler signal. The level 4 approximation coefficients are a lowpass approximation to the Doppler signal.

Obtain the 2-D nondecimated wavelet transform of an image. Use the Daubechies least asymmetric wavelet, sym4, and obtain the multiresolution analysis down to level 3. Load the image. Use wcodemat to scale the matrix for display.

```load tartan; nbcol = size(map,1); cod_X = wcodemat(X,nbcol); ```

Obtain the nondecimated multiresolution analysis down to level 3.

```[ca,chd,cvd,cdd] = swt2(X,3,'sym4'); ```

Display the original image and the approximation and detail coefficients at each level.

```subplot(221) image(cod_X) title('Original image'); colormap(map) for k = 1:3 cod_ca = wcodemat(ca(:,:,k),nbcol); cod_chd = wcodemat(chd(:,:,k),nbcol); cod_cvd = wcodemat(cvd(:,:,k),nbcol); cod_cdd = wcodemat(cdd(:,:,k),nbcol); decl = [cod_ca,cod_chd;cod_cvd,cod_cdd]; subplot(2,2,k+1) image(decl) title(['SWT dec.: approx. ', ... 'and det. coefs (lev. ',num2str(k),')']); colormap(gray) end ```