2
$\begingroup$

One of the problems in Proakis's signal processing book using Matlab asks to plot the histogram of

x3(n) = x1(n) + x1(n-1)

where x1(n) is a random sequence.

To create x1(n), I do the following:

n1 = 1:100000;
a = 0; b = 2; % interval over which to pick random numbers.
x1 = a + (b-a)*rand(100000,1);
N1 = hist(x1,100);
figure, bar(N1);

To generate x3(n), I use a couple of helper-functions defined in Proakis's book.

[x31,n31] = sigshift(x1,n1,1);
[x3,n3] = sigadd(x1,n1,x31,n31);
N3 = hist(x3,nbins);
figure, bar(N3);

Unfortunately, I do not have enough points to post images. However, the histogram of the random sequence x1(n) just shows that x1 is uniformly distributed. The x3(n) however, looks more like a Gaussian distribution.

I don't understand why this happens, and would appreciate if someone could explain this a bit.

Thanks.

$\endgroup$
  • $\begingroup$ I've found a simple explanation. The probability density function for the sum of two dice looks like a triangle. When we add two random sequences where one has been shifted, we basically throw two dice. That explains the distribution of x3. $\endgroup$ – dafeda Jun 10 '13 at 12:22
  • 1
    $\begingroup$ Users are encouraged on Stack exchange sites to answer their own questions if they are able to come up with a solution on their own, so you might consider fleshing this out to an actual answer instead of just a comment. $\endgroup$ – Sam Maloney Jun 10 '13 at 20:25
2
$\begingroup$

In your example, $x_3[n]$ is the sum of two iid random variables, $x_1[n]$ and $x_1[n-1]$. Since each is taken from the uniform distribution, the probability density function (pdf) of each is:

$$ f_{x_1}(x) = \begin{cases} \frac{1}{b-a}, & x \in [a,b] \\ 0, & \text{otherwise} \end{cases} $$

This is just a rectangle function that is scaled and shifted to lie on the interval $[a,b]$. One property of the sum of independent random variables is that the pdf of the sum is equal to the convolution of the individual random variables' pdfs. Therefore:

$$ f_{x_3}(x) = f_{x_1}(x) * f_{x_1}(x) $$

If you convolve two rectangles together, you get a triangle function. Therefore, if you histogram enough samples of $x_3[n]$, you should see the plot converge to a triangular shape.

$\endgroup$
  • $\begingroup$ Add enough uniformly distributed RV's together, and you'll eventually get to the CLT! $\endgroup$ – Peter K. Jun 10 '13 at 14:29
  • $\begingroup$ Much appreciated! $\endgroup$ – dafeda Jun 11 '13 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.