Advertisement
Kribo

Halveringstid-Graf-3-ny

Apr 13th, 2021
4,600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
  20. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement