Extracting EEG components from a signal inside MATLAB

I have a simple EEG signal in MATLAB, such as shown in the figure below. And I would like to extract the EEG components according to the following table.

  • Delta - up to 4 Hz;
  • Theta - 4 β†’ 8 Hz
  • Alpha - 8 β†’ 13 Hz
  • Beta 13 β†’ 30 Hz
  • Gamma - 30 β†’ 100 Hz

In my first attempt to solve this problem, I tried to create a bandpass filter with 'fdatool' from MATLAB in order to extract theta component signal, but to no avail.

In addition to the code for the filter obtained with 'fdatool'.

function Hd = filt_teta %FILTROPARA TETA Returns a discrete-time filter object. % % M-File generated by MATLAB(R) 7.9 and the Signal Processing Toolbox 6.12. % % Generated on: 05-May-2011 16:41:40 % % Butterworth Bandpass filter designed using FDESIGN.BANDPASS. % All frequency values are in Hz. Fs = 48000; % Sampling Frequency Fstop1 = 3; % First Stopband Frequency Fpass1 = 4; % First Passband Frequency Fpass2 = 7; % Second Passband Frequency Fstop2 = 8; % Second Stopband Frequency Astop1 = 80; % First Stopband Attenuation (dB) Apass = 1; % Passband Ripple (dB) Astop2 = 80; % Second Stopband Attenuation (dB) match = 'stopband'; % Band to match exactly % Construct an FDESIGN object and call its BUTTER method. h = fdesign.bandpass(Fstop1, Fpass1, Fpass2, Fstop2, Astop1, Apass, ... Astop2, Fs); Hd = design(h, 'butter', 'MatchExactly', match); 

Any suggestions how can I solve the problem?

Thank you all

+4
source share
2 answers

One simpler approach may be to simply take the FFT and zero frequency components other than the specific range that may interest you, and then invert the FFT to return to the time domain.

Keep in mind that you will have to zero out the positive frequency and the negative frequency in order to maintain that the signal in the frequency domain is conjugate symmetrical with respect to 0 frequency. If you do not, you will receive a complex signal when calculating the inverse FFT.

EDIT: For example, the following code creates two sine waves in the time domain corresponding to a DFT (calculated using FFT), and then one of the peaks is deleted.

 t = 0:0.01:0.999; x = sin(t*2*pi*4) + cos(t*2*pi*8); subplot(2,2,1); plot(x) title('time domain') subplot(2,2,2); xf = fft(x); plot(abs(xf)) title('frequency domain'); subplot(2,2,3); xf(9) = 0; xf(93) = 0; % manual removal of the higher frequency plot(abs(xf)); title('freq. domain (higher frequency removed)'); subplot(2,2,4); plot(ifft(xf)); title('Time domain (with one frequency removed)') 

A few things to note. The frequency domain in the DFT has several different ranges: constant bias (constant), which is a frequency of 0; a positive frequency range, which (for a long N source signal) is from 1 to N / 2; negative frequency range, which is entries from N / 2 to N-1; Please note that this is not a typo, the highest frequency (one in N / 2) is duplicated and is the same value for both positive and negative frequencies. (Some people use fftshift to show this, as a person can plot it, but it's really just for the sights / understanding.)

As for the frequencies that need to be removed, you have to figure it out yourself, but I can give you a hint. The highest frequency (at frequency position N / 2) will correspond to the highest frequency represented by your system, i.e. fs / 2, where fs is your sampling rate. You can scale to determine which ones should be denied.

If you do not deny the corresponding negative frequencies correctly, you will get an imaginary signal with the opposite fft.

Last comment. This method will only work if you have the luxury of having your entire signal ahead of time, since you need to use the DFT on the entire signal. If you want to do this in real time, you will need to create some kind of filter, as you did before.

+4
source

If filters do not have restrictions on their length, select sharper edges for the filters. If I were in your place, I would build various filters (low pass and high pass) and process the result in the Fourier transform to see that the frequency of the high frequencies or low frequencies is mixed with the frequency range. 1) Create a lower pass, extend the delta 2) Build a passband for theta alpha beta 3) Create a high pass filter, extract the gamma.

+1
source

All Articles