在MATLAB中从Signal中提取EEG分量 [英] Extracting EEG Components from Signal within MATLAB

查看:88
本文介绍了在MATLAB中从Signal中提取EEG分量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MATLAB中有一个简单的EEG信号,如下图所示.我想要的是根据下表提取脑电图的成分.

I have a simple EEG signal in MATLAB such as that shown in the figure below. And what I wanted was to extract the components of the EEG according to the following table.

  • Delta-最高4 Hz;
  • Theta-4-> 8 Hz
  • 阿尔法 - 8 -> 13 Hz
  • 测试版-13-> 30 Hz
  • 伽玛-30-> 100 Hz

在解决这个问题的第一次尝试中,我尝试使用MATLAB中的"fdatool"构建带通滤波器,以提取分量"theta"信号,但没有成功.

In a first attempt to solve this problem I tried to build a bandpass filter with 'fdatool' from MATLAB to extract the component' theta 'signal, but without success.

随附了使用"fdatool"获得的过滤器的代码.

Along attached the code for the filter obtained with the '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 I can solve the problem?

感谢所有人

推荐答案

一种简单的方法可能是简单地获取FFT并将零频率分量归零,而不是您可能感兴趣的特定范围,然后进行逆FFT返回到时域.

One simpler approach might be to simply take the FFT and zero out frequency components other than the specific range you might be interested in, and then inverse FFT to go back to the time domain.

请记住,您必须将正频率和负频率归零才能保持频域中的信号关于0频率是共轭对称的.如果不这样做,则在计算逆FFT时会得到复杂的信号.

Keep in mind that you'll have to zero out the positive frequency and negative frequency to maintain that the signal in the frequency domain is conjugate symmetric about the 0 frequency. If you don't do this, you'll get a complex signal upon computing the inverse FFT.

例如,以下代码在时域中产生两个正弦波,产生一个对应的DFT(用FFT计算),然后去除其中一个峰值.

For instance the following code, produces two sinusoids in the time domain, a corresponding DFT (computed with FFT), and then one of the peaks removed.

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)')

需要注意的几件事.DFT中的频域具有几个不同的范围:DC偏移量(恒定)为0频率; DC偏移量(恒定)为0频率.正频率范围,是(对于长度为N的原始信号而言)从1到N/2的条目;负频率范围,是从N/2到N-1的项;请注意,这不是错别字,最高频率(N/2处的频率)是重复的,并且对于正负频率都是相同的值.(有些人使用 fftshift 来显示它,就像人类可能会绘制的一样,但这实际上只是出于外观/理解.)

A couple things to note. The frequency domain in the DFT has a few different ranges: a DC offset (constant) which is the 0 frequency; a positive frequency range, which are (for a length N original signal) the entries from 1 to N/2; a negative frequency range which are the entries from N/2 to N-1; Note, this is not a typo, the highest frequency (the one at N/2) is duplicated and is the same value for both positive and negative frequencies. (Some people use fftshift to show this as a human might plot it, but that's really just for looks/understanding.)

关于要删除的频率,您必须自己弄清楚,但我可以给您一个提示.最高频率(在频率位置N/2处)将对应于系统可代表的最高频率,即fs/2,其中fs是您的采样率.您可以相应地进行扩展,以找出要否定哪些.

As far as which frequencies to remove, you'll have to figure this out yourself, but I can give you a hint. The highest frequency (at frequency position N/2) is going to correspond to the highest frequency representable by your system, that is fs/2 where fs is your sampling rate. You can scale accordingly to figure out which ones to negate.

如果未正确取反相应的负频率,则在fft逆时会得到虚信号.

If you don't negate the corresponding negative frequencies correctly, you'll get an imaginary signal upon inverse fft.

最后一条评论.由于您需要提前使用所有信号,因此该方法仅在您有奢侈的情况下才有效,因为您需要在整个信号上使用DFT.如果要实时执行此操作,则需要像以前一样创建某种过滤器.

One last comment. This method will only work if you have the luxury of having all of your signal ahead of time since you need to use the DFT on the whole signal. If you want to do this real time, you will need to create some kind of filter as you were doing previously.

这篇关于在MATLAB中从Signal中提取EEG分量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