How to plot spectrogram in actual time period?
Afficher commentaires plus anciens
Does anyone know how to plot actual time interval in Spectrogram using STFT?
I want to analyze an event in a signal in a certain time span, but using the spectrogram built in function plots in Spectrogram from 0, while I want it to be plotted from for exp. 5083s time span as seen below. I appreciate if anyone can help me with this.

9 commentaires
Mathieu NOE
le 1 Mai 2021
hello
I am not sure to understand what you want to do on the time axis ?
here a code that includes the spectrogram of a signal
now what you would do on its time axis ? you can interpolate or shift or whatever ...
Mathieu NOE
le 2 Mai 2021
hello
ok, so your time vector in the first plot starts at a now zero value; take this value and use it as an offset value to the time vector generated by the spectrogram function, so both data should be time aligned
also, there is something strage about the fact that the upper plot has a time span of 12 seconds and the lower plot only 1 second; I assume you did modify manually the xaxis rendering (limits) not the same way on both plots
Jan Ali
le 2 Mai 2021
Mathieu NOE
le 3 Mai 2021
hello again
can you share your code ? - it would be easier to show you what I mean once it's implemented.
tx
Jan Ali
le 4 Mai 2021
Mathieu NOE
le 6 Mai 2021
Hello
I have to admit that to get the fft output which same amplitude and scalling as the input time signal, I finally preferred (some time ago alreagy) to build my own code; the "new" recent implementation of Matlab functions need some time to be fully understood , and I have not taken this time yet; sure there must be the explanation somewhere in the doc;
I am now sure that a sinewave with amplitude = 1 is plotted with also the same amplitude , for the averaging fft spectrum and for the spectrogram
attached my code
Jan Ali
le 7 Mai 2021
Mathieu NOE
le 10 Mai 2021
hello
yiu can simply add this line of code , after the plot :
colorbar('vert');
Réponses (0)
Catégories
En savoir plus sur Transforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!