Advertisement
mpantus

Jos van Zanten & Math Pantus 01

Aug 15th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Jos van Zanten
  2. Math Pantus
  3. PASTEBIN 01
  4.  
  5. www.google.nl
  6.  
  7. PYTHON CODE:
  8. REM: Plotting Sine Wave:
  9.  
  10. import matplotlib.pyplot as plt # For ploting
  11. import numpy as np # to work with numerical data efficiently
  12.  
  13. fs = 100 # sample rate
  14. f = 2 # the frequency of the signal
  15.  
  16. x = np.arange(fs) # the points on the x axis for plotting
  17. # compute the value (amplitude) of the sin wave at the for each sample
  18. y = [ np.sin(2*np.pi*f * (i/fs)) for i in np.arange(fs)]
  19.  
  20. #this instruction can only be used with IPython Notbook.
  21. % matplotlib inline
  22. # showing the exact location of the smaples
  23. plt.stem(x,y, 'r', )
  24. plt.plot(x,y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement