import math
fc = 100.; #kHz
fm = 5.; #kHz
# Calculations and Results
LSB = [fc-fm ,fc]; #kHz
USB = [fc, fc+fm]; #kHz
print ("Part (a)");
print ("Lower sideband is from "+str(LSB[0])+" kHz to "+str(LSB[1])+" kHz");
print ("Upper sideband is from "+str(USB[0])+" kHz to "+str(USB[1])+" kHz");
B = 2*fm; #kHz
print "(b) Bandwidth(kHz)",B
print ("part (c)");
fm = 3; #kHz
f_usf = fc+fm; #kHz
print "Upper side frequency(kHz)",f_usf
f_lsf = fc-fm; #kHz
print "Lower side frequency(kHz)",f_lsf
import math
# Variables
fc = 500.; #kHz
fm = 10.; #kHz
#Am = 7.5*Vp & Ac = 20*Vc
Em = 7.5; #times of Vp
Ec = 20.; #times of Vp(unmodulated carrier)
# Calculations and Results
print ("Part (a)");
f_usf = fc+fm; #kHz
print "Upper side frequency(kHz)",f_usf
f_lsf = fc-fm; #kHz
print "Lower side frequency(kHz)",f_lsf
print ("Part (b)");
m = Em/Ec; #modulation coefficient
print "Modulation coefficient",m
M = 100*m; #% modulation
print "% Modulation",M
print ("Part (c)");
Ec1 = Ec; #times of Vp(modulated carrier)
Eusf = m*Ec/2; #times of Vp
Elsf = m*Ec/2; #times of Vp
print ("Peak amplitude of modulated carrier is "+str(Ec1)+"*Vp");
print ("Upper & lower side frequency voltages, Eusf = Elsf = "+str(Eusf)+"*Vp");
print ("Part (d)");
Vmax = Ec+Em; #times of Vp
Vmin = Ec-Em; #times of Vp
print ("Maximum amplitude of envelope is "+str(Vmax)+"*Vp");
print ("Minimum amplitude of envelope is "+str(Vmin)+"*Vp");
import math
# Variables
fc = 1.; #MHz
fm = 5.; #kHz
m = 60./100; #Modulation
Pc = 6; #kW
RL = 50.; #W
# Calculations and Results
Pavg = Pc*(1+m**2/2); #kW(Average power delivered to load)
print ("Part(a)");
print "Average power of modulated signal(kW)",Pavg
PdB = 10*math.log10(Pavg*1000); #dB
print "Average power of modulated signal(dB) :%.2f"%PdB
PdBm = 10*math.log10(Pavg*10**6); #dBm
print "Average power of modulated signal(dBm) : %.2f"%PdBm
print ("Part(b)");
VS_RMS = math.sqrt(2*RL*Pavg*1000)/1000; #kV
print "RMS voltage of modulated signal(kV) : %.2f"%VS_RMS
Vp = math.sqrt(2)*VS_RMS; #V
print "Peak value of modulated signal(kV) : %.2f"%Vp
#Answer is wrong in the book.
# Variables
Vc = 10.; #times of Vp
RL = 10.; #ohm
m = 1.; #modulation coefficient
# Calculations and Results
Pc = Vc**2/2/RL; #W
Pusb = m**2*Pc/4; #W
Plsb = m**2*Pc/4; #W
print ("Part(a)");
print "Carrier power(W)",Pc
print "Upper side band power(W)",Pusb
print "Lower side band power(W)",Plsb
print ("Part(b)");
Psbt = m**2*Pc/2; #W
print "Total side band power(W)",Psbt
print ("Part(c)");
Pt = Pc*(1+m**2/2); #W
print "Total power of modulated wave(W)",Pt
print ("Part(e)");
m = 0.5; #modulation coefficient
Pusb = m**2*Pc/4; #W
Plsb = m**2*Pc/4; #W
print "Carrier power(W)",Pc
print "Upper side band power(W)",Pusb
print "Lower side band power(W)",Plsb
Psbt = m**2*Pc/2; #W
print "Total side band power(W)",Psbt
Pt = Pc*(1+m**2/2); #W
print "Total power of modulated wave(W)",Pt
import math
# Variables
RF = 200.; #kHz
IF = 10.; #kHz
# Calculations
BI = RF/IF; #unitless(Bandwidth Improvement)
NF = 10*math.log10(BI); #dB
# Results
print "Noise Figure improvement(dB) : %.f"%NF
import math
# Variables
#Part (a)
K1 = 5.; #kHz/V
#vm(t) = 2*math.cos(2*p*2000*t);
Vm = 2.; #V
fm = 2000.; #Hz
# Calculations and Results
delta_f = K1*Vm; #kHz
print "(a) Pak frequency deviation(kHz) : %.2f"%delta_f
m = delta_f*1000/fm; #modulation index
print "(a) Modulation index : %.2f"%m
#Part (b)
K = 2.5; #rad/V
#vm(t) = -math.cos(2*p*2000*t);
fm = 2000; #Hz
m = K*Vm; #rad(Peak phase shift)
print "(b) Peak phase shift(rad) : %.2f"%m
import math
# Variables
#v(t) = 20*math.sin(6.28*10**6*t+10*math.sin(6.28*10**3*t));
#Comparing with VPM(t) = A*math.sin(omega_c*t+mp*math.sin(omega_m*t))
A = 20;
omega_c = 6.28*10**6; #rad
omega_m = 6.28*10**3; #rad
# Calculations
fc = omega_c/2/math.pi/10**6; #MHz
fm = omega_m/2/math.pi/10**3; #kHz
mp = 10; #modulation index
delta_theta = mp; #radians
# Results
print "(a) Carrier freuency(MHz)",fc
print "(b) Modulating freuency(kHz)",fm
print "(c) Modulation index(mp)",mp
print "(d) Peak phase deviation(radians)",delta_theta
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,bar
# Variables
delta_f = 10.; #kHz
fm = 10.; #kHz
Vc = 10.; #V
fc = 500.; #kHz
# Calculations and Results
m = delta_f/fm; #modulation index
#For m = 1 we have 3 sidebands
B = 2*(3*fm); #kHz
print "(a) Actual minimum bandwidh(kHz)",B
B = 2*(fm+delta_f); #kHz
print "(b) Approximate minimum bandwidh(kHz)",B
A0 = 0.77*fm; #V
A1 = 0.44*fm; #V
A2 = 0.11*fm; #V
A3 = 0.02*fm; #V
#For frequency spectrum
A = [A3, A2, A1, A0, A1, A2, A3]; #V(Amplitudes)
f = [fc-3*fm ,fc-2*fm, fc-fm, fc, fc+fm, fc+2*fm, fc+3*fm]; #kHz
bar(f,A);
title('Output frequency spectrum');
xlabel('Frequency(kHz)');
ylabel('Amplitudes(V)');
# Variables
#Part (a)
delta_f = 75.; #kHz
fm = 15.; #kHz
# Calculations and Results
DR = delta_f/fm; #Deviation ratio
print "(a) Deviation ratio",DR
#For m or DR = 5 we have 8 sidebands
B = 2*(8*fm); #kHz
print "(a) Bandwidh for worst case(kHz)",B
#Part (b)
delta_f = 75./2; #kHz
fm = 15./2; #kHz
DR = delta_f/fm; #Deviation ratio
print "(b) Deviation ratio or modulation index",DR
#For m or DR = 5 we have 8 sidebands
B = 2*(8*fm); #kHz
print "(b) Bandwidh for worst case(kHz)",B
# Variables
#Part (a)
ft = 88.8; #MHz
N1N2N3 = 20; #frequency multiplication
# Calculations and Results
fc = ft/N1N2N3; #MHz
print "(a) Master oscillator center frequency(MHz)",fc
delta_ft = 75.; #kHz
delta_f = delta_ft*1000/N1N2N3; #Hz
print "(b) Frequency deviation at the output(Hz)",delta_f
fm = 15; #kHz
DR = delta_f/1000/fm; #Deviation ratio at output
print "(c) Deviation ratio at the output",DR
DR = DR*N1N2N3; #Deviation ratio at antenna
print "(d) Deviation ratio at the antenna",DR
import math
# Variables
VCO = 200.; #ppm(VCO stability)
fc = 5.1; #MHz
ft_old = 91.8; #MHz
k0 = 10.; #kHz/V
kd = 2.; #V/kHz
f2 = 30.6; #MHz
# Calculations
fc = fc*10**6+(VCO*10**-6*fc*10**6); #Hz(with feedback loop open)
N1 = 2;
N2 = 3;
f2_new = N1*N2*fc; #Hz
df2 = f2_new-f2*10**6; #Hz(Frequency drift)
ft = N2*f2_new/10**6; #MHz(Transmit frequency)
df2_reduced = df2/(1+N1*N2*kd*k0); #Hz(reduced frequency drift)
df2_reduced = round(df2_reduced); #Hz
print "Reduced frequency drift(Hz)",df2_reduced
f2dash = f2*10**6+df2_reduced; #Hz(New transmit frequency of antenna)
ftnew = f2dash*N2; #Hz
print "New transmit frequency of antenna(Hz)",ftnew
old_drift = ft*10**6-ft_old*10**6; #Hz
new_drift = ftnew-ft_old*10**6; #Hz
print ("The frequency drift at the antenna has been reduced from "+str(old_drift)+" Hz to\
"+str(new_drift)+" Hz. This fulfill the FCC requirements.")