Advertisement
Guest User

What is the probability distribution of the DFT of a real Gaussian white noise random vector?

a guest
Jun 2nd, 2025
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | Science | 0 0
  1. import numpy as np
  2. import scipy as sp
  3. import matplotlib.pyplot as plt
  4.  
  5. N = 1024
  6. num_samples = 100000
  7. X = np.random.normal(size=(num_samples, 1024))
  8. X_hat = np.fft.fft(X, axis=-1)
  9.  
  10. fig, ax = plt.subplots(nrows=2, ncols=2, figsize=(10, 8))
  11. fig.suptitle('Distribution of DFT of real-valued Gaussian white noise\n$N=1024$, # Samples = 100,000')
  12. ax[0,0].grid()
  13. ax[0,0].hist(np.real(X_hat[:, 0]), bins=100, density=True, label='Observed')
  14. dom = np.linspace(-140, 140, 100)
  15. ax[0,0].plot(dom, sp.stats.norm.pdf(dom, scale=np.sqrt(N)), label='Theoretical')
  16. ax[0,0].legend()
  17. ax[0,0].set_title('Distribution of $\\hat{X}_0^\\mathrm{real}$')
  18. ax[0,1].grid()
  19. ax[0,1].hist(np.imag(X_hat[:, 0]), bins=100, density=True, label='Observed')
  20. dom = np.linspace(-140, 140, 100)
  21. ax[0,1].set_title('Distribution of $\\hat{X}_0^\\mathrm{imag}$')
  22. ax[1,0].grid()
  23. ax[1,0].hist(np.real(X_hat[:, 3]), bins=100, density=True, label='Observed')
  24. dom = np.linspace(-140, 140, 100)
  25. ax[1,0].plot(dom, sp.stats.norm.pdf(dom, scale=np.sqrt(N/2)), label='Theoretical')
  26. ax[1,0].set_title('Distribution of $\\hat{X}_3^\\mathrm{real}$')
  27. ax[1,1].grid()
  28. ax[1,1].hist(np.imag(X_hat[:, 3]), bins=100, density=True, label='Observed')
  29. dom = np.linspace(-140, 140, 100)
  30. ax[1,1].plot(dom, sp.stats.norm.pdf(dom, scale=np.sqrt(N/2)), label='Theoretical')
  31. ax[1,1].set_title('Distribution of $\\hat{X}_3^\\mathrm{imag}$')
  32.  
  33. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement