我需要检查EEG信号的质量,看看信号中是否有噪音(例如50 Hz线路噪音)。 对于我到目前为止所阅读的内容,检查的一个好方法是对所有电极和单个电极(例如Cz)进行单侧振幅频谱分析。
我运行了以下代码:
%Open the file
FileName = 'Data.dat';
fid = fopen(FileName);
if fid < 0, error('Cannot open file'); end
signal = fread(fid, Inf, 'float32');
fclose(fid);
%Set the parameters of the recording
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sample time
L = length(signal); % Length of signal
%Amplitude spectrum analysis
NFFT = 2^(nextpow2(L)-1);
x=zeros(NFFT,1);
x(1:NFFT,1) = signal(1:NFFT,1);
YY = fft(x,NFFT)/L;
ff = Fs/2*linspace(0,1,NFFT/2+1);
%is taking the positive half of the spectrum (NFFT/2 +1 gives this, including 0 and nyquist, hence the +1) and mapping it onto your real frequencies from 'normalised frequency'.
% Plot single-sided amplitude spectrum.
figure; plot(ff,2*abs(YY(1:NFFT/2+1))), title('Single-Sided Amplitude Spectrum of tp'), xlabel('Frequency (Hz)'), ylabel('|Y(f)|');
我不确定如何只绘制一个频道(例如Cz是频道28)。
(我有64个频道,10-20 IS)。
非常感谢任何建议。