How to plot scales versus time in continuous wavelet transform?

5 次查看(过去 30 天)
Dear all, I have data set over time. I used continuous wavelet transform as follows:
C = cwt (signal,1:200,'bior3.3','plot')
How can I plot the scales against time (instead of scales against the number of data)?
Sincerely.

回答(1 个)

albara
albara 2023-4-27
编辑:albara 2023-4-27
To plot the Continuous Wavelet Transform (CWT) coefficients with scales against time instead of the number of data points, you can create a time vector that corresponds to your signal and use it on the x-axis of your plot. Here's an example:
% Example signal (Replace this with your actual data)
signal = randn(1, 1000);
% Sampling frequency (Replace this with the correct value for your data)
fs = 1000;
% Calculate the time vector
N = length(signal);
t = (0:N-1) / fs;
% Compute the CWT coefficients
scales = 1:200;
wname = 'bior3.3';
C = cwt(signal, scales, wname);
% Create a meshgrid for the time and scales
[T, S] = meshgrid(t, scales);
% Plot the CWT coefficients with time and scales
figure;
surf(T, S, abs(C), 'EdgeColor', 'none');
view(0, 90); % Set the view to 2D
xlabel('Time (s)');
ylabel('Scale');
title('Continuous Wavelet Transform (CWT) Coefficients');
colorbar;
This code should generate a 2D plot of the CWT coefficients with the correct time and scale axes based on your signal and sampling frequency.
Important: There may be some mistakes in this answer Experts can tell if there are any mistakes
  1 个评论
Navid
Navid 2024-1-20
Hello,
I am reporting an issue I faced while using the Morse wavelet. I received an error message stating, "Error when using surf. Data dimensions must agree." I would appreciate your assistance in resolving this problem and any guidance you can offer. Thank you for your time and attention to this matter.
Best regards,
Navid

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by