# page no 105
# prob no 3.1
#calculate the Voltage equation
from math import pi, sqrt
# given
Erms_car=2; f_car=1.5*10**6;f_mod=500;Erms_mod=1;
# Equation requires peak voltages & radian frequencies
#calculations
Ec=sqrt(2)*Erms_car; Em=sqrt(2)*Erms_mod;
wc=2*pi*f_car;
wm=2*pi*f_mod;t=1;
#results
# Therefore the equation is
print 'V(t) = (',round(Ec,2),'+ ',round(Em,2),'*sin(',round(wm),'*t))*sin(',round(wc),'*t) V'
#print 'v(t) = (2.83+1.41*sin(3.14*10**3*t))*sin(9.42*10**6*t) V'
#page no 106
#prob no 3.2
#calculate the voltage equation
# To avoid the round-off errors we should use the original voltage values
#given
Em=1.;Ec=2.;
#Calculations
m=Em/Ec;
#results
print 'm =',m
print 'The equation can be obtained as','v(t) = 2.83(1+ ',m,'*sin(3.14*10**3*t))*sin(9.42*10**6*t) V',
#page no 109
#prob no 3.3
#calculate the modulation index
from math import sqrt
#given
E_car=10.;E_m1=1.;E_m2=2.;E_m3=3.;
#calculations
m1=E_m1/E_car;
m2=E_m2/E_car;
m3=E_m3/E_car;
mT=sqrt(m1**2+m2**2+m3**2);
#results
print 'The modulation index is',round(mT,3)
#page no 110
#prob no 3.4
#calculate the modulation index
#refer fig 3.2
#given
E_max=150.; E_min=70;# voltages are in mV
#calculations
m=(E_max-E_min)/(E_max+E_min);
#results
print 'The modulation index is',round(m,3)
#page no 114
#prob no 3.6
#calculate the max modulation frequency
#given
B=10.*10**3;
#calculations
# maximum modulation freq is given as
fm=B/2;
#results
print 'The maximum modulation freq is',fm,'Hz'
#page no 116
#prob no 3.7
# AM broadcast transmitter
#calculate the total power
#given
Pc=50.;m=0.8;#power is in kW
#calculations
Pt=Pc*(1+m**2 /2);
#results
print 'The total power is',Pt,'kW'
# page no 118
# prob no 8.6
#calculate the signal frequency
#2 kHz tone is present on channel 5 of group 3 of supergroup
#signal is lower sided so
#given
fc_channel_5=92*10**3;
#calculations
fg=fc_channel_5 - (2*10**3);# 2MHz baseband signal
# we know group 3 in the supergroup is moved to the range 408-456 kHz with a suppressed carrier frequency of 516kHz
f_s_carr=516*10**3;
fsg=f_s_carr - fg;
#results
print'The Signal Frequency in Hz =',fsg;
#page no 122
#prob no. 3.9
#calculate the total power, modulating frequency and carrier frequency
# refer fig 3.14
#given
# from spectrum we can see that each of the two sidebands is 20dB below the ref level of 10dBm.
#Therefore each sideband has a power of -10dBm i.e. 100uW.
power_of_each_sideband = 100.;
#calculations and results
Total_power = 2.* power_of_each_sideband;
print 'The total power is',Total_power,'uW'
div=4; freq_per_div=1.;
sideband_separation = div * freq_per_div;
f_mod= sideband_separation/2;
print 'The modulating freq is ',f_mod,'kHz'
# Even if this siganl has no carrier, it still has a carrier freq which is midway between the two sidebands. Therefore
carrier_freq = 10.;
print 'The carrier freq',carrier_freq,'MHz'
# page no 126
# prob no 3.10
#calculate the o/p frequency in both cases
#given
f_car=8*10**6;f_mod1=2*10**3;f_mod2=3.5*10**3;
#calculations
#Signal is LSB hence o/p freq is obtained by subtracting f_mod from f_car
f_out1=f_car-f_mod1;
f_out2=f_car-f_mod2;
#results
print 'The o/p freq f_out1 is ',f_out1/(10**6),'MHz'
print 'The o/p freq f_out2 is ',f_out2/(10**6),'MHz'
# page no 127
# prob no 3.11
#calculate the value of average power of signal
from math import sqrt
#Refering the fig. 3.17
#From fig it is clear that thee waveform is made from two sine waves
#given
Vp=12.5;#Since Vp-p is 25V from fig hence individual Vp is half of Vp-p
Rl=50.;#Load resistance is 50 ohm
#Determination of average power
#calculations
Vrms=Vp/sqrt(2);
P=((Vrms)**2)/Rl;
#results
print 'The value of average power of signal is ',P,'W'