Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. #Funksjon som gir hvor mange prosent som er igjen av stoffet.
  4. def p(t,h):
  5. return 0.5**(t/h)*100
  6.  
  7. #Be om verdier for t og h.
  8. t = np.linspace(0, float(input("Hvor lang tid skal gå? ")), 1000)
  9. h = float(input("Hva er halveringstiden? "))
  10.  
  11. #Lage graf.
  12. fig = plt.figure()
  13. ax1 = fig.add_subplot(111)
  14. ax1.grid(True)
  15.  
  16. x = t
  17. y = p(t,h)
  18.  
  19. ax1.plot(x,y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement