- https://www.mathworks.com/help/releases/R2024a/matlab/ref/reshape.html
- https://www.mathworks.com/help/releases/R2024a/matlab/ref/fft.html
how can i split or divide a dataset into its different parts (an electroencephalogram [EEG] of 122880 samples into 16 pieces or channels)
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
*edit, i corrected a wrong number i wrote*
i already got an answer for how to plot the eeg sample i got from
http://brain.bio.msu.ru/eeg_schizophrenia.htm which is basically 7680 samples for each channel and its 16 channels etc etc etc
but now i need to do a fourier transform and due to the fact that 122880 is not a power of base ^2 it means that doing a fourier transform would lead to the transform of the entire row of 122880 data samples turned into 131072 to be transformed, thus leading to me not being able to use the plotting the 16 channels code properly [i don't have access to the computer where i have the matlab code but instead of looking like the 16 channels one above the other, it looks like a snake line that goes up right up right up right etc etc etc]
sooooooo what i mean to ask is if there is a way to divide or split the data in 16 parts and do the fourier transform in those 16 parts and then plot those parts (in any way like via division or separation after a limit etc), i mainly need the divide and transforming, the plotting i will be able to manage if that isn't answered
thank you all in advance for reading my question
0 Kommentare
Antworten (1)
Kanishk
am 7 Okt. 2024
Bearbeitet: Kanishk
am 8 Okt. 2024
I understand you want to perform a Fourier transform on the EEG signal.
In MATLAB, the ‘fft’ function do not require input to be a power of 2. So, you can directly use the function on 7680 samples.
To divide the signal into 16 channels, use the ‘reshape’ function. 'reshape’ function is used to rearrange the elements of an array into a new array with a specified number of rows and columns.
dt = readmatrix('eeg_data.txt');
dt = reshape(dt, [], 16);
Now each column of ‘dt’ represents a channel. Perform the Fourier transform on the reshaped data to and plot the frequencies.
y = fft(dt)
for i=1:16
figure
plot(abs(y(:,i)));
end
To learn more about ‘reshape’ and ‘fft’, please go through the following official MATLAB documentation:
Thanks
3 Kommentare
Kanishk
am 8 Okt. 2024
The 'plot' function is overwriting the previous plot. Use 'figure' to generate a new figure window at every loop iteration.
dt = readmatrix('eeg_data.txt');
dt = reshape(dt, [], 16);
y = fft(dt);
for i=1:16
figure
plot(abs(y(:,i)));
end
Siehe auch
Kategorien
Mehr zu EEG/MEG/ECoG finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!