1
$\begingroup$

I was under the impression that zero-mean white guassian noise had a constant Power Spectral Density which means that smaller bandwidths should decrease the power in that band. I'm getting surprising results for average power in each FFT bin, it's staying the same irrespective of how long I make the FFT. Am I not measuring power correctly?

Here is a reduced for of my MATLAB script (should be Octave-compatible). Please excuse my odd habit of time vectors going up-down and frequency and misc ones going left-right.

%pkg load communications
% ^UNCOMMENT^ if using OCTAVE
close all

Q=8;        % Lowest power of 2 to iterate though in FFT loop
R=12;       % Highest power of 2 to iterate though in FFT loop
N=1;        % Linear PSD of noise
c=0;        % Loop counter

K=2.^(Q:R)  % Loop vector

for k=K
    n=sqrt(N).*(randn(k,1)+j.*randn(k,1))./sqrt(2); % complex noise
    P=(abs(fft(n)')).^2./k; % Noise Power in frequency domain
    c=c+1;    
    e(c)=mean(P); % Mean power measurement across bins
    %v(c)=var(P);
    figure
    plot(10.*log10(P))
end
e
%v

I feel like I'm missing something fundamental about this. Does FFT binning not truly band-limit signal power because of the way the algorithm works? I'm basically trying to get an output analogous to a spectrum analyzer in that is shows something proportional to true power.

$\endgroup$
  • $\begingroup$ By code, you have divided your fft(n) by k thus the power does not depend on the length of your vector. Theoretically, the power of sampled white noise (modeled by iid complex Gaussian random variables) does not depend on the bandwidth because it is the projection to an orthonormal basis. Please take a look at this answer (and its comments) dsp.stackexchange.com/questions/8629/… $\endgroup$ – AlexTP Oct 11 '17 at 14:46
  • $\begingroup$ @AlexTP I did divide the square of the FFT by k but if I didn't then the power would increase as k increased which makes even less sense. According to that equation in the top-rated answer, the variance or power should decrease for narrower bandwidths. (less total area under H(f) because it's the same height but a smaller width window). Should I instead divide by k^2? If so, I don't understand the math behind it. Square magnitude of fft should be energy, therefore dividing it by length should be power. $\endgroup$ – AnalogEE Oct 11 '17 at 15:10
  • $\begingroup$ The math behind it is the Parseval theorem for DFT en.wikipedia.org/wiki/… What is your question ? The physical signification of the model or how to code ? $\endgroup$ – AlexTP Oct 11 '17 at 15:22
  • $\begingroup$ I'm trying to emulate the performance of a spectrum analyzer using an FFT. When you decrease resolution bandwidth on an analyzer, the noise power in that band drops proportionally (which is correct because noise has a constant PSD as the answer you linked me explained). I'm not understanding why on earth the isn't doing that based on the code. $\endgroup$ – AnalogEE Oct 11 '17 at 15:37
1
$\begingroup$

A spectrum analyzer typically has more than one mode. One mode normalizes the frequency output such that a pure tone of amplitude “one” with frequency centered on a bin center has an amplitude of “one” in the spectrum display.

For a pure tone, nonrandom, centered on a bin frequency of amplitude “one” , the corresponding uniformly weighted N sample DFT bin magnitude will be “N”, so all the bins are reduced by dividing by N. (before magnitude squaring)

An actual Spectrum Analyzer will include a fudge factor correction for nonuniform windows, and average multiple DFTs .

I haven’t seen too many spectrum analyzers that don’t have a DFT under the hood. The last analog swept frequency analyzer I used was a very long time ago. I have seen a few modern versions at frequencies where converters aren’t good enough but DFT versions dominate most of the market.

$\endgroup$
  • $\begingroup$ Ok so they divide before abs-squaring. That makes sense considering how DFT is an expression of amplitude that scales with N. And yeah I don't want my signal power to change based on N because that's fairly non-physical. The relation between N and the noise floor is far more comfortable to me. $\endgroup$ – AnalogEE Oct 11 '17 at 18:13
  • $\begingroup$ If you can find any of the old app notes that came with HP spectrum analyzers, they covered this topic in more detail and generality than here and were very readable. $\endgroup$ – Stanley Pawlukiewicz Oct 11 '17 at 19:19

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.