# page no 7
#calculate the wavelength in all cases
# prob no 1.1
#part a) freq= 1MHz(AM radio broadcast band)
# We have the equation c=freq*wavelength
c=3.*10**8;
f=1.*10**6;
#calculations
wl=c/f;
print 'WAVELENGTH IN FREE SPACE IS ',wl,'m'
#part B) freq= 27MHz(CB radio band)
f=27.*10**6;
wl=c/f;
print 'WAVELENGTH IN FREE SPACE IS ',round(wl,1),'m'
#part C) freq= 4GHz(used for satellite television)
f=4*10**9;
wl=c/f;
print 'WAVELENGTH IN FREE SPACE IS ',wl*100,'cm'
# page no 18
#calculate the noise power
# prob no. 1.4
# In given problem noise power bandwidth is 10kHz; resistor temp T(0c)=27
# First we have to convert temperature to kelvins:
T0c=27.;
Tk=T0c+273.;
# noise power contributed by resistor , Pn= k*T*B
k=1.38*10**(-23);
B=10*10**3;
#calculations
Pn= k*Tk*B;
#results
print 'noise power contributed by resistor',Pn,'W'
# page no 20
#calculate the noise power and voltage
# prob no 1.5
from math import sqrt
# In the given problem B=6MHz, Tk=293, k=1.38*10**-23
B=6*10**6; Tk=293; k=1.38*10**-23;R=300;
#calculations
Pn=k*Tk*B;
# Th noise voltage is given by Vn=sqrt(4*k*Tk*B*R)
Vn=sqrt(4*k*Tk*B*R);
#results
print 'The noise power is',round(Pn*10**15,1),'pW'
print 'The noise voltage is',round(Vn*10**6,1),'muvolts'
# only one-half of this voltage is appears across the antenna terminals, the other appears across the source resistance. Therefore the actual noise voltag at the input is 2.7 uV
# page no 21
#calculate the current
# prob no 1.6
# given: FM broadcast receiver :- Vn=10uV, R=75V, B=200 kHz
Vn=10.;#in uV
R=75.; B=200.*10**3;
#calculations
#By Ohm's law
In=Vn/R;
print 'Noise current is',round(In,3),'muA'
# Noise votlage is also given as In=sqrt(2*q*Io*B)
q=1.6*10**-19;
# solving this for Io=In**2/2*q*B;
Io=(In*10**-6)**2/(2*q*B);
print 'current through the diode is',round(Io*1000.,0),'mA'
#page no 23
#calculate the load power and open-ckt noise voltage
#pro no 1.7
from math import sqrt
#Given:refer fig.1.12 of page no.23;R1=100ohm,300K;R2=200ohm,400k;B=100kHz;Rl=300ohm
R1=100.;T1=300.;R2=200.;T2=400.;B=100.*10**3;Rl=300.;k=1.38*10**-23;
#calculations
#open-ckt noise voltage is given by
#Vn1 =sqrt(Vr1**2 + Vr2**2)
# =sqrt[sqrt(4kTBR1)**2 + sqrt(4kTBR2)**2]
#by solving this we get Vn1=sqrt[4kB(T1R1 + T2R2)]
Vn1=sqrt(4*k*B*(T1*R1 + T2*R2));
# since in this case the load is equal in value to the sum of the resistors,
# one-half of this voltage is appear across the load.
# Now the load power is P= Vn1**2/Rl
P= (Vn1/2)**2/Rl;
#results
print 'Open-ckt noise voltage is ',round(Vn1*1e9),'nanovolts'
print 'The load power is',P,'W'
# page no 24
#Calculate the power ratio
# prob no 1.8
import math
# Given: N=0.2W; S+N=5W; :. S=4.8W
N=0.2; S=4.8;
#calculations
p=(S+N)/N;
pdB=10*math.log10(p);
#results
print 'The power ratio in dB',round(pdB)
#page no 25
#calculate the noise figure
#prob no 1.9
#Given: Si=100uW; Ni=1uW; So=1uW; No=0.03W
Si=100.; Ni=1.; So=1; No= 0.03# all powers are in uW
#calculations
r1=Si/Ni;# input SNR
r2=So/No;# output SNR
NF=r1/r2;# Amplifier noise figure
#results
print 'The noise figure is',NF
#page no 25
#calculate the SNR at output
#prob no 1.10
#giiven: SNRin=42 dB, NF=6dB
# NF in dB is given as SNRin(dB)-SNRop(dB)
SNRin=42 ; NF=6;
#calculations
SNRop=SNRin-NF;
#results
print 'SNR at the output is ',SNRop,'dB'
#page no 27
#calculate the noise temperature
# prob no 1.11
#Given NFdB=2dB,:.NF=antilog(NFdB)/10=1.585
NF=1.585;
#calculations
Teq=290*(NF-1);
#results
print 'The noise temperature is ',Teq,'K'
#page no 29
#calculate the power gain, noise figure, temperature
#prob no 1.12
#Given:
A1=10.;A2=25.;A3=30.;NF1=2.;NF2=4.;NF3=5.;
#calculations
At=A1*A2*A3;
print 'The power gain is',At
# The noise figure is given as
NFt=NF1+((NF2-1)/A1) + ((NF3-1)/(A1*A2));
print 'The noise figure is',NFt
# Noise temp can be found as
Teq=290*(NFt-1);
print 'The noise temperature is',round(Teq),'K'
# page no 34
#calculate the power and voltage in all cases
# prob no1.13 refer fig 1.20 of page no 34
# part A) The signal frequency is f1=110MHz.
from math import log10,sqrt
f=110.;# in MHz
#calculations and results
print 'A)The freq is',f,'MHz'
#The signal peak is two divisions below the reference level of -10dBm, with 10dB/division ,so its -30dBm.
PdBm=-30;
print 'The power in dBm',PdBm,'dBm'
# The equivalent power can be found from P(dBm)=10logP/1 mW
#P(mW)=antilog dBm/10= antilog -30/10=1*10**-3mW=1uW
#the voltage can be found from the graph but it is more accurately from P=V**2/R
P=10**-6; R=50;
print 'The power is',P,'W'
V=sqrt(P*R);
print 'The voltage is',round(V*10e3,2),'mvolts'
# part B)The signal is 1 division to theleft of center, with 100kHz/div. The freq is 100kHz less than the ref freq of 7.5MHz
f=7.5-0.1;# in MHz
print 'B)The freq is',f,'MHz'
# With regards to the amplitude, the scale is 1dB/div & the signal is 1 div below the reference level. Therefore the signal has a power level given as
PdBm=10-1;# in dBm
# This can be converted to watts & volts as same in part A
#P(mW)=antilog dBm/10= antilog 9/10=7.94mW
P=7.94*10**-3; R=50;
print 'The power is',round(P*10e3,2),'mW'
print 'The power in dBm',PdBm,'dBm'
V=sqrt(P*R);
print 'The voltage is',round(V*1000.),'mvolts'
#part C) The signal is 3 divisions to the right of the center ref freq of 543MHz, with 1MHz/div. Therefore the freq is
f=543+3*1;# in MHz
print 'C)The freq is',f,'MHz'
# from the spectrum, signal level is
V=22.4*6/8;
print 'The voltage is',V,'mvolts'
# power is given as
P=V**2/R;
print 'The power is',round(P,2),'uW'
PdBm=10*log10(P*10**-6/10**-3);
print 'The power in dBm',round(PdBm,1),'dBm'