1
$\begingroup$

When I am recording a pure tone and conduct a fft, I receive a peak in the spectrum for this certain tone. Let's say the peak is 5

Now I am recording a pure tone with additional white noise. Does this white noise affect the peak in the fft spectrum for the mentioned tone?

I would suggest, it affects the peak since the whise noise exhibits also energy at the certain frequency.

My own fft-tests show some unclear results...

. . .

EDIT: This is my first question here, and I think this is how I should revise my question after I read some of your pretty pretty helpful answers?

I revised now completely the noise. My results fit pretty well to the answer of @Baddioes. It was mentioned the DFT-Amplitude should be $\sqrt{A^2 + \sigma^2}$ when noise is added to the tone. I do not receive the results predicted by @Dan Boschen.

This is what I have done:

This is the results of a single DFT. The noise is created by numpy.random.normal(mean=0, std=50, size=10000). enter image description here

I repeated the single DFT above 2000 times for averaging: enter image description here

For the DFT I applied the scaling $2/N$. So the pure tone results in a DFT-Coefficient of 2 (matches the time signal amplitude). With $\sqrt{A^2 + \sigma^2}$ I would expect a DFT-Coefficient of 2.1213 (tone+noise). The averaged results show a DFT-Coefficient of 2.1416.

$\endgroup$
2
  • $\begingroup$ Yes, there would be contribution of white noise to the magnitude of the tone's frequency. to get consistent observations you may increase the noise power and observe the peak value. $\endgroup$
    – Arpit Jain
    Commented Apr 3 at 12:43
  • $\begingroup$ The magnitude will not increase proportional to the white noise variance because the magnitude of circular white noise is Rayleigh distributed. Without seriously mathematically delving into it, the magnitude will likely be something along the lines of $\sqrt{A^{2}+\sigma^{2}}$ $\endgroup$
    – Baddioes
    Commented Apr 3 at 20:07

2 Answers 2

3
$\begingroup$

It appears from a subsequent update that the OP may be making multiple experimental tests and tracking the mean of the magnitude of the DFT bin with noise added. This statistic is Ricean distributed, and the details of how the mean relates to the variance of the noise for that process are detailed here: https://en.wikipedia.org/wiki/Rice_distribution.

However, to validate the noise process is as expected, I suggest not taking the magnitude of the DFT and averaging the magnitudes of the tones, but instead simply taking the standard deviation or variance of those complex samples directly (the complex value for the tones).

Below are the results we would expect for white noise. Also from the OP's plots it appears the noise is band-limited white noise. This additional detail is covered at the end of this post as it is helpful to understand my given explanations first.

Assuming we have a real tone given as:

$$x[n] = A\cos(2\pi k n/N)$$

Where $k$ is the frequency index as an integer with $0\le k < N$.

Prior to adding noise, when we compute the DFT (without further windowing), if $k\ne0$, the DFT result we will be zero for all bins except bins $k$ and $N-k$.

If we add white noise to the time domain signal (white means every sample is independent and identically distributed) with variance $\sigma^2$, the resulting magnitude of the bins with the tone and variance will depend on how we scale the DFT. The three most popular scales are no scaling, scaling by $1/N$, and scaling by $1/\sqrt{N}$. Each would have a resulting DFT tone magnitude and variance as follows assuming two-sided spectrums that extend from $k=0$ to $k=N-1$ (includes both positive and negative frequencies):

No Scaling:

$$X[k]= \sum_{n=0}^{N-1}x[n]e^{-j 2\pi nk/N}$$

Magnitude of tone in DFT (at bins $k$ and $N-k$): $NA/2$
Variance of each bin: $N\sigma^2$

$1/N$ Scaling:

$$X[k]= \frac{1}{N}\sum_{n=0}^{N-1}x[n]e^{-j 2\pi nk/N}$$

Magnitude of tone in DFT (at bins $k$ and $N-k$): $A/2$
Variance of each bin: $\sigma^2/N$

$1/\sqrt{N}$ Scaling:

$$X[k]= \frac{1}{\sqrt{N}}\sum_{n=0}^{N-1}x[n]e^{-j 2\pi nk/N}$$

Magnitude of tone in DFT (at bins $k$ and $N-k$): $\sqrt{N}A/2$
Variance of each bin: $\sigma^2$


Details

Each bin in the FFT is effectively a bandpass filter (and for the unwindowed FFT the filter response in the frequency domain is the Dirichlet Kernel which is essentially an aliased Sinc Function). Conveniently for white noise, the equivalent noise bandwidth of the Dirichlet Kernel is that of a brickwall filter 1 bin wide. The scaling of the DFT by $1/\sqrt{N}$ is consistent with Parseval’s theorem:

