Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Wed Aug 31 12:48:07 2016
- @author: vx
- """
- import matplotlib.pyplot as plt
- import math
- def frange(start, stop, step):
- L=[]
- i = start
- while i <= stop:
- L.append(i)
- i += step
- return L
- def plot_series(radius,time_step,time):
- p=[0]
- c=[0]
- s=[0]
- j=[0]
- a=[0]
- v=[0]
- x=[.01]
- step_ser=frange(.001,time,time_step)
- for i in step_ser:
- a.append(2*math.cos(math.pi*22.03/180)*.0018/(85.1*radius*x[-1]))
- v.append(v[-1]+a[-1]*time_step)
- x.append(x[-1]+v[-1]*time_step)
- j.append((a[-1]-a[-2])/time_step)
- s.append((j[-1]-j[-2])/time_step)
- c.append((s[-1]-s[-2])/time_step)
- p.append((c[-1]-c[-2])/time_step)
- return step_ser,x,v,a,j,s,c,p
- # 0 1 2 3 4 5 6 7
- def plot():
- ser= plot_series(.005,.00001,2.2)
- beginning_offset=1000
- x=ser[0][1+beginning_offset:]
- y=ser[6][2+beginning_offset:]
- fig = plt.figure()
- fig.canvas.set_window_title('Velocity')
- plt.scatter(x, y)
- plt.show()
- plot()
Add Comment
Please, Sign In to add comment