# Power spectrum density and frequency

if i have some random signals (sampling rate = 10Hz, 0.1s per data)

Using python library i transformed it to power spectral density

power spectral density forms = f, psd (using mlab.psd)

If f is 0.01, is it really means 0.01Hz or 0.1Hz(10Hz * 0.01Hz) in signal??

Is it relevant to sampling rate and psd frequency?

I'm really thank you for your help!

If you are asking about the grid resolution of the PSD then it is given by:

$$\frac{{F}_{s}}{N}$$

Where ${F}_{s}$ is the sampling rate and $N$ is the number of samples.
Pay attention that you can increase the grid resolution by Padding the data with zeros.
Though it will increase the grid resolution it won't increase the resolution of the DFT (In the sense of resolution to see to close, in frequency, harmonic signals).

• Thank you for your comments. In my case Fs = 10, N= 12000 grid resolution is 1/1200 and then What is the meaning of grid resolution? If my psd data has peak or some value in 0.01, is it means my signal is related to 0.01Hz?? – 이병철 Jul 2 '18 at 6:35
• It means on on your grid of PSD that the frequency of each bin is $binIdx \cdot \frac{ {F}_{s} }{N}$. The PSD shows you the energy in each bin. – Royi Jul 2 '18 at 7:06

The mlab psd call is supposed to be compatible with MATLAB's current pwelch which is Welch's psd estimator. Welch's method falls into a category of algorithms that Overlap, Transform, and Average (OTA). One sometimes sees OTA in the literature. A proper Welch estimate consists of more than one FFT, usually many more FFTs.

There are two parameters that you need to identify in order to answer your question, NFFT , and 'onesided' / 'twosided'. If your data is real, 'onesidded' is most usually the proper choice.

Since your data is sampled at 10 samples per second, the span of frequencies in your data is from -5Hz to 5Hz. The bin resolution of the FFT is 10Hz/NFFT . For the the 'onesided' option, psd() will return NFFT/2 (assuming NFFT is even) real values that represent the frequency range between 0Hz to 5Hz. The FFT samples the frequency span uniformly so the 'kth bin' represents a 'bin bucket' with center frequency $k \frac{10}{NFFT}$ that is $\frac{10}{NFFT}$ wide. If there is a tonal component that doesn't correspond to the center bin frequency, that tonal component will appear in more than one bin, and this can be controlled by the window you use.

As mentioned before, a proper Welch psd should consist of "many" averages. If $N$ is the length of your data file, NFFT should not be N but something like N/10 which is a rule-of-thumb. Since psd() averages, your data should be nominally stationary over the entire file. If there is a lot of small scale events in your data that are of interest, psd() is probably not the correct tool.

Your answer is most likely $NFFT/2$ values spaced at $10/NFFT$ Hz intervals covering the range from $0$ to 5Hz.

In DSP it is helpful to develop an experimental mindset. Try adding a sine wave of known frequency to your data and see where it shows up in your psd. Note the amplitude. It will greatly increase your understanding and lead to new questions.

• a = int(len(V)/9) ps1, freqs = mlab.psd(newV, a,1/dt,detrend='none', window=mlab.window_hanning,noverlap=0) This is my code 9 averagings – 이병철 Jul 4 '18 at 0:07
• Thank you for your comments and I simulated this method t = (0.1,0.2....10) 100 samples 0.2, 0.4, 0.6..(even) = 1 0.1,0.3,0.5...(odd) = 0 and then transformed it to psd. Has it peak at 2Hz? – 이병철 Jul 4 '18 at 0:25