Chien-Pin Chen problem 2b first draft  about 8 years ago

Commit id: 72f1f6e76c03600edd010dd472d2525a3397c23c

deletions | additions      

       

(b) Use your conclusion from (a) to write a MATLAB code that  generates the sequence from Problem 1. Generate the sequence   100 (or more) times and based on these sequences, verify the  results obtained in Problem 1. 1.\\\\  ANS:\\  First, I use MATLAB to create uniform-shaped function $p_n(n)$ (as figure 1).  Then, I use MATLAB function (conv) to do the convultion of $p_n(n)$ and itself (as figure 2).  Finally, I generate the sequence of 100 times $x_k=x_{k-1}+m_k$, and I got $x_k$ about 100.   And, according to the regult of Problem that $E\{x_k\}=k\ \frac{1}{6}=100*\frac{1}{6}=16.667$.