Advertisement
Bastian_Eggum_Huuse

BøtteGrafGen

May 6th, 2024 (edited)
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | Science | 0 0
  1. import pylab as pl
  2. import matplotlib.pyplot as plt
  3.  
  4. #Selve fysikkdelen
  5.  
  6. g = 9.81 # m/s^2
  7. r = 1 # M
  8.  
  9. def GetVelocity(g_1,r_1,DegAlpha):
  10.    
  11.     v = (3*g_1*r_1*pl.sin(pl.deg2rad(DegAlpha)) + 2*g_1*r_1)**(1/2)
  12.     return v/(pl.pi * 2)
  13.  
  14.  
  15. #Plotting:
  16. fig, ax = plt.subplots()
  17. WaterColor = "dodgerblue"
  18. Degrees = [0,15,30,45,60,75,90]
  19. Velocities = []
  20. ArrowHeadSize = 0.07 * r
  21.  
  22. #Lager lister som skal plottes
  23. N = 400
  24. X = pl.linspace(0,90,N)
  25. Y = GetVelocity(g,r,X)
  26.  
  27. for n in range(0,6):
  28.     Velocities.append(Y[0] + ((Y[-1]-Y[0])/5) * n)
  29.    
  30. ax.plot(Y,X,WaterColor) #Flipper disse fordi jeg ønsker
  31. ax.set_yticks(Degrees)
  32. ax.set_xticks(Velocities)
  33. ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.2f'))
  34. ax.axvline(Y[-1],c="black",linestyle='--')
  35. print(Y[-1])
  36.  
  37. #Innstillinger for plot
  38. ax.set_xlabel("Rotasjoner per sekund")
  39. ax.set_ylabel("Grader nådd")
  40. ax.set_title(f"Antall grader nådd ved forskjellige \nantall rotasjoner per sekund (r = {r}m)")
  41.  
  42. rotasjoner per sekund (r = {r}m)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement