フィルターのクリア

How to plot scales versus time in continuous wavelet transform?

3 ビュー (過去 30 日間)
Navid
Navid 2023 年 4 月 27 日
編集済み: Navid 2024 年 1 月 20 日
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 Center および File ExchangeContinuous Wavelet Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by