import math
#Variable Declaration
m=0.5 #modulation index
#Calculation
#for AM
pt1=(1+(m**2)/2.0)
#for SSBSC
pt2=(m**2)/4.0
#% power saving
p=(pt1-pt2)*100/pt1
p=math.floor(p*10)/10
#Result
print("Percentage power saving is %.1f%%"%p)
#for case (b)
#Variable Declaration
m=1 #modulation index
#Calculation
#for AM
pt1=(1+(m**2)/2.0)
#for SSBSC
pt2=(m**2)/4.0
#% power saving
p=(pt1-pt2)*100/pt1
p=math.floor(p*10)/10
#Result
print("\n Percentage power saving is %.1f%%"%p)
#Variable Declaration
pc=500 #energy of carrier signal
m=0.6 #AM modulation index
#Calculation
#for (a)
pt=pc*(1+(m**2)/2)
#for (b)
pt2=pc*(m**2)/4
#Result
print("(a)\n A3E is the double side band AM with full carrier.\n Therefore, Pt= %.0f W\n\n (b)\n J3E is an SSBSC system.\n Therefore, Pt= %.0f W"%(pt,pt2))
import math
#Variable Declaration
m=0.6 #60% modulation
#Calculation
#for A3E
pt1=(1+(m**2)/2)
#for J3E
pt2=(m**2)/4
#% power saving
p=(pt1-pt2)*100/pt1
p=math.ceil(p*10)/10
#Result
print("Percentage power saving is %.2f%%"%p)
#Variable Declaration
bw=0.5/100 #bw is 0.5% of carrier freq.
#Calculation
wc=2/bw
#Result
print("Wc = %.0f*Wm"%wc)
import math
#Variable Declaration
m=6.0 #Modulation Index
wc=7.8*10**8 #unmodulated carrier frequency
wm=1450 #Modulating frequency
#Calculation
fc=wc/(2*math.pi)
fm=wm/(2*math.pi)
#Result
print("Unmodulated carrier frequency, fc = %.2f MHz \n The modulation index m = %d \n Modulating frequency, fm = %.2f Hz"%(fc/10**6,m,fm))
mf=150 #modulation index
fm=1 # modulating frequency in KHz
#Calculation
fd=mf*fm
bw=2*(mf+1)*fm
#Result
print("frequency deviation = %.0f kHz\n Bandwidth = %.0f kHz \n\n Expression for instantaneous frequency is given by, \n f = 10^8-150*(10^3)*sin(2*3.14*10^3*t)"%(fd,bw))
#Variable Declaration
fd=50 #frequency deviation in kHz
fm=1.0 #modulating frequency in kHz for case 1
fm2=100.0 #modulating frequency in kHz for case 2
#Calculation
#for case 1
m=fd/fm
bw=2*(m+1)*fm
#for case 2
m2=fd/fm2
bw2=2*(m2+1)*fm2
#Result
print("For first case\n Modulation index = %.0f \n Bandwidth = %.0f kHz \n\n For second case\n Modulation index = %.1f \n Bandwidth = %.0f kHz"%(m,bw,m2,bw2))
#Variable Declaration
bw=20*10**3 #bandwidth in Hz
fm=1* 10**3 #modulating frequency in Hz
#Calculation
mf=(bw/(2*fm))-1
new_mf=mf*6
new_fm=0.5 #kHz
new_bw=2*(new_mf+1)*new_fm
#Result
print("mf=%.0f\n New modulation index = %.0f\n New bandwidth = %.0f kHz"%(mf,new_mf,new_bw))
#Variable Declaration
fd=75.0 #Maximum allowed frequency deviation in kHz
fm=15.0 #Highest modulating frequency in kHz
#Calculation
D=fd/fm
bw=2*(D+1)*fm
#Result
print("Deviation Ratio, D = %.0f\n Bandwidth = %.0f kHz"%(D,bw))
import math
#Variable Declaration
fm=3200.0 #highest frequency component in message signal
k=48000.0 #channel capacity in b/s
#Calculation
fs=2*fm
n=k/fs
n=math.floor(n)
#Result
print("n = %.0f\n L = 2^7 = %.0f\n fs = %.3f kHz"%(n,2**7,(k/7)/1000))
f=2500 #Highest frequency component in the signal in Hz
#result
print("Nyquist rate = 2 x f\n\t = %.0f Hz = %.0f kHz"%(2*f,2*f/1000))
import math
#Variable Declaration
l=128 #no of Quantizing levels
fs=10000.0 #sampling frequency in Hz
#Calculation
n=7 #math.log2(l)
t=1/(n*fs)
#Result
print("Number of bits per sample (n) = %.0f\n Time duration of one bit of binary encoded signal is %.3f micro second"%(n,t*10**6))
f1=2.4 #first signal frequency
f2=3.2 #2nd signal frequency
f3=3.4 #3rd signal frequency
t
sr=3*(f3*2)
st=10**6/(sr*10**3)
print("Sampling rate of the composite signal = %.1f kHz \nSampling interval of the composite signal = %.0f micro second"%(sr,st))
import math
bw=3.2 # voice channel band limited frequency in kHz
r=1.2 # 1.2 times the Nyquist rate
n=24.0 # no of voice channel
b=8.0 # 8-bit PCM
sr=2*bw*r
p=10**6/(sr*10**3)
N=(n*b)+1
bit_d=p/N
bit_d=math.ceil(bit_d*1000)/1000
tr=1/bit_d
print("Number of bits in each frame = %.0f \nBit duration = %.3f micro second \nTransmission rate = %.3f Mbps"%(N,bit_d,math.ceil(tr*1000)/1000))