# phase of fft of random autocorrelation is deterministic...why?

Started by March 3, 2006
```Hello,

If I generate a random sequence x and calculate:

phase of FFT(autocorrelation of x)

then the phase is the same no matter what...

That puzzles me a little bit....Can anybody explain to
me why the phase is deterministic in this case?

```
```Jack wrote:

> Hello,
>
> If I generate a random sequence x and calculate:
>
> phase of FFT(autocorrelation of x)
>
> then the phase is the same no matter what...
>
> That puzzles me a little bit....Can anybody explain to
> me why the phase is deterministic in this case?
>
>
>
The autocorrelation operation automatically yields a result that has
even symmetry around the origin.  You'd find that if you arranged the
result of the autocorrelation so that it's origin was at sample 1 (time
= 0 -- don't you love Matlab?) the fft would be entirely real.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

```
```> The autocorrelation operation automatically yields a result that has even
> symmetry around the origin.  You'd find that if you arranged the result of
> the autocorrelation so that it's origin was at sample 1 (time = 0 -- don't
> you love Matlab?) the fft would be entirely real.

Ok, the fft would be entirely real...but how does that answer my question?

```
```Jack wrote:
>>The autocorrelation operation automatically yields a result that has even
>>symmetry around the origin.  You'd find that if you arranged the result of
>>the autocorrelation so that it's origin was at sample 1 (time = 0 -- don't
>>you love Matlab?) the fft would be entirely real.
>
>
> Ok, the fft would be entirely real...but how does that answer my question?
>
>
>
Well, the phase of a real number is either 0 or 180 degrees, no other
choices.  That's a lot more deterministic than "anything", which is what
you'd get from an arbitrary complex number.

If you happen to be taking the autocorellation of a positive-definite
process then the correctly-centered fft phase will always be 0, forget
the 180 degrees.  Taking the 'usual' fft with uncentered data will give
a phase that is always the same (spinning about at a rate proportional
to the offset), which would end up looking pretty darn deterministic.

This answer seems entirely adequate to me.  Perhaps you should try to
restate your question so I know what parts I've left out?

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

```
```>>
> Well, the phase of a real number is either 0 or 180 degrees, no other
> choices.  That's a lot more deterministic than "anything", which is what
> you'd get from an arbitrary complex number.
>
> If you happen to be taking the autocorellation of a positive-definite
> process then the correctly-centered fft phase will always be 0, forget the
> 180 degrees.  Taking the 'usual' fft with uncentered data will give a
> phase that is always the same (spinning about at a rate proportional to
> the offset), which would end up looking pretty darn deterministic.
>

excellent answer...now I understand...thank you very much...

```
```hmmm...i guess i hit the send button too fast...

you say that the phase of a real number is always either 0 or 180...

but in this case I am calculating the phase of a complex number which
you can see on subplot (1,3,3) in the matlab code below.

try running this matlab code and you will see what I am talking about..

i appreciate the help :-)

clc
close all
clear

N=40;
for k=1:1000
x=randn(1,N);
rxx=xcorr(x);
phase_x=angle(fft(rxx));
subplot(1,3,1)
plot(rxx)
ylim([-20 100]);
subplot(1,3,2)
plot(phase_x)
subplot(1,3,3)
plot(fft(rxx))
drawnow;
t=['Press any key ' num2str(k)];
title(t)
pause()
end

```
```ok...i get it now...the phase has nothing to do with the input but only with
the number of points....stupid me...

```