Plot - representation of frequency to time dependece

Hi everyone!
I have a signal (image 1) that chages its frequency (value to time).
How I can display the dependece of frequency to time? Something like image 2. Is it real?
Thanks in advance!

 Réponse acceptée

Star Strider
Star Strider le 18 Sep 2022
Modifié(e) : Star Strider le 18 Sep 2022
I would use the pspectrum function with the 'spectrogram' option. (The spectrogram function is also an option,. however the units are different and may be more difficult to interpret. Both are in the Signal Processing Toolbox.)
EDIT — (18 Sep 2022 at 20:14)
Added this example
There are transition regions in this example that appear as high frequency discontinuities that may not be present in your signal. However this iillustrates the approach —
t = linspace(0, 10, 1001);
f = [ones(1,250)*70 ones(1,501)*10 ones(1,250)*70];
s = sin(2*pi*f.*t);
Fs = 1/(t(2)-t(1));
figure
plot(t, s)
grid
[sp,fp,tp] = pspectrum(s, Fs, 'spectrogram');
fr = [min(fp(:)) max(fp(:))];
tr = [min(tp(:)) max(tp(:))];
figure
pspectrum(s, Fs, 'spectrogram')
tv = get(gca, 'XLim');
fv = get(gca, 'YLim');
[r,c] = find(sp >= 0.95*max(sp(:)));
figure
plot(c/max(c)*diff(tv)+min(tv), r/max(r)*diff(fv)+min(fv))
grid
xlabel('t')
ylabel('f')
axis([0 10 0 100])
.

1 commentaire

Where do the frequencies 50 and 17 come from? Shouldn't the plot start at 30 (70 aliased down by Fs = 100), transition to 10, then transition back to 30?
t = linspace(0, 10, 1001);
f = [ones(1,250)*70 ones(1,501)*10 ones(1,250)*70];
s = sin(2*pi*f.*t);
Fs = 1/(t(2)-t(1));
[sp,fp,tp] = pspectrum(s, Fs, 'spectrogram');
[M,I] = max(sp);
figure
plot(tp,fp(I))
xlabel('t');ylabel('f')

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by