In [1]:

```
from __future__ import division
from math import cos
# To compute received carrier frequency if mobile is moving a)towards the transmitter b)away from the transmitter c)in the direction perpendicular to arrival direction of transmitted signal
# Given data
fc=1850*10**6# # Carrier frequency in Hz
c=3*10**8# # Speed of ligth in m/s
v=60# # Speed of receiver (vehicle) in mph
v=v*0.44704# # Speed of receiver (vehicle) in m/s
lamda=0.162##c/f# # Wavelength in m
# a)To compute received carrier frequency if mobile is moving towards the transmitter
theta=0# # Angle between direction of receiver and transmitter
fd=(v/lamda)*cos(theta)# # Doppler shift
f=(fc+fd)*10**-6# # Received carrier frequency in MHz
# Displaying the result in command window
print '\n The received carrier frequency when mobile is moving towards the transmitter = %0.5f MHz'%(f)#
# b)To compute received carrier frequency if mobile is moving away from the transmitter
theta=180# # Angle between direction of receiver and transmitter
fd=(v/lamda)*cos(theta)# # Doppler shift
f=(fc+fd)*10**-6# # Received carrier frequency in MHz
# Displaying the result in command window
print '\n The received carrier frequency when mobile is moving away from the transmitter = %0.6f MHz'%(f)#
# c)To compute received carrier frequency if mobile is moving in the direction perpendicular to arrival direction of transmitted signal
theta=90# # Angle between direction of receiver and transmitter
fd=(v/lamda)*cos(theta)# # Doppler shift
f=(fc+fd)*10**-6# # Received carrier frequency in MHz
# Displaying the result in command window
print '\n The received carrier frequency when mobile is moving in the direction perpendicular to arrival direction of transmitted signal = %0.0f MHz'%(f)#
```

In [1]:

```
from __future__ import division
# To find a)time delay width (deltat) b)maximum RF bandwidth
# Given data
tN1=100*10**-6# # Excess delays for RF radio channels
tN2=4*10**-6# # Excess delays for microcellular channels
tN3=500*10**-9# # Excess delays for indoor channels
N=64# # Number of multipath bins
# a)To find time delay width (deltat)
deltat1=(tN1/N)*10**6# # Time delay width for RF radio channels
deltat2=(tN2/N)*10**9# # Time delay width for microcellular channels
deltat3=(tN3/N)*10**9# # Time delay width for indoor channels
# Displaying the result in command window
print '\n The time delay width for RF radio channels = %0.4f microsecond'%(deltat1)#
print '\n The time delay width for microcellular channels = %0.1f nanosecond'%(deltat2)#
print '\n The time delay width for indoor channels = %0.4f nanosecond'%(deltat3)#
#b)To find maximum RF bandwidth
bandwidth1=(2/deltat1)# #Maximum RF bandwidth for RF radio channels in MHZ
bandwidth2=(2/deltat2)*10**3# #Maximum RF bandwidth for microcellular channels in MHZ
bandwidth3=(2/deltat3)*10**3# #Maximum RF bandwidth for indoor channels in MHZ
#Displaying the result in command window
print '\n The maximum RF bandwidth for RF radio channels = %0.2f MHz'%(bandwidth1)#
print '\n The maximum RF bandwidth for microcellular channels = %0.0f MHz'%(bandwidth2)#
print '\n The maximum RF bandwidth for indoor channels = %0.0f MHz'%(bandwidth3)#
```

In [2]:

