#calculate the minimum value of permissible sampling rate
#given
X_1 = 4.*10**3#first analog signal in Hz
X_2 = 4.5*10**3#second analog signal in Hz
#calculation
#the highest frequency cmponent of the composite signal consisting among two signal is X_2
f_sMIN = 2*X_2;
print "The minimum value of permissible sampling rate (kHz) = ",f_sMIN/1000.
#calculate the signalling rate and minimum channel bandwidth
#given
X_1 = 6.*10**3#Nyquist rate in Hz obtained the table
X_2 = 2.*10**3#Nyquist rate in Hz obtained the table
X_3 = 2.*10**3#Nyquist rate in Hz obtained the table
X_4 = 2.*10**3#Nyquist rate in Hz obtained the table
#calculations
s = 2000#speed of rotation
X1 = 3*s#number of samples produced per second for first signal
X2 = 1*s#number of samples produced per second for second signal
X3 = X2#number of samples produced per second for third signal
X3 = X2#number of samples produced per second for fourth signal
SR = X1 + 3*X2#signalling rate
BW = .5*SR#minimum channel bandwidth
#results
print "If the sampling commutator rotates at the rate of 2000 rotations per second the the signals X_1,X_2,X_3,X_4 will be sampled at their Nyquist rate"
print "Signalling rate (samples per second) = ",SR
print "Minimum channel bandwidth (Hz) = ",BW
#calculate the sampling rate and Nyquist rate
#given
SR = 8000.#sampling rate in samples per second
T = 1.*10**-6#pulse duration
f = 3.4*10**3#highest frequency component
#calculations
#second case
NR = 2.*f#Nyquist rate of sampling
T2 = 1./NR#time taken for one rotation of commutator
#results
print "sampling rate for first condition = ",SR
print "There are 24 voice signals + 1 synchronizing pulse"
print "Pulse width of each voice channel and synchronizing pulseis 1 microseconds "
print "Now, time taken by the commutator for 1 rotation =1/8000 = 125*10**-6 seconds"
print "Number of pulses produced in one rotation = 24 + 1 = 25"
print "Therefore, the leading edges of the pulses are at 125/25 = 5*10^-6 seconds distance"
print "Nyquist rate for second condition (kHz) = ",NR/1000.
print "Time taken for one rotation of commutator (museconds) = ",round(T2*10**6,2)
print "Therefore, 147*10**-6 seconds corresponds to 25 pulses"
print "therefore, 1 pulse corresponds to 5.88*10^-6 seconds"
print "As the pulse width of each pulse is 1*10^-6 seconds, the spacing between adjacent pulses will be 4.88*10**-6 seconds\n and if we assume tou = 0 then the spacing between the adjacent pulses will be 5.88*10**-6 seconds "
#calculate the Signaling rate and minimum channel bandwidth
#given
N = 6.#number of channels
f_m = 5.*10**3#bandwidth of each channel
#calculations
SR1= 2*f_m#minimum sampling rate
SR = N*SR1#sampling rate
BW =N*f_m#minimum channel bandwidth
#results
print "Signaling rate (Kbits per second) = ",SR/1000.
print "Minimum channel bandwidth (kHz) = ",BW/1000.
#calculate the number of framing plus signaling bits per frame
#given
channel=64*10**3 #kb/s
bitrate=2.048*10**6 #bits/sec
#calculations
fs_min=channel*2
x=bitrate/fs_min
#results
print 'No. of bits per frame = ',x