Skip to content

Instantly share code, notes, and snippets.

@rhettallain
Created August 13, 2014 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhettallain/c44cd188203655022013 to your computer and use it in GitHub Desktop.
Save rhettallain/c44cd188203655022013 to your computer and use it in GitHub Desktop.
Falling Balrog with air resistance
from pylab import *
vt=54
g=9.8
K=2.24
m=68
y=0
t=0
dt=0.01
yp=[]
tp=[]
v=0
while t<13.8:
F=-m*g+K*v**2
v=v+F*dt/m
y=y+v*dt
t=t+dt
yp=yp+[y]
tp=tp+[t]
plot(tp, yp, linewidth=3)
grid(True)
xlabel('Time [s]')
ylabel('Vertical Position [m]')
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment