Search code examples
matlabsignal-processingspectral-density

Absolute/averaged spectral power of 128 channel EEG signal


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!


Solution

  • 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.