Removing baseline drift from EOG signal

52 views (last 30 days)
Mahsa Rm
Mahsa Rm on 29 May 2021
Edited: Mahsa Rm on 29 May 2021
I have eog datas (that has been recorded with 250 hz sample rate) and I want to analyze them, but at first I need to remove baseline drift from its channels. each recording has two channels(A & B). I'm not sure how to do it. Any help will be appreciated. .

Answers (2)

William Rose
William Rose on 29 May 2021
A high pass filter is usually the solution. You need to specify the cutoff frequency. Oscillaitons below the cutoff will be suppressed. I woudl start by trying highpass cutoff frequency from 0.5 Hz to 10 Hz.
Make a highpass filter wiht butter() and apply it to your signal with filtfilt(). filtfilt() is nice because is does not introduce a phase shift and it handles the beginning and the end in a reasonable way.
fs=250; %sampling frequency (Hz)
N=2000; %number of points
t=(0:N-1)/fs; %time vector
x=randn(1,N); %simulated EOG (random Gaussian noise)
%next: add extra noise at low frequencies to simulate drift
f=[.125 .25 .375 .5 .625 .75 .875 1]; %low frequency noise frequencies
for i=1:8
x=x+cos(2*pi*(t*f(i)+rand(1))); %add low frequency noise
end
%next: make a filter and apply it to the signal
fco=2; %cutoff frequency (Hz)
Np=4; %filter order=number of poles
[b,a]=butter(Np,fco/(fs/2),'high'); %high pass Butterworth filter coefficients
y=filtfilt(b,a,x); %apply the filter to x(t)
%next: plot the signal and filtered signal
figure;
subplot(2,1,1); plot(t,x,'r-');
xlabel('Time (s)'); ylabel ('EOG');
subplot(2,1,2); plot(t,y,'b-');
xlabel('Time (s)'); ylabel ('Filt. EOG');
Try it.

William Rose
William Rose on 29 May 2021
Edited: William Rose on 29 May 2021
@Mahsa Rm, The initial posting of your question did not include the data file or the figure - at least I did not see them. That is why I simulated a signal. You can apply the idea in my code to your signals. However, your A and B signal appear to include step changes in the baseline. I wuld not call that drift because it is not a slow process - it is abrupt. A high pass filter removes drift (i.e. low frequency variation in the baseline), but it will not remove a step change in the baseline (which includes high frequencies). A low pass filter will not be suitable, because it would suppress the phsyiologically useful part of the EOG, as well as the step change. Therefore I would develop a more customized solution.
Move across the signal one point at a time. At each time point, compute the standard deviation and the mean of the M preceding points, and the s.d. and mean of the current point plus M-1 additional points. Average the 2 SD's. If the means differ by more than T times the average SD (where T=3 or 4 or 5 maybe), then a baseline shift has happened. The magnitude of the shift is the difference of the means. Shift the current point and all future points by that amount. Continue, point by point, along the signal, until done, because there may be more than one shift.
Then apply a highpass filter, as described in my previous answer, if you feel it is warranted.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!