# 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.

# symaux

Symlet wavelet filter computation

The symaux function generates the scaling filter coefficients for the "least asymmetric" Daubechies wavelets.

## Syntax

w = symaux(n)
w = symaux(___,sumw)

## Description

w = symaux(n) is the order n Symlet scaling filter such that sum(w) = 1.

### Note

• Instability 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.

• As n increases, the time required to compute the filter coefficients rapidly grows.

example

w = symaux(___,sumw) is the order n Symlet scaling filter such that sum(w) = sumw.

w = symaux(n,0) is equivalent to w = symaux(n,1).

## Examples

collapse all

In this example you will generate symlet scaling filter coefficients whose norm is equal to 1.You will also confirm the coefficients satisfy a necessary relation. This example requires the Signal Processing Toolbox.

Compute the scaling filter coefficients of the order 10 symlet whose sum equals.

n = 10;
w = symaux(n,sqrt(2));

Confirm the sum of the cofficients is equal to and the norm is equal to 1.

sqrt(2)-sum(w)
ans = 0
1-sum(w.^2)
ans = -1.3545e-14

Since integer translations of the scaling function form an orthogonal basis, the coefficients satisfy the relation . Confirm this by taking the autocorrelation of the coefficients and plotting the result.

corrw = xcorr(w,w);
stem(corrw)
grid on
title('Autocorrelation of scaling coefficients')

stem(corrw(2:2:end))
grid on
title('Even-indexed autocorrelation values')

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 =

Columns 1 through 7

0.1629    0.5055    0.4461   -0.0198   -0.1323    0.0218    0.0233

Column 8

-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 =

Columns 1 through 7

0.0228   -0.0089   -0.0702    0.2106    0.5683    0.3519   -0.0210

Column 8

-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 = 4.1163e-16

For a given support, the orthogonal wavelet with a phase response that most closely resembles a linear phase filter is called least asymmetric. Symlets are examples of least asymmetric wavelets. They are modified versions of the classic Daubechies db wavelets. In this example you will show that the order 4 symlet has a nearly linear phase response, while the order 4 Daubechies wavelet does not. This example requires the Signal Processing Toolbox.

First plot the order 4 symlet and order 4 Daubechies scaling functions. While neither is perfectly symmetric, note how much more symmetric the symlet is.

[phi_sym,~,xval_sym]=wavefun('sym4',10);
[phi_db,~,xval_db]=wavefun('db4',10);
subplot(2,1,1)
plot(xval_sym,phi_sym)
title('sym4 - scaling function')
grid on
subplot(2,1,2)
plot(xval_db,phi_db)
title('db4 - scaling function')
grid on

Generate the filters associated with the order 4 symlet and Daubechies wavelets.

scal_sym = symaux(4,sqrt(2));
scal_db = dbaux(4,sqrt(2));

Compute the frequency response of the scaling synthesis filters.

[h_sym,w_sym] = freqz(scal_sym);
[h_db,w_db] = freqz(scal_db);

To avoid visual discontinuities, unwrap the phase angles of the frequency responses and plot them. Note how well the phase angle of the symlet filter approximates a straightline.

h_sym_u = unwrap(angle(h_sym));
h_db_u = unwrap(angle(h_db));
figure
plot(w_sym/pi,h_sym_u,'.')
hold on
plot(w_sym([1 end])/pi,h_sym_u([1 end]),'r')
grid on
xlabel('Normalized Frequency ( x \pi rad/sample)')
legend('phase angle of frequency response','straight line')
title('Symlet Order 4 - Phase Angle')

figure;
plot(w_db/pi,h_db_u,'.')
hold on
plot(w_db([1 end])/pi,h_db_u([1 end]),'r')
grid on
xlabel('Normalized Frequency ( x \pi rad/sample)')
legend('phase angle of frequency response','straight line')
title('Daubechies Order 4 - Phase Angle')

The sym4 and db4 wavelets are not symmetric, but the biorthogonal wavelet is. Plot the scaling the function associated with the bior3.5 wavelet. Compute the frequency response of the synthesis scaling filter for the wavelet and verify that it has linear phase.

[~,~,phi_bior_r,~,xval_bior]=wavefun('bior3.5',10);
figure
plot(xval_bior,phi_bior_r)
title('bior3.5 - scaling function')
grid on

[LoD_bior,HiD_bior,LoR_bior,HiR_bior] = wfilters('bior3.5');
[h_bior,w_bior] = freqz(LoR_bior);
h_bior_u = unwrap(angle(h_bior));
figure
plot(w_bior/pi,h_bior_u,'.')
hold on
plot(w_bior([1 end])/pi,h_bior_u([1 end]),'r')
grid on
xlabel('Normalized Frequency ( x \pi rad/sample)')
legend('phase angle of frequency response','straight line')
title('Biorthogonal 3.5 - Phase Angle')

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.

First, set the order to 15 and generate the scaling filter coefficients for the Daubechies wavelet and Symlet. Both wavelets have support of length 29.

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

Next, generate the scaling filter coefficients for the order 5 Coiflet. This wavelet also has support of length 29.

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

Confirm the sum of the coefficients for all three wavelets equals .

sqrt(2)-sum(LoR_db)
ans = 2.2204e-16
sqrt(2)-sum(LoR_sym)
ans = -4.4409e-16
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 the symlet, specified as a positive integer.

Sum of the scaling filter coefficients, specified as a positive real number. Set to sqrt(2) to generate vector of coefficients whose norm is 1.

## Output Arguments

collapse all

Vector of scaling filter coefficients of the order n symlet.

The scaling filter coefficients satisfy a number of properties. You can use these properties to check your results. See Unit Norm Scaling Filter Coefficients for additional information.

collapse all

### Least Asymmetric Wavelet

The Haar wavelet, also known as the Daubechies wavelet of order 1, db1, is the only compactly supported orthogonal wavelet that is symmetric, or equivalently has linear phase. No other compactly supported orthogonal wavelet can be symmetric. However, it is possible to derive wavelets which are minimally asymmetric, meaning that their phase will be very nearly linear. For a given support, the orthogonal wavelet with a phase response that most closely resembles a linear phase filter is called least asymmetric.

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. The example Least Asymmetric Wavelet and Phase compares wavelets with different phases. 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].

### Extremal Phase

As mentioned in Least Asymmetric Wavelet, when constructing a wavelet, you must choose among a set of roots of a particular equation. 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,...,N. 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,...,N:

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

The inequality is illustrated in the example Extremal Phase. The {hk} are sometimes called a minimal delay filter [2].

## References

[1] Daubechies, I. (1992), Ten Lectures on Wavelets, CBMS-NSF conference series in applied mathematics, SIAM Ed.

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