# Page Number: 9.10
# Example 9.1
import math
# Given
wo=2.*math.pi*8000.;
n=2.*10.**9.;
# N0=(n/4*%pi)integrate('1/(1+((w/w0)**2))','w',-%inf,+%inf)
# Which yields
# Output Noise Power
N0=(wo*n)/4.;
print"Output Noise Power: ",N0,"W"
# Page Number: 9.12
# Example 9.4
# Given
# (a)
import math
H1=1.;
H2=(1./2.);
S0=(H1**2.)/2.;
w0=-2.*math.pi;
w1=2.*math.pi;
N0=0.4;#(0.1/(2*math.pi))*2*(integrate('1','w',w0,w1));
SNR=S0/N0;
print"SNR: ",SNR
# (b)
S01=(H1**2.*H2**2.)/2.;
N01=0.101;
SNR1=S01/N01;
print"SNR1: ",SNR1
# Page Number: 9.15
# Example 9.8
# Given
import math
p=0.99;
u=1.;
q=1-p;
# As exp(-Ac^2/4*n*B)=1-p
# AndAC^2/2*n*B=S/N
# Therefore exp(-(1/2)*(S/N))=1-p
SN=2.*(math.log(1/q));
SN1=(round(SN)+1); # Upper limit
print'S/N:',SN1,'db'
# Hence proved
# Page Number: 9.16
# Example 9.9
# Given
import math
Si=7.*10.**4.;
u=1.;
BW=4.*10.**3.; # Hz
n=2.*10.**12.; # W/Hz
# (a)Minimum value of Ac
SbyN=40.; # dB
SN=10.**(SbyN/10.);
Sx=0.167;#2*[integrate('(x**2)*(-x+1)','x',0,1)];
# Now
g=SN/(Sx/(1+Sx));
# And
# Ac=sqrt((2*n*BW*g)/(1+(u**2*Sx))
# We have
Ac=math.sqrt((2.*n*BW*g)/(1.+(u**2.*Sx)));
print'Minimum Value of Ac:',Ac,'V'
# (b)Threshold value of Ac
# AS S/N at threshold is 10dB
SNT=10.; # dB
gT=2.*SNT;
AcT=math.sqrt((2.*n*BW*gT)/(1.+(u**2.*Sx)));
print'Minimum Value of Ac at Threshold:',AcT,'V'
# Page Number: 9.17
# Example 9.10
# Given
BW=10.*10.**3.; # Hz
SNR=40.; # dB
SNRO=10.**(SNR/10.);
P=40.; # dB
PL=10.**(P/10.);
n=2.*10.**9.; # W/Hz
USx2=0.5;
# For DSB, AM and SSB bandwidth requirement
BTD=2.*BW;
BTA=2.*BW;
BTS=BW;
print'Transmission Bandwidth for DSB:',BTD,'Hz'
print'Transmission Bandwidth for AM:',BTA,'Hz'
print'Transmission Bandwidth for SSB:',BTS,'Hz'
# Pt for DSB and SSB
# As SNRO=Si/nBW
Si=n*BW*SNRO; # W
# Considering Channel loss
ST=Si*PL;
print'Power transmission for DSB and SSB:',ST,'W'
# Pt for AM
# As SNRO=x*Si/nBW
# x=USx2/(1+USx)
x=USx2/(1.+USx2);
Si1=(n*BW*SNRO)/x; # W
# Considering Channel loss
ST1=Si1*PL;
print'Power transmission for AM:',ST1,'W'
# Page Number: 9.20
# Example 9.13
# Given
import math
Mf1=0.003;
# for f<=1.5*10.**3 Hz
f1=1.5*10.**3.; # Hz
Mf2=0.001;
# for 1.5*10.**3 <=f<=3*10.**3 Hz
f2=3.*10.**3.; # Hz
Mf3=0;
# for f>3*10.**3 Hz
# (a) Ac that power transmitted is 100mW
St=100.*10.**3.; # W
# As St=2*[{f1*(Mf1*Ac/2)**2}+{f1*(Mf2*Ac/2)**2}+{f2*(Mf3*Ac/2)**2}]
# Neglecting Mf3 as zero
Ac=math.sqrt((4.*St)/(2.*f1*(Mf1**2.+Mf2**2.)));
print'Ac for s(t)=100mw:',Ac,'V'
# (b)Power in abscence of noise
Zt=2.*((f1*(((Mf1*Ac)/4.)**2.))+(f1*(((Mf2*Ac)/4.)**2.))+(f2*(((Mf3*Ac)/4.)**2.)));
print'Power in absence of Noise:',Zt,'W'
# (c)
# Given
N0=0.0001*10.**3.; # W/Hz
# Psd=N0/4
# Pt=2*f1*N0/4
Pt=(2.*f2*N0)/4.;
print'Power:',Pt,'W'
# (d) SNR at output
SNR=Zt/Pt;
SNRO=10.*math.log(SNR)/math.log(10);
print'SNR at output for SSB:',SNRO,'dB'
# (e)For DSB
St1=100.*10.**3.; # W
# As St=4*[{f1*(Mf1*Ac/2)**2}+{f1*(Mf2*Ac/2)**2}+{f2*(Mf3*Ac/2)**2}]
# Neglecting Mf3 as zero
Ac1=math.sqrt((4.*St)/(4.*f1*(Mf1**2.+Mf3**2.)));
Zt1=4.*((f1*(((Mf1*Ac)/4.)**2.))+(f1*(((Mf2*Ac)/4.)**2.))+(f2*(((Mf3*Ac)/4.)**2.)));
# SNR at output
SNR1=Zt1/Pt;
SNRO1=10.*math.log(SNR1)/math.log(10);
print'SNR at output for DSB:',SNRO1,'dB'
# 3dB increase in SNR
# DSB has higher SNR but SSB os spectarally efficient
# Page Number: 9.22
# Example 9.14
# Given
import math
delf=75.*10.**3.; # Hz
W=15.*10.**3.; # Hz
Sx=1./2.;
# As SNRO=3(delf/W)**2*Sx*g
# Assume g=1
g=1.;
SNRO=3.*(delf/W)**2*Sx*g;
SNdB=10.*math.log(SNRO)/math.log(10);
print'Output SNR:',SNdB,'dB'
# Hence it is SNdB times better
# Page Number: 9.23
# Example 9.17
# Given
import math
oSNR=40.; # dB
SNRO=10.**(oSNR/10.);
n=2.*10.**10.; # W/Hz
l=50.; # dB
PL=10.**(l/10.);
B=15.*10.**3.; # Hz
Sx=1./2.;
# (a) DSB Modulation
BTD=2.*B;
print'Transmission bandwidth for DSB:',BTD,'Hz'
# As SNRO=Si/(n*B)
SiD=SNRO*n*B;
STD=SiD*PL;
print'Average Power transmitted for DSB:',STD,'W'
# (b) AM
U=1.;
U2Sx=U*U*Sx;
BTA=2.*B;
print'Transmission bandwidth for AM:',BTA,'Hz'
# As SNRO=x*Si/(n*B)
# where x=USx/(1+USx)
x=U2Sx/(1.+U2Sx);
SiA=(SNRO*n*B)/x;
STA=SiA*PL;
print'Average Power transmitted for AM:',STA,'W'
# (c)PM
kp=3.;
BTP=2.*(kp+1.)*B;
print'Transmission bandwidth for PM:',BTP,'Hz'
# As SNRO=kp**2*Sx*Si/(n*B)
SiP=(SNRO*n*B)/(Sx*(kp**2));
STP=SiP*PL;
print'Average Power transmitted for PM:',STP,'W'
# (d)FM
D=5.;
BTF=2.*10.**1.*B;
print'Transmission bandwidth for FM:',BTF,'Hz'
# As SNRO=3*D**2*Sx*Si/(n*B)
SiF=(SNRO*n*B)/(3.*(D**2.)*Sx);
STF=SiF*PL;
print'Average Power transmitted for FM:',STF,'W'
# Page Number: 9.24
# Example 9.18
# (b)Modulation index b
# Given
SNdB=30.; # dB
SNRO=10.**(SNdB/10.);
# As SNRO=30*b**2*(b+1)
# Therefore
#p2=poly(0,'x');
#p3 =30.*(p2**3.)+30.*(p2**2.)-1000.;
#r=roots(p3);
t=2.917128 ;#2.92+0j;#r(3,1);
print'Modulation index:',t
# Page Number: 9.27
# Example 9.21
# Given
import math
BW=5000.; # Hz
P=0.1; # W
CBW=100.*10.**3.; # Hz
A=80.; # dB
A1=10.**(-A/10.);
N0=2*(0.5*10.**12.); # W/Hz
Pt=10.*10.**3.; # W
# We know, CBW=2*(*10.**1)*BW
# Therefore
D=(CBW/(2.*BW))-1.;
kp=D;
Si=Pt*A1;
Sx=P;
# We know
# SNR=((kp**2)*Si*Sx)/(N0*BW);
SNR=((kp**2.)*Si*Sx)/(N0*BW);
SNR1=10.*math.log(SNR)/math.log(10);
print"SNR at output: ",SNR1,"dB"