Uploaded by 北科大-林奕廷

2023 RP Simu HW2

advertisement
Random Signals and Systems
Simulation Workout #2
1.
Generate a sequence of i.i.d. (independently identically distributed) random
variables U  {U n , N  n  1} which are uniformly distributed over [0,1]
for
N =10000,50000,100000. To verify the results you obtain, for each case of N,
A. Draw probability distribution histograms which show the relative frequency
of U in the interval of ( 10i , 10i  101 ], for i  0,1,  ,9.
B.
Compute the sample mean and sample variance. Compare your simulation
results with the theoretical values.
Note: For a sequence of i.i.d. random variable X n , n  1,2,  , N , the sample
mean, M N , and the sample variance,  N , are computed as
MN 
2.
1
N

N
n 1
X n , N 
1
N 1

N
n 1
( X n  M N )2 .
Generate a sequence of i.i.d. (independent identically distributed) random
variables T  {Tn , N  n  1} which are geometrically distributed with parameter
(intensity) p  0.1 for N =5000,10000,50000. The random variable Tn for
such case is governed by the distribution P{Tn  k}  (1  p ) k 1 p, k  1,2,3,   .
To verify the results you obtain, for each case of N, please
A. Draw probability distribution histograms which show the relative frequency
of T in terms of k for k  1,2,  ,30.
B.
Compute the sample mean and sample variance. Compare your simulation
results with the theoretical values.
Note (1): The i.i.d. sequence T  {Tn , N  n  1} often represents the inter
arrival time sequence for the discrete time stochastic processes. In such
process, time is divided into slots. Each slot is of unit length and is marked
by discrete times 1,2,  ,. An event (arrival) may occur with probability p
within one slot duration and is recorded at the end of the slot. If the
sequence T is geometrically distributed, the corresponding arrival process A
is called the geometric point process.
Note (2): To generate a sequence of i.i.d. Geometric random variable
T  {Tn , N  n  1} with the parameter p, 0<p<1, you may first generate a
sequence of i.i.d. uniform random variables U  {U n , N  n  1} over [0,1].
Then for each sample, use the transformation Tn  1  [ln U n / ln(1  p)].
where [x] represents the largest integer less than or equal to x.
3.
Please read the “Simulation Supplementary Reading Materials”, then use Monte
Carlo simulation method to find the approximation value of  . Compare your
result with the theoretical value.
4.
The following problem is the famous “Birthday Problem” of probability course.
Assume that there are 365 days in a year, simulate the probability that in a class
of 23 children, at least 2 children have the same birthday. Compare your result
with the theoretical value.
Download