# dbaux

Daubechies wavelet filter computation

## Syntax

``W = dbaux(N)``
``W = dbaux(N,SUMW)``

## Description

The `dbaux` function generates the scaling filter coefficients for the "extremal phase" Daubechies wavelets.

````W = dbaux(N)` is the order `N` Daubechies scaling filter such that ```sum(W) = 1```. NoteInstability may occur when `N` is too large. Starting with values of `N` in the 30s range, function output will no longer accurately represent scaling filter coefficients.For `N` = 1, 2, and 3, the order `N` Symlet filters and order `N` Daubechies filters are identical. See Extremal Phase. ```

example

````W = dbaux(N,SUMW)` is the order `N` Daubechies scaling filter such that ```sum(W) = SUMW```. `W = dbaux(N,0)` is equivalent to ```W = dbaux(N,1)```.```

## Examples

collapse all

This example shows how to determine the Daubechies extremal phase scaling filter with a specified sum. The two most common values for the sum are $\sqrt{2}$ and 1.

Construct two versions of the `db4` scaling filter. One scaling filter sums to $\sqrt{2}$ and the other version sums to 1.

```NumVanishingMoments = 4; h = dbaux(NumVanishingMoments,sqrt(2)); m0 = dbaux(NumVanishingMoments,1);```

The filter with sum equal to $\sqrt{2}$ is the synthesis (reconstruction) filter returned by `wfilters` and used in the discrete wavelet transform.

```[LoD,HiD,LoR,HiR] = wfilters('db4'); max(abs(LoR-h))```
```ans = 4.2590e-13 ```

For orthogonal wavelets, the analysis (decomposition) filter is the time-reverse of the synthesis filter.

`max(abs(LoD-fliplr(h)))`
```ans = 4.2590e-13 ```

This example shows that symlet and Daubechies scaling filters of the same order are both solutions of the same polynomial equation.

Generate the order 4 Daubechies scaling filter and plot it.

`wdb4 = dbaux(4)`
```wdb4 = 1×8 0.1629 0.5055 0.4461 -0.0198 -0.1323 0.0218 0.0233 -0.0075 ```
```stem(wdb4) title('Order 4 Daubechies Scaling Filter')```

wdb4 is a solution of the equation: P = conv(wrev(w),w)*2, where P is the "Lagrange trous" filter for N = 4. Evaluate P and plot it. P is a symmetric filter and wdb4 is a minimum phase solution of the previous equation based on the roots of P.

```P = conv(wrev(wdb4),wdb4)*2; stem(P) title('''Lagrange trous'' filter')```

Generate wsym4, the order 4 symlet scaling filter and plot it. The Symlets are the "least asymmetric" Daubechies' wavelets obtained from another choice between the roots of P.

`wsym4 = symaux(4)`
```wsym4 = 1×8 0.0228 -0.0089 -0.0702 0.2106 0.5683 0.3519 -0.0210 -0.0536 ```
```stem(wsym4) title('Order 4 Symlet Scaling Filter')```

Compute conv(wrev(wsym4),wsym4)*2 and confirm that wsym4 is another solution of the equation P = conv(wrev(w),w)*2.

```P_sym = conv(wrev(wsym4),wsym4)*2; err = norm(P_sym-P)```
```err = 1.8677e-15 ```

This example demonstrates that for a given support, the cumulative sum of the squared coefficients of a scaling filter increase more rapidly for an extremal phase wavelet than other wavelets.

Generate the scaling filter coefficients for the `db15` and `sym15` wavelets. Both wavelets have support of width $2×15-1=29$.

```[~,~,LoR_db,~] = wfilters('db15'); [~,~,LoR_sym,~] = wfilters('sym15');```

Next, generate the scaling filter coefficients for the `coif5` wavelet. This wavelet also has support of width $6×5-1=29$.

`[~,~,LoR_coif,~] = wfilters('coif5');`

Confirm the sum of the coefficients for all three wavelets equals $\sqrt{2}$.

`sqrt(2)-sum(LoR_db)`
```ans = 2.2204e-16 ```
`sqrt(2)-sum(LoR_sym)`
```ans = 0 ```
`sqrt(2)-sum(LoR_coif)`
```ans = 2.2204e-16 ```

Plot the cumulative sums of the squared coefficients. Note how rapidly the Daubechies sum increases. This is because its energy is concentrated at small abscissas. Since the Daubechies wavelet has extremal phase, the cumulative sum of its squared coefficients increases more rapidly than the other two wavelets.

