MATLAB Answers

Need to break down EEG signals into 4 frequency bands

111 views (last 30 days)
san chir
san chir on 20 May 2016
Commented: Srihari Haran on 14 Sep 2020 at 16:02
Hi all, I'm having a bit of a trouble breaking down an EEG signal into these bands, i dont have a wavelet toolbox, would i need it?
theta = 4 - 7.9 Hz
Lower Alpha = 7.9 - 10 Hz
Upper Alpha = 10 - 13 Hz % edited
Lower Beta = 13 - 17.9 Hz
Upper Beta = 18 - 24.9 Hz
I have attached the signal EEG recording with this, it has 22 arrays, the eeg channels are from 2 - 15 and the sampling frequency is 128.
thank you!

  4 Comments

Show 1 older comment
NIPUN vit student
NIPUN vit student on 2 Oct 2018
Sir can U plz send me the code to decompose the EEG signal in 4 parts, I need to submit it next few hrs, PLZ mail me the code and RAW EEG signal if possible. EMAIL: ayush.yash.abyb@gmail.com
Venkatesh chowdary
Venkatesh chowdary on 30 Apr 2019
Hello sir do you have the code to decompose the eeg signal into 4 parts.If you do have plz send methe code...
shweta nashikar
shweta nashikar on 1 Sep 2019
Am fresher sir, Please send all frequency band like alpha beta gamma theta delta, separate matlab coding and caculate the parameter like standard deviation,variance,entropy etc

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 20 May 2016
You can design stable filters that do what you want relatively easily. Here is one:
Fs = 128; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [4 7.9]/Fn; % Theta Passband
Ws = Wp .* [0.6 1.05]; % Bandstop Frequencies
Rp = 10; % Passband Ripple
Rs = 40; % Stopband Ripple
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Determine Optimal Order
[b,a] = cheby2(n,Rs,Ws); % Transfer Function Coefficients
[sos_theta,g_theta] = tf2sos(b,a); % Second-Order-Section For Stability
figure(1)
freqz(sos_theta, 4096, Fs); % Filter Bode Plot
You can also put them in a loop:
Wpm = [4 7.9; 7.9 10; 10.1 12.9; 13 17.9; 18 27.9]; % Passband Matrix
Fs = 128; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Rp = 10; % Passband Ripple
Rs = 40; % Stopband Ripple
for k1 = 1:size(Wpm,1)
Wp = Wpm(k1,:)/Fn;
Ws = Wp .* [0.6 1.05];
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Determine Optimal Order
[b,a] = cheby2(n,Rs,Ws); % Transfer Function Coefficients
[sos{k1},g{k1}] = tf2sos(b,a); % Second-Order-Section For Stability
end
Please check the ‘Wpm’ entries, since ‘Upper Alpha’ and ‘Lower Alpha’ were the same in your list. I changed ‘Upper Alpha’ to what I guess they should be. The cell arrays correspond to the appropriate second-order-section filter matrices.
I looked at these filters with the freqz function, and I’m happy with them. Don’t worry about the high ‘Rp’ value, since the Cnebyshev Type II filter has a flat passband.
Use the filtfilt function to do the actual filtering. I didn’t specifically load your data and filter it. I just designed the filters. I will filter your data if you’re getting anomalous results and need further help.

  7 Comments

Show 4 older comments
Star Strider
Star Strider on 22 Aug 2019
The Chebyshev II passband and stopband characteristics.
I would now use an elliptic filter, since it is significantly more computationally efficient.
kalarmago
kalarmago on 2 Apr 2020
Dear @Star Strider, I thank you in advace my questions (I am new in signal processing).
I started to work with EEG, I tried to apply your filters, but they give NAN values, so I am processing with the classic bandpass().
  1. What is the advantage of using your filter over bandpass() ?
  2. I think, before to band pass, the signal could be denoised, isn’t it? Which do you suggest?
  3. In which part of processing is useful Fourier Transform or Wavelets T ? I so confused about filtering.
Star Strider
Star Strider on 21 Jul 2020
kalarmago —
1. The bandpass function was introduced in R2018a, two years after I wrote this! (I would currently use ellip and its friends.)
2. There are several ways to denoise a signal. For broadband noise, wdenoise or sgolayfilt are likely best, in my experience at least.
3. I have no idea what you are asking!

Sign in to comment.

More Answers (2)

Todd Leonhardt
Todd Leonhardt on 20 May 2016
Edited: Todd Leonhardt on 20 May 2016
If you have the Signal Processing Toolbox, then you can design 4 bandpass filters, one for each band, using the Filter Design and Analysis Tool (FDATool): http://www.mathworks.com/help/signal/examples/introduction-to-the-filter-design-and-analysis-tool-fdatool.html
You can also do this with a script using various MATLAB functions instead of the GUI FDATool. But if you are unfamiliar with filter design, the GUI makes it easier.
Then you can apply those FIR filters to generate 4 output signals, one for each band.
There are many other ways you could solve this problem as well. This is one approach which should be relatively easy and effective.

  0 Comments

Sign in to comment.


Swarubini P J
Swarubini P J on 22 Aug 2019
sir,
how to separate the different frequency bands from a 2 channel EEG signal

  1 Comment

Sign in to comment.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!