[Eeglablist] exact same values of spectopo.m using pwelch()

James Bonello jamesbonello9 at gmail.com
Thu Dec 18 16:32:30 PST 2014


Hi EEGLablist,

The spectopo function calculates power spectral density values for a given
signal. However I would like to try get the same exact values of the
spectopo function but using MATLAB's pwelch() function instead since this
function should give the power spectral density as well. However I am
getting completely different values and I am not sure if the way I am
calculating it is correct:

X  = EEG.data(channel_no,:,epoch_no);
         length_X  = EEG.pnts;                    % signal length
         nfft = 2^nextpow2(length_X);             % Next power of 2 from
length of x

         no_of_overlapped_samples = 0;
         window = 512;

         % get psd using pwelch()
         [spectra,freqs] = pwelch(X, window, no_of_overlapped_samples,
nfft, EEG.srate);

         spectra = 10*log(spectra);

Above I am calculating it using the pwelch() function, with spectopo it is
as below:

[spectra,freqs] = spectopo(EEG.data(channel_no,:,epoch_no), 0, EEG.srate);


Is there something I am missing or am doing wrong?

Thank you!

-- 
*James Bonello*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20141219/2a697525/attachment.html>


More information about the eeglablist mailing list