#Caption: Sampling Rate
#initialisation of variables
f1=4.0*10**3
f2=4.5*10**3
#CALCULATIONS
fsmin=(2*f2)/1000
#RESULTS
print(" Sampling rate =%.2f kHz" %fsmin)
#Caption: Nyquest rate,Signaling rate,bandwidth
#initialisation of variables
f1=3000.0
f4=1000.0
f2=1000.0
f3=1000.0
#CALCULATIONS
#Nyquest rate
nq1=2*f1
nq2=2*f2
nq3=2*f3
nq4=2*f4
#RESULTS
print('i. Nyquest rate of x1 =%.2fkHz' %nq1)
print('ii. Nyquest rate of x2 =%.2fkHz' %nq2)
print('iii. Nyquest rate of x3 =%.2fkHz' %nq3)
print('iv. Nyquest rate of x4 =%.2fkHz' %nq4)
#Find The spacing between two successive pules
#initialisation of variables
samplingrate=8000.0
totalsignals=24+1
#CALCULATIONS
t=1/samplingrate
T=t/totalsignals
T=T*10**6 #time is now u sec
space=T-1
#RESULTS
print('The spacing between two successive pules %.f u sec' %space)
#Find signaling rate ,bandwidth
#initialisation of variables
N=6.0
fm=5000.0
#CALCULATIONS
r=2*fm #sampling rate
sr=N*r #signalingrate
BW=N*fm #Bandwith
sr=sr/1000
BW=BW/1000
#RESULTS
print('Signaling rate %.f K bits/sec' %sr)
print('Bandwith to avoid the cross talk in TDM is %.f kHz' %BW)
#Find signaling rate ,bandwidth
#initialisation of variables
N=4.0
x=24 #bits/frame
D=1152
s=1.0/3
r=1.544*10**6
#CALCULATIONS
r0=N*r*((D+x)/(D-s*N))
#RESULTS
print('Output bit rate %.2f MB/sec' %(r0/(10**6)))
#Find signaling rate ,bandwidth
#initialisation of variables
N=24.0
x=72.0 #bits
D=192 #message and stuff bits
s=1.0/3
r=64 #kb/sec
#CALCULATIONS
r0=N*r*((D+x)/(D-s*N))
r1=((N*r)/r0)*100
#RESULTS
print('i) Output bit rate %.2f MB/sec' %(r0/(10**3)))
print('iI) Throughput efficiency is = %.2f percent' %r1)