import numpy as np
import matplotlib.pyplot as plt
from sk_dsp_comm import sigsys as ss
m = np.arange(1000000)
Nfft = 2*1024
s = np.cos(2*np.pi*98.176/Nfft*m) + 3*np.cos(2*np.pi*200/Nfft*m)
w = 1/np.sqrt(2)*(np.random.randn(len(m)) + 1j*np.random.randn(len(m)));
Px, fx = ss.psd(w+s,n_fft=Nfft,fs=1.0,)
print(max(10*np.log10(Px)))
plt.plot(fx,10*np.log10(Px))
plt.grid()
plt.title(r'Sinusoid + Noise Spectrum using the Noise Scaling Option')
plt.xlabel(r'Normalized Frequency ($\omega/(2\pi)$)')
plt.ylabel(r'PSD (dB)')
plt.ylim(-10,40)
plt.show()
