MATLAB Answers

How to visualize time frequency information of time series signal using continuous wavelet transform

조회 수: 6(최근 30일)
Yared Daniel
Yared Daniel 2021년 7월 19일
댓글: Mathieu NOE 2021년 7월 22일
I have time series signal named X with variable Sg. I want to visualize it’s time frequency information by using continuous wavelet transform with the following input parameters:
samplingperiod=0.25;
scale = 24;
Fs = 4;
t = 0:1/Fs:(numel(Sg)-1)/Fs;
t = 0:1/Fs:(numel(Sg)-1)/Fs;
wavelet name = ‘db2’
I have tried the following script and got the following output (time scale information)
clear
load('X.mat')
samplingperiod=0.25;
scale = 24;
Fs = 4;
t = 0:1/Fs:(numel(Sg)-1)/Fs;
ax = newplot;
c = cwt(Sg,scale,'db2','plot');
colormap('jet(227)')
axis tight;
cb = colorbar(ax);
However what I need is a time- frequency information with a frequency range of 0 up to 2 Hz and time in second (4800/4 =1200 second) like the following figure
Thank you for contribution in advance

답변(1개)

Mathieu NOE
Mathieu NOE 2021년 7월 19일
hello
I used this FEX submission as I don't have the Wavelet Toolbox
Your code adapted is as follows. Note you can "zoom" the dB scale to better see the small signals rendering - here I choosed 40 dB of max scale.
clear
load('X.mat')
Fs = 4;
t = (0:numel(Sg)-1)/Fs;
ax = newplot;
[y,f,coi] = cwt(Sg,Fs);
% reduction of the dB scale : only display max to min = max - Range_dB
Range_dB = 40; % dB scale
out_dB = 20*log10(abs(y));
ind = find(out_dB< max(out_dB,[],'all')-Range_dB);
out_dB(ind) = NaN;
imagesc(t,f,out_dB);
xlabel('Time (s)')
ylabel('Frequency (Hz)')
colormap('jet(128)')
axis tight;
cb = colorbar(ax);
set(gca,'YDir','normal');
  댓글 수: 2
Mathieu NOE
Mathieu NOE 2021년 7월 22일
hello Yared
sorry, I am not expert in wavelet , I am until now using more basic fft tools . I have to learn a bit more myself on wavelet ...

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by