facing problem in combining EEG data

4 次查看(过去 30 天)
EEG.srate = 500; % sampling rate in Hz
EEG.pnts = 1500;
EEG.trials = 30;
EEG.nbchan = 23;
noiseamp=0.3;
% time vector
EEG.times = (0:EEG.pnts-1)/EEG.srate;
I have simulated EEG data with above details.
then I added a pink noise to contaminate it
I want to denoise it using wdenoise function.
But im getting error while concatenating the eeg data which is available in EEG.data?
can Someone help me, how to concatenate EEG.data

采纳的回答

Sanju
Sanju 2023-11-27
To concatenate the EEG data in the EEG.data field, you can use the “cat” function, In the below code, EEG.data is the simulated EEG data with pink noise added, and eeg_concat is the concatenated EEG data. You can then denoise the concatenated data using the "wdenoise" function.
% define EEG structure
EEG.srate = 500; % sampling rate in Hz
EEG.pnts = 1500;
EEG.trials = 30;
EEG.nbchan = 23;
% time vector
EEG.times = (0:EEG.pnts-1)/EEG.srate;
% generate simulated EEG data
noiseamp = 0.3;
eeg_data = noiseamp * randn(EEG.nbchan, EEG.pnts, EEG.trials);
% add pink noise
eeg_data = eeg_data + pinknoise(size(eeg_data(:,:,1)), 'like', eeg_data(:,:,1), EEG.srate);
% concatenate EEG data
eeg_concat = cat(2, eeg_data(:,:,1), eeg_data(:,:,2), eeg_data(:,:,3));
% denoise using wdenoise
eeg_denoised = wdenoise(eeg_concat, 'Wavelet', 'db4');
In this updated code, the 'like' parameter is used to specify the data type of the output as 'double', which is the same data type as the input data. The third input argument is also specified as eeg_data(:,:,1) to ensure that the output has the same size and shape as the input.
eeg_concat is the concatenated EEG data, and 'Wavelet' is set to 'db4', which specifies the Daubechies 4 wavelet. The “wdenoise” function can be used to remove noise from signals while preserving important features of the signal, such as sharp edges and peaks.
Hope this Helps!
Thanks.
  3 个评论
Vandana
Vandana 2023-11-28
Does the sample size matters for EEG denoising? If I want to use any open source EEG data set for denoising proces, should we considerthe minimum sample size?. when does this sample size matters?
Sanju
Sanju 2023-11-30
Yes, the sample size can matter for EEG denoising. Generally, a larger sample size can lead to more accurate denoising results. However, the specific sample size required can depend on the denoising method being used and the characteristics of the EEG data. It is important to consult the literature and/or consult with experts in the field to determine an appropriate sample size for your specific denoising project.
Regarding open source EEG datasets, it is important to consider the quality of the data and whether it is appropriate for your denoising project. It is also important to ensure that you have the necessary permissions and/or licenses to use the data.
The sample size can matter in EEG denoising when using certain methods that require a certain amount of data to be effective. Additionally, a larger sample size can help to reduce the impact of noise and artifacts in the data.
Hope this Helps!
Thanks.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 EEG/MEG/ECoG 的更多信息

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by