Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. import numpy as np
  2. import scipy.signal as sig
  3. import scipy.optimize as op
  4.  
  5. import matplotlib.pyplot as plt
  6. from matplotlib import rc;
  7. rc("text"   ,usetex=True)
  8. rc("text.latex", unicode=True)
  9.  
  10. N = 10000
  11. n = 100
  12.  
  13. rng1 = np.random.normal(size=N)
  14. rng2 = np.asarray(np.random.normal(size=N),dtype=np.int)
  15.  
  16. xs = np.linspace(1,n,n,dtype=np.int)
  17. errs1, errs2 = np.zeros(n), np.zeros(n)
  18. for i in xs:
  19.     win = sig.exponential(i*20+1, tau=i, sym=1)
  20.     r1 = np.convolve(rng1, win/i, mode="same")
  21.     r2 = np.convolve(rng2, win/i, mode="same")
  22.     errs1[i-1] = np.std(r1)
  23.     errs2[i-1] = np.std(r2)
  24.  
  25. fig,ax = plt.subplots()
  26. ax.plot(xs,errs1,"-r",label="$\sigma_f$")
  27. ax.plot(xs,errs2,"-b",label="$\sigma_i$")
  28. #ax.plot(xs,errs1/errs2,"-k",label="$\sigma_f/\sigma_i$")
  29. ax.legend()
  30. ax.set_xlim(xs[0],xs[-1])
  31.  
  32. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement