#page no 139
#prob no. 4.1
#Calculate the o/p frequency
#An FM modulator is given with kf=30kHz/V operate at carrier freq 175MHz
#given
fc=175.*10**6;kf=30.*10**3;
#a)Determination of o/p freq for modulating signal value em1=150mV
em1=150*10**-3;
#calculations and results
fsig1=fc+(kf*em1);
print 'a)The value of o/p freq is ',fsig1/(10**6),'MHz'
#b)Determination of o/p freq for modulating signal value em2=-2V
em2=-2;
fsig2=fc+(kf*em2);
print 'b)The value of o/p freq is ',fsig2/(10**6),'MHz'
#page no 140
#prob no. 4.2
#calculate the value of deviation
from math import sqrt
#An FM modulator is given which is modulated by sine wave 3V
#given
v=3.;
kf=30.*10**3;
#calculations
#Determination of peak value
Em=v*sqrt(2);
#Determination of deviation delta
delta=kf*Em;
#results
print 'The value of deviation is ',round(delta/1000.,3),'kHz'
#page no 140
#prob no. 4.3
#calculate the value of modulation index in both cases
#An FM broadcaster transmitter operate at max deviatn of 75kHz
#given
delta=75.*10**3;
#a)Determination of modulation index with modulating freq of signal =15kHz
fm1=15.*10**3;
#calculations and results
mf1=delta/fm1;
print 'a)The value of modulation index for fm=15kHz is ',mf1
#b)Determination of modulation index with modulating freq of signal =50Hz
fm2=50;
mf2=delta/fm2;
print 'b)The value of modulation index for fm=50Hz is ',mf2
#page no 141
#prob no. 4.4
from math import pi, sqrt
#calculate the rms voltage
#A phase modulator is given with kp=2rad/V
#given
kp=2;
#Peak phase deviation of 60 degree
#calculations
#Converting degree in radian
phi=(2*pi*60)/360;
#Determination of peak voltage that cause that deviation
Vp=phi/kp;
#Determination of rms voltage
Vrms=Vp/(sqrt(2));
#results
print 'The rms voltage that cause deviation is ',round(Vrms,2),'V'
#page no 145
#prob no. 4.6
#calculate the freq deviation
#given
#Phase modulator with sensitivity kp=3rad/V & sine wave i/p 2 V peak at 1kHz
kp=3.;Vp=2.;f=1*10**3;
#calculations
#As max value of sine functn is 1, hence max value of phi is kp*Vp
phi_max=kp*Vp;
#phi_max is nothing but mp
mp=phi_max;
#value of mf is same as mp if signal is considered as freq modulation
#Determination of freq deviation
dev=mp*f;
#results
print 'The freq deviation produce is',dev/1000,'kHz'
#page no 149
#prob no. 4.7
#calculate the rms voltage in all cases
%matplotlib inline
from math import sqrt, log10
import numpy
import matplotlib
from matplotlib import pyplot
#given
#An FM signal has deviation 3kHz & modulating freq 1kHz with total power Pt=5W
#developed across 50 ohm with fc=160 MHz
dev = 3. * 10 ** 3
fm = 10 ** 3
Pt = 5.
Rl = 50.
fc = 160. * 10 ** 6
#calculations and results
#a)Determination of RMS signal voltage
Vt = sqrt(Pt * Rl)
print 'a)The rms signal voltage is',Vt,'V'
######/b)Determination of rms voltage at carrier freq
#for that modulation index needs to be found out
mf = dev / fm
#From bessel function table, the coeff for the carrier first 3 side bands
J = ([0.26,0.34,0.49,0.31])
V = numpy.zeros(4)
print 'b)The rms voltage of side bands are'
for i in range(0,3):
V[i] = J[i] * Vt
print 'Vc=',round(V[0],2)
print 'V1=',round(V[1],2)
print 'V2=',round(V[2],2)
print 'V3=',round(V[3],2)
#####/c)Determination of freq of each side bands########
print 'c)The 3 side bands at different freq. are '
f_usb = numpy.zeros(3)
for j in range(0,2):
f_usb[j] = fc / 10 ** 6 + (fm * j / 10 ** 6)
print 'f_usb1=',round(f_usb[0],2)
print 'f_usb2=',round(f_usb[1],2)
print 'f_usb3=',round(f_usb[2],2)
f_lsb = numpy.zeros(3)
for j in range(0,2):
f_lsb[j] = fc / 10 ** 6 - (fm * j / 10 ** 6)
print 'f_lsb1=',round(f_lsb[0],2)
print 'f_lsb2=',round(f_lsb[1],2)
print 'f_lsb3=',round(f_lsb[2],2)
P = numpy.zeros(4)
a = numpy.zeros(4)
######d)Determination of power of each side band########/
for i in range(0,3):
P[i] = ((V[i]) ** 2) / Rl
a[i] = (P[i]) / (10 ** -3)
print 'd)The power of each side band is'
print 'Pc=',round(P[0],2)
print 'P1=',round(P[1],2)
print 'P2=',round(P[2],2)
print 'P3=',round(P[3],2)
#####e)Determination of power that is uncounted
P = P[0] + 2 * (P[2] + P[3] + P[1])
#As total power is 5 W
P_x = Pt - P
#Percentage of total power uncounted
Px = (P_x / P) * 100
print 'e)Percentage total power which is uncounted is',Px,'%',
#####f)Ploting the signal in freq domain##########/
#Converting power in dBm
P_dBm = numpy.zeros(4)
for i in range(0,3):
#a(k)=(P(k))/(10**-3);
P_dBm[i] = 10 * log10(a[i])
print 'f)Power of each side bands in dBm is'
print 'Pc(dBm)=',round(P_dBm[0],2)
print 'P1(dBm)=',round(P_dBm[1],2)
print 'P2(dBm)=',round(P_dBm[2],2)
print 'P3(dBm)=',round(P_dBm[3],2)
x = ([159.997,159.998,159.999,160.0,160.001,160.002,160.003])
y = ([26.8,30.8,27.6,25.3,27.6,30.8,26.8])
pyplot.plot(x,y);
pyplot.show();
#page no 157
#prob no. 4.9
#calculate the SNR at detector o/p
from math import log10
#given
#An FM signal has freq deviation of 5kHz modulating freq fm=1kHz with SNR at i/p is 20 dB
#Converting dB in voltage ratio
fm=1.*10**3;dev_s=5.*10**3;snr=20.;
#calculations
Es_En=10**(snr/20);
#Since Es>>En then
phi=1/(Es_En);
m_fn=phi;#modulation index equal to phi_n
dev_n=(m_fn)*fm;#Equivalent freq deviation due to noise
#SNR as a voltage ratio is given as
SNR=(dev_s)/(dev_n);
#Converting this voltage ration in dB
SNR_dB=20*(log10(SNR));
#results
print 'The SNR at detector o/p is',round(SNR_dB,3),'dB'
#page no 163
#prob no. 4.10
#calculate whether the freq is with in the acceptable range
#Refer the fig. 4.19
#given
# We know this transmitter is designed for voice frequencies,so we have to use trial
#and error method to produce a carrier null for a deviation of 5kHz
mf=2.4;# starting with the first null for mf=2.4
dev=5;#in kHz
#calculations and results
fm=dev/mf;
if (0.3 <= fm and 3>=fm):
print 'The freq is with in the acceptable range',round(fm,3),'kHz'
else:
mf=5.5;
fm=dev/mf;
print 'The freq is with in the acceptable range',round(fm,3),'kHz'
# for this calculated fm, set the function generator to the value of fm so that the deviation is 5kHz