# Spectrogram - Am I missing something?

I have the following signal:

I'm trying to compute a Spectrogram algorithm, but, don't think I'm doing it right..

I have computed the following:

1) STFT (size 256 with an overlap of 128) 2) Computed the logs using: '10 * log10(sqrt(re * re + im + im)

This is the result that I get:

But when I use pylab in Python (for the same signal): x = pl.specgram(signal)

I get the following result:

Using the matplotlib I get the following:

Obviously, these are very different results.. I don't know why I'm getting these, I'm new to signal processing and spectrograms. Hope someone can help

EDIT:

This is the result I have when doing imshow in python:

• How can you can call figure no. 2 a spectrogram when there is a time and amplitude on axis? To me it looks like a squared signal in log scale. I have the feeling that you first should read about: STFT. You must split your signals into frames, calculate DFT for each of them (this will give you a spectrum) and in the result you will obtain a matrix - MxN (M - number of frames, N - number of frequency bins). From that point you can play further. Some basic reference for python: scipy STFT – jojek Mar 25 '14 at 14:53
• "Using the matplotlib I get the following:" You're plotting a 2-dimensional array, so it interprets it as multiple 1-dimensional plots. You need to use imshow or pcolor or something. What is the arrayname.shape of your array? Show your code. – endolith Mar 25 '14 at 15:18