Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = 1024
- freq = 8000
- f1 = 500
- f2 = 1200
- n = np.arange(N)
- w = np.random.normal(0,1,N)
- s = 0.5*np.sin(2*np.pi*n*f1/freq) + np.sin(2*np.pi*n*f2/freq)
- y = s + 0.1*w
- pw = signal.hann(N) * w
- ps = signal.hann(N) * s
- py = signal.hann(N) * y
- plt.figure(figsize = (20,15))
- plt.subplot(3,2,1)
- plt.title("Periodogram Power Spectral Density Estimate")
- plt.xlabel("Normalized Frequency")
- plt.xlim(0,1)
- plt.psd(w, N)
- plt.subplot(3,2,3)
- plt.title("Periodogram Power Spectral Density Estimate")
- plt.xlabel("Normalized Frequency")
- plt.xlim(0,1)
- plt.psd(s, N)
- plt.subplot(3,2,5)
- plt.title("Periodogram Power Spectral Density Estimate")
- plt.xlabel("Normalized Frequency")
- plt.xlim(0,1)
- plt.psd(y, N)
- plt.subplot(3,2,2)
- plt.title("Periodogram Power Spectral Density Estimate")
- plt.xlabel("Normalized Frequency")
- plt.xlim(0,1)
- plt.psd(pw, N)
- plt.subplot(3,2,4)
- plt.title("Periodogram Power Spectral Density Estimate")
- plt.xlabel("Normalized Frequency")
- plt.xlim(0,1)
- plt.psd(ps, N)
- plt.subplot(3,2,6)
- plt.title("Periodogram Power Spectral Density Estimate")
- plt.xlabel("Normalized Frequency")
- plt.xlim(0,1)
- plt.psd(py, N)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement