Random Signals for Engineers using MATLAB and Mathcad Copyright 1999 Springer Verlag NY Example 4.5 Joint Continuous Expectation In this example we will compute the expected values for random variables that have continuous distribution functions. For this example we assume that the density functgion is uniform over a two dimensional region that is triangular in shape. This form of dependence of the density function upon a region that is described by a functional relation between the two variables, x and y, causes the resultant distribution to be correlated. We will show this result. We first descibe this density function. Let f(x,y) = C for 0 <y < x <1. Normalizing this density function over the region we express the normalization intergral. The limist on the v (y) integration is obtained from the domain of x, y expression, 0 < y < x, and therefore the upper limit for the inner integration is x (u). syms u v C F1=int(int(C,v,0,u),u,0,1); C=solve(F1-1,C) C = 2 When we integrate we find that C = 2. Computing the expected values we have E[X] = EX=int(int(2*u,v,0,u),u,0,1) EX = 2/3 This expression can be evaluated numerically or symbolically. We have evaluated this expression symbolically to obtain a rational arithmetic expression for the result. Maple performs numerical evaluation using rational arithmetic. A similar expression can be obtained for E[Y] E[Y] = EY=int(int(2*v,v,0,u),u,0,1) EY = 1/3 The Correlation can be computed using E[XY] = EXY=int(int(2*v*u,v,0,u),u,0,1) EXY = 1/4 The marginal distributions can be computed and then the expectation operations performed syms x y fx=int(2,v,0,x) fx = 2*x fy=int(2,u,y,1) fy = 2-2*y and the expected values E[X] = EX=int(2*u*u,u,0,1) EX = 2/3 E[Y] = EY=int(2*v*(1-v),v,0,1) EY = 1/3 Both procedures result in the same values for the expectation. The variances and covariances can be computed E[X2] = EX2=int(int(2*u^2,v,0,u),u,0,1) EX2 = 1/2 VAR[X] = E[X2] - E[X]2 = VARX=EX2-EX^2 VARX = 1/18 E[Y2] = EY2=int(int(2*v^2,v,0,u),u,0,1) EY2 = 1/6 VAR[Y] = E[Y2] - E[Y]2 = VARY=EY2-EY^2 VARY = 1/18 The Covariance can be computed COV[XY] = E[XY] - E[X] E[Y] = COVXY=EXY-EX*EY COVXY = 1/36 Two other computations can be performed E[X + Y] = EXPY=int(int(2*(u+v),v,0,u),u,0,1) EXPY = 1 and it is easy to show that E[X + Y] = E[X] + E[Y] = EX+EY ans = 1 And similarly E[(X + Y)2] = EXPY2=int(int(2*(u+v)^2,v,0,u),u,0,1) EXPY2 = 7/6 and it can be shown that E[(X + Y)2] = E[X2] + 2 E[X Y] + E[Y2]= EX2+2*EXY+EY2 ans = 7/6 The covariance matrix P can be written as VARX K COVXY COVXY VARY K=[VARX COVXY;COVXY VARY] K = [ 1/18, 1/36] [ 1/36, 1/18]