Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- amp = 1
- freq = 2
- time = np.linspace(0, 2, 1000)
- signal1 = amp*np.sin(2*np.pi*freq*time)
- signal2 = np.where(signal1<0, 0, signal1)
- plt.figure()
- plt.style.use('seaborn-whitegrid')
- plt.plot(time, signal2)
- plt.ylim(bottom=-1) # To avoid automatic resizing of the plot
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement