15
$\begingroup$

I would like to create white noise in the frequency domain, and then transform it to the time domain using python. To understand the problem, I simply generated white noise in the time domain, and transformed it to freq domain:

import scipy.signal as sg
import numpy as np
import matplotlib.pyplot as plt

e = np.random.normal(0,1,1e3)
E = sg.fft(e)

plt.figure("Bode plot")
plt.subplot(211)
plt.title("Magitude")
plt.plot(abs(E))
plt.subplot(212)
plt.title("Phase")
plt.plot(np.angle(E))
plt.show()

I does not look at all as I expected: Bode plot of white noise Questions:

  • Isn't white noise supposed to have a flat magnitude response? (equal amounts for all frequencies)
  • What is the relationship between the standard deviation (1 in my example) and the magnitude and phase?

Thank you in advance!

$\endgroup$
21
$\begingroup$

Isn't white noise supposed to have a flat magnitude response? (equal amounts for all frequencies)

The expected magnitude response of white noise is flat (this is what JasonR calls the power spectral density). Any particular instance of a white noise sequence will not have precisely flat response (this is what JasonR's comment refers to as the power spectrum).

In fact, the Fourier transform of white noise is... white noise!

What is the relationship between the standard deviation (1 in my example) and the magnitude and phase?

There will be no relationship between the standard deviation and the phase. As for the magnitude, suppose $n(t)$ is stationary white noise with zero mean and standard deviation $\sigma$. Then the autocorrelation (covariance) is:

$$ R_{nn}(\tau) = E[n(t)n(t+\tau)] = \sigma^2\delta(\tau) $$

So the power spectral density is just $\sigma^2$ (though for discrete-time, there will be a scaling based on the duration of the signal).


Questions from comment:

  1. When you say that the Fourier transform is also white noise, how can I measure the std-dev when the transform is complex? Real, imaginary part or some combination?

Assume that our noise is discrete-time and is $n[m]$ (zero mean, Gaussian, white noise with variance $\sigma^2$). Then the transform is:

$$ \begin{eqnarray} N[k] &=& \sum_{m=0}^{M-1} n[m] e^{-j2\pi mk/M} \\ &=& \sum_{m=0}^{M-1} n[m] \cos(2\pi mk/M) + j n[m] \sin(2\pi mk/M) \end{eqnarray} $$

and the expected value is:

$$ \begin{eqnarray} E\left[N[k]\right] &=& E\left[\sum_{m=0}^{M-1} n[m] e^{-j2\pi mk/M} \right]\\ &=& \sum_{m=0}^{M-1} E\left[n[m]\right] e^{-j2\pi mk/M} \\ &=& 0 \end{eqnarray} $$

The variance of the real part is given by:

$$ \begin{eqnarray} E\left[ (\Re N[k])^2 \right] &=& E \left [ \sum_{m=0}^{M-1} n[m] \cos(2\pi mk/M) \cdot \sum_{p=0}^{M-1} n[p] \cos(2\pi pk/M) \right ]\\ &=& E\left[ \sum_{m=0}^{M-1} \sum_{p=0}^{M-1} n[m]n[p] \delta[n-p] \cos(2\pi mk/M)\cos(2\pi pk/M) \right]\\ &=& \sum_{m=0}^{M-1} E\left[ n[m]^2 \right]\cos^2(2\pi mk/M)\\ &=& \sigma^2\sum_{m=0}^{M-1} \cos^2(2\pi mk/M)\\ &=& \sigma^2 \left( \frac{M}{2} + \frac{\cos(M+1) 2\pi k/M \sin(2\pi Mk/M) }{ 2 \sin (2\pi k/M) } \ \ \ \right)\\ &=& \frac{\sigma^2 M}{2} \end{eqnarray} $$

I believe the imaginary part will behave the same way.

  1. Could you please enlighten me how the duration of the signal relates to the power spectral density (for discrete time situations)

I believe that (based on the above derivation), the power spectral density (the expected value of the square of the DFT) will scale linearly as the duration.

  1. If the phase is not affected by the std-dev, what determines the 3 degree amplitude, and the type of distribution (seems to be uniform rather than normal)

Check out the table on page 2 of this PDF file. it says that the argument (phase) of the coefficients will be uniformly distributed, as you state. Screenshot of the table included below.

enter image description here

$\endgroup$
  • 3
    $\begingroup$ Specifically, the two concepts that the OP is confusing are the power spectral density of white noise and the power spectrum of one particular realization of a white noise random process. $\endgroup$ – Jason R Mar 29 '13 at 18:22
  • $\begingroup$ Thanks! I have some follow-up questions. 1: When you say that the Fourier transform is also white noise, how can I measure the std-dev when the transform is complex? Real, imaginary part or some combination? 2: Could you please enlighten me how the duration of the signal relates to the power spectral density (for discrete time situations) 3: If the phase is not affected by the std-dev, what determines the 3 degree amplitude, and the type of distribution (seems to be uniform rather than normal) $\endgroup$ – Uffe Apr 2 '13 at 8:34
  • $\begingroup$ Perfect! This explains all the features of the frequency response. It is now clear to me that the amplitude of the phase was not 3, but $\pi$, and that the std-dev of the real and imaginary parts simply depends on the amount of elements in the vector. I can also confirm, by experiment, that the imaginary part also has a variance of $\frac{\sigma^2 M}{2}$. $\endgroup$ – Uffe Apr 4 '13 at 8:14
  • $\begingroup$ This is the current link to PDF document referenced above (radarsp.weebly.com/uploads/2/1/4/7/21471216/dft_of_noise.pdf), which is broken. $\endgroup$ – Guest Jun 17 at 21:22
  • $\begingroup$ @Guest Thanks! In the future, just try to edit the answer with the new link. It won't go directly as it will need to be reviewed by a higher-rep user, but it will get there (and get you +2 rep in the process). $\endgroup$ – Peter K. Jun 18 at 1:32

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.