ex5m6_1.doc

advertisement
Random Signals for Engineers using MATLAB and Mathcad
Copyright  1999 Springer Verlag NY
Example 6.1 Correlation Functions for a Gaussian Process
 In this example we will compute the expected values of products of two random variables or the
correlation coefficients for processes that have two-dimensional gaussian distributions. Specifically, we
will evaluate E[X2Y2] and E[|X| |Y|] .The computations will make use of the results of Example 4.7. The
equation for a two dimensional gaussian is
syms x y rho sx sy mpi
f=-1/2/(1-rho^2)*(x^2/sx^2-2*rho*x*y/sx/sy+y^2/sy^2);
gauxy=1/2/mpi/sx/sy/(1-rho^2)^(1/2)*exp(f);
pretty(gauxy)
2
2
x
rho x y
y
--- - 2 ------- + --2
sx sy
2
sx
sy
exp(- 1/2 ---------------------)
2
1 - rho
1/2 -------------------------------2 1/2
mpi sx sy (1 - rho )
The conditioned gaussian density function will be needed or
f ( y| X  x ) 
f ( x, y)
f ( x)
In example 4.7 we found that
fygx=-1/2/(1-rho^2)/sy^2*(y-rho*sy/sx)^2;
gauygx=1/(2*mpi)^(1/2)/sy/(1-rho^2)^(1/2)*exp(fygx);
pretty(gauygx)
/
rho sy\2
|y - ------|
1/2
\
sx /
2
exp(- 1/2 --------------)
2
2
(1 - rho ) sy
1/2 -----------------------------1/2
2 1/2
mpi
sy (1 - rho )
We recognize that the conditional expression is just a gaussian density function in y with the mean
E[Y | X  x]  
and a variance of
y
x
x
1   
2
2
y
The first correlation function that is needed E[X2Y2] and is computed using Equation 5.5-1 and is expressed
as
E[X2Y2] = E[X2E[Y2| X=x]] From the equation we recognize that we need to compute E[Y2 | X=x]. This
can be computed directly from f(y | X= x) with a and b constants
f ( y | x) 
1

 y  b 2 
exp 
2
2 a
 2a

1
Where a and b are
b 
y
x
x
and
a   y  1  2
The second moment is, using Matlab
syms a b u
agt=sym('a>0');
maple('assume',agt);
EYgX=int(u^2*1/a*exp(-1/2/a^2*(u-b)^2),u,-inf,inf);
pretty(EYgX)
2
b
1/2
2
after dividing by the normalization factor
1/2
pi
2
+ a~
1/2
2
1/2
pi
2 we obtain E[Y2|X=x}= a2+b2
It is instructive to trace the substitution used by Matlab to obtain this result. We must first make some
substitutions to begin the process. Let us first make the u v substitution v=u-b , du = dv, and at the limits
u   v  and u
v

syms v
EYint=u^2*1/a*exp(-1/2/a^2*(u-b)^2);
EYintv=subs(EYint,u,v+b);
pretty(EYintv)
2
v
(v + b) exp(- 1/2 ---)
2
a~
----------------------a~
2
Expanding the quadratic and expanding result in three integrals, the first and third have symmetrical
kernels and can be integrated on the half interval and multiplying by 2 to obtain the result, the second
integral is odd and will integrate to zero over the full interval. We perform the integration of the first
integral using Matlab.
EY1=1/a*exp(-1/2/a^2*v^2)*v^2;
EYint1=2*int(EY1,v,0,inf);
EYint1=simplify(EYint1);
pretty(EYint1)
2
1/2
a~
1/2
2
pi
The integration of the third integral can be performed by observation . It is just the integral of the
probability density function of a gaussian multiplied by b 2. Combining the result of the tree integral and
normalizing by 2 we have E[Y | X=x] = a2 + b2 as we have shown above. Substitution for the
constants, a and b, we obtain
2

E[Y | X  x]   1  
2
2
y
2
 
2
 y2
 x2
x2
Multiplying by x2 and taking the expected value we have
 y2
E  X E [Y | X  x ]   1     
E X 4 
 x2
2
2
2
y
2
2
x
2
Where EX4 is E[X4]. We must now find this moment and we make use of the characteristic function for a
gaussian in example 3.5. From Equation 3.3-7 we have after differentiating using Matlab and after
substitution  = 0 in the expression
syms om sig
EX4=real(i^4)*diff(exp(-om^2*sig^2/2),om,4)
subs(EX4,om,0)
EX4 =
3*sig^4*exp(-1/2*om^2*sig^2)-6*sig^6*om^2*exp(1/2*om^2*sig^2)+om^4*sig^8*exp(-1/2*om^2*sig^2)
ans =
3*sig^4
Substitution in the expression we obtain the desired result. The result can be rewritten in more general
terms as
 y2
