Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import pylab
  2.  
  3.  
  4.  
  5. m = float(input("Mass of object: ")) #Input Variable
  6. g = 9.81 #Constant
  7. v = float(input("Desired Terminal Speed: ")) #Input Variable
  8. A=(((g-0)*m)/(0.1*v**2))+1 #Finding A using the input variables and constant
  9. k = 0.1*A #Set a value of k using A
  10. Start = float(input("Starting speed of object: ")) #Input Variable
  11. d = 300000
  12. t = 15
  13. dt = t/d #Big step in relation to time, to avoid problems of the tangent being to steep and becoming negative.
  14. print("Parachute must be",A,"meters squared to get the desired terminal speed for that object.")
  15.  
  16.  
  17. speed = pylab.zeros(d)
  18. time = pylab.zeros(d)
  19.  
  20. speed[0] = Start
  21. for i in range(d-1): #Goes through all the steps we set
  22. speed[i+1] = speed[i] + dt*(g-(k*(speed[i]**2))/m) #Takes speed at point i adds the differntial (Which is negative)
  23. time[i+1] = time[i]+dt #Adds time
  24.  
  25.  
  26. pylab.plot(time,speed) #Plots a time/speed graph for us to look at
  27. pylab.xlabel("time[seconds]")
  28. pylab.ylabel("speed[m/s]")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement