Quantcast
Viewing all articles
Browse latest Browse all 898

Reply To: FFT problem to raw EEG data in matlab

Hi, i’m trying to analysis EEG signal in matlab. I’m using SDK and EEGlogger.exe.
My problem is FFT max amplitude appeared around 0Hz.

My process is like that:
1. Remove median for remove DC offset.
2. High pass filter, cut off = 3hz
3. FFT

And result like that:

This result show that max amplitude is around 3hz…
When i didn’t use the HPF, the FFT graph show that max amplitude is around 0hz

my matlab coode:


clear all;
clc;

%% data importfc
data = import_data('data1.csv');

%% set variable
fs =128;
x = data(:,4);   % channel F3
x = x(fs*170:fs*175);   % 170s ~175s time's data

t = data(:,21);  % time 
t = t(fs*170:fs*175);  % 170s ~175s time interval

%% remove DC component by removing median
x= x - median(x);

subplot(3,1,1);
plot(t,x);
title('raw data (removed median for remove DC offset)','color','r');
xlabel('time(s)');
ylabel('uv');

%% high pass filter
n = 5;
fc = 0.2;
fn = fs/2;
[b, a] =butter(n, fc/fn, 'high');
y = filter(b,a,x);
subplot(3,1,2);
plot(t,y);
title('high pass filter, cutoff= 3','color','r');
xlabel('time(s)')

%% FFT 
T = 1/fs;
L = length(y);
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = fs/2*linspace(0,1,NFFT/2+1);

% Plot single-sided amplitude spectrum.
subplot(3,1,3);
plot(f,2*abs(Y(1:NFFT/2+1))) 
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')

my EEG signal data file:

https://drive.google.com/file/d/0B09oFayQTv3kRUI4RlFuMWhkVTA/view?usp=sharing

How can i fix the problem??
i found some post about my problem.
This post say about it is problem with dc offset. But i already remove dc offset.
Please help me.
Thank you.


Viewing all articles
Browse latest Browse all 898

Trending Articles