Last active
January 6, 2019 01:00
-
-
Save Brenn10/d3b85d003cf5a9b5b8683fd681f1e304 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Aug 31 12:48:07 2016 | |
@author: Brennan Cain | |
""" | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment