DSPRelated.com
Forums

A question on autocorrelation

Started by Jay April 23, 2004
Hello group
           Let X(n) = Y for all n. X(n) is a stochastic process. Y is
random variable with uniform distribution in (0,1).
           The autocorrelation of X, rxx(m) = E{X(n)X(n-m)} = E{Y.Y} =
E{Y^2}
            
                     1
          E{Y^2} = integral y^2 pdf(y) dy = 1/3
                     0
 
          rxx(m) = 1/3 which is a constant.

 Matlab
          N = 2500;
          x = rand(1,N);
          xc = xcorr(x,'unbiased');
          The value of xc(1250) to corresponds rxx(0). Both are 1/3. 
          No problem so far.  

          My problem is this:
             xc(x~=1250) = xc(x not equal 1250) is not 1/3. They are
all constant but not 1/3. What is the mistake I am making?

Thanks
innocent_802000@yahoo.com (Jay) writes:

> Hello group > Let X(n) = Y for all n. X(n) is a stochastic process. Y is > random variable with uniform distribution in (0,1). > The autocorrelation of X, rxx(m) = E{X(n)X(n-m)} = E{Y.Y} = > E{Y^2}
Nope! E{X(n)X(n-m)} = E{Y.Y} if m=0 0 if m != 0 This is because X(n) and X(n-m) are independent random variables.
> 1 > E{Y^2} = integral y^2 pdf(y) dy = 1/3 > 0 > > rxx(m) = 1/3 which is a constant. > > Matlab > N = 2500; > x = rand(1,N); > xc = xcorr(x,'unbiased'); > The value of xc(1250) to corresponds rxx(0). Both are 1/3. > No problem so far. > > My problem is this: > xc(x~=1250) = xc(x not equal 1250) is not 1/3. They are > all constant but not 1/3. What is the mistake I am making?
Ciao, Peter K. -- Peter J. Kootsookos "I will ignore all ideas for new works [..], the invention of which has reached its limits and for whose improvement I see no further hope." - Julius Frontinus, c. AD 84
> > Nope! > > E{X(n)X(n-m)} = E{Y.Y} if m=0 > 0 if m != 0 > > This is because X(n) and X(n-m) are independent random variables. >
Thanks for your tip on independence. 1 1 rxx(m) = E{X(n)X(n-m)} = integral integral x y joint pdf of (x,y) dx dy 0 0 1 1 = integral x pdf of x dx * integral y pdf of y dy 0 0 this is by independence = 1/2 * 1/2 = 1/4. Matlab also gave me the same answer 0.254 for m != 0.
Peter J. Kootsookos wrote:

> innocent_802000@yahoo.com (Jay) writes: > > >>Hello group >> Let X(n) = Y for all n. X(n) is a stochastic process. Y is >>random variable with uniform distribution in (0,1). >> The autocorrelation of X, rxx(m) = E{X(n)X(n-m)} = E{Y.Y} = >>E{Y^2} > > > Nope! > > E{X(n)X(n-m)} = E{Y.Y} if m=0 > 0 if m != 0 > > This is because X(n) and X(n-m) are independent random variables.
Err, no they're not. For one instance of the random process, all the x[n] have the same value. Carlos --
Carlos Moreno wrote:
> Peter J. Kootsookos wrote: > >> innocent_802000@yahoo.com (Jay) writes: >> >> >>> Hello group >>> Let X(n) = Y for all n. X(n) is a stochastic process. Y is >>> random variable with uniform distribution in (0,1). >>> The autocorrelation of X, rxx(m) = E{X(n)X(n-m)} = E{Y.Y} = >>> E{Y^2} >> >> >> >> Nope! >> >> E{X(n)X(n-m)} = E{Y.Y} if m=0 0 if m != 0 >> >> This is because X(n) and X(n-m) are independent random variables. > > > Err, no they're not. For one instance of the random process, all the > x[n] have the same value. > > Carlos > --
rannd(N,1) is not equal to c*ones(N,1)
Stan Pawlukiewicz wrote:

> Carlos Moreno wrote: > >> Peter J. Kootsookos wrote: >> >>> innocent_802000@yahoo.com (Jay) writes: >>> >>> >>>> Hello group >>>> Let X(n) = Y for all n. X(n) is a stochastic process. Y is >>>> random variable with uniform distribution in (0,1). >>>> The autocorrelation of X, rxx(m) = E{X(n)X(n-m)} = E{Y.Y} = >>>> E{Y^2} >>> >>> >>> >>> >>> Nope! >>> >>> E{X(n)X(n-m)} = E{Y.Y} if m=0 0 if m != 0 >>> >>> This is because X(n) and X(n-m) are independent random variables. >> >> >> >> Err, no they're not. For one instance of the random process, all the >> x[n] have the same value. >> >> Carlos >> -- > > rannd(N,1) is not equal to c*ones(N,1)
Ok, but then the bug is in using rand(N,1) -- or in the OP's description of the problem. See above: "Let X(n) = Y for all n" That tells me that the random process is constant -- to obtain a realization of the random process, you draw a random variable Y with uniform distribution in (0,1), and the process will take that value for all time-indices. Carlos --
Carlos Moreno wrote:
> Stan Pawlukiewicz wrote: > >> Carlos Moreno wrote: >> >>> Peter J. Kootsookos wrote: >>> >>>> innocent_802000@yahoo.com (Jay) writes: >>>> >>>> >>>>> Hello group >>>>> Let X(n) = Y for all n. X(n) is a stochastic process. Y is >>>>> random variable with uniform distribution in (0,1). >>>>> The autocorrelation of X, rxx(m) = E{X(n)X(n-m)} = E{Y.Y} = >>>>> E{Y^2} >>>> >>>> >>>> >>>> >>>> >>>> Nope! >>>> >>>> E{X(n)X(n-m)} = E{Y.Y} if m=0 0 if m != 0 >>>> >>>> This is because X(n) and X(n-m) are independent random variables. >>> >>> >>> >>> >>> Err, no they're not. For one instance of the random process, all the >>> x[n] have the same value. >>> >>> Carlos >>> -- >> >> >> rannd(N,1) is not equal to c*ones(N,1) > > > Ok, but then the bug is in using rand(N,1) -- or in the OP's > description of the problem. See above: "Let X(n) = Y for all n" > > That tells me that the random process is constant -- to obtain > a realization of the random process, you draw a random variable > Y with uniform distribution in (0,1), and the process will take > that value for all time-indices. > > Carlos > --
Most books don't agree on simple notation. I don't expect to see any better on a newsgroup particularly when the person posting is also trying to get the basic concepts. It's really up to the original poster to elaborate on his or her meaning.
"Jay" <innocent_802000@yahoo.com> wrote in message
news:7f6c0a9a.0404230334.338af3f1@posting.google.com...
......
> this is by independence > = 1/2 * 1/2 = 1/4. > Matlab also gave me the same answer 0.254 for m != 0.
The difference is due to the fact that MATLAB, a US product, does not use the metric system in its internal calculations, but does use it in the external display because "scientists" use the metric system. Note that one inch is defined to be EXACTLY 2.54 cm in the US (something slightly different in the rest of the world). Thus, the answer that MATLAB computed is actually 0.1 (inch), and it converted it to cm to give 0.254 as the answer. What is amazing, of course, that Jay's back-of-the-enevelope calculation gives 1/4 = 0.25 which is so close to the correct answer. \include{Smileys all around to circumvent expostulations by the humor-impaired}
Carlos Moreno <moreno_at_mochima_dot_com@xx.xxx> wrote in message news:<uw9ic.58817$mK3.695597@weber.videotron.net>...
> Peter J. Kootsookos wrote: > > > innocent_802000@yahoo.com (Jay) writes: > > > > > >>Hello group > >> Let X(n) = Y for all n. X(n) is a stochastic process. Y is > >>random variable with uniform distribution in (0,1). > >> The autocorrelation of X, rxx(m) = E{X(n)X(n-m)} = E{Y.Y} = > >>E{Y^2} > > > > > > Nope! > > > > E{X(n)X(n-m)} = E{Y.Y} if m=0 > > 0 if m != 0 > > > > This is because X(n) and X(n-m) are independent random variables. > > Err, no they're not. For one instance of the random process, all the > x[n] have the same value. > > Carlos > --
No, Peter is correct. What we have to understand is that at each time instant in the random process, the value of the random process is uniformly distributed. However, for the next time instant, the value of the random process will be uniformly distributed and independent of the previous time instant. This process is a white random process with uniformly distributed samples. Susheem
Thanks everyone.
What I meant is the following: The value X(n) takes is drawn from a
uniform random distribution. X(n) and X(m) are not the same random
variables if n and m are different. X(n) is drawn from uniform
distribution. X(m) is again drawn from the same distribution. More
formally, the pdf of X(n) is uniform in (0,1). The pdf of X(m) is
again uniform in (0,1). X(n) and X(m) need not be neccessarily equal
if n~=m. They are equal if n = m.