Aim: Plot sine wave with 5 cycles.
Code:
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0, 10*np.pi, 1024, endpoint=True)
s = np.sin(t)
plt.plot(t,s)
plt.show()
import matplotlib.pyplot as plt
t = np.linspace(0, 10*np.pi, 1024, endpoint=True)
s = np.sin(t)
plt.plot(t,s)
plt.show()
Output:
Aim: Plot sine wave with exponential decay.
Code:
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0, 2*np.pi, 1024, endpoint=True)
s = np.sin(30*t) * np.exp(-t)
plt.plot(t,s)
plt.show()
import matplotlib.pyplot as plt
t = np.linspace(0, 2*np.pi, 1024, endpoint=True)
s = np.sin(30*t) * np.exp(-t)
plt.plot(t,s)
plt.show()
Output:
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.