Why isn't the autocorrelation of rand a delta function?

조회 수: 5 (최근 30일)
Erika
Erika 2013년 7월 17일
Hello,
As both rand and randn generate uncorrelated random numbers, I expected that the autocorrelation of both rand or randn shows delta functions. However the result was different for rand.
(rand generates uniformly distributed random numbers and randn generates normal random numbers)
Does anyone know why the autocorrelation of rand is not a delta function?
x=rand(1,100,1); Rxx=xcorr(x); subplot(2,1,1); plot(Rxx); grid; title('Autocorrelation function of rand'); xlabel('lags'); ylabel('Autocorrelation');
x=randn(1,100,1); Rxx=xcorr(x); subplot(2,1,2); plot(Rxx); title('Autocorrelation function of randn'); xlabel('lags'); ylabel('Autocorrelation');

채택된 답변

Teja Muppirala
Teja Muppirala 2013년 7월 18일
As described in detail here, http://en.wikipedia.org/wiki/Autocorrelation, there is more than one convention when calculating autocorrelation. In signal processing, autocorrelation of a sequence is often calculated without subtracting off the mean. As described in the documentation, this is indeed what XCORR does:
By default, xcorr computes raw correlations with no normalization.
If you generate the uniform random numbers with no bias (subtract 0.5), you will indeed get a result that looks like a delta function.
x=rand(1,100,1)-0.5; Rxx=xcorr(x); subplot(2,1,1); plot(Rxx); grid; title('Autocorrelation function of rand'); xlabel('lags'); ylabel('Autocorrelation');
x=randn(1,100,1); Rxx=xcorr(x); subplot(2,1,2); plot(Rxx); title('Autocorrelation function of randn'); xlabel('lags'); ylabel('Autocorrelation');

추가 답변 (1개)

the cyclist
the cyclist 2013년 7월 18일
I don't have the Signal Processing Toolbox, so I can't test this idea, but is this related to the normalization discussed in the documentation here:

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by