Advertisement
yukcheong

Sin grpah

May 10th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. import scipy.optimize as opt
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4.  
  5.  
  6. Fs = 8000
  7. f = 3
  8. sample = 8000
  9. x = np.arange(sample)
  10. y = np.sin(2 * np.pi * f * x / Fs)
  11. y1 = 0.5*np.sin((2 * np.pi * f * x / Fs)+(np.pi/2))
  12. y2 = 0*x + 0
  13.  
  14. plt.plot(x, y)
  15. plt.plot(x, y1)
  16. plt.plot(x, y2, '#000000')
  17. plt.xlabel('sample(n)')
  18. plt.ylabel('voltage(V)')
  19.  
  20. ax=plt.subplot()
  21. ax.spines['top'].set_visible(False)
  22. ax.spines['right'].set_visible(False)
  23. ax.axes.xaxis.set_visible(False)
  24. ax.axes.yaxis.set_visible(False)
  25.  
  26. #plt.title('test')
  27. plt.xlabel('Test', labelpad=10)
  28. plt.ylabel('Test', labelpad=10)
  29. #plt.text(1, -7,'matplotlib', horizontalalignment='left',verticalalignment='center')
  30.  
  31. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement