# Deriving the frequency spectrum graph from the graph of a spectrogram and vice versa?

I have a signal's spectrogram and frequency spectrum (which, if i'm not mistaken, is its the signal's fourier transform) as given below: I understand that the spectrogram plots the frequency (y-axis) vs time (x-axis) and that the colors represent the amplitude. I also understand the frequency spectrum as the plot of amplitude vs. frequency. But I'm not quite sure how to produce one graph from the other. Since there is no time axis on the frequency spectrum, surmise that it is impossible to create the spectrogram from a frequency spectrum. It seems plausible to derive the frequency spectrum from the spectrogram, but I'm not quite sure how to remove the time parameter.

Any help with this would be greatly appreciated.

The data that when colored produces one vertical slice of your spectrogram image is a spectrum. If you have the color mapping function, and it is invertible, you could take the array of colors from one vertical column in a spectrogram and attempt to produce the original spectrum for that point in time. But the inversion process would likely be lossy, since there are usually less quantized colors than spectrum amplitudes.

Since a spectrum is only one vertical slice of a spectrogram, a spectrogram produced from just one spectrum would only be something like 1 pixel wide, thus not very useful. But a bunch of spectrums at evenly spaced time increments could be used to produce a wider spectrogram.

Also note that due to time-frequency-resolution trade-offs, the width of time data used for each FFT/DFT spectrum array can be different between spectrum and spectrogram analysis presentations.

• I see... so, you are saying that the frequency spectrum does not summarize the data over the entire time frame? It is just the data at one particular time? I was under the impression that the frequency spectrum some how encapsulates the data over the entire time frame. Am I mistaken? – Paul Oct 14 '12 at 20:29
• The time encapsulated by a spectrum is a parameter, could be from a tiny instant to the entire data frame (essentially complex averaging or summing all the smaller sub-frames). – hotpaw2 Oct 14 '12 at 21:05
• So, you're saying that it could be done either way and that there isn't really a way to determine which way it is just by looking at these graphs? – Paul Oct 15 '12 at 2:37

If you know the parameters that generated the spectrogram (time-frequency image) and you have the magnitude + phase information of the short-time Fourier transform (STFT), you can reconstruct the time domain signal and then calculate its DFT.

If you all have is the magnitude squared of the STFT (i.e. the spectrogram) then inversion is ill-posed. One option is to build fake'' phase values into it. Also see the paper by Griffin and Lim (1984) on STFT inversion.

Similarly, going from the magnitude frequency spectrum (magnitide of DFT) to time domain is ill-posed, if you don't have any phase information. If you do have phase information, then you can get the time domain signal and then calculate its spectrogram.