# Page Number: 5.26
# Example 5.9
# Given,
# m(t)=10cos(2000*pi*t)cos(8000*pi*t)
# or 5 cos (6000*pi*t) +5*cos(10000*pi*t)
# (a) Minimum sampling rate
# we have
fM=5000.; # Hz
fs=2.*fM;
print'Minimum sampling rate',fs,'Hz'
# (b)bandpass sampling theoram
fu=fM;
fb=fM-3000.; # Hz
# As fu/fb is 2.5
# We have
k=2.;
fs2=(2.*fu)/k;
print'Minimum sampling rate by sampling theoram',fs2,'Hz'
# Page Number: 5.31
# Example 5.14
# Given,
Rb=36000.; # (b/s)
fM=3200.; # Hz
fs=2.*fM;
n=Rb/fs;
# As n should be less than Rs/fs
nn=round(n,2)-1;
print'Binary digits',nn
L=2**nn;
print'Quantizing level',L
fs=Rb/nn;
print'Sampling Rate',fs,'Hz'
# Page Number: 5.31
# Example 5.15
mp=1.; # Assume peak amplitude is unity
# Given
dela=0.02*mp;
L=(mp*2)/dela;
#for i in range(0,10):
# j=2**i;
# if(j>=L)
# L1=j;
# break;
import math
#n=math.log(L1,2);# bits per sample
n=7.;
print'Number of bits',n
# Page Number: 5.31
# Example 5.18
# Given,
import math
SbyN=40.; # db
SbyN0=10.**(SbyN/10);
# As sbyn=3L**2/2
L=math.sqrt((2.*(SbyN0))/3.);
LL=round(L);
n=(math.log(LL))/math.log(2);
nn=(round(n))+1; # Upper limit
print'Binary digits',nn
LL=2.**nn;
print'Number of levels',LL
# As SQN= 1.76+6.02(n)
SQN= 1.76+6.02*(nn);
print'Signal to quantizin ratio',SQN,'db'
# Page Number: 5.33
# Example 5.19
# Given,
n=16.;
Rb=44100.; # b/s
# (a) Output signal to quantizing ratio
SNQ=1.76+(6.02*n);
print'Output signal to quantizing ratio: ',SNQ,'db'
# (b)Input Bit Rate
IBR=2.*Rb*n;
print'Input bit rate: ',IBR,'B/s'
OBR=2.*IBR;
print'Output bit rate: ',OBR,'B/s'
# (c)Number of bits recorded
# Given, an hours time
# Therefore, time
t=60.*60.;
NBR=OBR*t;
print'Number of bits recorded: ',NBR,'Bytes'
# (d) Dictionary
# Given
p=1500.;
c=2.;
l=100.;
w=8.;
let=6.;
b=7.;
d=p*c*l*w*let*b;
print'Number of bits required',d,'Bytes'
x=NBR/(2.*d);
y=round(x);
print'Number of comparable books',y
# Page Number: 5.35
# Example 5.22
# Given,
f1=200.; # Hz
f2=3300.; # Hz
fs=8000.; # Samples/s
SQN=30.; # dB
import math
# (a)Minimum number of quantizin levels and bits per sample
# From SQN=1.76+20log L
La=10.**((SQN-1.76)/20.);
L=round(La);
print'Minimum number of quantizing levels',L
n=math.log(L)/math.log(2);
nn=round(n);
print'Minimum number of bits per sample',nn
# (b)Minimum system bandwidth
Fpcm=(nn*fs)/2.;
print'Minimum system Bandwidth',Fpcm,'Hz'
# (c)For u=255
# SQN=20logL-10.1
La1=10.**((SQN+10.1)/20.);
L1=(round(La1))+1.; # Upper Limit
print'Minimum number of quantizing levels for u=255',L1
n1=math.log(L1)/math.log(2);
nn1=(round(n1));
print'Minimum number of bits per sample',nn1
# Minimum system bandwidth
Fpcm1=(nn1*fs)/2.;
print'Minimum system Bandwidth',Fpcm1,'Hz'
# Page Number: 5.37
# Example 5.25
# Given,
import math
fs=32.*10.**+3.; # Hz
fm=1000.; # Hz
fM=4.*10.**3.; # Hz
# As SNR=(3*(fs**3))/(8*pi*pi*(fm**2)*fM)
SNR=(3.*(fs**3.))/(8.*math.pi*math.pi*(fm**2.)*fM);
SNRdb=(math.log(SNR))/math.log(10);
print'Output SNR',SNRdb,'dB'
# Page Number: 5.38
# Example 5.26
# Given,
n=4.;
SNQ=1.76+(6.02*n);
print'Output SNR',SNQ,'dB'
# Page Number: 5.38
# Example 5.27
import math
# Given,
bw=3.*10.**3.; # Hz
n=3.;
fs=(n*2.*bw);
dela=250.*10.**3; # mV
fm=1000.; # Hz
# (a) Maximum amplitude
Amax=(dela*fs)/(2.*math.pi*fm);
print'Maximum Amplitude',Amax,'V'
# (b) Output signal to quantizing ratio
SNRO=(3.*(fs**3.))/(8.*math.pi*math.pi*(fm**3.));
SNRdb=10.*(math.log(SNRO))/math.log(10);
print'Output SNR',SNRdb,'dB'
# Page Number: 5.40
# Example 5.32
# Given,
m1=3.*10.**3.; # Hz
m2=3.5*10.**3.; # Hz
# Since highest frequency is of m2
Sr=2.*m2;
print'Sampling Rate',Sr,'Samples/s'
# Page Number: 5.40
# Example 5.33
# Given,
import math
m1=3.6*10.**3.; # Hz
m2=1.2*10.**3.; # Hz
m3=m2;
m4=m2;
# (a)Nyquist rate
nr1=2.*m1;
print'Nyquist Rate of m1(t)',nr1
nr2=2.*m2;
print'Nyquist Rate of m2(t)',nr2
nr3=2.*m3;
print'Nyquist Rate of m3(t)',nr3
nr4=2.*m4;
print'Nyquist Rate of m4(t)',nr4
# (b) Speed of commutator
c=nr1+nr2+nr3+nr4;
print'Speed of commutator',c,'samples/s'
# (c)Output bit rate
# Given,
L=1024.;
n=math.log(L)/math.log(2);
OBR=n*c;
print'Output bit rate',OBR,'b/s'
# (d)Minimum channel bandwidth
fB=c/2.;
print'Minimum Channel Bandwidth',fB,'Hz'
# Page Number: 5.41
# Example 5.34
# Given,
fs=8000.; # Hz
m=24.;
n=8.;
# (a) Duration of each bit
t1=1./fs;
t2=(m*n)+1.; # Extra bit for synchronization
Tb=t1/t2;
print'Duration of each bit',Tb,'seconds'
# (b) Transmission Rate
Rb=1./Tb;
print'Transmission Rate',Rb,'b/s'
# (c)Minimum transmission bandwidth
fT1=1./(2.*Tb);
print'Minimum transmission bandwidth',fT1,'Hz'
# Page Number: 5.42
# Example 5.35
# Given,
n=24.;
f=3.4*10.**3; # Hz
ts=1.*10**6.; # Second
# (a) Spacing between succesive multiplexed pulses
fs=8000.; # Samples per second
t1=1./fs;
t2=n+1.; # One synchronizing bit
Tb=t1/t2;
# Actual Tb, as actual duration of each pulse is 1us
ATb=Tb-ts;
print'Spacing between succesive multiplexed pulses',ATb,'Seconds'
# (b) Nyquist Rate of Sampling
f1=2.*f;
T=1./f1; # Seconds
Tb1=T/t2;
ATb1=Tb1-ts;
print'Spacing between succesive multiplexed pulses using Nyquist rate of sampling',ATb1,'Seconds'
# Page Number: 5.43
# Example 5.37
# Given,
bw=3.5*10.**3.; # Hz
# Roll off factor
a=0.25;
Rb=(2.*bw)/(1.+a);
print'Data Rate',Rb,'b/s'
# Page Number: 5.43
# Example 5.38
# Given,
fB=75.*10.**3.; # Hz
Rb=0.1*10.**6.; # B/s
Tb=1./Rb;
a=(2.*fB*Tb)-1.;
print'Roll off factor',a
# Page Number: 5.43
# Example 5.39
# Given,
import math
m=8.;
fM=2.*10.**3.; # Hz
a=0.2;
# Here we choose L=128;
L=128.;
n=math.log(L)/math.log(2);
Sr=2.*fM;
fs=1.25*Sr;
# For n tdm signals
x=m*fs;
# Resultant bit rate
br=7.*x;
# Minimum Transmission bandwidth
fB=((1.+a)*br)/2.;
print'Minimum Transmission bandwidth',fB,'Hz'
# Page Number: 5.44
# Example 5.40
# Given,
import math
M=16.;
sr=40000.;
a=0.3;
# (a) Bit Rate
n=math.log(M)/math.log(2);
br=sr*n;
print'Bit Rate: ',br,'b/s'
# (b)
# As 2*fB=(1+a)*R/log2M
# Given
bw=110.*10.**3.; # Hz # =2*fB
M=2.**(((1.+a)*br)/bw);
MM=round(M);
print'Value of M',MM
# (c)Band Rate
band=br/(math.log(n))/math.log(2);
print'Band Rate',band,'Symbols/s'
# (d) Spectral efficiency
BT=((1.+a)*br)/2.;
Eff=br/BT;
print'Spectral efficiency',Eff,'b/s Hz'