## introduction

The impetus for this post is figure 1.4 on page 6 of Burrus et al. (Since it’s been a while, that’s Burrus, C. Sidney; Gopinath, Ramesh A.; Guo, Haitao. Introduction to Wavelets and Wavelet Transforms, A Primer. Prentice Hall, 1998.ISBN 0 13 489600 9.)

They offered the figure as an illustration of four different scaling functions; in addition, these scaling functions were parameterized by two angles.

Now I know how to produce the drawings of those scaling functions — and I also know how to produce drawings of the corresponding mother wavelets, which they did not show on page 6. It also turns out that they have interchanged the legends for figures (a) and (b) — and when we can produce the drawings ourselves, that mistake becomes almost irrelevant.

This post also serves to reiterate the calculation sequence for plotting a scaling function and its corresponding mother wavelet.

## setup

It turns out that there are equations which must be satisfied by any “reasonable” filter coefficients h. I expect to show these to you in the next post. I have already shown you a description of these solutions of these equations when we have 4 nonzero coefficients. And I have shown you how to compute scaling functions and mother wavelets for N = 4 (D4 only) and for N = 2 (D2 = Haar).

Let me emphasize that what I understand is how to get the equations which the filter coefficients h must satisfy. What I do not yet understand is how to parameterize the solutions in terms of angles.

Let me now hand you a description of the solutions when we have 6 nonzero coefficients. The four examples I am about to work out all come from specific choices of these solutions. That is, for every one of the following examples, N = 6.

The following 4 scaling functions match figure 1.4, although (a) and (b) are swapped. (The legend describes the values “a” and “b” in the equations; the legend for figure a belongs with figure b.)

In addition, they have drawings of the Daubechies D6 (p. 82) and Coiflet C6 (p. 94) mother wavelets, so I have confirmed 6 of the following 8 graphs.

From p. 66 of Burrus et al., we get the following (using H instead of h just because it lets me preserve the equations in H while setting values for h.)

Let me tell you before I start writing that the last two equations are actually

$H(4) = -H(0)-H(2)+\frac{1}{\sqrt{2}}$

$H(5) = -H(1)-H(3)+\frac{1}{\sqrt{2}}$

That is, they say that the sum of the even coefficients is equal to the sum of the odd coefficients is equal to half the sum of all the coefficients = $\frac{1}{2} \sqrt{2}= \frac{1}{\sqrt{2}}\$. They will look much more complicated than that when I substitute the first four equations.

$H(0) = \frac{(\cos (a)+\sin (a)+1) (-\cos (b)-\sin (b)+1)+2 \cos (a) \sin (b)}{4 \sqrt{2}}$

$H(1) = \frac{(-\cos (a)+\sin (a)+1) (\cos (b)-\sin (b)+1)-2 \cos (a) \sin (b)}{4 \sqrt{2}}$

$H(2) = \frac{\cos (a-b)+\sin (a-b)+1}{2 \sqrt{2}}$

$H(3) = \frac{\cos (a-b)-\sin (a-b)+1}{2 \sqrt{2}}$

$H(4) = -\frac{\cos (a-b)+\sin (a-b)+1}{2 \sqrt{2}}-\frac{(\cos (a)+\sin (a)+1) (-\cos (b)-\sin (b)+1)+2 \cos (a) \sin (b)}{4 \sqrt{2}}+\frac{1}{\sqrt{2}}$

$H(5) = -\frac{\cos (a-b)-\sin (a-b)+1}{2 \sqrt{2}}-\frac{(-\cos (a)+\sin (a)+1) (\cos (b)-\sin (b)+1)-2 \cos (a) \sin (b)}{4 \sqrt{2}}+\frac{1}{\sqrt{2}}$

## legend 1.14 a (figure b)

The first choice (the legend for figure 1.14 a) for the angles a and b (in radians) is

$\{a\to 1.3598,b\to -0.782106\}$

(I knew when I saw those that the figure was wrong; by that time I recognized the D6 h’s.)

The resulting h’s are…

$\{0.332671,0.806892,0.459878,-0.135011,-0.0854413,0.0352263\}$

Now we form the m0 matrix (in stages for clarity)…

$\left(\begin{array}{llllll} \text{h0} & 0 & 0 & 0 & 0 & 0 \\ \text{h2} & \text{h1} & \text{h0} & 0 & 0 & 0 \\ \text{h4} & \text{h3} & \text{h2} & \text{h1} & \text{h0} & 0 \\ 0 & \text{h5} & \text{h4} & \text{h3} & \text{h2} & \text{h1} \\ 0 & 0 & 0 & \text{h5} & \text{h4} & \text{h3} \\ 0 & 0 & 0 & 0 & 0 & \text{h5}\end{array}\right)$

