- 'cwt' function: https://www.mathworks.com/help/wavelet/ref/cwt.html
- 'abs' function: https://www.mathworks.com/help/matlab/ref/abs.html
How to correctly interpret continuous wavelet transform data
17 次查看(过去 30 天)
显示 更早的评论
Hello world!
I recently learned MATLAB to investigate local field potential signals (neuroscience). In spectrograms, the signals in question showed high-frequency activity at certain timepoints. I isolated the continuous wavelet coefficients of the CWT at said timepoints and plotted the mean of the wavelet spectra of multiple signals.
As you can see, the red signals show clear peaks not observable in the green signals.
I now have several questions:
First, my values on the x-axis are the values of the "f" output of the cwt function, described as scale-to-frequency conversions in the cwt documentation. Did I interpret those correctly as the frequency of the morlet wavelets used for the transform? Or does the "f" vector refer to the actual frequency of my signal?
And second, in MATLABs spectrograms, magnitude is displayed instead of wavelet coefficients. Can I convert the coefficients to magnitude?
Sadly, my grasp on the mathematics behind the CWT is quite limited, that's why I want to confirm my interpretation of the data.
Any help is greatly appreciated!
0 个评论
回答(1 个)
Balavignesh
2023-11-10
Hi Nikolai,
As per my understanding, you would like to interpret continuous wavelet transform data and convert the wavelet coefficients to magnitude.
The 'f' output vector of the 'Continuous Wavelet Transform (CWT)' function represents the scale-to-frequency conversions. In the CWT, the wavelet scales are inversely proportional to the frequency. The 'f' vector provides the frequencies associated with each scale used in the CWT. So, your interpretation that 'f' values represent the frequency of Morlet wavelets used for the transform is correct.
Coming to the second part of your question, the CWT coefficients are complex values that contain both magnitude and phase information. The magnitude of the CWT coefficients represents the strength or amplitude of the wavelet response at different scales and time points. I would suggest you use the 'abs' function to compute the magnitude of the wavelet coefficients.
The following example code could help you understand how to compute magnitude of the CWT coefficients and plot average wavelet spectra:
% Example CWT coefficients. Feel free to use your actual CWT_coeffs
cwt_coeffs = randn(10, 100); % Random coefficients for 10 signals and 100 scales
% Compute the magnitude of CWT coefficients and calculate the average wavelet spectra
num_signals = size(cwt_coeffs, 1);
num_scales = size(cwt_coeffs, 2);
mean_wavelet_spectra = zeros(1, num_scales);
for i = 1:num_signals
magnitude_coeffs = abs(cwt_coeffs(i, :));
mean_wavelet_spectra = mean_wavelet_spectra + magnitude_coeffs;
end
mean_wavelet_spectra = mean_wavelet_spectra / num_signals;
% Plot the average wavelet spectra
frequencies = 1:num_scales; % Assuming scale-to-frequency conversion is 1-to-1
figure;
plot(frequencies, mean_wavelet_spectra);
xlabel('Morlet Wavelet Frequency');
ylabel('Morlet Wavelet Magnitude');
title('Average Wavelet Spectra');
grid on;
Kindly have a look at the following documentation links to have more information on:
Hope that helps!
Balavignesh
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!