this is my first time extracting eeg signal.for practising only beta wave is taken.after running my code there doesn't show any curve though no error is found.M1 is declared as variable help me to find the problem
4 次查看(过去 30 天)
显示 更早的评论
load S001R01_edfm.mat;% loading data
Ts=2;% sampling period
Fs=500;%sampling frequency
[N,nu]=size(M1);%obtain size of data
t=(1:N)*Ts;%generates time vector
%%Raw Signal Analysis
figure()
title('EEG Wave Patterns')
subplot (2,1,1),plot(t,M1)
grid on;
xlabel('Time(s)')
ylabel('Amplitude')
title('Raw EEG Signal')
xlim([0 (1600)])
%BETA BANDPASS FILTER (12-30)
Fs = 500; % Sampling Frequency
Fstop1 = 11.5; % First Stopband Frequency
Fpass1 = 12; % First Passband Frequency
Fpass2 = 30; % Second Passband Frequency
Fstop2 = 30.5; % Second Stopband Frequency
Dstop1 = 0.0001; % First Stopband Attenuation
Dpass = 0.057501127785; % Passband Ripple
Dstop2 = 0.0001; % Second Stopband Attenuation
dens = 20; % Density Factor
% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 1 ...
0], [Dstop1 Dpass Dstop2]);
% Calculate the coefficients using the FIRPM function
b4 = firpm(N, Fo, Ao, W, {dens});
Hd4 = dfilt.dffir(b4);
x4=filter(Hd4,M1);
subplot(2,1,2), plot(t,x4)
grid on;
xlabel('Time(s)')
ylabel('Amplitude')
title('BETA Waves')
xlim([0 (1600)])
title('waveform for BETA band')
0 个评论
回答(2 个)
Walter Roberson
2017-9-23
Your code
t=(1:N)*Ts;%generates time vector
is not right: it does not take into account the sampling frequency. More likely to be right would be
t = (0:N-1) / Fs;
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 EEG/MEG/ECoG 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!