Chapter 11 : Random Processes

Page 500 Example 11.2

In [1]:
from math import pi,sin
#given signal is Sx=(N/2)*rect(w/4(pi)B)
N=1#
B=1#
T=input("enter the value of T : ")
Rx=(N*B)*(sin(2*(pi)*B*T))#
print "mean square value of the signal is %0.4f"%Rx,"Watt"
enter the value of T : 0.245
mean square value of the signal is 0.9995 Watt

Page 501 Example 11.3

In [3]:
from math import cos
# autocorrelation function of given signal is A**2/2 * cos(wct)
A=2#
wct=input("enter the value of wct : ")
Rx=((A**2)/2)* cos(wct)#
print "mean square value of the process is %.4f"%Rx,"Watt"
enter the value of wct : .165
mean square value of the process is 1.9728 Watt

Page 506 Example 11.7

In [4]:
P1=input("enter prob of symbol 1 : ")
P2=input("enter prob of symbol -1 : ")
ak=(1)*P1+(-1)*P2#
print "mean is",ak
Ro=(1**2)*P1+((-1)**2)*P2#
print "mean square is",Ro
enter prob of symbol 1 : .75
enter prob of symbol -1 : .21
mean is 0.54
mean square is 0.96

Page 507 Example 11.8a

In [5]:
P1=input("enter prob of symbol 1 : ")
P0=input("enter prob of symbol 0 : ")
ak=(1)*P1+(0)*P2#
print "mean is",ak
Ro=(1**2)*P1+((0)**2)*P2#
print "mean square is",Ro
enter prob of symbol 1 : 0.215
enter prob of symbol 0 : .314
mean is 0.215
mean square is 0.215

Page 508 Example 11.8b

In [7]:
# bipolar signalling
P0=input("enter prob of symbol 0 : ")
P1=input("enter prob of symbol 1 : ")
P2=input("enter prob of symbol -1 : ")
ak=(0)*P0+(1)*P1+(-1)*P2#
print "mean is",ak
Ro=(0**2)*P0+(1**2)*P1+((-1)**2)*P2#
print "mean square is",Ro
enter prob of symbol 0 : .25
enter prob of symbol 1 : .35
enter prob of symbol -1 : .45
mean is -0.1
mean square is 0.8