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 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Walter Roberson
on 23 Sep 2017
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 Comments
See Also
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!