from __future__ import division
from math import pi,sqrt
# To determine a)the maximum Doppler shift b)the coherence time of the channel c)the maximum number of symbolsthat could be transmitted
#Given data
f=900*10**6# # Carrier frequency in Hz
c=3*10**8# # Speed of ligth in air (m/s)
v=80# # Velocity of mobile in km/hr
v=v*(5/18)# # Velocity of mobile in m/s
lamda=c/f# # Carrier wavelength in meter
# a)To determine the maximum Doppler shift
fd=v/lamda# # The maximum Doppler shift in Hz
# b)To determine the coherence time of the channel
Tc=sqrt(9/(16*pi*fd**2))# # The coherence time of the channel
# Answer is varrying due to round-off error
# c)To determine the maximum number of symbols that could be transmitted with symbol rate 24.3 ksymbols/sec
Rs=24.3*10**3# # Symbol rate in symbols/sec
Nb=Tc*Rs# # The maximum number of transmitted symbols
# Displaying the result in command window
print '\n The maximum Doppler shift = %0.2f Hz'%(fd)#
print '\n The coherence time of the channel = %0.2f ms'%(Tc*10**3)#
print '\n The maximum number of symbols that could be transmitted with symbol rate 24.3 ksymbols/sec = %0.0f symbols'%(Nb)#
from __future__ import division
from math import exp
# To determine probability that the SNR will drop below threshold SNR
# Given data
M1=4# # Number of branch diversity
M2=1# # Number of branch diversity
gamm=10# # Specified SNR threshold in dB
gamm=10**(gamm/10)# # Specified SNR threshold
Gamma=20# # Average SNR in dB
Gamma=10**(Gamma/10)# # Average SNR
# Probability that the SNR will drop below 10dB when 4 branch diversity is used
P4=(1-exp(-gamm/Gamma))**M1# # Probability that the SNR will drop below 10dB
# Probability that the SNR will drop below 10dB when single branch diversity is used
P1=(1-exp(-gamm/Gamma))**M2# # Probability that the SNR will drop below 10dB
# Displaying the result in command window
print '\n Probability that the SNR will drop below 10dB when 4 branch diversity is used = %0.6f'%(P4)#
print '\n Probability that the SNR will drop below 10dB when single branch diversity is used = %0.3f'%(P1)#
print '\n \n From above results, it is observed that without diversity the SNR drops below the specified threshold with a probability that is three orders of magnitude greater \n than if four branch diversity is used.'