Guest User

Untitled

a guest
Jan 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # create new arrays
  2. Adat = [0] #acceleration
  3. Vdat = [0] #velocity
  4. Zdat = [0] #height
  5.  
  6.  
  7. V0 = 0
  8. Vdat[0] = V0 #set initial conditions
  9.  
  10. Z0 = 30000
  11. Zdat[0] = Z0
  12.  
  13. T = 0
  14.  
  15. t_step = 0.9 #set time step in seconds
  16.  
  17. b = 0.5 #drag coefficient in kg/s
  18.  
  19. while Zdat[-1] >= 0:
  20. A1 = (-m*g-b*np.abs(V0)*V0)/m
  21. V1 = V0+A1*t_step
  22. Z1 = Z0+V1*t_step
  23. T = T + t_step
  24. Adat.append(A1)
  25. Vdat.append(V1)
  26. Zdat.append(Z1)
  27. V0 = V1
  28. Z0 = Z1
Add Comment
Please, Sign In to add comment