# Anybody know anything about Wavelets?

Specifically the discrete wavelet transform. Even more specifically, how to determine the frequency bands that result from the samples and how to calculate the power in that band.
Example:

I have some EEG data. I load it up in Matlab in the wavelet toolbox using their GUI, and do the discrete wavelet transform. I have arbitrarily picked the daubechie5 wavelet. From my understanding, since my signal was originally sampled at 500 Hz, the first level transform breaks it into 0-250 Hz, and 250-500 Hz. The lower 0-250 Hz is the so-called approximation, and the 250-500 Hz is the details. Fine. Then the second level would break the approximation into two again, and so on and so on until after 5 levels I have 5 sets of detail coefficients and 1 set of approximation coefficients. From these I can reconstruct the waveform.
In theory, or at least in my head, if I’m interested in the 61-125 Hz range, I can take detail set 3 (set 1 being 250-500, 2 = 125 - 250, 3 = 61-125) and the final approximation and reconstruct the signal from just that and I should get the time-scale-amplitude for only that scale.

Here are my questions:

Is that breaking things in half correct? So if I wanted to see 125-250 Hz, I’d look at level 3?
How would I calculate the power in the signal in that frequency band assuming I’m correct on how to extract it?
I’m sure I’ll think of more, but after reading so many articles that assume I have some basic knowledge that I don’t have, I’m getting a bit lost.

I’m not very familiar with wavelets, but I was wondering if there’s a particular reason you’re not using a Fourier transformation. I would have thought that it would be the ideal representation for the information you’re trying to gather.

The Fourier transformation gives me a very precise frequency localization, but no time localization. Unfortunately I need both, to a less precise degree.

Sort of a bump, but also a realization. If I sample at 500 Hz, the max frequency I can reliably recreate is 250 Hz. So really after the first half-band filter, I get a max frequency of 125 Hz. If I’m looking for the 31-62 Hz range, then it’s the third step I want.
Despite this, anybody have a clue how to calculate the power of a wavelet transform?

Bump. Anybody?

I’m surprised no one else has answered this. I was hoping to learn something too, since I don’t know much about Daubechies wavelets. But here are some generic comments which might be somewhat useful.

First, a wavelet expansion is a linear functional (that is, a linear combination of the wavelet basis functions). This is good because it means that you can use Fourier analysis to understand the behavior of the coefficients. (The coefficients are usually defined as convolutions of the time samples with a set of dual basis functions; in frequency space, this turns into a multiplication of the two Fourier transforms.) So one way of figuring out your first question is to plot the (amplitude of the) Fourier transform of the dual-basis functions. The ones you want are then the ones that look like bandpass filters in the 62-125Hz range. Another way of doing this (if, for example, you don’t know the explicit forms of the basis functions, or you want to avoid all of that tedious theory stuff), would be to sample the frequency response by simply putting in sinusoids of various frequencies and phases and seeing what comes out.

With the Fourier decomposition, the power spectral density is easy to find, by summing the squared magnitudes of the appropriate coefficients (Parseval’s theorem, etc.). This works because the expansion functions (the sines and cosines, or the complex exponentials) form an orthonormal basis: they are normalized (to unit power over the interval of interest) and they are orthogonal to one another. I think this is the case for many choices of Daubechies wavelets, but I’m not sure if it’s always the case (in particular, I don’t know if it’s true in your case). If so, then the same technique should work here: the total power is the sum of the squared magnitudes of the basis coefficients, and the sum over a subset of coefficients gives the power in the band(s) filtered by the corresponding basis function.

(Note that in any case, this “filtering” is not going to be perfect. Different wavelet expansions have different filter responses; you have to examine the coefficient frequency response to see whether the filtering is good enough for your purposes. Estimating frequency components from a short time series is not always as easy as throwing the series at a linear filter.)

[QUOTE=audiobottle]
Specifically the discrete wavelet transform.

“The”?

Okay, you specify to the Daubechies wavelet basis. But it looks like you’re just looking for a frequency analysis. Wavelets are important for looking at frequency and time. That is, you’re probably better off with the simpler Fourier analysis.

Reading further… you say you need both, but you never say why. Look, why not just get a book on functional analysis and try to learn why it works and not just plow headlong into a tool suite like a benighted engineer? Try Rudin’s book first, and it might do to work through real analysis first (also Rudin, or Royden). Then move on to Ingrid’s and Yves’ work.

Thanks for the great responses (even one by e-mail that was very helpful!). I see I need to clear up why I have to use wavelets. Basically, it’s because I was told to. Recently there’s been a growing use of wavelet analysis on EEG signals because of its good time-frequency resolution. I can’t use a straight Fourier transform, because like I said, the timing is particularly important.
I am looking for the gamma band respones, both time-locked to the presentation of a stimulus and not time-locked. The time-locked response would be pretty easily found by using the STFT since it’s duration and timing is pretty well known. However, the not time-locked response could happen at any time, anywhere, for any kind of duration. Okay, not any, but it’s not as easily found.
Basically I was given a task to do a wavelet analysis of some EEG signals, and to try and have something pretty to show in about two weeks. So I’ve been reading through articles and attempting to reproduce what they do, but many of the articles suppose a prior familiarity with the technique. My signal processing was limited to Fourier transforms, and even that I haven’t done anything with in a few years. My PI says they want something, but they don’t really know exactly what it is they want. My job then becomes to give them something, and to hope that it works out well enough for a grant renewal.