import math
# Variables
Gb = 1.;
print 'a) SSB: Gb = %i '%(Gb);
print ' GbdB = %i dB'%(10*math.log10(Gb));
print 'b) DSB: Gb = %i '%(Gb);
print ' GbdB = %i dB'%(10*math.log10(Gb));
m = 0.5;
Gb = m**2/(2+m**2);
print 'c) AMm = .5): Gb = %.3f '%(Gb);
print ' GbdB = %.3f dB'%(10*math.log10(Gb));
m = 1.;
Gb = m**2/(2+m**2);
print 'd) AMm = 1): Gb = %.3f '%(Gb);
print ' GbdB = %.3f dB'%(10*math.log10(Gb));
delta_phi = 5.;
Gb = delta_phi**2/2;
print 'e) FMdelta phi = 5)): Gb = %.1f '%(Gb);
print ' GbdB = %.3f dB'%(10*math.log10(Gb));
D = 5.;
Gb = 3.*D**2/2;
print 'f) FMD = 5): Gb = %.1f '%(Gb);
print ' GbdB = %.3f dB'%(10*math.log10(Gb));
Wf1 = 7.07;
Gb = 3./2*D**2*math.pi/6*Wf1;
print 'g) FMD = 5, W/f1 = 7.07): Gb = %.1f '%(Gb);
print ' GbdB = %.2f dB'%(10*math.log10(Gb));
import math
# Calculations and Results
GR = 1.;
print 'a) SSB: GR = %i '%(GR);
print ' GRdB = %i dB'%(10*math.log10(GR));
GR = 2.;
print 'b) DSB: GR = %i '%(GR);
print ' GRdB = %.2f dB'%(10*math.log10(GR));
m = 0.5;
GR = 2*m**2/(2+m**2);
print 'c) AMm = .5): GR = %.4f '%(GR);
print ' GRdB = %.3f dB'%(10*math.log10(GR));
m = 1.;
GR = 2*m**2/(2+m**2);
print 'd) AMm = 1): GR = %.3f '%(GR);
print ' GRdB = %.2f dB'%(10*math.log10(GR));
delta_phi = 5.;
GR = (1+delta_phi)*delta_phi**2;
print 'e) FMdelta phi = 5)): GR = %.1f '%(GR);
print ' GRdB = %.3f dB'%(10*math.log10(GR));
D = 5.;
GR = 3*D**2*(1+D);
print 'f) FMD = 5): GR = %.1f '%(GR);
print ' GRdB = %.3f dB'%(10*math.log10(GR));
Wf1 = 7.07;
GR = 3*(1+D)*D**2*math.pi/6*Wf1;
print 'g) FMD = 5, W/f1 = 7.07): GR = %.1f '%(GR);
print ' GRdB = %.2f dB'%(10*math.log10(GR));
import math
# Variables
k = 1.38*10**-23; #Boltzmann's const
#Temperatures in K
Ti = 150.;
Te = 325.;
# Calculations and Results
Tsys = Ti+Te;
print ' Tsys = %i K '%(Tsys);
D = 5;
W = 15; #kHz
B = 2*(1+D)*W;
print ' B = %i kHz'%(B);
Nsys = k*Tsys*B*10**3; #W
print ' Nsys = %.3f fW'%(Nsys*10**15);
PR = 50*10**-12; #W
SNsys = PR/Nsys;
print ' S/N)sys = %i '%(SNsys);
GR = 3*(1+D)*D**2
print ' GR = %.0f '%(GR);
SNoutput = GR*SNsys;
print ' S/N)output = %.0f '%(SNoutput);
print ' S/N)out,dB = %.2f dB'%(10*math.log10(SNoutput));
print ' S/N)sys, dB = %.2f dB'%(10*math.log10(SNsys));
GRdb = 10*math.log10(GR);
print ' GR, dB = %.2f dB '%(GRdb);
print ' S/N)output ,dB = %.2f dB'%(10*math.log10(SNoutput));
# Variables
N = 16; #bit
# Calculations
SNoutdB = 1.76+6.02*N;
# Results
print ' (S/N)output, dB = %.2f dB '%(SNoutdB);
# Variables
SNoutdB = 53;
# Calculations and Results
N = (SNoutdB-1.76)/6.02;
print ' N = %.2f bits '%(N);
N = 9; #roundup
print ' N = %i bits '%(N);
import math
# Variables
N = 6.; #bits per word
# Calculations and Results
M = 2**N;
print ' M = %i '%(M);
Pr = 200.*10**-15; #W
R = 2.*10**6; #bits/s
Eb = Pr/R;
print ' Bit energy ,Eb = %.0f*10**-21 '%(Eb*10**21);
k = 1.38*10**-23; #Boltzmann cons
Ti = 300.; #K
Te = 425.; #K
Tsys = Ti+Te;
nsys = k*Tsys;
print ' Noise power spectral density ,nsys = %.0f*10**-20 W/Hz '%(nsys*10**20);
rho = Eb/nsys;
print ' Bit energy , rho = %.0f '%(rho);
rhodB = 10*math.log10(rho);
print ' Bit energy in db, rho,dB = %.0f dB '%(rhodB);
#part a
Pe = 4*10**-6;
SNout = 1.5*M**2/(1+4*M**2*Pe);
print ' a) S/N)output = %.0f or %0.2f dB) '%(SNout,10*math.log10(SNout));
#part b
Pe = 2.3*10**-5;
SNout = 1.5*M**2/(1+4*M**2*Pe);
print ' b) S/N)output = %.0f or %0.2f dB) '%(SNout,10*math.log10(SNout));
#part c
Pe = 8*10**-4;
SNout = 1.5*M**2/(1+4*M**2*Pe);
print ' c) S/N)output = %.1f or %0.2f dB) '%(SNout,10*math.log10(SNout));
#part d
Pe = 3.5*10**-3;
SNout = 1.5*M**2/(1+4*M**2*Pe);
print ' d) S/N)output = %.1f or %0.2f dB) '%(SNout,10*math.log10(SNout));
import math
# Variables
#data from ex 13.6
M = 2.**6;
Pr = 200.*10**-15; #W
R = 8.*10**6; #bits/s (changed)
Eb = Pr/R;
# Calculations and Results
k = 1.38*10**-23; #Boltzmann cons
Ti = 300; #K
Te = 425; #K
Tsys = Ti+Te;
nsys = k*Tsys;
#print ' Noise power spectral density %(nsys = %.0f*10**-20 W/Hz '%(nsys*10**20);
rho = Eb/nsys;
print ' Bit energy , rho = %.1f '%(rho);
rhodB = 10*math.log10(rho);
print ' Bit energy in db, rho,dB = %.2f dB '%(rhodB);
Pe = 1.3*10**-2;
SNout = 1.5*M**2/(1+4*M**2*Pe);
print ' S/N)output = %.2f or %0.2f dB) '%(SNout,10*math.log10(SNout));
import math
# Variables
Pe = 10.**-5;
R = 1*10**6; #bits/s
k = 1.38*10**-23; #Boltzmann cons
Ti = 475.; #K
Te = 250.; #K
Tsys = Ti+Te;
nsys = k*Tsys; #W/Hz
# Calculations
def E(rhodb): #function for Eb
rho = 10**(rhodb/10);
return nsys*rho;
def P(E): #function for Pr
return R*Eb;
def lay(rhodb,pt):
Eb = E(rhodb);
print P(E);
print '%c)Bit energy , Eb = %.2f*10**-21 J '%(pt,Eb*10**21);
print ' Required reciver carrier power , Pr = %.2f fW '%(Pr*10**15);
#Part a
rhodb = 9.6;
lay(rhodb,'a');
#Part b
rhodb = 10.3;
lay(rhodb,'b');
#Part c
rhodb = 12.6;
lay(rhodb,'c');
#Part d
rhodb = 13.4;
lay(rhodb,'d');
import math
#Data form ex13.8
# Variables
Pe = 10**-5;
R = 2*10**6; #bits/s (changed)
k = 1.38*10**-23; #Boltzmann cons
Ti = 475; #K
Te = 250; #K
Tsys = Ti+Te;
nsys = k*Tsys; #W/Hz
# Calculations
def E(rhodb): #function for Eb
rho = 10**(rhodb/10);
return nsys*rho;
def P(E): #function for Pr
return R*Eb;
rhodb = 9.6;
Eb = E(rhodb);
Pr = P(E);
# Results
print 'Bit energy , Eb = %.2f*10**-21 J '%(Eb*10**21);
print ' Required reciver carrier power , Pr = %.2f fW '%(Pr*10**15);