ex5m5_3.doc

advertisement
Random Signals for Engineers using MATLAB and Mathcad
Copyright  1999 Springer Verlag NY
Example 5.3 Poisson Distribution and Random Processes
A random process can be generated that is a sum of unit steps that occur at times, t i, that are Poisson
distributed. The Random Process S becomes
n
s (t )   u t  t i 
i 1
This random process can be generated by recognizing that ti is the exponentially distributed inter event
times and s(t) is just the index of each ti .
N=20;
lam=2;
z=-1/lam*log(rand(20,1));
t(1)=0;
for i=1:20
t(i+1)=t(i)+z(i);
end
i=1:20;
stairs(t(1:20),i)
20
18
16
14
12
10
8
6
4
2
0
0
2
4
6
8
10
12
The next process generated is the so-called Random telegrapher wave. It is similar to the random binary
transmission process of Example 5.2 where sequences of +1, -1 are generated. However, the possible
transitions are not periodic at time T as the binary waveform. For this Random process we will generate 3
sample processes from the ensemble. As above, we first generate three sets of event times by generating
the exponential inter-event times and summing these to obtain the random event time sequences.
The three exponential inter-event times are generated in the loop are
z
1
 log rand ( N ,1) 
lam
The cumsum function is used to sum the variable for each i. The Telegraph waveform is formed using a
vector set of alternating +1 and -1 sequence with each event. Finally this waveform can be plotted in a
subgraph for each instance of the ensemble. Since the random number generator does not repeat each of
the three plots are members of the ensemble of random processes generated.
N=70;
for j=1:3
subplot(3,1,j)
z=-1/lam*log(rand(N,1));
zc=cumsum(z);
y(1)=-1;
for i=1:(N-1)
if y(i)==-1
y(i+1)=1;
else
y(i+1)=-1;
end
end
stairs(zc,y)
axis([0 35 -1.5 1.5])
end
1
0
-1
0
5
10
15
20
25
30
35
0
5
10
15
20
25
30
35
0
5
10
15
20
25
30
35
1
0
-1
1
0
-1

Download