wavelet decomposition on 2D EEG data
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello Everyone
I am processing 2D EEG data set, each sample dimension is 5209 by 16, where 16 is a number of channel and 5209 is per second time by sampling fresuency (42 sec multiply 124= 5208) where numbers of sample is 10...Now i am trying to genterate a 'Ch' variable for wavelelt decompostion inorder to create a row vector and than decompose all sample with DWT.But unable to get the desired result
for i=1:10
data{i,:}; % i is number of samples as data is in cell array
for k=1:16 % k is number of channels which is 16
v = genvarname('Ch', who);
eval([v '=data(:,k)']);
end
end
Thanks in advance
0 comentarios
Respuestas (1)
Prasanna
el 6 de Nov. de 2024 a las 9:59
Hi Saima,
To generate a variable for wavelet decomposition from your 2D EEG dataset in MATLAB, you can directly create a cell array or structure to hold your channel data for each sample. Below is a sample MATLAB code assuming your data variable is in a cell array with each cell containing a 5209X16 matrix for each sample.
% Parameters
numSamples = 10;
numTimePoints = 5209;
numChannels = 16;
% Generate random EEG data
data = cell(numSamples, 1);
for i = 1:numSamples
data{i} = rand(numTimePoints, numChannels);
end
% extracting channel data for wavelet decomposition
Ch = cell(numSamples, numChannels);
for i = 1:numSamples
currentSample = data{i};
for k = 1:numChannels
Ch{i, k} = currentSample(:, k)';
end
end
% Perform wavelet decomposition on each channel
waveletName = 'db1';
for i = 1:numSamples
for k = 1:numChannels
[cA, cD] = dwt(Ch{i, k}, waveletName);
fprintf('Sample %d, Channel %d: cA size = %d, cD size = %d\n', i, k, length(cA), length(cD));
end
end
In the above code, the ‘Ch’ cell array is used to store each channel’s data as a row vector for each sample. The outer loop goes through each sample, while the inner loop extracts each channel and transposes it to a row vector. The ‘dwt’ function is then used to perform the discrete wavelet transform on each channel. For more information regarding cell arrays, and ‘dwt’ function, refer the following documentation links:
0 comentarios
Ver también
Categorías
Más información sobre Discrete Multiresolution Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!