How to extract brain wave bands: Gamma, Beta, Alpha, Theta, Delta

H

All human beings display five different types of electrical patterns or brain waves over the cortex in order of highest frequency to lowest are as follows: Gamma, Beta, Alpha, Theta, and Delta. Each brain wave has a purpose and helps serve us in optimal mental functioning. If one of the five types of brain waves are either overproduced or under-produced in our brain, it can cause problems [1]. For this reason, it is important to understand that no single brain wave is better or more optimal than the others.

Epilepsy leaves its signature in the EEG signals. The detection of seizures occurring in the EEGs is an important component in the diagnosis and treatment of epilepsy. The separation of two important categories of abnormal activity can be observed in an EEG signal: ictal (during an epileptic seizure) and inter-ictal (between seizures). Often, the onset of a clinical seizure is characterized by a sudden change of frequency in the EEG measurement. It is normally within the alpha wave frequency band with slow reduction in frequency but increase in amplitude during the seizure period. It may or may not be spiky in shape [2]. For assisting the diagnosis and treatment of epilepsy or neurological disease, this dissertation aims to develop methods that can identify the epileptic EEG signals during seizure activity and also during seizure-free time.

preictal=trial(94799:95950,:);

ictal=trial(95950:97100,:);

[Gamma, Beta, Alpha, Theta, Delta]=waveBands(ictal);
function [Gamma, Beta, Alpha, Theta, Delta] = waveBands( eeg )

s=eeg;
figure; p=plot(s);
title('EEG Signal')
%title(tags)
 
fs = 32; 

% Sampling frequency

N=length(s); 
 
waveletFunction = 'db8';
                [C,L] = wavedec(s,8,waveletFunction);
       
                cD1 = detcoef(C,L,1); 
                cD2 = detcoef(C,L,2); 
                cD3 = detcoef(C,L,3); 
                cD4 = detcoef(C,L,4); 
                cD5 = detcoef(C,L,5); %GAMA
                cD6 = detcoef(C,L,6); %BETA
                cD7 = detcoef(C,L,7); %ALPHA
                cD8 = detcoef(C,L,8); %THETA
                cA8 = appcoef(C,L,waveletFunction,8); %DELTA 
                D1 = wrcoef('d',C,L,waveletFunction,1); 
                D2 = wrcoef('d',C,L,waveletFunction,2); 
                D3 = wrcoef('d',C,L,waveletFunction,3); 
                D4 = wrcoef('d',C,L,waveletFunction,4); 
                D5 = wrcoef('d',C,L,waveletFunction,5); %GAMMA
                D6 = wrcoef('d',C,L,waveletFunction,6); %BETA
                D7 = wrcoef('d',C,L,waveletFunction,7); %ALPHA
                D8 = wrcoef('d',C,L,waveletFunction,8); %THETA
                A8 = wrcoef('a',C,L,waveletFunction,8); %DELTA
               
                Gamma = D5; 
                t1=[1/fs:1/fs:length(Gamma(:,1))/fs];




         figure; 
          subplot(5,1,1), scrollplot( plot(t1,Gamma), 'WindowSize',30); title('GAMMA');
          %subplot(5,1,1); plot(1:1:length(Gamma),Gamma);title('GAMMA');
               
                Beta = D6; 
                t2=[1/fs:1/fs:length(Beta(:,1))/fs];
                subplot(5,1,2), scrollplot( plot(t2,Beta), 'WindowSize',30); title('Beta');
                
               % subplot(5,1,2); plot(1:1:length(Beta), Beta); title('BETA');
                
                
                Alpha = D7; 
                t3=[1/fs:1/fs:length(Alpha(:,1))/fs];
                subplot(5,1,3), scrollplot( plot(t3,Alpha), 'WindowSize',30); title('Alpha');
               
                %subplot(5,1,3); plot(1:1:length(Alpha),Alpha); title('ALPHA'); 
                
                
                Theta = D8; 
                t4=[1/fs:1/fs:length(Theta(:,1))/fs];
                subplot(5,1,4), scrollplot( plot(t4,Theta), 'WindowSize',30); title('Theta');
               
                %subplot(5,1,4); plot(1:1:length(Theta),Theta);title('THETA');
                
                
                Delta = A8; 
                t5=[1/fs:1/fs:length(Delta(:,1))/fs];
                %figure, plot(0:1/fs:1,Delta); 
                subplot(5,1,5), scrollplot( plot(t5,Delta), 'WindowSize',30); title('Delta');
                
                %subplot(5,1,5);plot(1:1:length(Delta),Delta);title('DELTA');


