What is the equivalent (or similar) of newtimef (EEGLAB toolbox) in the Wavelet toolbox?

9 views (last 30 days)
Hi all,
I am trying to work on a comparison between Wavelet toolbox and the open source EEGLAB toolbox. I found out that cwt() would give me the best chance of getting what newtimef() returned in EEGLAB.
However, it is still unclear to me on how to get a matrix of log spectral diffs output after cwt.
Any help or pointer would be much appreciated.
Thank you,
P/s: here is my attempt at cwt
% data is a row vector of EEG data
[cfs,f] = cwt(data,'amor',250);

Answers (1)

Jaynik
Jaynik on 28 Sep 2023
Hi Tyler,
I understand that you are trying to find the equivalent method for the newtimef method present in the EEGLAB toolbox from the Wavelet Toolbox and want to perform log spectral difference on the output.
The "cwt" function and the newtimef function can both be used for time-frequency analysis; they use different algorithms and provide different representations. They are not equivalent in terms of the specific implementation and the resulting outputs.
The code you have written for performing Continuous 1-D Wavelet Transform is correct.
[cfs, f] = cwt(data, 'amor', 250);
The code above uses an analytic Morlet wavelet, and the sampling frequency is set to 250. To perform the log spectral difference on the coefficient matrix cfs, you can do the following:
log_cfs = log(abs(cfs));
log_spec_diff = diff(log_cfs, 1, 2);
Here, log_cfs calculates the natural logarithm of the coefficients, and log_spec_diff calculates the difference between adjacent elements along the second dimension (columns) of the matrix to obtain the log spectral difference.
Refer to the following link to learn more about the “diff” function:
Hope this helps!

Categories

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

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!