EE132B Computer Workout 1
EE132B (2015 Winter) Computer Workout 1 Prof. Izhak Rubin Problem 1 Generate a stream of i.i.d. random variables U = {Un | 1 ≤ n ≤ N} which are uniformly distributed over [0, 1], for each N = 1000, 5000, 10000. (a) Use the resulting streams to draw the probability density histograms of U over the intervals (0.1i, 0.1i + 0.1], for i = 0, 1, . . . , 9. Also, compare the histogram levels with those derived analytically. (b) Compute the sample means and variances for each of the three runs. Then, compare the results with the mean and variance values derived analytically. – when the variables {Xn | 1 ≤ n ≤ N} are observed, N > 1, the sample mean µN and sample variance σ 2 N are calculated as follows: µN = PN i=1 Xi N , σ2 N = PN i=1(Xi − µN ) 2 N − 1 . Problem 2 Generate a stream of i.i.d. random variables T = {Tn | 1 ≤ n ≤ N} which are exponentially distributed with parameter (intensity) λ = 0.1, for each N = 1000, 5000, 10000. (a) Use the resulting streams to compute and exhibit the probability density histograms for T, over the intervals (i, 1 + i], for i = 0, 1, . . . , 19. Also, compare the histogram levels with those derived analytically. (b) Compute the sample means and variances, for each one of the three runs. Then, compare the results with the analytically derived mean and variance values – Note: The theoretical mean and variance of Tn are 1 λ and 1 λ2 , respectively. (c) Show that if Un is uniformly distributed over (0, 1], and the random variable Tn is calculated as Tn = − ln(Un) λ , then Tn is exponentially distribution with intensity λ. Problem 3 Consider a traffic stream represented by the stochastic point process A = {An | n ≥ 0}, where An denotes the time of occurrence of the n-th message arrival and A0 = 0. The n-th inter-arrival time is Tn = An−An−1, for n ≥ 1, where An = Pn i=1 Ti . Assume that the inter-arrival time sequence T = {Tn | n ≥ 1} consists of i.i.d. exponentially distributed random variables with parameter λ. Then, the traffic stream A is said to be a Poisson point process. Use the method described in Problem 2 to generate a sequence T = {Tn | 1 ≤ n ≤ N} that consists of i.i.d. exponentially distributed random variables with λ = 0.1, for each N = 1000, 5000, 10000. Then, 1 EE132B (2015 Winter) Computer Workout 1 Prof. Izhak Rubin write a program to generate the corresponding Poisson point process streams A = {An | n ≥ 0}, where A0 = 0, for each N = 1000, 5000, 10000. Plot realizations for these point process streams, for N = 1000, 5000, 10000 (y-axis is the arrival time and x-axis is indices of the arrival events). Problem 4 Let N(t) be the counting variable associated with the point process A. N(t) represents the number of arrivals (events) occurring during the interval (0, t] where N(0) = 0. The process M = {N(t) | t ≥ 0} is the associated counting process. Consider a Poisson point process A with intensity λ. The associated counting process M is then called a Poisson Counting Process. For this process, we note the following properties: (P1) N(t) follows a Poisson distribution with parameter λ: P(N(t) = n) = e −λt(λt) n n! , ∀n = 0, 1, . . . , E[N(t)] = λt; V ar[N(t)] = λt. (P2) The probability of an event occurrence in an interval (t, t + h] of small duration h (so that λh << 1) is approximately equal to λh: P(N(t + h) − N(t) = 1) = λh + o(h), P(N(t + h) − N(t) = 0) = 1 − λh + o(h), where limh→0 o(h) h = 0. (P3) The number of events occurring over an interval is statistically independent of the number of events occurring over any other disjoint interval. (a) Write a computer program that generates and plots a realization of a Poisson counting process M until N(t) = N, by starting with the generated Poisson point process A (y-axis is N(t) and x-axis is index of t), for each N = 1000, 5000, 10000. (b) For λ = 0.1, t = 30, generate the Poisson counting variable N(30) with K independent realizations of N(30). Then, use the results to draw a probability mass function by using histogram expressing P(N(30) = n), for n ≥ 0. Also use the results to compute the mean and variance realized values of N(30). Assume the following values: K = 1000, 5000, 10000. Compare these results with the analytically derived probability distribution values, and with the analytically computed mean and variance values. (c) For λ = 0.1 and h = 1, verify the above mentioned property (P2), using K independent realizations, for each K = 1000, 5000, 10000. You can consider any time period of [t, t + h), for any time t (e.g., by choosing t = 29). 2
10 years ago
Purchase the answer to view it

- generate_a_stream_a.zip