time-frequency

4 views (last 30 days)
Sravantej
Sravantej on 24 Jan 2012
Commented: nour yousfi on 6 Sep 2016
hi, i have a signal whose frequency is varying with time, i need to know the frequencies at all the times. I need a plot of the signal frequency vs signal time. Can anyone tell me how to get that plot

Answers (1)

Wayne King
Wayne King on 24 Jan 2012
Hi Sravantej, You have to understand that there are constraints on how precise you can obtain a time-frequency analysis of a signal.
Having said that, you can use spectrogram in the Signal Processing Toolbox and/or cwtft in the Wavelet Toolbox.
Here is an example with spectrogram:
t=0:0.001:2;
x=chirp(t,0,1,150);
[y,f,t,p] = spectrogram(x,256,250,1000);
surf(t,f,10*log10(abs(p)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time');
ylabel('Frequency (Hz)');
Here is an example with cwtft from the Wavelet Toolbox:
N = 1024;
t = linspace(0,1,N);
dt =1/(N-1);
Y = sin(8*pi*t).*(t<=0.5) + sin(16*pi*t).*(t>0.5);
s0 = 6*dt; ds = 0.15; NbSc = 50;
wname = 'morl';
SCA = {s0,ds,NbSc};
cwtsig = cwtft({Y,dt},'scales',SCA,'wavelet',wname);
MorletFourierFactor = 4*pi/(6+sqrt(2+6^2));
Scales = cwtsig.scales.*MorletFourierFactor;
Freq = 1./Scales;
imagesc(t,[],abs(cwtsig.cfs));
indices = get(gca,'ytick');
set(gca,'yticklabel',Freq(indices));
xlabel('Time'); ylabel('Hz');
title('Time-Frequency Analysis with CWT');
  1 Comment
nour yousfi
nour yousfi on 6 Sep 2016
Hi;how can I obtain CWT plots at specific frequencies

Sign in to comment.

Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!