Clear Filters
Clear Filters

facing problem in combining EEG data

4 views (last 30 days)
Vandana
Vandana on 20 Nov 2023
Commented: Sanju on 30 Nov 2023
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
  1 Comment
Mathieu NOE
Mathieu NOE on 20 Nov 2023
you need to provide your data (as mat file) along with your code

Sign in to comment.

Accepted Answer

Sanju
Sanju on 27 Nov 2023
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 Comments
Vandana
Vandana on 28 Nov 2023
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 on 30 Nov 2023
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.

Sign in to comment.

More Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!