Hi to all,
I’m computing some spectrograms using the convenient functions defined in matplotlib.mlab.
I found something that I don’t completely understand. In computing the PSD the onesided power spectrum is scaled by a factor of 2 except for the first and the last bin:
in principle this should account for the contributions that in a two-sided spectrum is spread over negative and positive frequencies. However the lack of scaling in the highest frequency seems to cause a systematic underestimation on that frequency bin.
Is it possible that the power spectrum should be scaled, in the case of even-length signal, up to the last bin (so that -1 in the slicing should be removed)?
With correct scaling a signal comprised of two sinusoids of same power, one being at the Nyquist frequency, should have the same amplitude (excluding scallopping losses). I don’t have time to test it at the moment, but maybe someone more expert can already tell me if I’m missing something or the matplotlib scaling is wrong.