Advertisement
Kribo

Bryting-NN-3

Aug 4th, 2020
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. #Definere funksjon for utrekning av bølgja:
  5. def f(A,k,x,c):
  6.     return A*np.sin(k*x+c)
  7.  
  8.  
  9. #Få data frå brukaren:
  10. A = float(input("Skriv inn verdi for A: "))
  11. k = float(input("Skriv inn verdi for k: "))
  12. c = float(input("Skriv inn verdi for c: "))
  13.  
  14.  
  15. #Teikn bølgja:
  16. fig = plt.figure()
  17. ax1 = fig.add_subplot(111)
  18. ax1.grid(True)
  19.  
  20. x = np.linspace(0, 25, 1000)
  21.  
  22. ax1.plot(x,f(A,k,x,c))
  23. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement