# PSD - Spectrum analysis

Could someone tell me where it is that I might be going wrong with the following problem?

Ok, so I'm computing a spectrogram, and, trying to return the PDS of the signal (to show where the signal has the most energies) which I will then use in plotting the decibels.

In my approach, I multiply each of the frames by the Hanning window, perform FFT of the resulting blocks and then only take the first half of the result (resulting vector).

Finally, I take each of the blocks (computed by the STFT) and perform PSD.

The problem that I'm having is this:

The chart below illustrates the results that I'm getting using my own C++ code:

Whereas in Python, using matplotlib if I replicate this, then I get the following:

I can't understand where the "noise" is coming from. I can only think that it could be some periodic noise which could be due to little discontinuities at the start and at the end of each frame. But I don't know where I have gone wrong.

The NFFT = 256 hop size = 128

Thanks

• Anyone? =) any help would be appreciated Commented Jan 21, 2014 at 1:38
• Hello, and wellcome to DSP. We discourage asking questions directly about programming code, writing new code or debugging. I tried to focus your question on the approach and your results. Feel free to add more detail. I feel the question is more focused on what the community here is interested this way. Commented Jan 21, 2014 at 10:41
• @penelope I thought with having the code, it would be a lot easier for someone to debug, since, this question does not seem to be getting any responses Commented Jan 21, 2014 at 15:55
• Well, the python implementations are open source. Reading the code and comparing with yours should tell you what is different.
– jan
Commented Jan 21, 2014 at 15:59
• It's true that it'd help us debug, but the thing of the matter is, we don't deal with code here. This is not the right site if you want something debugged (you go to stackoverflow for that). We, here, can help you with (finding a flaw in) your approach: you should elaborate on that, explain what results you are expecting (and why) and where they differ from what you have. Commented Jan 21, 2014 at 16:01