Created
August 13, 2014 14:01
-
-
Save rhettallain/c44cd188203655022013 to your computer and use it in GitHub Desktop.
Falling Balrog with air resistance
This file contains hidden or 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
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