Guest User

Untitled

a guest
Oct 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. def piston_position (t, r1, l):
  5. return (r1 * np.cos(t) + ((l**2) - (r1**2) * (np.sin(t)**2)**0.5)
  6.  
  7. t = np.linespace(0,361,50)
  8. y5 = piston_position(t,3,15)
  9.  
  10. plt.plot(t,y5)
  11. plt.show()
  12.  
  13. import numpy as np
  14. import matplotlib.pyplot as plt
  15.  
  16. def yFall (t,v0,y0):
  17. return (-9.8*t*t/2+v0*t+y0)
  18.  
  19. t = np.linspace(0,3,11)
  20. y5 = yFall(t,5,30)
  21.  
  22. plt.plot(t,y5, 'b^--', mfc = 'r')
  23. plt.title ("position")
  24. plt.ylabel ("time")
  25. plt.xlabel ("speed")
  26. plt.show()
Add Comment
Please, Sign In to add comment