```
from __future__ import division
from math import cos,pi,sqrt,sin
# To find average narrowband power & to compare average narrow band and wideband power
# Given data
v=10# # Velocity of moving mobile
f=1000*10**6# # Carrier frequency in Hz
c=3*10**8# # Speed of ligth in air (m/s)
P1=-70# # Received power of first component in dBm
P2=P1-3# # Received power of second component in dBm
theta=0# # Initial phase for both component
P1=(10**(P1/10))*10**-3# # Received power of first component in Watt
P2=(10**(P2/10))*10**-3# # Received power of second component in Watt
lamda=c/f# # Wavelength
# Narrowband instantaneous power
rt2=(sqrt(P1)*cos(0)+sqrt(P2)*cos(0))**2# # Narrowband instantaneous power in pW
# Displaying the result in command window
print '\n The narrowband instantaneous power = %0.0f pW'%(rt2*10**12)#
# Answer is varrying due to round-off error
# To find average narrowband instantaneous power
t=0.1# # Time interval in seconds
theta=((2*pi*v*t)/lamda)/10# # Phase interval in rad
theta=theta*(180/pi)# # Phase interval in degree
theta1=theta# # Phase of first component at t=0.1s
theta2=-theta# # Phase of second component at t=0.1s
rt21=(sqrt(P1)*(complex(cos(pi/180*theta1),sin(pi/180*theta1)))+sqrt(P2)*(complex(cos(pi/180*theta2),sin(pi/180*theta2))))**2# # Narrowband instantaneous power in pW at t=0.1s
mgrt21=sqrt(((rt21.real))**2+((rt21.imag))**2)#
# Displaying the result in command window
print '\n The narrowband instantaneous power (at t=0.1s) = %0.1f pW'%(mgrt21*10**12)#
theta1=theta1+theta# # Phase of first component at t=0.2s
theta2=theta2-theta# # Phase of second component at t=0.2s
rt22=(sqrt(P1)*(complex(cos(pi/180*theta1),sin(pi/180*theta1)))+sqrt(P2)*(complex(cos(pi/180*theta2),sin(pi/180*theta2))))**2# # Narrowband instantaneous power in pW at t=0.2s
mgrt22=sqrt(((rt22.real))**2+((rt22.imag))**2)#
# Displaying the result in command window
print '\n The narrowband instantaneous power (at t=0.2s) = %0.1f pW'%(mgrt22*10**12)#
theta1=theta1+theta# # Phase of first component at t=0.3s
theta2=theta2-theta# # Phase of second component at t=0.3s
rt23=(sqrt(P1)*(complex(cos(pi/180*theta1),sin(pi/180*theta1)))+sqrt(P2)*(complex(cos(pi/180*theta2),sin(pi/180*theta2))))**2# #Narrowband instantaneous power in pW at t=0.3s
mgrt23=sqrt(((rt23.real))**2+((rt23.imag))**2)#
# Displaying the result in command window
print '\n The narrowband instantaneous power (at t=0.3s) = %0.0f pW'%(mgrt23*10**12)#
mgrt24=mgrt21# # Narrowband instantaneous power in pW at t=0.4s due to repeating phase
# Displaying the result in command window
print '\n The narrowband instantaneous power (at t=0.4s) = %0.1f pW'%(mgrt24*10**12)#
mgrt25=mgrt22# # Narrowband instantaneous power in pW at t=0.5s due to repeating phase
# Displaying the result in command window
print '\n The narrowband instantaneous power (at t=0.5s) = %0.1f pW'%(mgrt25*10**12)#
rt=(rt2+mgrt21+mgrt22+mgrt23+mgrt24+mgrt25)/6# # The average narrowband instantaneous power in pW
# Displaying the result in command window
print '\n An average narrowband instantaneous power = %0.0f pW'%(rt*10**12)#
# Wideband power
Pwb=(P1+P2)# # Widebnd received power in pW
# Displaying the result in command window
print '\n The wideband received power = %0.0f pW'%(Pwb*10**12)#
print '\n Comparing narrowband and wideband received power, it is observed that they are vertually identical. But CW signal fades over observation interval (0-0.5S)'
```

In [8]:

```
from __future__ import division
from math import sqrt
#To compute a)RMS delay spread b)maximum bit rate
#Given data
t1=0# #Excess delay of first signal
a1=0# #Power level of first signal in dB
t2=1*10**-6# #Excess delay of second signal
a2=0# #Power level of second signal in dB
a1=10**(a1)# #Power level of first signal in Watt
a2=10**(a2)# #Power level of second signal in Watt
#a)To compute RMS delay spread
t=((a1*t1+a2*t2)/(a1+a2))*10**6# #Mean excess delay
t2=((a1*t1**2+a2*t2**2)/(a1+a2))*10**12# #Mean square excess delay
sigmat=sqrt(t2-t**2)# #RMS delay spread in microseconds
#Displaying the result in command window
print '\n The RMS delay spread = %0.1f microseconds'%(sigmat)#
#b)To compute maximum bit rate
Ts=(sigmat*10**-6)/0.1# #Sampling time of BPSK modulated signal
Rs=(1/Ts)*10**-3# #Maximum bit rate in kbps
#Displaying the result in command window
print '\n The maximum bit rate = %0.0f kbps'%(Rs)#
```

In [9]:

```
from __future__ import division
from math import sqrt
# To calculate mean excess delay, rms delay spread and maximum excess delay
# Given data
t10dB=5*10**-6# # By definition of maximum excess delay (10dB)
t1=0# # Excess delay of first signal in seconds
a1=-20# # Power level of first signal in dB
t2=1*10**-6# # Excess delay of second signal in seconds
a2=-10# # Power level of second signal in dB
t3=2*10**-6# # Excess delay of third signal in seconds
a3=-10# # Power level of third signal in dB
t4=5*10**-6# # Excess delay of fourth signal in seconds
a4=0# # Power level of fourth signal in dB
a1=10**(a1/10)# # Power level of first signal in Watt
a2=10**(a2/10)# # Power level of second signal in Watt
a3=10**(a3/10)# # Power level of third signal in Watt
a4=10**(a4/10)# # Power level of fourth signal in Watt
# Mean excess delay
t=((a1*t1+a2*t2+a3*t3+a4*t4)/(a1+a2+a3+a4))# # Mean excess delay in seconds
tsquare=((a1*t1**2+a2*t2**2+a3*t3**2+a4*t4**2)/(a1+a2+a3+a4))# # Mean square excess delay
# RMS delay spread
sigmat=sqrt(tsquare-t**2)# # RMS delay spread
# Coherence bandwidth
Bc=1/(5*sigmat)# # 50% Coherence bandwidth
# The answer is varrying due to round-off error
# Displaying the result in command window
print '\n The maximum excess delay (10 dB) = %0.0f microsecond'%(t10dB*10**6)#
print '\n The mean excess delay = %0.2f microsecond'%(t*10**6)#
print '\n The RMS delay spread = %0.2f microsecond'%(sigmat*10**6)#
print '\n The coherence bandwidth = %0.0f KHz'%(Bc*10**-3)#
print '\n Since coherence bandwidth is greater than 30 KHz, AMPS will work without an equalizer. However, GSM requires 200 KHz bandwidth which exceeds coherence bandwidth,\n thus an equalizer would be needed for this channel'
```

