# Chapter 10 : Digital communication II M ary system¶

## Example 10.1 Page No : 350¶

In [4]:
import math

# Variables
B = 4;   #kHz

# Calculations and Results
C = 2*B;
print 'a) C = %ikbits/s'%(C);
C = 2*B*math.log(4,2);
print ' b) for 4-level encoding ,C = %ikbits/s'%(C);
C = 2*B*math.log(128,2);
print ' c) for 128-level encoding ,C = %ikbits/s'%(C);

a) C = 8kbits/s
b) for 4-level encoding ,C = 16kbits/s
c) for 128-level encoding ,C = 56kbits/s


## Example 10.2 Page No : 351¶

In [8]:
import math
from numpy import array,log10,log2

# Variables
B = 4;   #kHz
SNdb = array([20, 30, 40]);   #S/N in db
SN = 10**(SNdb/10);  #absolute S/N

# Calculations and Results
C = B*log2(1+SN);
print ' S/Ndb  Ckbits/s';
out = [SNdb, C];
print (out);

 S/Ndb  Ckbits/s
[array([20, 30, 40]), array([ 26.63284593,  39.86890504,  53.15142657])]


## Example 10.5 Page No : 352¶

In [10]:
import math

# Variables
B = 20.;   #kHz
C = 160.;  #kb/s

# Calculations and Results
M = 2**(C/B/2);
print 'a) Number of encoding levels ,M =  %i'%(M);
SN = 2**(C/B)-1;
SNdb = 10*math.log10(SN)   #S/N in db

print ' b) S/N =  %i  S/Ndb) = %.2f dB'%(SN,SNdb);

a) Number of encoding levels ,M =  16
b) S/N =  255  S/Ndb) = 24.07 dB


## Example 10.6 Page No : 356¶

In [11]:
# Variables
R = 1.;  #Mb/s

# Calculations
Bt = R/2;   #MHz

# Results
print 'Bt =  %i kHz'%(Bt*10**3);

Bt =  500 kHz