Then we multiply by Sqrt[2]…

$M_0 = \left(\begin{array}{llllll} \sqrt{2}\ \text{h0} & 0 & 0 & 0 & 0 & 0 \\ \sqrt{2}\ \text{h2} & \sqrt{2}\ \text{h1} & \sqrt{2}\ \text{h0} & 0 & 0 & 0 \\ \sqrt{2}\ \text{h4} & \sqrt{2}\ \text{h3} & \sqrt{2}\ \text{h2} & \sqrt{2}\ \text{h1} & \sqrt{2}\ \text{h0} & 0 \\ 0 & \sqrt{2}\ \text{h5} & \sqrt{2}\ \text{h4} & \sqrt{2}\ \text{h3} & \sqrt{2}\ \text{h2} & \sqrt{2}\ \text{h1} \\ 0 & 0 & 0 & \sqrt{2}\ \text{h5} & \sqrt{2}\ \text{h4} & \sqrt{2}\ \text{h3} \\ 0 & 0 & 0 & 0 & 0 & \sqrt{2}\ \text{h5}\end{array}\right)$

Note that since all 4 examples have N = 6, that is the m0 matrix in principle for each of these examples. I won’t show it again.

Now we set the values…
$M_0 = \left(\begin{array}{llllll} 0.470467 & 0. & 0. & 0. & 0. & 0. \\ 0.650365 & 1.14112 & 0.470467 & 0. & 0. & 0. \\ -0.120832 & -0.190934 & 0.650365 & 1.14112 & 0.470467 & 0. \\ 0. & 0.0498175 & -0.120832 & -0.190934 & 0.650365 & 1.14112 \\ 0. & 0. & 0. & 0.0498175 & -0.120832 & -0.190934 \\ 0. & 0. & 0. & 0. & 0. & 0.0498175\end{array}\right)$

We find the eigenvector of eigenvalue 1. Mathematica returned a unit vector, but I want one whose components add up to 1. I will simply divide the unit vector by the sum of its components.

Here’s the unit vector…

$\{0.,-0.955434,0.286583,-0.0707606,-0.00314509,0.\}$

The sum of its components is -0.742756, so I get

$V = \{0.,1.28634,-0.385837,0.0952675,0.00423435,0.\}$

This function should be defined on [0,5]. I use that vector for the values of the scaling function at the integers.

Working, I graphed this immediately, but for the post, I ought to put the two drawings — scaling function and mother wavelet — in close proximity. This one turns out to be the Daubechies D6 scaling function.

To get the D6 mother wavelet, we take our filter coefficients h…

$h = \{0.332671,0.806892,0.459878,-0.135011,-0.0854413,0.0352263\}$

… we reverse them, and alternate the signs. The resulting filter coefficients are often denoted by h1 or by g. I’ll use g. The resulting g coefficients are what I expect (the sign of g[0] = h[5] has not been changed), but their Table 6.2 on p. 79 has the negatives of these numbers. And yet, I match their picture on p. 82.

(That’s why there’s a $\pm$ in front of the recipe. Sorry, but you’ll have to look for it in the post.)

$g = \{0.0352263,0.0854413,-0.135011,-0.459878,0.806892,-0.332671\}$

Define the mother wavelet…

and plot it…
(These are Daubechies D6 mother wavelet and scaling function, respectively.)

Beautiful. That matches their picture on p. 82.

And here’s the D6 scaling function whose plot I delayed showing you…

and that matches (b), rather than (a), of figure 1.4.

## legend 1.14 b (figure a)

Let’s make a different choice for a and b. I believe this is the “Coiflet” of order 6.

$\{a\to 1.1468,b\to 0.42403\}$

The resulting h’s are:

$h = \{-0.0727362,0.337915,0.852573,0.384847,-0.0727302,-0.0156552\}$

Now we form the m0 matrix exactly as before, and set the new values…

$M_0 = \left(\begin{array}{llllll} -0.102864 & 0. & 0. & 0. & 0. & 0. \\ 1.20572 & 0.477884 & -0.102864 & 0. & 0. & 0. \\ -0.102856 & 0.544256 & 1.20572 & 0.477884 & -0.102864 & 0. \\ 0. & -0.0221398 & -0.102856 & 0.544256 & 1.20572 & 0.477884 \\ 0. & 0. & 0. & -0.0221398 & -0.102856 & 0.544256 \\ 0. & 0. & 0. & 0. & 0. & -0.0221398\end{array}\right)$

We find the eigenvector of eigenvalue 1.

$\{0.,-0.189494,0.961829,-0.197385,0.00396248,0.\}$

