Filters LAB: EEG Baseline RemovalIn this lab we will try to improve the baseline of the real EEG waves recorded with a very high sampling frequency of 100,000 Hz. The signal includes two channels...

1 answer below »
Filters LAB: EEG Baseline RemovalIn this lab we will try to improve the baseline of the real EEG waves recorded with a very high sampling frequency of 100,000 Hz. The signal includes two channels recorded with deep brain stimulation pulse stimulus. The stimulus might have multiple amplitudes from 0 to 8V, and the pulses appear at random.The problem with all EEG recordings is that their DC level is continuously drifting. This means that all frequencies below 1Hz are not reliable. In other words, the actual EEG signal (typically measured in microvolts) could ride on top of slowly changing random signal (order of millivolts to volts). Moreover, due to extremely weak signal, the EEG has a very low signal to noise ratio and the technique for removal of the noise is to do ensemble average on multiple experiments with the same stimulus. For more information on DC drift in EEG you could read here:http://www.bmedreport.com/archives/3739Load the dataLoad the file EEGdata.mat
You should see two workspace variables: EEG, which includes 2 channels of recorded data, and mark which includes 7 points at which 8V stimulation pulse appeared.Plot both EEG channels to see that they have different DC levels which are slowly changing in time:Fs = 100000; % Sampling Frequencyt = linspace(0,size(EEG,1)/Fs,size(EEG,1));???xlabel('t [sec]')ylabel('Voltage [\muV]')Extraction of 8V stimulus experimentsFrom now on we will be working only with the first channel. There were 7 trials of 8V stimulus (outlined in the mark variable). We will take 500 samples before the event and 2000 samples after the event and put them all into a matrix (columns are trials and rows are samples). This way, all of the 8V pulses will be aligned:for t=1:numel(mark) A(:,t)=EEG(mark(t)-500:mark(t)+2000,1);endplot(-0.005:1/Fs:0.02,A)All of the waves should start at 0, but they drifted and have different initial baseline value before the pulse. Our goal is to correct that.Let's design a highpass filter which will try to remove the DC baseline:Fstop = 1; % Stopband FrequencyFpass = 2; % Passband FrequencyAstop = 80; % Stopband Attenuation (dB)Apass = 1; % Passband Ripple (dB)match = 'passband'; % Band to match exactly
% Construct an FDESIGN object and call its ELLIP method.h = fdesign.highpass(Fstop, Fpass, Astop, Apass, Fs);Hd = design(h, 'ellip', 'MatchExactly', match);Now, let's apply the filter to each of the trials and plot them all again:Hint: use filtfilt(Hd.sosMatrix,Hd.ScaleValues,double(A(:,t))) for trial t.
It is better now, but not perfect. Let's try to filter the entire EEG signal first, and then to extract 8V trials:EEG2(:,1) = filtfilt(Hd.sosMatrix,Hd.ScaleValues,double(EEG(:,1)));for t=1:numel(mark) C(:,t)=EEG2(mark(t)-500:mark(t)+2000);endplot(-0.005:1/Fs:0.02,C)Discuss in comments which way is better and why.Use the last filtered set of trials and subtract from each trial the average of 20 samples which are before the pulse:
Finally, we could compute ensemble average:
Design lowpass filter in such a way that it will clean the high frequency noise from the ensemble average above (use filter designer app), but not affecting too much the deep brain stimulation pulse. Plot both filtered and unfiltered waves on the same plot.% Export your designed SOS and G values from the app; x is the enseble averageDfilt = filtfilt(SOS,G,x);plot(-0.005:1/Fs:0.02,Dfilt)
Answered 1 days AfterApr 05, 2022

Solution

Sathishkumar answered on Apr 06 2022
14 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here