Chapter 6: Sampling and pulse code modulation¶

page no 271 prob no. 6.2¶

In [5]:
from math import log
fm=input("Enter the band limited freq in hertz is ")
Rn=2*fm# # Nyquist sampling rate
Ra=Rn*(4/3)## actual Nyquist sampling rate
# here the maximum quantization error(E) is 0.5% of the peak amplitide mp. Hence, E=mp/L=0.5*mp/100*L
mp=1##we assume peak amplitude is unity
L=(mp*100)/(0.5*mp)#
for i in range(0,11):
j=2**i
if(j>=L):
L1=j#
break#

n=log(L1,2)## bits per sample
c=n*Ra## total no of bits transmitted
# Beause we can transmit up to 2bits/per hertz of bandwidth,we require minimum transmission bandwidth Bt=c/2
Bt=c/2#
print "minimum transmission bandwidth = %.2f Hertz"%Bt
s=input("enter the no of signal to be multiplexed ")
Cm=s*c##total no of bits of 's' signal
c1=Cm/2## minimum transmission bandwidth
print "minimum transmission bandwidth = %.2f Hertz"%c1

Enter the band limited freq in hertz is 1100
minimum transmission bandwidth = 8800.00 Hertz
enter the no of signal to be multiplexed 25
minimum transmission bandwidth = 220000.00 Hertz


Page no 273 prob no 6.3¶

In [6]:
from math import log,log10
# from the expresion given on the page no 272# (So/No)=(a+6n) dB where a=10log[3/[ln(1+u)]**2]
#check the ollowing code for L=64 and L=256
L=input("enter the value of L = ")
B=input("enter the bandwidth of signal in hertz : ")
n=log(L,2)#
Bt=n*B#
u=100##given
a=10*log10(3/(log(1+u))**2)
SNR=(a+(6*n))#
print "SNR ratio is = %0.2f "%SNR
# Here the SNR ratio for the two cases are found out. The difference between the two SNRs is 12dB which is the ratio of 16. Thus the SNR for L=256 is 16 times the SNR for L=64. The former requires just about 33% more bandwidth compared to the later.

enter the value of L = 12
enter the bandwidth of signal in hertz350
SNR ratio is = 13.00