Guest User

Untitled

a guest
Jan 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Wed Aug 31 12:48:07 2016
  4.  
  5. @author: vx
  6. """
  7.  
  8. import matplotlib.pyplot as plt
  9. import math
  10. def frange(start, stop, step):
  11. L=[]
  12. i = start
  13. while i <= stop:
  14. L.append(i)
  15. i += step
  16. return L
  17.  
  18. def plot_series(radius,time_step,time):
  19. p=[0]
  20. c=[0]
  21. s=[0]
  22. j=[0]
  23. a=[0]
  24. v=[0]
  25. x=[.01]
  26. step_ser=frange(.001,time,time_step)
  27. for i in step_ser:
  28. a.append(2*math.cos(math.pi*22.03/180)*.0018/(85.1*radius*x[-1]))
  29. v.append(v[-1]+a[-1]*time_step)
  30. x.append(x[-1]+v[-1]*time_step)
  31. j.append((a[-1]-a[-2])/time_step)
  32. s.append((j[-1]-j[-2])/time_step)
  33. c.append((s[-1]-s[-2])/time_step)
  34. p.append((c[-1]-c[-2])/time_step)
  35. return step_ser,x,v,a,j,s,c,p
  36. # 0 1 2 3 4 5 6 7
  37. def plot():
  38. ser= plot_series(.005,.00001,2.2)
  39. beginning_offset=1000
  40. x=ser[0][1+beginning_offset:]
  41. y=ser[6][2+beginning_offset:]
  42.  
  43. fig = plt.figure()
  44. fig.canvas.set_window_title('Velocity')
  45. plt.scatter(x, y)
  46. plt.show()
  47.  
  48. plot()
Add Comment
Please, Sign In to add comment