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.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.