D5 = detrend(D5,0);
xdft = fft(D5);
freq = 0:N/length(D5):N/2;
xdft = xdft(1:length(D5)/2+1);
figure;
subplot(511), scrollplot( plot(freq,abs(xdft)), 'WindowSize',30); title('GAMMA-FREQUENCY');
%subplot(511);plot(freq,abs(xdft));title('GAMMA-FREQUENCY');
[~,I] = max(abs(xdft));
fprintf('Gamma:Maximum occurs at %3.2f Hz.\n',freq(I));

D6 = detrend(D6,0);
xdft2 = fft(D6);
freq2 = 0:N/length(D6):N/2;
xdft2 = xdft2(1:length(D6)/2+1);

subplot(512), scrollplot( plot(freq2,abs(xdft2)), 'WindowSize',30); title('BETA');
%subplot(512);plot(freq2,abs(xdft2));title('BETA-FREQUENCY');
[~,I] = max(abs(xdft2));
fprintf('Beta:Maximum occurs at %3.2f Hz.\n',freq2(I));

D7 = detrend(D7,0);
xdft3 = fft(D7);
freq3 = 0:N/length(D7):N/2;
xdft3 = xdft3(1:length(D7)/2+1);

subplot(513), scrollplot( plot(freq3,abs(xdft3)), 'WindowSize',30);title('ALPHA');
%subplot(513);plot(freq3,abs(xdft3));title('ALPHA-FREQUENCY');
[~,I] = max(abs(xdft3));
fprintf('Alpha:Maximum occurs at %f Hz.\n',freq3(I));


D8 = detrend(D8,0);
xdft4 = fft(D8);
freq4 = 0:N/length(D8):N/2;
xdft4 = xdft4(1:length(D8)/2+1);

subplot(514), scrollplot( plot(freq4,abs(xdft4)), 'WindowSize',30);title('THETA');
%subplot(514);plot(freq4,abs(xdft4));title('THETA-FREQUENCY');
[~,I] = max(abs(xdft4));
fprintf('Theta:Maximum occurs at %f Hz.\n',freq4(I));

A8 = detrend(A8,0);
xdft5 = fft(A8);
freq5 = 0:N/length(A8):N/2;
xdft5 = xdft5(1:length(A8)/2+1);
subplot(515), scrollplot( plot(freq5,abs(xdft5)), 'WindowSize',30);title('DELTA');
%subplot(515);plot(freq3,abs(xdft5));title('DELTA-FREQUENCY');
[~,I] = max(abs(xdft5));
fprintf('Delta:Maximum occurs at %f Hz.\n',freq5(I));
%%%%%%%%%%%%%%%
end

 

[1] M. H. Daily, “5 types of brain waves frequencies: Gamma, beta, alpha, theta, delta.”

[2] A. Goshvarpour, H. Ebrahimnezhad, and A. Goshvarpour, “Classification of epileptic eeg signals using time-delay neural networks and probabilistic neural networks,” International Journal of Information Engineering and Electronic Business, vol. 5, no. 1, p. 59, 2013.

Disclaimer: The present content may not be used for training artificial intelligence or machine learning algorithms. All other uses, including search, entertainment, and commercial use, are permitted.

Categories

Tags