Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to calculate PSD for an EEG signal?

152 views
Skip to first unread message

dan

unread,
May 19, 2012, 11:55:12 AM5/19/12
to
I have an EEG signal with 16 channels (basically a 16*5376 matrix, with 5376 being the number of samples for each channel of the signal) corresponding to 16 electrodes.

I need to calculate the sum of the PSD on 4 different bands (0.5-4Hz ; 4-8Hz ; 8-12Hz ; 12-20Hz) for each channel of the signal.

The code i used it
for j=1:16
psd=(abs(fft(signal.samples(j,:))).^2);
thetaband = sum(psd(12:85));
alphaband= sum(psd(86:169));
betaband= sum(psd(170:295));
gammaband = sum(psd(296:421));

12, 85 are the indexed of the frequencies 0.5 and 4 in the frequency vector i created using

n=5376;
fs=256;
dt=1/fs;
t=(0:n-1)*dt;
df=1/(n*dt);
f=(0:n-1)*df;

Am i doing anything wrong here? I'm not used to working with neither matlab nor eeg signals, so i'm at a loss here...

TideMan

unread,
May 19, 2012, 5:53:46 PM5/19/12
to dan
Apart from:
1. Not dividing by df to get PSD - power spectral DENSITY
2. Writing everything over the top of the previous variables in the loop; and
3. Having no end statement to close the loop;

it looks OK to me.
0 new messages