0

I have a EEG signal with 128 channels and 500 samples as 128*500 matrix. I know we can calculate power spectral density using pmcov or pwelch in matlab for any discrete time signal. But is there any way in which I can calculate absolute or averaged spectral power for the entire signal? So that I have just one absolute power on y-axis and corresponding frequencies on x-axis which can be used to represent the entire signal?

Thanks a lot for the help!

user8020776
  • 13
  • 1
  • 3
  • `pwelch` computes power for the entire signal. Do you need average power across channels? – kedarps May 22 '17 at 21:44
  • Yes I am trying to find averaged power across all the channels which can be used to represent the entire 128*500 signal. – user8020776 May 22 '17 at 22:12

1 Answers1

0

You can do it as follows:

% assume x is 500-by-128 matrix
pxx = pwelch(x);

% convert to dB
pxx = 10*log10(pxx);

% take average across channels
avgPwr = mean(pxx, 2);

Note that I am assuming x to be 500-by-128, because pwelch computes columnwise power.

kedarps
  • 851
  • 9
  • 19
  • Thanks for the answer. I have a question, why do we convert the pxx values to dB and what is the original unit for pxx? – user8020776 May 23 '17 at 14:45
  • Usually the range of power values is high, taking the logarithm helps compress the range. If you plot `pxx` and `10*log10(pxx)`, you will be able to appreciate the difference. – kedarps May 23 '17 at 14:54
  • So this is the average band power for 128 signals separately, averaged across frequency. Is there a way I can calculate one absolute power for the entire 128 channel EEG signal? – user8020776 May 23 '17 at 15:16
  • This will give the average power across the 128 channels. It will give one power vector as a function of frequency. If you wish to get the mean across frequencies, take `mean(avgPwr)`. This should work fine, but it is not a good idea to take such averages, because you are washing out a lot of information. – kedarps May 23 '17 at 15:21
  • My sampling rate is 1000 and I am trying to use Nfft as 1000. So, pxx=pwelch(x,[],[],1000,1000); This is giving me pxx as 501*128 matrix. Here 501 are frequency samples and 128 are power of 128 channels. So, mean(pxx,1) is giving a 1*128 matrix which is the average power of 128 signals averaged across all the frequencies.?? Am I getting it right? – user8020776 May 23 '17 at 15:37
  • My bad, last line should be `mean(pxx,2)`, (see answer edit). So you get a 501x1 vector, which is power averaged across 128 channels. – kedarps May 23 '17 at 15:53
  • Thanks for confirming. Could you please tell me what is the unit of pxx before we convert it to dB. – user8020776 May 23 '17 at 20:59