It seems to me that the spectrogram representation of a finite signal gives you significantly more useful information than a frequency spectrum. As I understand it, the spectrogram breaks down the spectrum over time whereas the frequency spectrum gives you no time dependent information. Why wouldn't I want to use this kind of representation all the time? When would it be more useful to use the frequency spectrum rather than the spectrogram? Is it just computationally expedient to produce a frequency spectrum?
3 Answers
The spectrogram suffers from a time/resolution restriction - the smaller your time step, the smaller your analysis windows become, the worse your frequency resolution gets.
It is a waste of frequency resolution to break down a stationary signal into tiny temporal slices. Thus, if you know in advance that your signal you analyze is stationary; or if you have pre-segmented your signal into stationary segments (using a transient/onset detector; novelty detection; or an auxiliary signal/sensor), there is no reason to lose frequency resolution by using the spectrogram.
-
$\begingroup$ I'm not quite sure I understand why a smaller frequency resolution (induced by the smaller timestep) produces a loss in frequency resolution... Could you elaborate on that? $\endgroup$– PaulOct 15, 2012 at 12:55
-
$\begingroup$ I have made my answer clearer. Smaller analysis windows = smaller FFT size = bigger increment between consecutive FFT bins = less resolution. Of course, you can compute a spectrogram with a very small time-steps and large analysis windows (ie, with a very high overlap between consecutive windows), but this won't be very helpful in locating events accurately on the time axis. $\endgroup$ Oct 15, 2012 at 13:26
You use a spectrogram (time-frequency analysis) if you need to know when a frequency component is active, and a frequency spectrum when you don't. The drawback of using a spectrogram is that it has less spectral resolution. The time-frequency trade-off is the well known Heisenberg uncertainty principle.
As mentioned, if you analyze smaller time windows of a signal, the you'll loose frequency resolution.
However, if you only need a coarse frequency resolution for your application, and you know the signal is stationary, or changes very slowly, you still might be best off just periodically taking a spectrum made of a limited number of samples. Spectrograms are generally made by taking the FFT of frames of overlapping samples to maximise the information in both time and frequency domains. They are used to make pretty pictures pleasing to the eye. However, the more data you generate, the more you have to waste processing resources sorting it. Think of the time resolution that you want and the frequency resolution that you want separately. You can then decide how many samples are in the FFT and how often you want to take it.