Spectrogram of low-frequency data

I generate the following data

data = Table[Sin[2 π*100*t] + Sin[2 π*140*t], {t, 0, 10, 1/1023}];


and the spectrogram, as expected, shows two horizontal lines corresponding to the two frequencies:

Spectrogram[data, SampleRate -> 1023]


Now, if I try to do the same with data at lower frequencies, such as:

data2 = Table[Sin[2 π*2*t] + Sin[2 π*6*t], {t, 0, 10, 1/1023}];


the spectrogram does not show the two frequencies, not even if I try changing the PlotRange.

What am I doing wrong? I have tried modifying the sampling rate, or changing the grouping in the Spectrogram function, but it does not seem to help...

You have a range from 0 to 511.5, so the frequencies at 2 & 6 are simply not visible. PlotRange itself doesn't help because you need to increase also the resolution:
Spectrogram[data2, 1024, SampleRate -> 1023, PlotRange -> {All, {0, 10}}, FrameTicks -> {{{2, 2}, {6, 6}}, Automatic}]

• @zakk See the Details and Options in the docs of Spectrogram (and maybe also SpectrogramArray). – corey979 Sep 22 '18 at 20:47