## D4 dyadic wavelet

We can compute the mother wavelet from the scaling function. Let me show you how to do this for Daubechies’s D4.

First, we need the scaling function.

**the D4 scaling function again, quickly**

This is review. There is a matrix M0 which has an eigenvector with eigenvalue 1, and that eigenvector gives me the values of the scaling function at the integers. Once I have initial values, I can compute by recursion (and because of the specific form of the recursion, only at points whose denominator is a power of 2).

I start by constructing the matrix M0 in principle…

(This comes from evaluating the dilation equation at the integers, then writing the resulting system of equations as a matrix-vector equation. It turns out to be . In fact, I construct M0 from its pattern, but i know how to derive – hence check – it.)

Then I set the values of the filter coefficients h…

The matrix M0 becomes…

Now I look for an eigenvector having eigenvalue 1. Here are the eigenvalues (first row) and eigenvectors (subsequent rows)…

We see, as we saw before, that we want the first eigenvector from that list. Mathematica has given me a vector of length 1; I want a vector – I’ll explain later – whose components sum to 1.

I take those components as the initial values of the scaling function, i.e. its values at the integers. Then I write a recursive function definition, which includes the requirement that the function is zero outside the interval [0,3].

Frankly, the easiest way to show it to you is a drawing, especially of what Mathematica knows after I make the definition; read the last line.

In order to make a point, I am not going to evaluate that function anywhere else. I have all I need for now.

**the D4 mother wavelet**

Let me hand you another recipe. The “mother wavelet” satisfies an equation very much like the dilation equation. We have

We do not have to specify that the function is zero outside [0,3]; all we have to do is feed it .

It’s important that it is not a recursion for : the LHS is but the RHS is still the scaling function . And the coefficients have changed. They are often denoted by h1 or by g. I think I’ll use g.

The g(n) are related to the h(n), but not uniquely. In general,

, for L an even integer (I’m pretty sure it has to be even).

An extremely convenient choice is L = N, the number of nonzero h’s, in which case we get

,

which simply says reverse the h’s and alternate the signs.

That is, for our case, N = 4, so we’re looking at h(3-n), and then

g(0) = h(3)

g(1) = -h(2)

g(2) = h(1)

g(3) = -h(0)

(or the negative of all those).

Here are our h’s again…

or

We reverse them, and alternate the signs, in order to get the g’s.

or

Oddly enough, Burrus et al. showed the opposite of those signs. That doesn’t agree with their own equation, and it would lead to the negative of the following graph – but my picture matches their picture!

Now we define in terms of …

It’s time to just plot the D4 mother wavelet.

and that looks good.

NOTE that it will compute whatever it needs of , so in a sense it is recursive. This is the point I wanted to make: I did not have to compute for it, it could do it itself.

Just to put them near each other, here’s a picture of the scaling function:

## the Haar wavelet system

Let me show you all of that again for a much simpler case. The Haar wavelets, as they are now called, were invented long before we knew they were a wavelet system. Its scaling function is a step function, defined to be 1 on the half open interval [1,0) and zero elsewhere. I will eventually show you – I hope – that it could be considered the D2 scaling function also.

Oh, here I go again using a cannon when a slingshot would more than suffice. There is no reason to use recursion to graph this scaling function, nor even to graph this mother wavelet. But it’s nice to know that the algorithm works in the simplest case.

**Haar (D2) scaling function**

We start with the M0 matrix in principle, for two nonzero h’s…

I simply tell you that the h’s have these (two identical) values…

Then the matrix M0 is…

Well, well. By inspection – it’s diagonal! – there are two eigenvalues equal to 1, and the eigenvectors are the columns of that matrix. We might as well choose the eigenvector

The sum of the components is already 1, so we don’t need to scale it to get the initial values of the scaling function.

We define the scaling function as usual…

Let’s plot it.

A unit step function on the half-open unit interval. I’m rather pleased to see that.

**D2 wavelet**

To get the g’s for the mother wavelet, we reverse the h’s (oh, they’re the same!) and alternate the signs…

We write the definition… ask what we know… and then we plot the mother wavelet…

Yes! That’s exactly what I wanted to see. And if you’ve ever seen the Haar (D2) mother wavelet, it’s what you wanted to see, too.

I think the next post will show you a few more scaling functions and mother wavelets, for six nonzero h’s.

September 25, 2010 at 7:23 am

Really Very Helpfull. Thanks for writing this. I was stuck in these things from many days. and i got it now .. Thanks Again.. 🙂

September 25, 2010 at 8:04 am

You’re welcome. It’s nice to know that my posts are helping.

Rip