Plot - representation of frequency to time dependece

2 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Star Strider
Star Strider il 18 Set 2022
Modificato: Star Strider il 18 Set 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 Commento
Paul
Paul il 18 Set 2022
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')

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by