# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# wavedec

Multilevel 1-D wavelet decomposition

## Syntax

```[C,L] = wavedec(X,N,'wname') [C,L] = wavedec(X,N,Lo_D,Hi_D) ```

## Description

`wavedec` performs a multilevel one-dimensional wavelet analysis using either a specific wavelet (`'wname'`) or a specific wavelet decomposition filters (`Lo_D` and `Hi_D`, see `wfilters`).

### Note

`wavedec` supports only Type 1 (orthogonal) or Type 2 (biorthogonal) wavelets.

`[C,L] = wavedec(X,N,'wname')` returns the wavelet decomposition of the signal `X` at level `N`, using `'wname'`. `wavedec` does not enforce a maximum level restriction. Use `wmaxlev` to ensure the wavelet coefficients are free from boundary effects. If boundary effects are not a concern in your application, a good rule is to set `N` less than or equal to `fix(log2(length(X)))`.

The output decomposition structure contains the wavelet decomposition vector `C` and the bookkeeping vector `L`, which contains the number of coefficients by level. The structure is organized as in this level-3 decomposition example.

`[C,L] = wavedec(X,N,Lo_D,Hi_D)` returns the decomposition structure as above, given the low- and high-pass decomposition filters you specify.

## Examples

collapse all

The current extension mode for this example is zero-padding, as specified using the `dwtmode` function.

```load sumsin; s = sumsin;```

Perform decomposition at level 3 of s using `db1`. Extract the detail coefficients at levels 1, 2, and 3 from the composition structure.

```[c,l] = wavedec(s,3,'db1'); [cd1,cd2,cd3] = detcoef(c,l,[1 2 3]);```

Plot the output of the decomposition.

```plot(s) title('Original signal')```

```plot(cd3) title('Level 3 detail coefficients (cd3)')```

## Algorithms

Given a signal s of length N, the DWT consists of log2 N stages at most. The first step produces, starting from s, two sets of coefficients: approximation coefficients CA1, and detail coefficients CD1. These vectors are obtained by convolving s with the low-pass filter `Lo_D` for approximation, and with the high-pass filter `Hi_D` for detail, followed by dyadic decimation (downsampling).

More precisely, the first step is

The length of each filter is equal to 2N. If n = length(s), the signals F and G are of length n + 2N −1 and the coefficients cA1 and cD1 are of length

floor$\left(\frac{n-1}{2}\right)+N$

The next step splits the approximation coefficients cA1 in two parts using the same scheme, replacing s by cA1, and producing cA2 and cD2, and so on

The wavelet decomposition of the signal s analyzed at level j has the following structure: [cAj, cDj, ..., cD1].

This structure contains, for J = 3, the terminal nodes of the following tree:

## References

Daubechies, I. (1992), Ten lectures on wavelets, CBMS-NSF 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. (1990), Ondelettes et opérateurs, Tome 1, Hermann Ed. (English translation: Wavelets and operators, Cambridge Univ. Press. 1993.)