The MATLAB Notebook v1.5

advertisement
Random Signals for Engineers using MATLAB and Mathcad
Copyright  1999 Springer Verlag NY
Example 5.6 Correlation Function for Binary Transmission
In this example we will generate a semirandom and random binary transmission Random Process.
In all cases, in order to simply the computations, we set i T equal to i or alternately take T = 1. A
semirandom process is one where the transitions are synchronized to occur at each index value. In order to
obtain a random binary transmission process we add a uniformly distributed Random Variable, e, to each
index value. In this example we will plot one member of the ensemble of the semirandom and of the
random binary transmission process waveforms.
N=200;
ind=find(rand(N,1)>0.5);
z(1:N)=1;
z(ind)=-1;
y1=1:15;
y2=y1+.56;
u=-1.5:.1:1.5;
v1=ones(1,length(u));
This generates the binary transmission discrete random process plotted below
stairs(y1,z(1:15),'b');hold on;stairs(y2,z(1:15),'r:');
stairs(4.1*v1,u,'g--');
stairs(4.7*v1,u,'m-.');
axis([0 15 -1.5 1.5])
hold off;
1.5
1
0.5
0
-0.5
-1
-1.5
0
5
10
15
For illustrative purposes we have also marked t1 as 4.1 and t2 as 4.7 on the graph.
In order to calculate the correlation function of a semirandom binary transmission waveform we note that
E[x(t1) x(t2)] = E[X1 X2] = 1 when
(n-1) T < t1, t2 < T
This is true because if the transition did not occur and the values of x 1 and x2 are the same. When we
select t1 and t2 to occur on either side of nT, the values at these times are uncorrelated and
E[x(t1) x(t2)] = E[X1 X2] = E[X1] E[X2] = 0
E[X1] = E[X2] = 0 since the values of X1 and X2 are selected from a Bernoulli process with p = q = 1/2 and
with corresponding values of 1, -1 this process has a zero mean.
Summarizing, we have for the correlation function
1 (n  1)  T  t1 , t 2  n  T
R(t1 , t 2 )  
otherwise
0
This Random Process is not second order wide sense stationary because the value depends upon the
selection of t1 and t2 and not on the | t1 -t2 | value. In the following, we will show that the correlation
function for a random binary transmission waveform is a wide sense stationary in contrast to the
semirandom process, which is not.
Using Equation 5.5-1 we can facilitate the calculation of the correlation function of the Random Binary
transmission waveform
E[X1 X2] = E[E[X1 X2| e]]
The inner expectation operation with e, a constant value, is the same calculation as the semirandom binary
transmission case. In this case when | t1 -t2 | > T and for any value of e < T, t1 and t2 fall in different
intervals and [E[X1 X2| e] = 0.
When | t1 -t2 | < T we have to first set a value for t1 to find the minimum value of e that will make t1 and
t2 fall in different intervals. Let us first examine the case when t 1 lines up with a synchronization interval
(n-1) T. In this case e < T - | t1 -t2 | before transition can occur. In this interval [E[X 1 X2| e] = 1 as was
found for the semirandom case. When t1 lines up at a time, u, past the synchronization time then we have
e < T - | t1 -t2 | - u
The variable u + e can now be thought of as the parameter of concern and the condition when [E[X 1 X2| e]
= 1 remains the same. The outer expectation operation is now performed with respect to the parameter e,
which is the random variable in this expectation operation. For the random binary transmission case we
have assumed e to be a random variable that is uniformly distributed in the range 0 to 1. Using the
elementary definition of expectation we perform the expectation operation
E[ X ]   X i  P( X i  xi )
In order to evaluate this expression we must find
PE  T  t1  t 2 and PE  T  for e uniformly
distributed in [ 0, T ] with a density function 1/T. The first case we have, by the definition of the
cumulative distribution function for a uniform density function,
P( E  T  | t1  t 2 |) 
For the second case
1
T  | t1  t 2 |
T
PE  T   1 . Performing the outer expectation operation using these values
 | t  t |
E X 1 X 2   1  1  1 2   0  1

T 
or
| |

1 
| |  T
R( )   T
 0
elsewhere

This correlation function can also be derived by first calculating the second order density function and then
evaluating
R  
1 1
x
1
 x 2  f  x1 , x 2   dx 2 dx1
1 1
We begin by first calculating
Px1  x2  when < T.

P( x1  x 2 )  1 
and
T
P( x1  x 2 ) 

T
The second order density function f(x1, x2) can be found by using the conditional expression
f(x1, x2) = f(x2| X1 =x1 ) f(x1)
The conditional density function f(x2|X1 =x1 ) can be written using the delta function to express the
condition when x1 = x2 and adding the condition when x1  x2

 
f ( x 2 | X 1  x1 )  1     ( x1  x 2 ) 
t
T

Setting up the integral for the correlation function we have we have
R  
1 1
x
1
1 1
  

 x 2  1      x1  x 2    dx 2 dx1
T
 T 
Let us first perform the integration with respect to the delta function for x2. Maple has the Dirac or delta
function. The results of the integration are given including the sign (signum) function.
maple('int','x2*Dirac(x1-x2),x2=-1..1')
ans =
-1/2*(signum(x1-1)+1)*x1+1/2*(signum(x1+1)+1)*x1
The signum is replaced by the sign function for Matlab. The resultant expression can be evaluated by
plotting the result of the integral for the limit values of the integral and verifying that the result of the
integration is indeed x1.
xp=-.99:.05:.99;
f=-1/2*(sign(xp-1)+1).*xp+1/2*(sign(xp+1)+1).*xp;
figure
plot(xp,f)
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-1
-0.8
-0.6
x
-0.4
2
-0.2
0
0.2
0.4
0.6
0.8
1
   x1  x 2   dx 2  x1
The rest of the integral becomes
R  

 
2 
1 1 x1  x2   T   f x1 dx2 dx1  1 x1  1  T   f x1 dx1
1 1
1
The integral can be evaluated for different f(x). For the binary transmission case we have
f x  
1
  ( x  1    x  1)
2
The correlation function becomes
1
 
 
R    x1     f  x1 dx1  x 2 dx 2  1     x12     x1  1    x1  1dx1
2
T 
 T  1
1
1
1
1
1
We can evaluate the first integral by noting that the inner integral evaluates to zero by
syms mx2
int(mx2,mx2,-1,1)
ans =
0
Therefore
1
x
1
1


T
 f ( x1 )  0  dx1  0
Continuing the evaluation we obtain for the third integral
maple('int','x1^2/2*(Dirac(x1+1)+Dirac(x1-1)),x1=-1..1')
ans =
1
Combing the results we have
we
R    1 
The results are the same as the other method of evaluation.

T

Download