# Applying periodogram-based PSD

For plotting a Power Spectral Density graph based on FFT results, I had used two different approaches, but they produced very different results, and it'd be great if anyone knows why.

Note: From this point on, $$N$$ is assumed to be the total number of data samples, $$f_s$$ is assumed to be the sampling frequency.

• APPROACH #1:

(from here: www.mathworks.com/help/signal/ref/periodogram.html ) $$PSD(f) = \frac{\Delta t}{N} \left| \sum_{n = 0}^{n = N-1} x_n e^{-i2 \pi fn}\right|^2$$

of which I assume the $$\Delta t$$ to be the same as $$1/f_s$$, with it being multipled by 2 for most cases (one sided periodogram). So the idea was implemented as: $$PSD(f) \cong \frac{2}{f_s N} \left| FFT(x_n) \right|^2$$

Note: As per one of the responses, APPROACH #1 would've been more accurately interpreted as
$$PSD(f) \cong \frac{1}{f_s} \left| FFT(x_n) \right|^2$$

• APPROACH #2:

(from here: http://www.bitweenie.com/listings/power-spectral-density-matlab/) $$PSD(f) = 20 \log_{10} \left( \frac{|FFT(x_n)|}{\sqrt{N f_s}}\right) + 30$$

This approach was implemented with no interpretative modifications.

• RESULTS:

Using approach #1, my results looked like a typical FFT, while approach #2 produced the expected log-scale result. • QUESTION:

However, the approach #1 from MATLAB seems like the more commonly-accepted way to do the periodogram PSD. Is there a fault somewhere in the interpretation of this approach to cause the discrepancy in results?

It's exactly the same method, only the second is converted to (power) dB ($\text{dB}:\,x\mapsto 10\log_{10}x$):

Let's convert your first formula to dB:

\begin{align} P_{1,\text{dB}} &= 10\log_{10}P_1\\ &=10\log_{10}\left(\frac{\Delta t}{N}\lvert\text{FFT}\rvert^2\right)\\ &=10\log_{10}\left(\frac{\lvert\text{FFT}\rvert^2}{f_sN}\right)\\ &=10\log_{10}\left(\frac{\lvert\text{FFT}\rvert^2}{\sqrt{f_sN}^2}\right)\\ &=10\log_{10}\left(\left(\frac{\lvert\text{FFT}\rvert}{\sqrt{f_sN}}\right)^2\right)\\ &=10\cdot2\cdot\log_{10}\left(\frac{\lvert\text{FFT}\rvert}{\sqrt{f_sN}}\right)\\ &=20\log_{10}\left(\frac{\lvert\text{FFT}\rvert}{\sqrt{f_sN}}\right)\\ \end{align}

The $+30$ just happen because your seconds source is considering $\text{dBm}$ (decibel of milliwatt) instead of $\text{dBW}$ (decibel of watt), assuming your input values are in Volt over a impedance of 1Ω or so.

Note: you nowhere in your question stated the physical units of what your input data is; be very careful when "implying" something can be represented as $\text{dBm}$ or $\text{dBW}$. That makes a statement about your signals origin (namely, that your ADC or wherever the signal came from is calibrated, or will be converted to analog with calibrated equipment) if you're dealing with real-world observations/signals. This assumption is usually wrong – if you just got a good microphone and a good sound card (or a good receiver and a good SDR device) your digital amplitudes will be proportional, but not identical, to the voltages observed, or even more significantly, to the sound intensity (or EM field strength) that caused the electrical signal in the first place.

I think $$\Delta t$$ in the formula you wrote is NOT the sampling period, but the sampling interval, which is the total observation time of your sample time series.

• So $\Delta t / N$ should actually just be $1 / f_s$? – plu Oct 24 '19 at 4:52
• As farr as I have understood, I think so – EmThorns Nov 4 '19 at 11:27
• Updated post to reflect this info. – plu Nov 9 '19 at 18:20