Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import numpy as np
  2. from matplotlib import pyplot as plt
  3.  
  4. N = 1000;
  5.  
  6. r_noise = np.random.uniform(-0.01,0.01,size=(1,N))
  7. theta_noise = np.random.uniform(-0.35,0.35,size=(1,N))
  8. r = 1 + r_noise;
  9. theta = np.pi/2 + theta_noise;
  10. x = r * np.cos(theta);
  11. y = r * np.sin(theta);
  12.  
  13. x_meanNon = np.mean(x);
  14. y_meanNon = np.mean(y);
  15.  
  16. x_meanLin = 0.0;
  17. y_meanLin = 1.0;
  18.  
  19. fig = plt.figure(linewidth=2)
  20. plt.plot(x[:],y[:], 'c.')
  21. plt.plot(x_meanNon ,y_meanNon , 'ro')
  22. plt.plot(x_meanLin ,y_meanLin , 'bo')
  23. plt.text(x_meanNon ,y_meanNon , 'Nonlinear Mean')
  24. plt.text(x_meanLin ,y_meanLin , 'Linearized Mean')
  25. plt.xlabel("X")
  26. plt.ylabel("Y")
  27. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement