I have a code for spectral analysis but I don't 100% understand it?

1 view (last 30 days)
Hey guys, so as the title says I have a script that I can use to analyse some raw EEG data (.edf). Although I have the code and can use it I don't really understand what it's doing at each stage and I'd really like to.
After the conversion the data is averaged - I assume this is to remove noise? Then something called an elliptic filter is 'setup' and 'applied' to the data - I don't really understand what this is doing?
[order, Wn] = ellipord([fmin/(fs/2), fmax/(fs/2)], [(fmin-1)/(fs/2), (fmax+1)/(fs/2)], Rp, Rs);
[B,A] = ellip(order, Rp, Rs, [fmin/(fs/2), fmax/(fs/2)]);
Then ranksums values are calculated and this is used to work out something called the energy? Energy values are obtained for each of the 'channels' which corresponds to an electrode on the EEG. I have no idea what this means, the code is as follows:
for j=1:14 [p(j),H(j),STATS(j,:)] = ranksum(Energy_EEGH(j,:),Energy_EEGL(j,:),'tail','right') end
And the output gives me 'p' and 'H' values. I understand that p values show whether or not a result set is statistically significant? So < 0.05 proves the working hypothesis and vice versa? However I don't understand what H values are and from what I can tell they can only be 0 or 1, 0 being bad and 1 being good? Thanks a lot.

Accepted Answer

Star Strider
Star Strider on 24 Aug 2016
You’re correct that the first two lines you quoted design an elliptical bandpass filter. Exactly what the passband is I can’t tell from here. It’s possible that it could be eliminating baseline offset and drift at the low end, and high-frequency noise at the high end, or alternatively, it could be passing only a specific range (band) of EEG frequencies (alpha, beta, etc.).
The ranksum call uses the Wilcoxon rank-sum test to compare the medians of two independent EEG energy measure vectors to determine if there is a decrease from ‘Energy_EEGH’ to ‘Energy_EEGL’ for that particular column.
That’s as specific as I can get. You’ll have to ask the author of the code for details.

More Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!