필터 지우기
필터 지우기

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 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