Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. amp = 1
  5. freq = 2
  6. time = np.linspace(0, 2, 1000)
  7.  
  8. signal1 = amp*np.sin(2*np.pi*freq*time)
  9.  
  10. signal2 = np.where(signal1<0, 0, signal1)
  11.  
  12. plt.figure()
  13. plt.style.use('seaborn-whitegrid')
  14. plt.plot(time, signal2)
  15. plt.ylim(bottom=-1) # To avoid automatic resizing of the plot
  16. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement