Why my EEG raw data can not be processed by this FFT code, while the other EEG raw data provided in EEGLab tutorial can?
Show older comments
I wish to plot frequency vs. power spectrum of eeg raw data from EMOTIV Epoc using this code:
clear;
clc;
[hdr,record] = edfread('dataemotiv.edf');
Fs = hdr.samples(1,1); %to see sampling frequency
F3 = record(5,:);
%BUTTERWORTH FILTER
cutOffFreq = 15; % Hz
filterOrder = 1; % Filter order (e.g., 2 for a second-order Butterworth filter)
D = butter(filterOrder, cutOffFreq/(Fs/2)); % Generate filter coefficients
[b, a] = butter(filterOrder, cutOffFreq/(Fs/2)); % Generate filter coefficients
Y3 = filtfilt(b, a, F3); % Apply filter to data using zero-phase filtering
%Power Spectrum
y=fft(F3);
PS=abs(y).^2;
N=length(y);
freq=(1:N/2)*Fs/N;
plot(freq,PS(1:N/2))
When I applied this to another EEG raw data provided in EEGlab tutorial "eegexample.edf", I got this:

But when I applied the code to my eeg data "dataemotiv.edf", I got this:

Please help me to know why this can happen. I'm sorry for my long post. Thanks for the help.
PS: My friend applied wavelet transform to my EEG data and can get power spectrum plot. I don't know what differ FFT and wavelet transform that my EEG data can be processed by wavelet transform.
Accepted Answer
More Answers (0)
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!