#page no. 38
import math
r1=1.
y=20.*math.log10(r1/(2.*r1))
Delc1=y#change in recieved signal strengths
print'%s %d %s' %('\ndel when r2=2r1 =',Delc1,'dB')
Delc2=20.*math.log10(r1/(10.*r1))##change in recieved signal strengths
print'%s %d %s' %('\ndel when r2=10r1 =',Delc2,'dB')
#page no. 39
import math
r1=1.
y=40.*math.log10(r1/(2.*r1))
Delc1=round(y)#change in recieved signal strengths
print '%s %d %s' %('del when r2=2r1 is =',Delc1,'dB')
Delc2=40.*math.log10(r1/(10.*r1))#change in recieved signal strengths
print '%s %d %s' %('delc when r2=10r1 is =',Delc2,'dB')
#page no. 41
import math
fc=900.*10.**6.
c=3.*10.**8.
yc=c/fc#wavelength of transmission
ddir=1000.
dref=1000.
Angle=120.
Q=120./2.
tdir=ddir/c#time taken by direct path
tref=dref/(c*math.sin(Q*math.pi/180.))#time taken by reflected path
delay=tref-tdir
print'%s %.2f %s' %('delay is =',delay*10**6,'microsec')
#page no. 47
Vm=60.*5./18.#speed of mobile in m/s
fc1=900.*10.**6.#frequency of operation
fc2=1900.*10.**6.#frequency of operation
c=3.*10.**8.#speed of radio waves
Tf1=c/(2.*fc1*Vm)
Tf2=c/(2.*fc2*Vm)
print '%s %.f %s' %('time between fades at 900 Mhz=',Tf1*10**(3),' ms')
print '%s %.1f %s' %('\ntime between fades at 1900 Mhz=',Tf2*10**(3),'ms')
#page no.51
import math
Vm=72.*5./18.
fc=900.*10.**6.
c=3.*10.**8.
Q1=180.*math.pi/180.
Q2=0.*math.pi/180.
Q3=60.*math.pi/180.
Q4=90.*math.pi/180.
fd1=fc*Vm*math.cos(Q1)/c#dopler shift
fd2=fc*Vm*math.cos(Q2)/c
fd3=fc*Vm*math.cos(Q3)/c
fd4=fc*Vm*math.cos(Q4)/c
fr1=fc+fd1#recieved carrier frequency
fr2=fc+fd2
fr3=fc+fd3
fr4=fc+fd4
print '%s %.5f %s' %('recieved carrier frequency directly away from base station transmitter = ',fr1*10**(-6),'MHz')
print '%s %.5f %s' %('recieved carrier frequency directly towards from base station transmitter =',fr2*10**(-6),'MHz')
print '%s %.5f %s' %('recieved carrier frequency in direction 60 deg to direction of arrival =',fr3*10**(-6),'MHz')
print '%s %d %s' %('recieved carrier frequency in direction perpendicular to direction of arrival =',fr4*10**(-6),'MHz')
#page no. 52
fc=900.*10.**6.
c=3.*10.**8.
fdm=70.
Yc=c/fc
V=fdm*Yc#max. speed of the vehicle
Vm=V*18./5.#to convert max speed in kmph
print '%s %d %s' %('maximum speed of the vehicle is =',Vm,'kmph')
#page no. 52
import math
fc=800.*10.**6.
fd1=10.
fd2=50.
Vm=80.*5./18.
c=3.*10.**8.
Yc=c/fc #wavelength of transmission
Q1=math.acos(Yc*fd1/Vm)*180/math.pi #ascosQ=Yc*fd/Vm
Q2=math.acos(Yc*fd2/Vm)*180/math.pi
Beamwidth=Q1-Q2
print '%s %.3f %s' %('Beamwidth is =',Beamwidth,'degrees')
#page no. 53
import math
fc=900.*10.**6.#carrier frequency of transmission
fdm=20.#max. doppler frequency
p=1.#normalized specified level
Nl=2.5*fdm*p*(math.e)**(-1*(p**2.))#level crossing rate
c=3.*10.**8.#velocity of light
V=fdm*c/fc
Vm=V*18./5.#maximum speed
print '%s %.2f %s' %('positive going level crossing rate =',Nl,'crossings per second');
print '%s %d %s' %('\nmaximum velocity of the mobile for the given doppler frequency =',Vm,'kmph')
#page no. 54
import math
fdm=20.
p1=0.01
T1=0.4*(((math.e)**(p1**2.)) -1)/(fdm*p1)#average fade duration T
p2=0.1
T2=0.4*(((math.e)**(p2**2.)) -1)/(fdm*p2)
p3=0.707
T3=0.4*(((math.e)**(p3**2.)) -1)/(fdm*p3)
p4=1.
T4=0.4*(((math.e)**(p4**2.)) -1)/(fdm*p4)
print '%s %d %s' %('\naverage fade duration when p=0.01 T=',((T1*10**6)-1),'miceosec')
print '%s %d %s' %('\naverage fade duration when p=0.01 T=',(T2*10**3),'microsec')
print '%s %d %s' %('\naverage fade duration when p=0.01 T=',(T3*10**3),'microsec')
print '%s %d %s' %('\naverage fade duration when p=0.01 T=',(T4*10**3),'microsec')
Dr=50.
Bp=1./Dr#Bit period
print '%s %d %s' %('\nBit period=',Bp*10**(3),' msec')
if Bp>T3:#for case p=0.707
print('Fast rayleigh fading as Bp>T for p=0.707')
else:
print('Slow rayleigh fading as Bp<T for p=0.707')
#end
Nl=2.5*fdm*p2*((math.e)**(-1*(p2**2.)))#avg. no. of level crossings
AvgBER=Nl/Dr
print '%s %.1f' %('average bit error rate =',AvgBER)
#page no. 56
Vm=96.*5./18.
fc=900.*10.**6.
c=3.*10.**8.
def fround(x,n):
y=round(x*10.**n)/10.**n#
return y
Yc=fround((c/fc),2)
fdm=fround((Vm/Yc),2)
Tc=fround((0.423/fdm),5)#coherence time
Symbol_rate=fround((1/Tc),0)#Symbolrate
print '%s %d %s' %('Symbol rate is =',Symbol_rate,'bps')
#page no. 57
import math
Td=1.*10.**(-1*6.)
Delf=1.*10.**6.#difference in frequency
print '%s %d %s' %('Delf=',Delf*10**(-6),' MHz')
Bc=1/(2*math.pi*Td)#coherence bandwidth
print '%s %.2f %s' %('coherence bandwidth= ',Bc*10**(-3),'kHz')
if Delf>Bc:
print('Correlative fading -- fading will not be experienced as Delf>Bc')
else:
print('Correlative fading -- fading will be experienced as Delf<Bc')
#end