```plot(cumsum(LoR_db.^2),'rx-') hold on plot(cumsum(LoR_sym.^2),'mo-') plot(cumsum(LoR_coif.^2),'b*-') legend('Daubechies','Symlet','Coiflet') title('Cumulative Sum')```

## Input Arguments

collapse all

Order of Daubechies scaling filter, specified as a positive integer.

Data Types: `single` | `double`

Sum of coefficients, specified as a positive scalar. Set to `sqrt(2)` to generate vector of coefficients whose norm is 1.

Data Types: `single` | `double`

## Output Arguments

collapse all

Scaling filter coefficients returned as a vector.

The scaling filter coefficients satisfy a number of properties. As the example Daubechies Extremal Phase Scaling Filter with Specified Sum demonstrates, you can construct scaling filter coefficients with a specific sum. If {hk} denotes the set of order `N` Daubechies scaling filter coefficients, where n = 1, ..., 2N, then $\sum _{n=1}^{2N}{h}_{n}^{2}=1.$ The coefficients also satisfy the relation ${\sum }_{n}h\left(n\right)h\left(n-2k\right)=\delta \left(k\right).$ You can use these properties to check your results.

## Limitations

• The computation of the `dbN` Daubechies scaling filter requires the extraction of the roots of a polynomial of order `4N`. Instability may occur beginning with values of `N` in the 30s.

collapse all

### Extremal Phase

Constructing a compactly supported orthogonal wavelet basis involves choosing roots of a particular polynomial equation. Different choices of roots will result in wavelets whose phases are different. Choosing roots that lie within the unit circle in the complex plane results in a filter with highly nonlinear phase. Such a wavelet is said to have extremal phase, and has energy concentrated at small abscissas. Let {hk} denote the set of scaling coefficients associated with an extremal phase wavelet, where k = 1,…,M. Then for any other set of scaling coefficients {gk} resulting from a different choice of roots, the following inequality will hold for all J = 1,…,M:

`$\sum _{k=1}^{J}{g}_{k}^{2}\le \sum _{k=1}^{J}{h}_{k}^{2}$`

The {hk} are sometimes called a minimal delay filter [2].

The polynomial equation mentioned above depends on the number of vanishing moments N for the wavelet. To construct a wavelet basis involves choosing roots of the equation. In the case of least asymmetric wavelets and extremal phase wavelets for orders 1, 2, and 3, there are effectively no choices to make. For N = 1, 2, and 3, the `db`N and `sym`N filters are equal. The example Symlet and Daubechies Scaling Filters shows that two different scaling filters can satisfy the same polynomial equation. For additional information, see Daubechies [1].

## Algorithms

The algorithm used is based on a result obtained by Shensa [3], showing a correspondence between the “Lagrange à trous” filters and the convolutional squares of the Daubechies wavelet filters.

The computation of the order N Daubechies scaling filter w proceeds in two steps: compute a “Lagrange à trous” filter P, and extract a square root. More precisely:

• P the associated “Lagrange à trous” filter is a symmetric filter of length 4N-1. P is defined by

P = [a(N) 0 a(N-1) 0 ... 0 a(1) 1 a(1) 0 a(2) 0 ... 0 a(N)]

• where

• Then, if w denotes dbN Daubechies scaling filter of sum , w is a square root of P:

P = `conv`(`wrev`(w),w) where w is a filter of length 2N.

The corresponding polynomial has N zeros located at −1 and N−1 zeros less than 1 in modulus.

Note that other methods can be used; see various solutions of the spectral factorization problem in Strang-Nguyen [4] (p. 157).

## References

[1] Daubechies, I. Ten Lectures on Wavelets, CBMS-NSF Regional Conference Series in Applied Mathematics. Philadelphia, PA: SIAM Ed, 1992.

[2] Oppenheim, Alan V., and Ronald W. Schafer. Discrete-Time Signal Processing. Englewood Cliffs, NJ: Prentice Hall, 1989.

[3] Shensa, M.J. (1992), “The discrete wavelet transform: wedding the a trous and Mallat Algorithms,” IEEE Trans. on Signal Processing, vol. 40, 10, pp. 2464-2482.

[4] Strang, G., and T. Nguyen.Wavelets and Filter Banks. Wellesley, MA: Wellesley-Cambridge Press, 1996.