# Page Number: 8.6
# Example 8.1
import math
print'Part a'
# (a)Given, u1=1W and u2=1mW
# Change to dBW and dBm
u1=1.*10.**3.;
u2=1.;
# (i)470mW
a=470.*10.**3.;
y1=(10.*math.log(a/u1))/math.log(10);
print'dBm',y1
y2=(10*math.log(a/u2))/math.log(10);
print'dBW',y2
# (ii)1W
b=1.;
z1=(10.*math.log(b/u1))/math.log(10);
print'dBm',z1
z2=(10.*math.log(b/u2))/math.log(10);
print'dBW',z2
# (iii)100nW
c=100.*10.**9;
x1=(10*math.log(c/u1))/math.log(10);
print'dBm',x1
x2=(10.*math.log(c/u2))/math.log(10);
print'dBW',x2
print'\nPart B'
# (b)Here u1=1W (for dBW)and u2=1mW (for dBm)
# Change to powers to watts
# (i)-20dBW
a=-20.;
k1=u2*(10.**(a/10.));
print'W',k1
# (ii)47dBm
b=47.;
k2=u1*(10.**(b/10.));
print'W',k2
# (ii)0dBm
c=0;
k3=u1*(10.**(c/10.));
print'W',k3
print'\nPart C'
# (c)Given, channel loss=20dB and Pt=1W
l=-20.;
PT=1.;
PR=10.**(l/10.);
print'Received Power',PR,'W'
print'\nPart D'
# (d)Given, channel loss=30dB when signal=3dB and overall loss=20dB
l1=-30.;
s=-3.;
l2=-20.;
q=-l1-s-s+l2;
d1=10.**(q/10.);
print'=',q,'dB'
print d1
print'\nPart E'
# (e)Given,
Si=0; # dBm
S1=1.*10.**3.*(10.**(Si/10.));
Ni=1.*10.**7.; # W
Osnr=S1/Ni;
Odb=(10.*(math.log(Osnr)))/math.log(10)
print Odb,'dB'
# Page Number: 8.7
# Example 8.2
# Given,
import math
R=1000.;
T=27.; # degree celsius
TK=T+273.; # kelvin
# We know, rms noise voltage is 4RKTB
K=1.38*10.**28.;
B=10.;
V=math.sqrt(4.*R*K*TK*B);
print'Rms noise voltage:',V,'V'
# Page Number: 8.8
# Example 8.3
# Given,
G=100.;
G1=(10.**(G/10.));
T=30.;
Te=270.;
# We know,output noise power=GKB(T+Te)
K=1.38*10.**23.;
B=1.5*10.**6.;
No=G1*1.38*10.**23.*1.5*10.**6.*(T+Te);
print'Output Noise Power',No,'W'
# Page Number: 8.8
# Example 8.4
# Given,
import math
R=50.;
osnr=0;
SNRo=(10.**(osnr/10.));
print'Output SNR',SNRo
# As Pni=KTB
K=1.38*10.**23.;
T=290.;
B=5.*10.**5.;
Pni=K*T*B;
print'Input noise power',Pni,'W'
# Psi=V**2/R
# Given V=5*10**-6V
V=0.5*10.**6.;
Psi=(V**2.)/R;
print'Signal Power Input',Psi,'W'
isnr=(Psi/Pni);
print'Input SNR',isnr
F=(isnr/SNRo);
print'Noise Factor',F
NF=10.*math.log(F)/math.log(10);
print'Noise figure',NF,'dB'
# Page Number: 8.9
# Example 8.6
# Given,Stage 1
import math
SNRo=120.;
Pni=0.01*10.**6.; # W
G1=20.;
# Stage 2
F2=12.; # dB
FF2=(10.**(F2/10.));
G2=30.;
# Stage 3
F3=9.3; # dB
FF3=(10.**(F3/10.));
G3=35.;
# (a)Nosie factor and noise figure of Stage 1
F=5.6; # dB
FF=(10.**(F/10.));
# As F=F1-((F2-1)/G1)-((F3-1)*(G1G2));
Fa=FF-((F2-1)/G1)-((FF3-1)/(G1*G2));
print'Noise factor of stage 1',Fa
FadB=(10*(math.log(Fa)))/math.log(10); # dB
print'Noise figure of stage 1',FadB,'dB'
# (b)Input signal power of stage 1
Psi=Pni*Fa*SNRo;
print'Input signal power of stage 1',Psi,'W'
# (c)Nosie added by stage 1
N=(Fa-1)*G1*Pni;
print'Noise added by stage 1',N,'W'
# Page Number: 8.10
# Example 8.7
# Given
import math
Te=127.;# Kelvin
T=290.;# Kelvin
G1=100.;
F2dB=12.;# db
F2=(10.**(F2dB/10.));
F1=1.+(Te/T);
F=F1+((F2-1.)/G1);
FF=(10.*math.log(F))/math.log(10);
print'Overall Noise Figure',FF,'dB'
# Equivalent Noise Temperature TE
TE=(F-1.)*T;
print'Equivalent Noise Temperature',TE,'K'
# Page Number: 8.11;
# Example 8.9
# (a)Noise Figure
# Given
# Loss Fcator
import math
IL=1.5; # dB
IL1=(10.**(IL/10.));
# Noise figure
F1=1.41;
G1=1./F1;
G2=10.;
GG2=(10.*math.log(G2))/math.log(10); # dB
G3=100.;
GG3=(10.*math.log(G3))/math.log(10); # dB
F2=2.; # dB
F3=2.; # dB
FF2=(10.**(F2/10.));
FF3=(10.**(F3/10.));
F=(F1+((FF2-1.)/G1)+((FF3-1.)/(G1*GG2)));
FF=(10.*math.log(F))/math.log(10);
print'Noise figure of cascade',FF,'dB'
# (b) SNR at output
# Given
Pin=-90.; # dBm
Pout=Pin-IL+GG2+GG3; # dBm
# Pn=Gcas*K*Te*B (cascade)
K=1.38*10.**23.;
To=290.; # Kelvin
B=1.*10.**8.;
Gcas=GG2+GG3-IL;
Gcas1=(10.**(Gcas/10.));
Pn=K*To*(F-1.)*B*Gcas1; # W
Pn1=(10.*(math.log(Pn/1.*10.**3.)))/math.log(10);
print'Noise power output:',Pn1,'dBm'
SNR=Pout-Pn1;
print'Signal to Noise ratio:',SNR,'dB'
# (c)Best Noise Figure
# G1 after G2 after IL
Fcas=(FF2+((FF3-1)/G3)+((IL1-1)/(G3*G2)));
Fcas1=(10.*(math.log(Fcas)))/math.log(10);
print'Noise figure will be:',Fcas1,'dB'
# Page Number: 8.12
# Example 8.10
import math
# Given
K=1.38*10.**23;
B=40.*10.**6.;
Tant=600.; # Kelvin
Trec=3000.; # Kelvin
G=80.; # dB
GG=(10.**(G/10.));
# Input noise power from antenna
Nant=K*Tant*B; # W
print'Nant=',Nant,'W'
Nrec=K*Trec*B; # W
print'Nant=',Nrec,'W'
Nout=(Nant+Nrec)*GG;
print'Reciver Noise Power Output',Nout,'W'
# Page Number: 8.12
# Example 8.11
import math
# We use, F=(F1+(F2-1)/G1)
# Given
FA=1.5;
GA=10.; # dB
GAA=(10.**(GA/10.));
FB=3.; # dB
FBB=(10.**(FB/10.));
GB=15.; # dB
GBB=(10.**(GB/10.));
# Case 1: Amp A followed by Amp B
F11=FA;
F12=FBB;
G11=GAA;
F1=(F11+(F12-1.)/G11);
print'Gain when Amp A followed by Amp B',F1
# Case 2: Amp B followed by Amp A
F21=FBB;
F22=FA;
G21=GBB;
F2=(F21+(F22-1)/G21);
print'Gain when Amp B followed by Amp A',F2
# As F1<F2, Case 1 gives lowest Noise
# Also given,
T0=20. # degree celsius
T=T0+273.; # Kelvin
# For amplifier A
TA=((FA-1.)*T);
# For amplifier B
TB=((FBB-1.)*T);
# When A is followed by B
Te1=(F1-1.)*T;
print'Noise temperataure when Amp A followed by Amp B',Te1
# When B is followed by A
Te2=(F2-1.)*T;
print'Noise temperataure when Amp B followed by Amp A',Te2
# Page Number: 8.13
# Example 8.12
import math
# Given, Noise figure
NF=2.; # dB
F=(10.**(NF/10.));
AG=12.; # dB
A=(10.**(AG/10.));
# (a)Total Output Noise Power
# Also given,Input signal power
Pi=1.; # W
# Input Noise power Pni
Pni=100.*10.**-3.; # W
# Input SNR
Isnr=Pi/Pni;
# Output SNR
Osnr=Isnr/F;
# Total output signal power
Po=Pi*A; # W
# Total output noise power
N=Po/Osnr; # W
print'Total Output Noise Power',N,'W'
# (b)Signal to Noise and disortion ratio
# Given. 2% is disortion
Di=2./100.;
# Total disortion
D=Di*A; # W
# Useful Power
S=(1.-Di)*A; # W
# As given,SNAD=10*(log10(S+N+D)/(N+D));
SNAD=10.*(math.log((S+N+D)/(N+D)))/math.log(10);
print'SNAD:',SNAD,'dB'
# Page Number: 8.14
# Example 8.13
# Given
import math
Pni=-100.; # dBm
PniW=((1.*10.**3.)*(10.**(Pni/10.)));
To=290.; # K
F=1.6; # dB
NF=(10.**(F/10.));
# (a) Noise tempertaure of antenna
# As Te=Pni/K*B;
K=1.38*10.**23.;
B=20.*10.**6.;
Te=(PniW/(K*B));
print'Noise tempertaure of antenna',Te,'K'
# (b)Effective noise tempertaure
# Given,
G=30.; # dB
GdB=(10.**(G/10.));
Tef=((NF-1.)*To);
print'Effective Noise tempertaure',Tef,'K'
# Output Noise Pno=K*T(Te+Tef)*B*GdB
Pno=K*(Te+Tef)*B*GdB; # W
Pno1=(10.*(math.log(Pno/1.*10.**3.)))/math.log(10);
print'Output Noise: ',Pno1,'dBm'
# Page Number: 8.14
# Example 8.14
# Given
import math
GG1=20.;# dB
G1=(10.**(GG1/10.));
FF1=6.;# dB
F1=(10.**(FF1/10.));
GG2=60.;# dB
G2=(10.**(GG2/10.));
FF2=16.;# dB
F2=(10.**(FF2/10.));
LF=3.; # dB
FC=(10.**(LF/10.));
GC=1./FC;
# (a)Overall Noise Figure
# Usinng F=(F1+((F2-1)/G1)+((F3-1)(G1*G2)));
Fa=(F1+((FC-1.)/G1)+((F2-1.)/(G1*GC)));
FadB=(10.*(math.log(Fa)))/math.log(10);
print'Overall Noise Figure:',FadB,'db'
# (b)Noise figure, if pre-amplifier is removed and gain increased by 20dB
Fb=FC+((F2-1.)/GC);
FbdB=(10.*(math.log(Fb)))/math.log(10);
print'Overall Noise Figure:',FbdB,'db'
# (c)Change in noise figure
# Again usinng F=(F1+((F2-1)/G1)+((F3-1)(G1*G2)));
Fc=(FC+((F1-1.)/GC)+((F2-1.)/(G1*GC)));
FcdB=(10.*(math.log(Fc)))/math.log(10);
print'Overall Noise Figure:',FcdB,'db'
# Page Number: 8.15
# Example 8.15
# Given Noise figure
import math
NF=5.; # dB
F=(10.**(NF/10.));
Ta=1050.; # Kelvin
# (a) Overall Noise Figure
T=20.; # degree Celsius
To=T+273.; # Kelvin
# Effective Noise temperature
Te=((F-1.)*To);
print'Effective Noise temperature',Te,'K'
# Overall effective Noise Temperature
TIN=Ta+Te;
print'Overall Effective Noise temperature',TIN,'K'
# Overall noise figure
ONF=(1.+(TIN/To));
ONFdB=(10.*(math.log(ONF)))/math.log(10); # dB
print'Overall Noise Figure:',ONFdB,'dB'
# (b)Input Signal Power
# Given Output SNR
Outsnr=6.; # dB
Osnr=(10.**(Outsnr/10.));
Isnr=ONF*Osnr;
# Input Noise Power=KTB
K=1.38*10.**23.;
B=50000.;
Pni=K*TIN*B; # W
# Input signal Power
Psi=Isnr*Pni; # W
PsidBW=(10.*(math.log(Psi/1)))/math.log(10); # dBW
print'Input signal Power:',PsidBW,'dBW'
# (c)Minimum detectable signal Vmin
# Given
Osnr=10.; # dB
R=50.; # Ohms
FF1=3.; # dB
F1=(10.**(FF1/10.));
FF2=5.; # dB
F2=(10.**(FF2/10.));
GG1=7.;
G1=(10.**(GG1/10.));
# Using F=F1+((F2-1)/G1)
Fa=F1+((F2-1.)/G1);
Fa1=(10.*(math.log(Fa)))/math.log(10);
# Equivalent Noise Tempertaure
Te1=((Fa-1.)*To);
print'Equivalent Noise temperature:',Te1,'K'
# Overall effective Noise Temperature
TIN1=Ta+Te1;
print'Effective Noise temperature:',TIN1,'K'
# Input Noise Power=KTB
Pni1=K*TIN1*B; # W
# Overall noise figure
ONF1=(1.+(TIN1/To));
ONFdB1=(10.*(math.log(ONF)))/math.log(10);
print'Overall Noise Figure:',ONFdB1,'W'
# Input SNR
Isnr1=ONF1*Osnr;
# Input signal Power
Psi1=Isnr1*Pni; # W
print'Input Signal Power:',Psi1,'W'
# Now as Vmin**2/R=Psi1
# Therefore
Vmin=math.sqrt(Psi1*R);
print'Minimum detectable signal Vmin:',Vmin,'V'
# Page Number: 8.18
# Example 8.18
# Given,
import math
Fa=5.; # dB
d=200.; # Km
a=2.; # dB/Km
No=4.*10.**21.; # W/Hz
BW=4000.;
Osnr=30.; # dB
# (a) No repeaters used
L=d*a; # dB
print'Noise figure:',L,'dB'
# As Output SNR=InputSNR/F where F=L*Fa
# And Input SNR=(Pt/(No*B))
# Therefore,PT=Output SNR+L+Fa+(No*B)
NoB=10.*math.log(No*BW)/math.log(10);
# Power Transmitted
Pt=Osnr+L+Fa+(NoB);
PtdB=10.**(Pt/10.);
print'Power transmitted with no repeaters',PtdB,'W'
# (b)20 repeaters are employed
n=20.;
# F becomes 20F
# Output SNR=InputSNR/20*F where F=L*Fa
L1=L/n; # dB per segment
# Power Transmitted
Pt1=Osnr+L1+Fa+(NoB)+(10.*(math.log(n)))/math.log(10.);
PtdB1=10.**(Pt1/10.);
print 'Power transmitted with 20 repeaters',PtdB1,'W'
# Page Number: 8.23
# Example 8.23
# Given,
# S=10*10.**8*(1-(|f|/10*10.**8));
# (a)Power contenet of output noise
# Bandwidth of 2MHz centered at 50MHz
# Therefore, first limits will be
x0=-51.*10.**6.;
x1=-49.*10.**6.;
P1=1*10.**06;#integrate('1+(f/10**8)','f',x0,x1);
# And,second limits will be
x2=49.*10.**6.;
x3=51.*10.**6.;
P2=1*10.**06;#integrate('1-(f/10**8)','f',x2,x3);
P=0.2;#10.*10.**8.*(P1+P2);
print'Power content:',P,'W'
#Page Number: 8.25
#Example 8.24
#Given, band limited gaussian noise with psd,
%matplotlib inline
import scipy,numpy,matplotlib
from matplotlib import pyplot
from scipy import integrate
S=9.6e-5; #W/Hz for |f|<8kHz
L=100e-3; #H
R=100.; #Ohms
#(a) Noise power at input of filter
x0=-8000.;
x1=8000.;
def function(x):
y = 1;
return y
Pni=S*(scipy.integrate.quad(function,x0,x1)[0]);
print 'Noise power at input of filter:',Pni,'W'
#Plot
x=numpy.linspace(-8,8, num=3);
y=numpy.linspace(0,1,num=3);
pyplot.plot(x,y);
pyplot.show();