Hey guys,
i am pretty new to using matlab and i need a little bit of help right now.
is the PSD of a statistical process x(t)
ist the autocorrelation function and E{ } the expected value
are a fourier pair
Now the Wiener Khintchine theorem states, that:
Using the average as the expectation:
Then the cross spectrum of two random processes gives :
I was trying to verify the above theory in matlab but didnt manage to do so, maybe you can help me detect what went wrong.
c = randn(1,1e6); %created random sequences
x = 5*randn(1,1e6)+c;
y = 5*randn(1,1e6)+c;
L=1e6;
[xy_cor,lags] = xcorr(x,y); %execute the fft on the cross-correlation on x,y
P2xy = abs(fftshift(fft(xy_cor))/1e6);
P1xy = P2xy(1:L/2+1);
P1xy(2:end-1) = 2*P1xy(2:end-1);
figure(1); %plotted the PSD ,length of showed plot shouldnt really matter
plot(f(1:100),10*log10(P1xy(1:100)))
title('Single-Sided Amplitude Spectrum of xy(t) selfmade')
xlabel('f (Hz)')
ylabel('|P1(f)|')
xf = fft(x);
yf = fft(y);
xf_wien = xf.*yf;
figure(2);
plot(1:100,10*log10(xf_wien(1:100)))
So why do figure 1 and 2 differ? As far as i understood the theory they should be the same???
Thanks in advance
댓글 수: 0
댓글을 달려면 로그인하십시오.