# Use wavelet transform to extract a waveform of certain frequency [closed]

how to apply wavelet transform method to extract alpha waveform( higher and lower band frequency known) from a given known signal ?

• As the auto-generated closure message says, your question is very ill-posed --- it's not clear what you're asking. Why ask about wavelets when you also ask about a certain frequency? Surely the Fourier transform (or a variant) would be better equipped than the wavelet transform for that sort of problem? Can you explain what you mean or what you are trying to achieve? More details might give a better question and, therefore, better answers. – Peter K. Feb 3 '15 at 19:01
• I dont think what is being asked is vague. It asks how to Alpha waves (neural oscillations in the frequency range of 7.5–12.5 Hz arising from synchronous and coherent (in phase or constructive) electrical activity of thalamic pacemaker cells in humans. They are also called Berger's wave in memory of the founder of EEG). Possibly rewording of the question is necesary – Barnaby Feb 4 '15 at 14:16

## 2 Answers

The mother wavelet is a bandpass filter. This means we have to apply the CWT(in this case), calculate the correspondence between scales and frequencies, zero out everything outside the known frequency band for the alpha wave and invert the transform.

data = Import["your_sample_eeg_data"];

ListLinePlot[data] cwd = ContinuousWaveletTransform[data, MorletWavelet[], SampleRate -> 200, Padding -> 0]

freq = (cwd["SampleRate"]/(#1 cwd["Wavelet"]["FourierFactor"])) & /@
(Thread[{Range[cwd["Octaves"]], 1}] /. cwd["Scales"]);

ticks = Transpose[{Range[Length[freq]], freq}];

WaveletScalogram[cwd, Frame -> True, FrameTicks -> {{ticks, Automatic}, Automatic},
FrameLabel -> {"Time", "Frequency(Hz)"}, ColorFunction -> "SunsetColors", ImageSize -> 500] So, we are interested in the 5th octave(the region between 10.51 and 5.25, of course, roughly speaking)

mwd = WaveletMapIndexed[#1 0 &, cwd, Except[{5, _}]]

WaveletScalogram[mwd, ColorFunction -> "SunsetColors"] It's like performing a brain surgery with a chainsaw ;__;

ListLinePlot[InverseContinuousWaveletTransform[mwd]] Those are the basic steps I would perform if I have to extract a signal within a certain frequency band.

Beyond the good response of -sector-

You can use applying the prior results of a succession wavelet decompositions of a discrete Wavelet applying only one level decomposition for a haar wavelet as to segment frequencies for both Detail and Scaling coefficients. You keep on applying this until the desired range. You would need to calculate the equivalent frequency range in herts for each segmented part.

Beyond wavelets you can use mutitaper for a weak sense stationary time series (you make the series stationary of second order by any methods suitable depending on the signal - Loess regresión to remove MA, removal of existing AR terms or diferenciation which ever or combination of them provides second order stationarity to the series and then test for stationarity with time frequency stationarity tests).

Then you use multitaper to extract the spectrum of frequencies then using a white noise F test determine the relevant frequencies position in the frequency spectrum and then using this construct a band pass filter for the frequencies you want removed, effectively reconstructingt the signal desired frequency range.

See the multitaper package in R

One caveat is that it is posible that important information on the signal is eliminated by the process of making the series second order stationary. One way to minimize this is to partition the data by segmenting the data in similar variance segments. So in obtaining the second order stationarity of a similar variance segment less of the signal is eliminated in making the series second order stationarity.

Alpha waves are similar to an AR process or low MA process so the requirement of weak sense stationarity may eliminate them from the signal.