SHARE
TWEET

Untitled

a guest Jul 18th, 2019 66 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.  
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top