In [10]:

```
from __future__ import division
from math import pi
# To determine proper spatial sampling interval for small scale propagation, number of samples required over 10m, time required to make these measurements and Doppler spread for this channel
# Given data
fc=1900*10**6# # Carrier frequency in Hz
v=50# # Velocity of propagation in m/s
c=3*10**8# # Speed of ligth in air in m/s
Tc=(9*c)/(16*pi*v*fc)# # Coherence time
# The spatial sampling interval
deltax=(v*Tc)/2# # Spatial sampling interval in meter
# The number of samples required over 10m travel distance
d=10# # Distance to be travelled
Nx=d/deltax# # Number of samples required over 10m
# Answer is varrying due to round-off error
# The time required to make these measurements
t=d/v# # Time required to make these measurements
# Doppler spread for this channel
BD=(v*fc)/c# # Doppler spread for this channel
# Answer is varrying due to round-off error
# Displaying the result in command window
print '\n The proper spatial sampling interval for small scale propagation = %0.2f cm'%(deltax*10**2)#
print '\n The number of samples required over 10m travel distance = %0.0f'%(Nx)#
print '\n The time required to make these measurements = %0.1f seconds'%(t)#
print '\n The Doppler spread for this channel = %0.2f Hz'%(BD)#
```

In [12]:

```
from math import exp,pi,sqrt
from __future__ import division
# To compute the positive-going lvel crossing rate and maximum velocity of mobile
# Given data
rho=1# # Value of normalized level of fading amplitude to rms amplitude
fm=20# # Maximum Doppler frequency in Hz
fc=900*10**6# # Carrier frequency in Hz
c=3*10**8# # Speed of ligth in air in m/s
# The positive-going level crossing rate
NR=sqrt(2*pi)*fm*rho*exp(-rho**2)# # Number of zero level crossings per second
lamda=c/fc# # Carrier wavelength
# The maximum velocity of mobile
v=fm*lamda# # Maximum velocity of mobile in m/s
v=v*(18/5)# # Maximum velocity of mobile in km/hr
# Displaying the result in command window
print '\n The positive-going level crossing rate = %0.2f crossings per second'%(NR)#
print '\n The maximum velocity of mobile = %0.0f Km/Hr'%(v)#
```

In [13]:

```
from math import exp,pi,sqrt
from __future__ import division
# To find the average fade duration
# Given data
rho1=0.01# # Threshold level
rho2=0.1# # Threshold level
rho3=1# # Threshold level
fm=200# # Doppler frequency
t1=(exp(rho1**2)-1)/(rho1*fm*sqrt(2*pi))# # The average fade duration
t2=(exp(rho2**2)-1)/(rho2*fm*sqrt(2*pi))# # The average fade duration
t3=(exp(rho3**2)-1)/(rho3*fm*sqrt(2*pi))# # The average fade duration
# Displaying the result in command window
print '\n The average fade duration (for rho = 0.01) = %0.1f microseconds'%(t1*10**6)#
print '\n The average fade duration (for rho = 0.1) = %0.0f microseconds'%(t2*10**6)#
print '\n The average fade duration (for rho = 1) = %0.2f microseconds'%(t3*10**3)#
```

In [15]:

```
from math import exp,pi,sqrt
from __future__ import division
# To find the average fade duration and average number of bit errors per second. & to determine whether the fading is slow or fast.
# Given data
rho=0.707# # Threshold level
fm=20# # Doppler frequency
datarate=50# # Bit duration of binary digital modulation in bps
errho=0.1# # Threshold level below which bit error occurs
t=(exp(rho**2)-1)/(rho*fm*sqrt(2*pi))# # The average fade duration
tb=1/datarate# # Bit period
t1=(exp(errho**2)-1)/(errho*fm*sqrt(2*pi))# # The average fade duration
# Displaying the result in command window
print '\n The average fade duration (for rho = 0.707) = %0.1f ms'%(t*10**3)#
print '\n The bit period = %0.0f ms'%(tb*10**3)#
print '\n Since the bit period is greater than average fade duration, for 50bps datarate the signal undergoes fast Rayleigh fading.'
print '\n \n The average fade duration of the threshold level below which bit error occurs (for rho = 0.1) = %0.3f'%(t1)#
print '\n Since the average fade duration of the threshold level below which bit error occurs is less than duration of one bit,\n only one bit on average will be lost'
```