1
$\begingroup$

My question is this:

Do the 'amplitudes' of a PSD depend on the number of samples on which it is based?

One definition of the PSD I have found is: $$ P_{xx}(\Omega_m) = \frac{X(\Omega_m)\cdot\bar{X}(\Omega_m)}{N}=\frac{|X(\Omega_m)|^2}{N} $$ With $N$ being the number of samples and $X(\Omega_m)$ being the $m^{ \rm th}$ point in the DFT of the time series. Based on this definition, the PSD values will increase with increasing $N$.

However, in other places (e.g. here ) I am being told that the strength of the PSD is that it does not vary with varying frequency resolution.

I have found that the definition above obeys the Wiener-Khintchine relation, when the autocorrelation is: $$ \hat{R}_{xx}(k) = \frac{1}{N}\cdot\sum_{n=0}^{N-1}{x[n]\cdot x[n+k]} $$ So far I think I have found five different definitions of the PSD. What is "the right one" in your opinion and does it depend on sample size?

$\endgroup$

2 Answers 2

2
$\begingroup$

Do the 'amplitudes' of a PSD depend on the number of samples on which it is based?

Yes.

Let's consider a signal that is the sum of a single sine wave and white noise. Apply an FFT of different sizes, compute the PSD as $P(k) = |X(k)|^2$ and see what happens

Depending on how you scale the FFT you will see the following

  1. No scaling: Sine wave amplitude increases with 6dB per doubling and the noise amplitude increases with 3 dB per doubling.
  2. Scale by $1/\sqrt{N}$: Sine wave amplitude increases by 3 dB per doubling, noise amplitudes stays constant
  3. Scale by $1/N$: sine wave amplitude stays constant, noise amplitude decreases by 3 dB per doubling.

So no matter what scaling you apply it you cannot make it constant for all types of signals. The difference here is that white noise has a uniform spectral density but a sine wave has theoretically an infinity density and the entire energy always ends up in a single bin, regardless of how many FFT points you use.

$\endgroup$
1
  • $\begingroup$ Hi. Thanks for the answer. I think something important I had missed was that, when using PSD, the "amplitudes" of random noise is kept constant despite varying the sample size. However, single peaks resulting from actual harmonics in the signal will change size. This was what did not make sense to me before :) $\endgroup$ Oct 29, 2021 at 8:22
2
$\begingroup$

The Siemens link is pretty good.

Screenshot from Siemens link in question.

The issue is that, when you have a signal with $N$ samples, the DFT bin resolution will be $\frac{2\pi}{N}$. That means that as you add samples, the resolution of the DFT (and therefore the PSD) changes.

Suppose I sample a sine wave and use different lengths of the samples to plot the absolute value of the DFT. The power of the signal at the frequency of the sine wave will be the same (energy per unit frequency). But because the DFT bin widths change as I change the length of data, the DFT height differs.

The top plot here shows the straight DFT for 400, 800, and 1000 samples of the same sine wave. The bottom plot shows the DFT normalized to the duration of each signal.

enter image description here


Matlab code

N = 1000;
fs = 1000;
t = [0:N-1]/fs;
omega = 2*pi*203;
phi = 2*pi*0.3459357;
x = sin(omega*t+phi);

clf
subplot(211);
title('No normalization')
plot(abs(fft(x(1:400), N)), 'linewidth', 8);
hold on;
plot(abs(fft(x(1:800), N)),'k', 'linewidth', 8);
plot(abs(fft(x, N)),'g', 'linewidth', 8);
axis([190 220 0 500])
subplot(212);
title('Normalized')
plot(abs(fft(x(1:400), N))/400, 'linewidth', 8);
hold on;
plot(abs(fft(x(1:800), N))/800,'k', 'linewidth', 8);
plot(abs(fft(x, N))/1000,'g', 'linewidth', 8);
axis([190 220 0 0.5])
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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