# Histogram of signal with a time shift added

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);
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.

• 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. – dafeda Jun 10 '13 at 12:22
• 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. – Sam Maloney Jun 10 '13 at 20:25

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.