title: Python - modelling noise in electrical systems
body: <p>This may open a can of worms or will be very easily answered:
  I'm building a model of a system within Python: how do I quantitatively add noise? So far I have this (below code) -</p>
  
  <p>i. Can I do this by broadcasting, even for unique noise added to each sample?</p>
  
  <p>and </p>
  
  <p>ii. Should noise be Gaussian or Uniform for electrical signal modelling?
  (Gaussian I think though I'm unsure)</p>
  
  <pre><code>import random
  import numpy as np
  import matplotlib.pyplot as plt
  
  f   = 1e6
  T   = 1/f
  pi  = np.pi
  t   = np.arange(0,20e-6,10e-9) 
  # create signal and normalise  
  y  = np.sin(2*pi*f*t) 
  y /= max(y)
  
  # add noise
  for i in range(0, len(y)):
      noise = random.uniform(-1, 1) / 10    **#10% noise added** 
      y[i] += noise
  
  plt.figure(1)
  plt.plot(t*1e6,y,'r-')
  plt.grid()
  plt.show()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/JPRYp.png" alt="enter image description here"></p>