0
$\begingroup$

I have a matrix [66 x 100,000] (it's some EEG data, across 66 electrodes) and want to find the mean power in the 8-13hz range. How can I do this?

I have so far: x = fft(data) What do I have to do next?

Furthermore, when I plot this I get the following:enter image description here:

I was hoping for something more like this:

enter image description here

$\endgroup$
1
$\begingroup$

Did you ever tried to follow example from MATLAB help? Result of the FFT is complex, containing information both for magnitude and phase. Thus in order to extract the magnitude you must take the absolute value of your result - abs function. What you are doing currently is plotting complex values.

Please refer to basics of DFT if you have any doubts (i.e. to understand why DFT spectrum is mirrored) and mentioned example for MATLAB fft. Here is one of ways to create frequency vector for magnitude response.

% fs --> sampling frequency to be defined.
N = length(data);
X = abs(fft(data))/N;
f = (0:N-1).*(fs/N);

If you wish to show your results in decibel scale, then convert the values with usage of 20*log10(X/ref); where ref is your reference value - can be max(abs(X)).

I am sure that having the frequency vector and magnitude values you can take it from here in order to calculate the mean value in appropriate range.

Extra things you might want to consider:

  • Apply the windowing to your signal if it is necessary (probably it is). When windowing is applied, scale not by N, but use the sum of window samples.
  • Use the Power Spectral Density estimation instead of FFT. Second figure you provided is the example of PSD - in fact this is copied from MATLAB help regarding PSD estimates using FFT. I believe you have all necessary info in there regarding periodogram.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.