EX Y   EX E[Y | X  x]   1     
3   x4
2
x
2
2
2
2
2
y
2
2
x
2
syms sx sy
EX2Y2=sy^2*(1-rho^2)*sx^2+rho^2*sy^2/sx^2*3*sx^4;
pretty(simplify(EX2Y2))
2
sy
2
sx
2
+ 2 rho
2
sy
2
sx
Interpretation in terms of the Expectation operation E[X 2Y2]= E[X2] E[Y2] + 2 E[XY].
The second correlation function, E[|X| |Y|], is computed using the integral definitions directly. Let us
begin by evaluating and integral with an unnormalized the gaussian kernel in the first octant of the xy plane
and we call this integral J. This integral cannot be evaluated directly by Matlab directly but after
substitutions it can be evaluated.
iarg=exp(-u^2-v^2-2*rho*u*v);
pretty(iarg)
int(int(iarg,u,0,inf),v,0,inf)
2
2
exp(-u - v - 2 rho u v)
??? Error using ==> sym/sym (char2sym)
Definite integration: Can't determine if the integral is
convergent.Need to know the sign of --> 2*rho*vWill now try indefinite
integration and then take limits.1/2*pi^(1/2)*exp(v^2*(rho-1)*(rho+1))1/2*erf(rho*v)*pi^(1/2)*exp(v^2*(rho-1)*(rho+1)) is not a valid
symbolic expression.
Using a linear transformation from u, v to p, q we transform the kernel
syms p q
u=p-rho/(1-rho^2)^(1/2)*q;
v=q/(1-rho^2)^(1/2);
iarg=(-u^2-v^2-2*rho*u*v);
pretty(simplify(iarg))
2
-p
2
- q
The Jacobian is
jac=jacobian([u;v], [p; q])
jac =
[
[
1, -rho/(1-rho^2)^(1/2)]
0,
1/(1-rho^2)^(1/2)]
det(jac)
ans =
1/(1-rho^2)^(1/2)
Substitution for p and q into the kernel, changing the derivative terms and at the limits we have
jint=1/(1-rho^2)^(1/2)*int(int(exp(-p^2-q^2),p,q*rho/(1rho^2)^(1/2)
\
,inf),q,0,inf);
pretty(jint)
rho
1/4 pi - 1/2 atan(-------------)
2 1/2
(1 - rho )
-------------------------------2 1/2
(1 - rho )
The term can be replaced in the above equation
 
 a tan 
 1  2
2




  a cot 

 1  2






and the integral becomes
 
a cot
 1  2
2 1  2

1
J

1


 2 1  2

We have expressed the acot term in terms of and angle . Using trigonometry we can form a right triangle
with the side opposite the angle  = (1- 2)1/2 and the side adjacent equal to  and the hypotenuse equal to
1. The above expression can be reduced to
J
where
  cos 
1
2 1 
2
a cos   
1
   csc( )
2
The above expression can be differentiated to obtain the left-hand side
syms u v
syms phi
iarg= -u^2-v^2-2*cos(phi)*u*v;
iargd=diff(iarg,phi)
iargd =
2*sin(phi)*u*v
and the right hand side
jrs=1/2*phi*csc(phi);
jrsd=diff(jrs,phi)
jrsd =
1/2*csc(phi)-1/2*phi*csc(phi)*cot(phi)
Combining the terms in  from the left half of the equation above we obtain the normalized integral
equation evaluation


 u v e
0
u 2 v 2  2uvcos 
du  dv 
0
1
2
 csc   1    cot  
4
The E[|X| |Y|] can be expressed in terms of the above equation . First the expression is written. This result
must be normalized because this expected value is 4 times the expected value of the gaussian in the first
octant. This is due to the absolute value operators in E[|X| |Y|] . Using the equation for a gaussian density
function with
 x2   y2   2
and, for simplicity, we have taken to be negative and used the symbol
EXY is used for E[|X| |Y|] in the expressions we have.
EXY 
4
2   2  1   2


0
0
  x ye
 x 2  y 2  2 x y cos  
dx  dy
This integral can be evaluated by rewriting in term of the integral developed above. This variable scaling
of the argument changes the form of the integral to the one evaluated above.
We have for the argument of the kernel
syms x y
x=u*sig*2^(1/2)*(1-rho^2)^(1/2);
y=v*sig*2^(1/2)*(1-rho^2)^(1/2);
arguv=-1/2/(1-rho^2)/sig^2*(x^2+y^2+2*rho*x*y);
pretty(simplify(arguv))
2
-u
2
- v
- 2 rho u v
and the differentials
4
2    1  
2
2
 dx  dy 
1

 du  dv  1   2
We now obtain the integral
EXY 
42 2
  1   2


3
2

0
0
  u ve
u 2 v 2  2 x ycos 
du  dv
From above, this integral can be evaluated
EXY 
42

3 1
2
  2  sin      csc   1    cot  

4

Expanding and simplifying we obtain
EXY=4*2/mpi*sig^2*(sin(phi))^3*(1/4*(csc(phi))^2*(1-phi*cot(phi)));
pretty(simplify(EXY))
2
sig (-sin(phi) + phi cos(phi))
-2 ------------------------------mpi
to the desired result
The integral can also be expressed in term of the complement of , or  +  = /2 and we have
EXY  2   2 
cos     sin  

This equation is used in Example 6.2 to evaluate the correlation function.

Download