I would like to see the spectrogram of x=cos(-250*pi*t^2) for 0<t<2s. How do I plot the spectrogram ( f on y axis, time on x axis)?t = [0,0.1,2]; % Intervall for t y = cos(-2

4 visualizaciones (últimos 30 días)
I need a simple code to plot the spectrogram of sinusoids as f over time.
So far, my code looks like this:
t = [0,0.1,2]; % Intervall for t
y = cos(-250 * pi * t.^2); % the signal
spectrogram(y,t)
But the spectrogram is strange.
Which parameters do I need to add or change?

Respuesta aceptada

Star Strider
Star Strider el 17 de Nov. de 2021
The frequency of the sine curve is 125 Hz, however the sampling frequency of ‘t’ is 10 Hz. This leads to asliasing and unfortunate results. Increase the sampling frequency to 1 kHz and the result appears to be more appropriate —
t = [0:0.001:2]; % Intervall for t
y = cos(-250 * pi * t.^2 ); % the signal
spectrogram(y,t)
colormap(turbo)
I also changed the colormap to make the differences easier to see.
.

Más respuestas (1)

Julia-Alexandra Giesbrecht
Julia-Alexandra Giesbrecht el 18 de Nov. de 2021
Thank you!! When t = [0:0.0005:2] it looks like i want it to. :)

Categorías

Más información sobre Time-Frequency Analysis en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by