5
$\begingroup$

I am really confused with matlab's periodogram.

First of all, it says in the documentation that its unit is "dB per unit frequency". What does that really mean? I just don't quite get it.

Second of all, I'm trying to evaluate an ADC. I tried to measure its linearity but that won't work because when I reduce the level of the input signal by ,let's say, -3dB I excpect to see -3dB reduction in the highest peak of the spectrum, but that's not the case.

Last but not least, with this "dB per unit frequency" when is the highest peak actually 0 dB? It should reach that at a point, right? Because as far as I know dB is always a ratio of some kind. How can I modify it as to give me the values in dBFs for example? so I could get a sense of what my data look like.

Sorry for the long post, Mathworks' Periodogram just doesn't say it clear.

Thank you all.

$\endgroup$
7
$\begingroup$

As the documentation states, periodogram provides a power spectral density estimate pxx:

[pxx, w] = periodogram(x);

meaning that it shows how the total variance of the signal, var(x), is distributed over the frequency w. This implies that the integral of the estimated spectral density over the frequency axis

trapz(w, pxx)

should correspond to that total variance.

This also means that the psd is not normalized, neither to a total variance of 1, nor to a maximum peak of 1 (= 0 dB). That the result is plotted (not computed!) in dB merely means that the vertical axis shows $10 \, \log_{10}($ pxx $)$, not that it shows a ratio. There is therefore no reason to expect a peak to align with 0 dB; depending on the range of values of the signal it can be both much higher and much lower.

To produce a plot from pxx and w, use

plot(w, 10 * log10(pxx))
xlabel('normalized frequency   [rad / sample]')
ylabel('power spectral density   [(rad/sample)^{-1}] in dB')

Reducing the level of the total signal by 3 dB means to divide the signal x by a factor of 2. If you do this numerically

periodogram(x)
hold all
periodogram(x / 2)

you will see that the second psd estimate has exactly the same shape as the first, it's just 3 dB lower. If this is not what you find with your measurement data, then this means that either your volume regulation or your ADC do not work correctly.


If you are really sure you want a normalized spectrum, do the following: First, compute the psd estimate:

[pxx, w] = periodogram(x);

Then, normalize the psd, e.g. with respect to the highest peak:

npxx = pxx / max(pxx);

You can then plot the normalized psd on a logarithmic scale like this:

plot(w, 10 * log10(npxx))
xlabel('normalized frequency   [rad / sample]')
ylabel('normalized power spectral density')

Note that npxx does not have a unit.


A note about units: The unit of numbers returned as pxx by periodogram & friends depends on the units of the input signal x. Let's say these are dimensionless numbers; then the unit of the numbers in the pxx output is $\rm \frac{1}{rad / sample}$, because it is a density over w which is in units of $\rm rad / sample$. Or let's say these are voltage measurements coming from a calibrated ADC, so that the numbers in x are in volts. Then the unit of the numbers in the pxx output is $\rm \frac{V^2}{rad / sample}$.

If you additionally specify the sampling frequency in the call to periodogram:

[pxx, f] = periodogram(x, [], [], fs);

and fs is in Hz, the pxx is a density over frequency f, and its unit is $\rm \frac{V^2}{Hz}$.

Now if pxx is plotted, it is often plotted logarithmically, like stated above. If the function $10 \log_{10}$ is used, then it is said that the result is in decibel, dB. Then sometimes the unit of 10 * log10(pxx) is written as $\rm \frac{dB}{rad / sample}$. Strictly speaking, this expression doesn't make sense because dB is not just a unit (a different measurement stick) but denotes the use of a different quantity: the logarithm. That's why above I wrote the unit as [(rad/sample)^{-1}] in dB.

$\endgroup$
  • $\begingroup$ Okay thanks mate, that explains so much. So if it doesn't compute the power spectral density, to calculate it using FFT is a better approach to get the spectrum, am I right? And that way I could normalize to my ADC levels to show result relative to fullscale. Thank you again for taking the time to answer my question. $\endgroup$ – Kevin.hammet Apr 28 '15 at 6:20
  • $\begingroup$ @Kevin.hammet, you're welcome, but I get the feeling I wasn't completely clear. `periodogram´ does compute the power spectral density. It's just that the psd does not have the properties that you thought it had; you seem to think that the psd is normalized, but it isn't. And if you want to see the effect of reduced volume, that's a good thing: you don't want a normalized psd. I added a section about how to normalize. $\endgroup$ – A. Donda Apr 29 '15 at 17:45
  • $\begingroup$ In any case, do not compute the psd using the Fourier transform; those functions in Matlab are there exactly because it is not completely simple, and they take care of the important details. As a matter of fact, it would be even better if you use pwelch instead of periodogram. $\endgroup$ – A. Donda Apr 29 '15 at 17:46
  • $\begingroup$ Thank you for recorrecting the concept, and for suggesting a way to normalize it with respect to its highest peak. No I just want to get this strraight what is the units produced by the periodogram ( or Pwelch) method ? (vrms)^2 $\endgroup$ – Kevin.hammet Apr 30 '15 at 6:11
  • $\begingroup$ @Kevin.hammet, I added a note on units. $\endgroup$ – A. Donda Apr 30 '15 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.