Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# ndwt

Nondecimated 1-D wavelet transform

## Syntax

WT = ndwt(X,N,'wname')
WT = ndwt(X,N,'wname','mode','ExtM')
WT = ndwt(X,N,WF,...)

## Description

ndwt performs a multilevel 1-D nondecimated wavelet decomposition using either a particular wavelet ('wname') or the wavelet filters you specify. The decomposition also uses the specified DWT extension mode (see dwtmode).

WT = ndwt(X,N,'wname') returns a structure which contains the non-decimated wavelet transform of the vector X at the level N. N is a positive integer, and 'wname' is a string containing the wavelet name. The default default extension mode is'sym'. For more information on wname, see wfilters.

WT = ndwt(X,N,'wname','mode','ExtM') uses the extension mode specified in the string 'ExtM'.

WT is a structure with the fields shown in the table.

Instead of a wavelet you can specify four filters (two for decomposition and two for reconstruction).

WT = ndwt(X,N,WF,...) specifies four filters (two for decomposition and two for reconstruction) instead of a wavelet name. WF is a 1-by-4 cell array {LoD,HiD,LoR,HiR} or a structure with the four fields 'LoD', 'HiD', 'LoR', 'HiR'.

 rowvect Logical value which is true if X is a row vector level Level of the decomposition mode Name of the wavelet transform extension mode filters Structure with 4 fields, LoD, HiD, LoR, HiR, which contain the filters used for DWT dec 1 by (level+1) cell array containing the coefficients of the decomposition. dec{1} contains the coefficients of the approximation and dec{j} (j = 2 to level+1), contains the coefficients of the detail of level (level+1-j) longs 1 by (level+2) vector containing the lengths of the components. longs is defined as (where N is the level)longs(1) = length of app. coef.(N)longs(i) = length of det. coef.(N-i+2) for i = 2,...,N+1longs(N+2) = length(X).

## Examples

expand all

### Localize Discontinuity with Nondecimated Wavelet Transform

Use fine-scale nondecimated wavelet transform coefficients to localize a discontinuity.

Create signal consisting of a 1/2–hz sine wave sampled at 1 kHz with discontinuities at 0.3 and 0.72 seconds.

```t = linspace(0,1,1000);
x = 4*sin(4*pi*t);
x = x - sign(t - .3) - sign(.72 - t);
plot(t,x); xlabel('t'); ylabel('x');
grid on;```

Obtain the nondecimated wavelet transform of the input signal down to level 4 using the Daubechies extremal phase wavelet with 2 vanishing moments and the default whole-point symmetric extension mode. Reconstruct a signal approximation based on the level-one wavelet coefficients.

```W = ndwt(x,4,'db2','mode','per');
d1 = indwt(W,'d',1);```

Plot the original signal and the signal approximation to visualize how the wavelet coefficients localize the discontinuities.

```subplot(211);
plot(t,x); title('Original Signal');
grid on;
subplot(212);
plot(t,d1,'linewidth',2); title('Wavelet Approximation -- Level 1');
grid on;```

### Specify Extension Mode for Nondecimated Wavelet Transform

Specify an extension mode different from the default whole-point symmetric extension.

Load the freqbrk signal and obtain the nondecimated wavelet transform down to level 4 using the Daubechies extremal phase wavelet with 2 vanishing moments. Use the periodic extension mode.

```load freqbrk;
W = ndwt(freqbrk,4,'db2','mode','per');```

### Nondecimated Wavelet Transform Using Specified Decomposition and Reconstruction Filters

Specify the decomposition and reconstruction filters as a cell or structure array.

Obtain the decomposition and reconstruction filters for the biorthogonal spline wavelet with 3 vanishing moments in the reconstruction wavelet and 5 vanishing moments in the decomposition wavelet. Create a cell array with the scaling and wavelet filters and analyze the freqbrk signal.

```[LoD,HiD,LoR,HiR] = wfilters('bior3.5');
WF = {LoD,HiD,LoR,HiR};
```WF1 = struct('LoD',LoD,'HiD',HiD,'LoR',LoR,'HiR',HiR);