$$X[k]= \frac{1}{\sqrt{N}}\sum_{n=0}^{N-1}x[n]e^{-j 2\pi nk/N}$$

For this scaling, the variance for each bin (which is the total noise power in the signal divided by the total number of bins) will go down as $1/N$ when the noise is white (the noise is evenly spread over all frequencies, and we have $N$ bins, so the noise in one bin is $1/N$ in power). Similarly, the standard deviation will be $1/\sqrt{N}$. In the bin where a tone exists (and to simplify the explanation without involving spectral leakage, let's assume the tone is exactly at a bin center), the FFT result will be the perfect tone +/- the standard deviation as $\sigma/\sqrt{N}$ where $\sigma$ is the standard deviation of the noise. This could be confirmed by repeating the experiment many times with independent and identically distributed zero-mean stationary white noise, as we would do for other experimental measurements to establish a noise statistic. Ultimately the noise variation we see on the peak is identical to the noise variation we see on every other bin (without the offset due to the tone present on bin center). So we can also confirm the noise on the peak by using the statistics from the variation we see for every other bin (again and importantly under this contrived case of not inducing spectral leakage from the tone to other bins by ensuring the tone is exactly on bin center).

Effect of Bandlimiting the Noise

The OP has shown a plot that looks as follows:

OP's spectrum

From this we see that the noise is not white, but bandlimited around the tone of interest. If we assume that the noise extends evenly over $M$ bins out of the $N$ bins total and has a total variance of $\sigma^2$, then the variance in each of the bins where the noise is present (including the tone bin) would be $\sigma^2/M$ instead of $\sigma^2/N$ (assuming we scale the DFT by $1/\sqrt{N}$).

For more details on the filter bank view of the FFT, see DSP.SE #66299.

$\endgroup$
6
  • $\begingroup$ Correct me if I'm misunderstanding your point, but the variation in the FFT bin value will not asymptotically approach 0. For large $N$ and circular white noise, the covariances between frequencies asymptotically tend towards 0, meaning the variance in a given bin will be the variance of the underlying process. $\endgroup$
    – Baddioes
    Commented Apr 3 at 21:29
  • $\begingroup$ @Baddioes I am using a normalized DFT form with the DFT scaled by $N$ such that the result is the same as a block average of the bin: the variance in the bin will go down as $1/N$ relative to the peak $\endgroup$ Commented Apr 4 at 1:45
  • $\begingroup$ I agree that the statistical variance of the value in a given bin will decrease by $1/N$, I was just saying that it won't asymptotically converge to 0 variance, which I wasn't sure if you were implying, and was just wanting to clarify. It would likely converge to something like $\sigma^{2}(1+\frac{1}{N})$. There's a variance analysis of the periodogram for filtered white noise in the Stoica and Moses book, which if I remember correctly can be adapted to the DFT in a somewhat analogous manner. I'd have to look back into that though. $\endgroup$
    – Baddioes
    Commented Apr 4 at 1:53
  • $\begingroup$ That must be for the case when the DFT is normalized by $1/\sqrt{N}$ (but also the peak would go down in that case). I normalize by $1/N$ to keep the signal power constant $\endgroup$ Commented Apr 4 at 2:00
  • $\begingroup$ (But the scaling assumed is an important clarification I should add to the answer) $\endgroup$ Commented Apr 4 at 2:04
1
$\begingroup$

I ensured there is no leakage by choosing a suitable sampling rate and duration.

Here you can see the results of my DFT of a pure tone: enter image description here

Here you can see the results of my DFT of a pure tone + noise: enter image description here

The Fourier Coefficient increased from 10.000 to 11.134 ... then a repeated this "1 second observation" 50 times and tracked the coefficient for 100Hz: enter image description here

I expected somehow the coefficient for the tone would rise by the level of the noise. But instead it only increased slightly by 700.

$\endgroup$
3
  • $\begingroup$ this is somewhat related and might be of interest to you. $\endgroup$
    – Jdip
    Commented Apr 3 at 14:05
  • $\begingroup$ This does NOT look like a sine with white noise added. The noise is clearly bandlimited and the wave from looks like it's amplitude modulated, not like added noise. $\endgroup$
    – Hilmar
    Commented Apr 3 at 15:42
  • 1
    $\begingroup$ @Stefan As Hilmar said. (White noise means same noise power at all bins, as an FFT it would also be noisy but similar across the spectrum). This is not an answer but further clarification of your question. Please delete this and edit your original question with this information. $\endgroup$ Commented Apr 4 at 3:42

Your Answer

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

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