Generate 1024 samples of a noisy sinusoid having a normalized frequency of rad/sample. Estimate the power spectrum of the signal using pwelch. Express the estimate in decibels and plot it.
n = 0:1024-1;
x = cos(2*pi*n/3) + randn(size(n));
[pxx,w] = pwelch(x,'power');
dB = pow2db(pxx);
plot(w/pi,dB)
xlabel('\omega / \pi')
ylabel('Power (dB)')
Repeat the computation using pwelch without output arguments.