Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Fundamentals of probability

Lab4: Random Process

General Instructions:
- Random Seed: When you start Matlab initialize the random seed generator to be “xxyy” where
xx is your birthday and “yy” is your birth month, i.e if your birthday is 25 Oct then you should
type
rand(‘seed’,2510)

- Submit a single word or txt file for each problem. The file should contain all of your work
including:
- Your relevant command line work including outputs of your scripts and function. Use Diary
or copy/paste if necessary
- Copy any scripts or function code into the file
- Use Copy/paste figures to copy your relevant output figures into the file.

m
er as
co
eH w
o.
Problem #1
rs e
ou urc
Use Matlab to generate the discrete-time random process X[n], which is constructed
o

according to
aC s
vi y re

X[n] = X[n − 1] + Wn,

where Wn are a sequence of IID, zero-mean Gaussian random variables, W1, W2, W3, with
ed d

the initial condition X[0] = 0. The value of the process at each point in time is equal to the
ar stu

value of the process at the previous point in time plus a random increase (decrease) which
follows a Gaussian distribution.

- Run your program several times to generate several realization of the process with a
is

length of N=25 time instants.


Th

- Estimate and plot the mean function of the process over the generated samples.
Problem #2
sh

Use Matlab to generate 1000 realizations of the following random process

X(t) = cos(2πFt),

where F is a random variable uniformly distributed over some interval (0,fo) . For example,
generate the process for fo = 2 Hz, with 0.01 sample increments over a 10 seconds time interval
around t=0.

This study source was downloaded by 100000788984292 from CourseHero.com on 06-23-2021 22:07:03 GMT -05:00

https://www.coursehero.com/file/50082232/Prob-Lab4pdf/
a function of time and this one is not? Consider the member functions
of the respective ensembles for the two random processes.

- Compute and plot the sample mean of the random process


EXAMPLE 8.11: Now consider a sinusoid with a random fre-
- Compare the sample X(t)
Chapter 8variable
Random Processes
quency
mean with a plotFt),
= cos(2π where
of the F is a random
analytical ensemble meanuniformly
function of the
by over some interval (0, fo ). The mean function can be
distributed
process, which is given
readily determined to be
8.32 Write a MATLAB program! to generate a Bernoulli process X[n] for which
1 fo sin(2π fo t)
each time
µX (t) = E[ instant of =the process
cos(2π Ft)] cos(2πisft)adfBernoulli
= random
= sinc variable
(2fo t). with
fo 0 2π fo t
Pr(X[n] = 1) = 0. 1 and Pr(X[n] = 0) = 0. 9. Also, the process is IID
We canX[
(i.e., n]estimate
also is independent
the meanof X[m] for
function all m ̸=
through n). Once We
simulation. youprovide
have created
some the
ProblemMATLABprogramcode
#3 to simulate X[n],
to produce manythenrealizations
create a counting Y[n] thatThe
processprocess.
of this random counts
mean
the function
numberisofthen found by taking
occurrences of X[the
m] sample
= 1 inmean of all the m
the interval realizations
∈ [0, n]. Plot
Let Wn, n=0,1,2,3,…be
created.
member a sequence
Thefunctions
sample mean of
of each IID
andof zero-mean
the ensemble
the Gaussian random variables
mean are shown in Figure 8.7.
two processes. with
Naturally, more or less accuracy in the sample mean can be obtained by
variance σW2 = 1.
8.33varying
Let Wthe number of realizations generated.
n , n = 0, 1, 2, 3, . . . be a sequence of IID zero-mean Gaussian random
variables with variance σW2 = 1.
fo=2;
(a)  Write a MATLAB program to generate % Maximum frequency.
the process
N=1000; % Number of realizations.
(a) Write a MATLAB program to generate the process

m
t=[-4.995:0.01:4.995]; % Time axis.

er as
F=fo*rand(N,1); % Uniform frequencies.
X[n] = 21 X[n − 1] − 41 X[n − 2] − 41 X[n − 3] + Wn ,

co
x=cos(2*pi*F*t); % Each row is a

eH w
% realization of process.
where X[0] = W0 and X[n] = 0 for n < 0.

o.
sample_mean=sum(x)/N; rs e % Compute sample mean.
(b) Estimate the mean function of this process by generating a large num-
ou urc
(b)  Estimate the
ber mean function of
of realizations ofthis
the process
randomby generating
process a large number
and computing of
the sample
realizations of the random process and computing the sample mean.
mean.
(c) Compute the timemean
averaged
of themean of the
fromprocess
a singlefrom a singleDoes
real-this
o

(c)  Compute the time averaged process realization.


ization. Does this seem to give the same result as the ensemble mean
aC s

seem to give the same result as the ensemble mean estimated in part (b)? 

estimated in part (b)?
vi y re

8.34#4A(Ahmed
Problem certain random process is created as a sum of a large number, n, of
Atef Gift)
sinusoids with random frequencies and random phases,
ed d

Simulate the Many realization of the following Random Process of Example 8.18. Plot the different
Chapter 8 Random Processes
ar stu

!n
realization as a function of t with different colors on a 2D graph. Calculate the mean and
X(t) = cos(2πFk t + θk ),
autocorrelation functions and plot i on a separate graph
k=1
is

where the random phases θk are IID and uniformly distributed over
Th

(0, 2π), and the random frequencies are given by Fk = fo + fd cos(βk ),


EXAMPLE 8.18: Let X(t) = At + B where A and B are independent
where the βk are IID and uniformly distributed over (0, 1). (Note: These
random variables, both uniformly distributed over the interval (−1, 1).
types of processes occur in the study of wireless communication systems.)
To determine whether wethis
will process is WSS, focalculate thefo =
mean
25 Hzand
sh

For this exercise, take the constants and fd to be and


autocorrelation
fd = 10 Hz,functions:
while we will let the number of terms in the sum be n = 32.

X (t) = E[
(a) Write aµMATLAB At + B] =toE[
program A]t + E[
generate B] = 0;
realizations of this random
process.
RXX (t,(b)
t +Assuming the +
τ ) = E[(At process
B)(A(tis +
stationary
τ ) + B)]and ergodic, use a single realization
to estimate the first order PDF of the process, fX (x).
2 2 1 1
= E[Athe]t(t
(c) Assuming + τ ) is
process E[B ] + E[
+stationary AB](2
and t + τuse
ergodic, 3 t(t +realization
) =a single τ) + 3 .
to estimate the mean of the process, µX .
Clearly, this process is not WSS.
This study source was downloaded by 100000788984292 from CourseHero.com on 06-23-2021 22:07:03 GMT -05:00

Many of the processes we deal with are WSS and hence have a constant mean
https://www.coursehero.com/file/50082232/Prob-Lab4pdf/
Powered by TCPDF (www.tcpdf.org)

You might also like