That’s orthonormal, so I find the sum of its components (0.578913) and divide by it, getting

$V = \{0.,-0.327328,1.66144,-0.340958,0.0068447,0.\}$

Set those to be the values of the scaling function at the integers, and define the recursion…

Again, I will delay the plot until I have the mother wavelet.

$h = \{-0.0727362,0.337915,0.852573,0.384847,-0.0727302,-0.0156552\}$

(Those agree with p 92)

We reverse them, and alternate the signs. (This time, I need to use their signs! And they have got g[0] = -h[5].)

$g = \{0.0156552,-0.0727302,-0.384847,0.852573,-0.337915,-0.0727362\}$

compute and plot…
(These are the Coiflet C6 mother wavelet and scaling function in order.)

That matches their p. 94 drawing of the C6 mother wavelet.

And here’s the C6 scaling function…

and that matches their figure 1.14 (a).

## figure 14.1 c

I do not know if the following pair has a name. We take

$\left\{a\to \frac{23 \pi }{60},b\to -\frac{\pi }{12}\right\}$

The resulting h’s are…

$h = \{0.0858766,0.652297,0.742126,0.0388932,-0.120896,0.0159163\}$

Now we form the m0 matrix, and set the values.

$M_0 = \left(\begin{array}{llllll} 0.121448 & 0. & 0. & 0. & 0. & 0. \\ 1.04953 & 0.922488 & 0.121448 & 0. & 0. & 0. \\ -0.170973 & 0.0550033 & 1.04953 & 0.922488 & 0.121448 & 0. \\ 0. & 0.022509 & -0.170973 & 0.0550033 & 1.04953 & 0.922488 \\ 0. & 0. & 0. & 0.022509 & -0.170973 & 0.0550033 \\ 0. & 0. & 0. & 0. & 0. & 0.022509\end{array}\right)$

Now we find the eigenvector of eigenvalue 1:

$\{0.,-0.840331,-0.536329,0.0786992,0.00151279,0.\}$

The sum of its components is -1.29645, so we divide by it, to get a vector whose components add up to 1:

$V = \{0.,0.648179,0.413691,-0.0607037,-0.00116688,0.\}$

That gives us the initial values, and we define the recursion…

Recall the h’s…

$h =\{0.0858766,0.652297,0.742126,0.0388932,-0.120896,0.0159163\}$

We reverse them, and alternate the signs.

$g = \{-0.0159163,-0.120896,-0.0388932,0.742126,-0.652297,0.0858766\}$

Redefine the mother wavelet…

and plot it…

… followed by the scaling function:

## The last case for their Figure 1.4.

Here are the angles a and b…

$\left\{a\to \frac{3 \pi }{4},b\to \frac{2 \pi }{15}\right\}$

Here are the resulting h’s…

$h = \{-0.158303,0.744755,0.556922,-0.103219,0.308488,0.0655711\}$

We form the M0 matrix and set its values…

$M_0 = \left(\begin{array}{llllll} -0.223874 & 0. & 0. & 0. & 0. & 0. \\ 0.787606 & 1.05324 & -0.223874 & 0. & 0. & 0. \\ 0.436267 & -0.145974 & 0.787606 & 1.05324 & -0.223874 & 0. \\ 0. & 0.0927315 & 0.436267 & -0.145974 & 0.787606 & 1.05324 \\ 0. & 0. & 0. & 0.0927315 & 0.436267 & -0.145974 \\ 0. & 0. & 0. & 0. & 0. & 0.0927315\end{array}\right)$

Once again we find the eigenvector of eigenvalue 1. (If you’re using Mathematica, be careful. It’s probably the 2nd one rather than the 1st, in this case.) The normalized eigenvector is…

$\{0.,0.955662,0.22728,0.184742,0.0303893,0.\}$

The sum of its components is 1.39807, so we divide through and get our initial values for the scaling function…

$V = \{0.,0.683556,0.162567,0.13214,0.0217365,0.\}$

So we define the scaling function

Here are the h’s…

$h = \{-0.158303,0.744755,0.556922,-0.103219,0.308488,0.0655711\}$

We reverse them, and alternate the signs to get a set of g’s…

$g = \{-0.0655711,0.308488,0.103219,0.556922,-0.744755,-0.158303\}$

Define the mother wavelet…

Compute and plot it…

And here’s the scaling function (which we defined first, as usual)…

## Closing

So. We’ve had some practice computing the scaling function and the mother wavelet from the h’s. We know that the h’s are not arbitrary, but are given by solutions to some set of equations, and I’ve shown you the general solutions for N = 4 and N = 6.

Now I really owe you an explanation of where the heck these computations come from. But at least you’ll know why I’m writing equations when you see them.

Next, I think.