import math
#initialisation of variables
T=1.0*10**-6 #ms
A=10.0*10**-3
N=1*10**-11
#CALCULATIONS
Eb=((A**2)*T)/2.0
Epb=math.sqrt(Eb/N)
Pb=(1.0/2)*math.erfc(Epb)*(1.0/4)
#RESULTS
print("Bit error probability = %.2f X 10^-4 " %(Pb*(10**4)))
print('Approximation error')
import math
#initialisation of variables
Br=25*10**6 #bits/sec
N=2*10**-20 #Power spectral density of noise
A=1.0*10**-6
Ps=1*10**-12 # Normalized power
#CALCULATIONS
Tb=1.0/Br
Ps=(A**2)/2.0
Pe=1.0/2*(math.erfc((0.6*Ps*Tb)/N))
#RESULTS
print("Average probability of bit error is Pe= %.2f X 10^-4 " %(Pe*10))
import math
#Find probability of error
#initialisation of variables
A=2.0
N0=2.0*10**-4 #power sepctral density
#CALCULATIONS
Tmin=(6.76*N0)/4
#RESULTS
print("The min time for which the signal should be extended is Tmin= %.3f X 10^-3 msec " %(Tmin*10**3))
import math
#The average carrier
#initialisation of variables
Pe=10**-4
N0=2*10**10
T=1.0/10**6
#CALCULATIONS
E=6.76*N0
P=E/T
Eb=8.5171*N0
P2=Eb/T
#RESULTS
print("The average carrier = %.3f X 10^-3 mW " %(P2/10**17))
import math
#The average carrier
#initialisation of variables
A=0.2*10**-3 #V
T=2*10**-6
N0=2*10**-15
#CALCULATIONS
Pe=(math.sqrt((A**2*T)/4*N0))
#RESULTS
print("The average carrier = %.3f X 10^-4 mW " %(Pe*10**15))
print("Approximation error")
import math
#initialisation of variables
A=1.0
N0=2.0*10**-5 #power sepctral density
#CALCULATIONS
T=((3.71**2)*2*N0)/(A**2)
Br=1/T
#Results
print("Bit rate Br= %.2f k bits/sec" %(Br/(10**3)))
import math
#initialisation of variables
Pe=10.0**-4 #probability of error of PSK
N0=2.0*10**-10
Br=10**6 #Bit Rate
#CALCULATIONS
T=1.0/Br
E=N0*6.76
P=E/T
Eb=8.5171*N0
Pb=Eb/T
#Results
print("i) PSK system The required carrier power = %.2f mW" %(P*10**3))
print("ii) DPSK system The required carrier power = %.2f mW" %(Pb*10**3))
import math
#initialisation of variables
A=0.2*10**-3 #V
T=2*10**-6 #Sec
N0=2*10**-15
#CALCULATIONS
x=math.sqrt((A**2*T)/(4*N0))
Pe=(1.0/2)*math.erfc(x/math.sqrt(2.0))
#Results
print("Probability of error = %.2f X 10^-4" %(Pe*10**4))
#print("Channel Bandwidth = %.5f MHz" %BW)
import math
#initialisation of variables
Ap=1 #mV
En=192.3 #mV
Arms=707 #mV
#CALCULATIONS
Z=Arms/En
Pe=1.0/2*(math.erfc(math.sqrt(2)*(Z/math.sqrt(2))))
#Results
print("Probability of error is %.7f " %Pe)
import math
#initialisation of variables
Br=2.08*10**-6 #Bit Rate
N0=2*10**-8
#CALCULATIONS
Eb=(math.sqrt(3.3))/(5*10**7) #Eb=bit energy
Ps=Eb*Br
BW=2*Br #Bandwidth
Es=286.39*N0
Ps2=(Es*Br)/2
BW2=(2*Br)/4
#Results
print("i) BPSK THe transmission bandwidth = %.2f MHz" %(BW*10**6))
print("ii) For 16 ary PSK THe transmission bandwidth = %.2f MHz" %(BW2*10**6))