Visit Homepage

This is what a one second sample of brainwaves looks like when graphed: So based on these squiggly brainwaves, how do we calculate frequencies and amplitudes?

Luckily mathematicians have come up with a solution called “Spectrum Analysis using Fourier transform”. The basic idea is that every wave, no matter how complex and irregular, can be represented by combining a number of simple (sine and cosine) waves.

For example: where two sine waves are added together, creating a more complex waveform, this is called “Fourier Synthesis”.  “Fourier Transform” is the opposite, where a complex waveform is broken down into it’s simpler waves (called sinusoidal or spectral components).

The Brainwave Analyzer, using “Fast Fourier Transform” or FFT, calculates the FFT real numbers and the FFT imaginary numbers.

Original input file: And then import into the Brainwave Analyzer.

Click on the “Analyze” button, then scroll down until you get to the “File Export” section. Then, where it says “Export numbers table for all seconds”, click on “Download file”. And here’s what the FFT and FFTimag (FFT imaginary number) look like when graphed: This is how the amplitude is calculated:

Amplitude = square root ( (FFT x FFT) + (FFTimag x FFTimag))

And next to “Amplitude” in the results spreadsheet, is “Frequency Index”.

As you can see, the “Frequency Index” looks like this: 0,1,2,3,4,5,6, etc… Note, if you are opening the csv file using excel, make sure to increase the width of the columns so that you can see at least 5 or 6 decimal places.

So for example to calculate the “Amplitude” at “Frequency Index” 1

Amplitude = square root ( (-5060.595 x -5060.595) + (-7575.272 x -7575.272))

Amplitude = square root ( (25609621.754025) + (57384745.873984))

Amplitude = square root ( 82994367.628009 )

Amplitude = 9110.12445732818

Amplitude = 9110.124 (rounded down)

The same method is used to calculate the amplitude at “Frequency Index” 2, 3, 4, 5, etc…

The Mindwave has a sampling rate of 512 Hz, or in other words 512 lines of data per second. EEG machines vary in their sampling rates, some higher-end EEG machines have sampling rates of 1000 Hz or even higher, while many have sampling rates of 200 Hz or 250 Hz. The sampling rate has to be twice has high as the highest frequency to be measured. Since the high end of Gamma brainwaves is usually considered to be 100 Hz, an EEG machine with a sampling rate of 200 Hz is sufficient.

Because the Mindwave has a sampling rate of 512, the Frequency Index goes up to 256 (half of 512). The Brainwave Analyzer doesn’t calculate anything past the Frequency Index of 256, as they results would be a mirror image of the first 256 Frequency Index.

Using excel, I did a bar graph of the Amplitude and Frequency Index: And this is how the Brainwave Analyzer graphs the Amplitudes and Frequency Index: The results show that this one second of EEG readings contains multitudes of different frequencies of different amplitudes.

The thing is though, unless you are an advanced math expert this method is pretty strange and makes no logical sense.

Luckily there is a way to test this method. Here is a simple wave with a frequency of 3

If you download it, import it into the Brainwave Analyzer, and click on “Analyze”, here are the results: No advanced math is needed to see that this wave has a frequency of 3, and this is exactly the results of the Brainwave Analyzer thanks to the power of “Spectrum Analysis using Fourier transform”.

And here is a simple wave with a frequency of 4

These csv files were created using an equation I found in the excellent book “Fundamentals of Time-Frequency Analyses
in Matlab/Octave” by Mike X Cohen.

More on Fourier Transform:

The Fourier Transform isn’t just used to analyze brainwaves, in fact it is essential for the analysis of sound, light, energy, chemicals, images, etc… It is no wonder it is considered one of the most important mathematical equations ever discovered.

https://www.theguardian.com/science/2014/jul/13/fourier-transform-maths-equations-history

https://en.wikipedia.org/wiki/Fourier_analysis

https://www.nayuki.io/page/free-small-fft-in-multiple-languages

https://www.nayuki.io/page/how-to-implement-the-discrete-fourier-transform

If you have any questions, don’t hesitate to post in comments.

1. Princeton University February 7, 2017

It’s surprising to find on brainwaves.io a resource so precious about equations.

We will note your page as a benchmark for How
to Calculate Frequencies and Amplitudes.
We also invite you to link and other web resources for equations like http://equation-solver.org/ or https://en.wikipedia.org/wiki/Equation.
Thank you ang good luck!

• katie356 February 8, 2017

Hi Princeton

Thank you so much for your kind words!