Question

I only just discovered the awesome that is matplotlib.mlab.psd(), but I am having one issue, that is: how can I change the frequency range used by the method?

This has two return values: freqs, which is pretty much the histogram bins for various frequencies, and Pxx, the normalized power at each frequency bin. freqs ranges in [0, 100] Hz. I can change the resolution using the parameter pad_to, but I can't change the range to be, say, [0, 20]. Any ideas?

Was it helpful?

Solution

The frequency range is set by the sampling details of your data, this is a property of the FFT.

The lowest frequency is set by the length of your data (in this case by NFFT which sets your window size), and the highest frequency is set by your sampling frequency.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top