# CHAPTER05:PULSE MODULATION¶

## Example E09 : Pg 5.26¶

In [1]:
# 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'

Minimum sampling rate 10000.0 Hz
Minimum sampling rate by sampling theoram 5000.0 Hz


## Example E14 : Pg 5.31¶

In [2]:
# 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'

Binary digits 4.63
Quantizing level 24.7610398967
Sampling Rate 7775.37796976 Hz


## Example E15 : Pg 5.31¶

In [3]:
# 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

Number of bits 7.0


## Example E18 : Pg 5.31¶

In [4]:
# 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'

Binary digits 7.0
Number of levels 128.0
Signal to quantizin ratio 43.9 db


## Example E19 : Pg 5.33¶

In [5]:
# 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

Output signal to quantizing ratio:  98.08 db
Input bit rate:  1411200.0 B/s
Output bit rate:  2822400.0 B/s
Number of bits recorded:  10160640000.0 Bytes
Number of bits required 100800000.0 Bytes
Number of comparable books 50.0


## Example E22 : Pg 5.35¶

In [6]:
# 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'

Minimum number of quantizing levels 26.0
Minimum number of bits per sample 5.0
Minimum system Bandwidth 20000.0 Hz
Minimum number of quantizing levels for u=255 102.0
Minimum number of bits per sample 7.0
Minimum system Bandwidth 28000.0 Hz


## Example E25 : Pg 5.37¶

In [7]:
# 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'

Output SNR 2.49312146597 dB


## Example E26 : Pg 5.38¶

In [8]:
# Page Number: 5.38
# Example 5.26
# Given,
n=4.;
SNQ=1.76+(6.02*n);
print'Output SNR',SNQ,'dB'

Output SNR 25.84 dB


## Example E27 : Pg 5.38¶

In [9]:
# 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'

Maximum Amplitude 716197.243914 V
Output SNR 23.4554903765 dB


## Example E32 : Pg 5.40¶

In [10]:
# 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'

Sampling Rate 7000.0 Samples/s


## Example E33 : Pg 5.40¶

In [11]:
# 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'

Nyquist Rate of m1(t) 7200.0
Nyquist Rate of m2(t) 2400.0
Nyquist Rate of m3(t) 2400.0
Nyquist Rate of m4(t) 2400.0
Speed of commutator 14400.0 samples/s
Output bit rate 144000.0 b/s
Minimum Channel Bandwidth 7200.0 Hz


## Example E34 : Pg 5.41¶

In [12]:
# 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'

Duration of each bit 6.47668393782e-07 seconds
Transmission Rate 1544000.0 b/s
Minimum transmission bandwidth 772000.0 Hz


## Example E35 : Pg 5.42¶

In [13]:
# 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'

Spacing between succesive multiplexed pulses -999999.999995 Seconds
Spacing between succesive multiplexed pulses using Nyquist rate of sampling -999999.999994 Seconds


## Example E37 : Pg 5.43¶

In [14]:
# 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'

Data Rate 5600.0 b/s


## Example E38 : Pg 5.43¶

In [15]:
# 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

Roll off factor 0.5


## Example E39 : Pg 5.43¶

In [16]:
# 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'

Minimum Transmission bandwidth 168000.0 Hz


## Example E40 : Pg 5.44¶

In [17]:
# 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'

Bit Rate:  160000.0 b/s
Value of M 4.0
Band Rate 166509.51848 Symbols/s
Spectral efficiency 1.53846153846 b/s Hz