ECE/BIOM 537: Biomedical Signal Processing
Colorado State University
Student: Minh Anh Nguyen
Email: minhanhnguyen@q.com
1.
This homework will demonstrate EEG
signal processing techniques and interpretation. A 10 s signal, with sampling
rate of 512 samples per second, has been provided. The signal was monitored and
obtained using the C4 and P4 electrodes, and is a differential voltage signal (Image (Links to an external site.) ).
The signal in the attached file,
'EEGsig', will be used for parts a through d, while 'EEGsig_wander' will be
used in part e. Use two of the methods discussed in
class to estimate the power spectral density of the 10 s epoch, and compare
them with some discussion.
a)
Estimate the dominant frequency
region in the EEG signal using the PSD estimates. Given your knowledge of the
frequency bandwidths in EEG signals and the location of the electrodes, what
type of wave might this signal represent? What might it indicate?
The
dominant frequency is 8.3Hz, which indicates that the EEG signal is for Theta
wave (8-13Hz).
The maximum power occurs at 8.3 Hz
The power estimate is 0.67
b)
Design a low-pass filter to be used
on the EEG signal. Choose a cut-off frequency that retains the energy in the
dominant frequency region found in part b. Discuss your choice of cut-off
frequency and how well your filter worked.
The cut-off frequency is 175Hz; because the dominant
frequency is 8-10 Hz and the plot becomes flat after 175Hz. After 175Hz signal has a lot of noise.
Low-pass filters
will pass low frequencies without change, but attenuate (i.e. reduce)
frequencies above the cutoff frequency
c)
Plot the low-pass filtered signal
using the filter you designed in part c, then comment on the new signal.
e)
The original signal had
low-frequency artifacts (baseline wander, etc) that were removed for the signal
in parts a-d. Using EEGsig_wander, find a way to remove the baseline wander to
approximate EEGsig. Discuss the method used and how well it worked. You can
quantify the difference using a metric like mean squared error, if you prefer
.
Matlab code:
ECE/BIOM 537: Biomedical Signal Processing
Colorado State University
Student: Minh Anh Nguyen
Email: minhanhnguyen@q.com
l close all; clear all; clc;
fs = 512 % fs — Sampling frequency, positive scalar. Sampling frequency, specified as a positive scalar. The sampling frequency is the number of samples per unit time. If the unit of time is seconds, the sampling frequency has units of hertz.
T = 1/fs;% sampling rate or frequency
load('J:\BIOM_Signal_processing\HW10\hmwk_EEGs') % contains eeg1 and fs
N =length(EEGsig); ls = size(EEGsig); % find the length of the data per second
tx =[0:length(EEGsig)-1]/fs;% Make time axis for EEG signal
fx = fs*(0:N/2-1)/N; %Prepare freq data for plot
figure; subplot (211), plot(tx,EEGsig); xlabel('Time (s)'), ylabel('Amplitude (uV)'), title('Original EEG signal'); %EEG waveform
subplot(212), plot(tx,EEGsig);
xlabel('Time (s)'), ylabel('Amplitude (uV)'), title('Zoom into original EEG signal at 1 to 2 seconds'), xlim([1,2]) % Used to zoom in on single ECG waveformfigure;
%The mean of the PSDs of xl
mean_EEGsig = mean(EEGsig);
max_value=max(EEGsig);
mean_value=mean(EEGsig);
threshold=(max_value-mean_value)/2;
%Estimate the power spectrum of the 10-s epoch by computing the periodogram
%% this method is slide the window through the entire data at every 1/2 second, calculate the frequency, average it.
[p,f] = pwelch(EEGsig,hamming(fs),.5*fs, 2*fs,fs); %%
figure; subplot(421), plot (f,10*log10(p),'r'); xlabel('freq (hz)');
ylabel('PSD Amplitude'); title('Power SPectral Density via Welchs method and hamming window');grid on; xlabel('freq (hz)');ylabel('PSD Amplitude (dB)');
subplot(422), plot (f,10*log10(p),'g'); xlabel('freq (hz)');ylabel('PSD Amplitude (dB)'); title('Power SPectral Density via Welchs method zoom in at 60 hz'); xlim([0,60]);grid on;
x= EEGsig;
[pxx,f] = periodogram(EEGsig,hamming(length(x)),length(x),fs,'power');
[pwrest,idx] = max(pxx);
fprintf('The maximum power occurs at %3.1f Hz\n',f(idx));
fprintf('The power estimate is %2.2f\n',pwrest);
subplot(423), plot(f,10*log10(pxx));title('Power SPectral Density via periodogram method and hamming window');grid on; xlabel('freq (hz)');ylabel('PSD Amplitude (dB)');
subplot(424), plot(f,10*log10(pxx));title('Power SPectral Density via periodogram method and hamming window zoom in at 60Hz');grid on; xlabel('freq (hz)');ylabel('PSD Amplitude (dB)');xlim([0,60]);
%% low pass filter
lpfLength=127; % Order/Number of Filter coefficients
fc = 30; %% cutoff frequency
Wn=(2*fc)/fs; h1=fir1(lpfLength,Wn);
figure; plot(h1);xlabel('Time in Seconds'); ylabel('Magnitude'); title('Low-pass filter');
fi = filtfilt(h1,1,EEGsig);
figure; plot(fi); title ('filtfilt');
%Compute the Fourier transform
Tr1 = conv(EEGsig,h1);
figure; plot(Tr1);
Click on the link below to download the EEG raw data:
hmwk_EEG.mat file
fs = 512 % fs — Sampling frequency, positive scalar. Sampling frequency, specified as a positive scalar. The sampling frequency is the number of samples per unit time. If the unit of time is seconds, the sampling frequency has units of hertz.
T = 1/fs;% sampling rate or frequency
load('J:\BIOM_Signal_processing\HW10\hmwk_EEGs') % contains eeg1 and fs
N =length(EEGsig); ls = size(EEGsig); % find the length of the data per second
tx =[0:length(EEGsig)-1]/fs;% Make time axis for EEG signal
fx = fs*(0:N/2-1)/N; %Prepare freq data for plot
figure; subplot (211), plot(tx,EEGsig); xlabel('Time (s)'), ylabel('Amplitude (uV)'), title('Original EEG signal'); %EEG waveform
subplot(212), plot(tx,EEGsig);
xlabel('Time (s)'), ylabel('Amplitude (uV)'), title('Zoom into original EEG signal at 1 to 2 seconds'), xlim([1,2]) % Used to zoom in on single ECG waveformfigure;
%The mean of the PSDs of xl
mean_EEGsig = mean(EEGsig);
max_value=max(EEGsig);
mean_value=mean(EEGsig);
threshold=(max_value-mean_value)/2;
%Estimate the power spectrum of the 10-s epoch by computing the periodogram
%% this method is slide the window through the entire data at every 1/2 second, calculate the frequency, average it.
[p,f] = pwelch(EEGsig,hamming(fs),.5*fs, 2*fs,fs); %%
figure; subplot(421), plot (f,10*log10(p),'r'); xlabel('freq (hz)');
ylabel('PSD Amplitude'); title('Power SPectral Density via Welchs method and hamming window');grid on; xlabel('freq (hz)');ylabel('PSD Amplitude (dB)');
subplot(422), plot (f,10*log10(p),'g'); xlabel('freq (hz)');ylabel('PSD Amplitude (dB)'); title('Power SPectral Density via Welchs method zoom in at 60 hz'); xlim([0,60]);grid on;
x= EEGsig;
[pxx,f] = periodogram(EEGsig,hamming(length(x)),length(x),fs,'power');
[pwrest,idx] = max(pxx);
fprintf('The maximum power occurs at %3.1f Hz\n',f(idx));
fprintf('The power estimate is %2.2f\n',pwrest);
subplot(423), plot(f,10*log10(pxx));title('Power SPectral Density via periodogram method and hamming window');grid on; xlabel('freq (hz)');ylabel('PSD Amplitude (dB)');
subplot(424), plot(f,10*log10(pxx));title('Power SPectral Density via periodogram method and hamming window zoom in at 60Hz');grid on; xlabel('freq (hz)');ylabel('PSD Amplitude (dB)');xlim([0,60]);
%% low pass filter
lpfLength=127; % Order/Number of Filter coefficients
fc = 30; %% cutoff frequency
Wn=(2*fc)/fs; h1=fir1(lpfLength,Wn);
figure; plot(h1);xlabel('Time in Seconds'); ylabel('Magnitude'); title('Low-pass filter');
fi = filtfilt(h1,1,EEGsig);
figure; plot(fi); title ('filtfilt');
%Compute the Fourier transform
Tr1 = conv(EEGsig,h1);
figure; plot(Tr1);
Click on the link below to download the EEG raw data:
hmwk_EEG.mat file
This comment has been removed by the author.
ReplyDeleteThank you very much for providing help to understand analysis of EEG signal.
ReplyDeleteplease provide the code for
splitting or classification of EEG for getting frequency band in EEG signals like DELTA (0.5 to 4 Hz) THETA(4 to 8 Hz), APLA( 8 to 12 Hz),BETA( 12 to 30 Hz),GAMMA( >30 Hz)
I am looking forward to a positive response from you.
THANK YOU SO MUCH FOR YOUR TIME AND CONSIDERATION
can u pls mail me the load file or raw signal file.('J:\BIOM_Signal_processing\HW10\hmwk_EEGs')
ReplyDeleteminkscdl@gmail.com
https://drive.google.com/file/d/0B8b2y53z8_NsTjlac2hDYXh6Ylk/view
Deleteatleast tell how u have taken variables in the raw data file .
ReplyDeletehi i would like to see your raw eeg signal file so that i may try to use your codes. this is my email address. aaronkarlo_maranan@yahoo.com
ReplyDeletethank you.
can u mail me your eeg raw file signal
ReplyDeletemail id-purushotamdeora@gmail.com
Thank you very much.
ReplyDeleteHi. I want matlab codes about analysis eeg with CCA and MEC algorithm and fond eeg signal labels.plz help me.tkanks
ReplyDeleteHi. I want matlab codes about analysis eeg with CCA and MEC algorithm and fond eeg signal labels.plz help me.tkanks
ReplyDeleteThank you very much.
ReplyDeletehi i would like to see your raw eeg signal file so that i may try to use your codes. this is my email
ReplyDeleteaddress.
nehad19944@gmail.com
J:\BIOM_Signal_processing\HW10\hmwk_EEGs
hi i would like to see your raw eeg signal file so that i may try to use your codes. this is my email
ReplyDeletegahan97@gmail.com
hi i would like to see your raw eeg signal file so that i may try to use your codes. this is my email saurabh.telharkar@gmailcom
ReplyDeleteHi thank u very much for this code.
ReplyDeletecan u pls mail me the code for epilepsy classification using eeg signals.
I am looking forward to a positive response from you.
thanks alot again and this is my email:
faris2205@gmail.com
i need raw eeg data. please send to me in seethalvs93@gmail.com
ReplyDeleteHi thank u very much for this code.
ReplyDeletecan u pls mail me the code for epilepsy classification using eeg signals.
I am looking forward to a positive response from you.
thanks alot again and this is my email:
faris2005@gmail.com
can someone help me in matlab coding to filter original wave for my channel?
ReplyDeletei can not run this code. shows error in line 4. please sone one tell me what can i do?
ReplyDeleteHai.. I need matlab code for preprocessing of EEG signal.. can someone send me MATLAB code.. email id- monicasweety39@gmail.com
ReplyDeleteHello currently working on EEG Based Human stress detection could any one share the database used and the MATLAB Code for refernce .
ReplyDeleteketkigijare@gmail.com
i want EEG database for Alzheimer's diseases please help me
ReplyDeletecan someone provide me the P300 speller matrix BCI analysis matlab code please?
ReplyDeleteI have my own .mat file but i am not sure what I am supposed to replace EEGsig with, if you could please explain how you got that array of numbers
ReplyDeleteCongrats on your post. Everything works like a charm. Thank you. Excellent work. All the best.
ReplyDeleteHi. Anyone have MATLAB code for preprocessing of EEG data in EDF format. can anyone send me the code pliz.
ReplyDeletes11101819@student.usp.ac.fj
hii,i am new this topic. I need matlab code for preprocessing of EEG signal. please provide the code for
ReplyDeletesplitting or classification of EEG for getting frequency band in EEG signals like DELTA (0.5 to 4 Hz) THETA(4 to 8 Hz), APLA( 8 to 12 Hz),BETA( 12 to 30 Hz),GAMMA( >30 Hz).can anyone send me the code plz
nparvin698@gmail.com
Hi..i want license agreement of eeg signal that are converted into scale from 1 to 100
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi.. I'm in a need of MATLAB Code for CCA on EEG signals. I'll be grateful if anyone can provide this.
ReplyDeleteThanking you in advance,
Vidyasri.
Hi, can you please mail me your EEG raw file signal
ReplyDeleteMAIL ID : dominat865@gmail.com
Можете ли вы отправить мне свой сигнальный файл EEG
ReplyDeleteпо электронной почте astaninnamargo@rambler.ru
can u mail me your eeg raw file signal
ReplyDeletemail astaninnamargo@rambler.ru
Respect and I have a swell provide: average cost to remodel a house
ReplyDelete