How to filter off the noise in raw EEG signal

3 views (last 30 days)
ABCDEEG
ABCDEEG on 9 Nov 2018
Edited: ABCDEEG on 9 Nov 2018
I want to denoise in raw EEG data with MATLAB, but there is something wrong with the program. I couldn't run the code. Could you possibly help me to solve this problem, please? The program is below.
%%Denoise program
% This section is only pre-processing the original data
% after denosing and re-arranging the labels
% s is the raw biosignal data, having 4 channels
% SampleRate is sampling rate of EEG signals ( the data points per second)
% InputEEG and OutputEEG are single channel EEG signal.
clear all
% Notch filter
w0 = 50*(2/SampleRate);
[b,a] = iirnotch(w0, w0/35); %iirnotch is notch filter (a built in function in Matlab)
s = filtfilt(b, a, s);
% Bandpass filter
s(:,1) = bpfilter(s(:,1), [0.3 SampleRate/2]); %bpfilter is another built filter.
s(:,2:3) = bpfilter(s(:,2:3), [0.3 SampleRate/2]);
s(:,4) = bpfilter(s(:,4), [10 SampleRate/2]);
% Downsample by 2
s = s(1:2:end,:);
HDR.SampleRate = HDR.SampleRate/2;
% Replace NaN and Inf with 0
s(isnan(s)) = 0;
s(isinf(s)) = 0;
% Convert to single
s = single(s);

Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!