Created
June 19, 2018 23:20
-
-
Save csiki/8d4702bc4e64d690c92bff6d64f5b40a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function feature = alpha_feature(EEG) | |
% constants | |
alpha = 7 : 12; | |
left_channels = 1 : 4; | |
right_channels = 11 : 14; | |
% left mean alpha power for every channel | |
left_alpha_power_avg = 0; | |
for chan = left_channels | |
pxx = pwelch(EEG.data(chan, :)); | |
left_alpha_power_avg = left_alpha_power_avg + mean(pxx(alpha)); | |
end | |
left_alpha_power_avg = left_alpha_power_avg / length(left_channels); | |
% right mean alpha power for every channel | |
right_alpha_power_avg = 0; | |
for chan = right_channels | |
pxx = pwelch(EEG.data(chan, :)); | |
right_alpha_power_avg = right_alpha_power_avg + mean(pxx(alpha)); | |
end | |
right_alpha_power_avg = right_alpha_power_avg / length(right_channels); | |
feature = [log(left_alpha_power_avg), log(right_alpha_power_avg)]; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment