Let's assume we have a random process consisting of three sinusoids in white noise: $$x[n] = 3 \cdot \sin(ω_1 \cdot n + ϕ_1) + 5 \cdot \cos(ω_2 \cdot n + ϕ_2) + 2 \cdot \sin(ω_3 \cdot n + ϕ_3) + v[n]$$ where $ϕ_1$, $ϕ_2$, $ϕ_3$ are uncorrelated uniformly distributed random variables in $[0,2\pi]$
I want to estimate the power spectral density of $x[n]$. For that purpose I apply two different methods:
- Periodiagram of $x[n]$
- Welch method (Averaged Modified Periodogram) using Hamming window
I generated the following code and ran in Matlab:
N = 1024;
w1 = 0.3 * pi;
w2 = 0.6 * pi;
w3 = 0.7 * pi;
phi1 = unifrnd(0, 2*pi);
phi2 = unifrnd(0, 2*pi);
phi3 = unifrnd(0, 2*pi);
u = randn(1, N);
n = 0:N-1;
x = 3 * sin(w1*n + phi1) + 5*cos(w2*n + phi2) + 2*sin(w3*n + phi3) + u;
fig = figure;
plot(n,x);
title('signal x[n]');
xlabel('samples');
ylabel ('Magnitude');
fig=figure;
[p,f]=periodogram(x);
plot(f,p);
fig=figure
[pw,f]= pwelch(x, N/8, N/16);
plot(f,pw);
Which is the difference in these two methods about the resolution and the variance of the power spectrum ?