# How can I do FFT of EEG

26 views (last 30 days)
nazmican on 22 Dec 2022
This question was flagged by Bora Eryilmaz
I am performing FFT on EEG data. My ultimate goal is to have a frequency by time plot. However, the range of frequencies should be from 0Hz to 70.87Hz. How can I limit these frequencies so that my results are in the correct range? Below is my code. My sampling rate is 2000Hz.
Now we want to visualize the frequency spectrum magnitude of one EEG_1 with respect to frequency for frequency range 0 - 70.87Hz
% First find the df, the frequency resolution of the signal, that is the frequency equivalent of a single point
% Using df how many frequency points do we need to show ? Create a frequency vector f for the x
% axis and spectrum absolute magnitude vector EEG_1_Spectrum for the y axis.
Nbin=
f=
EEG_1Spec=
%Create a new figure
figure;
%Plot the computed spectrum using the stem() function for thefrequency range 0 - 70.87Hz on top row of the figure.
subplot(2,1,1);
stem()
%put title , xlabel, ylabel,
% Repeat the above step for the VEPconvolved average signal.
% Can you use the same frequency vector for the x axis?
subplot(2,1,2);
VEPconvAveSpec=fft()
stem()
% put title, xlabel, ylabel
nazmican on 22 Dec 2022
Edited: nazmican on 22 Dec 2022
%My code
Nbin=length(t) ;
df=fs/L ; %Frequency resolution
EEG_1Spec=0:70.87;
figure;
subplot(2,1,1);
stem(df,abs(EEG_1Spec));
plot(EEG_1Spec);
title('EEG_1Spec');
xlabel('frequency(Hz)');
ylabel('Amplitude(microV)');
subplot(2,1,2);
VEPconvAveSpec=fft(127); %Number of EEGdata/Gain=130048/1024
stem(VEPconvAveSpec);
plot(VEPconvAveSpec);
title('VEPconvAveSpec');
xlabel('frequency(Hz)');
ylabel('Amplitude(microV)');

Sulaymon Eshkabilov on 23 Dec 2022
If I have understood your question correctly, you want to put limitations along y-axis. If so, you can use one of these two options:
(1)
ylim([0, 70.87])
OR
(2)
axis([xmin xmas ymin ymax])