import math
# Variables
#The capacimath.tance in pF
C1 = 200.;
C2 = 2400.;
C3 = 8.;
# Calculations and Results
t = 1/C1+1/C2+1/C3; #temperary variable
Ceq = 1/t;#pF
Ceq = Ceq*10**-12;#In Farad
L = 2*10**-6;#In H
f0 = 1./(2*math.pi*math.sqrt(L*Ceq))*10**-6; # IN MHz
print '(a) The oscillation frequency is',f0,'MHz'
f0 = 1./(2*math.pi*math.sqrt(L*C3*10**-12))*10**-6; # IN MHz
print '(b) Assuming Ceq~C3 , the oscillation frequency is',f0,'MHz'
B = -C1/C2; #based on eq 5.3
print '(c) The feedback fraction is ',B
A = 1./B;
print 'The gain is',A
def frequency(f0,k,T,T0):
return f0+k*f0*(T-T0);
# Variables
k = 40*10**-6;
f = 148;
# Calculations
fmax = frequency(f,k,32,20);
fmin = frequency(f,k,-8,20);
# Results
print 'The maximum possible frequency , fmax = ',fmax,'MHZ'
print 'The maximum possible frequency , fmin = ',fmin,'MHz'
# Variables
N = 5.;
M = 8.;
fi = 4.; # in MHz
# Calculations and Results
f0 = M/N*fi;
print '(a) The output frequency is f0 = ',f0,'MHz'
f1 = fi/N;
print '(b) The frequency f1 is',f1,'MHz'
f2 = f0/M;
print ' The frequency f2 is ',f2,'MHz'
#The two frequencies are same as required
%matplotlib inline
from numpy import zeros,concatenate,array,arange,ones
from matplotlib.pyplot import plot,suptitle,xlabel,ylabel,subplot
import math
#for input spectrum
f = arange(-20,20.001,0.001); #x axis
V = concatenate(([1], zeros(len(arange(-20+.001,20.001,.001))) ,[1])); #y axis
subplot(211);
plot(f,V)
suptitle('Input Spectrum')
xlabel('f,kHz')
#for output spectrum
f = arange(-120,120.01,.01) #x axis
V = concatenate(([1], zeros(len(arange(-120+.01,-80,.01))), [1], zeros(len(arange(-80+.01,80,0.01))) ,[1],\
zeros(len(arange(80+.01,120,.01))), [1]))
subplot(212);
plot(f,V)#,[5],rect = [-130,0,130,2])
suptitle('Output Spectrum')
xlabel('f,kHz')
%matplotlib inline
from numpy import zeros,concatenate,array,arange,ones
from matplotlib.pyplot import plot,suptitle,xlabel,ylabel,subplot
import math
fLO = 110; #MHz
#for V2(f)
f = arange(0,231+0.02,.01) #x axis
def pulse():
return arange(1,1.5+.005,0.005)
V2 = concatenate((zeros(len(arange(0,120-fLO,.01))), pulse(), zeros(len(arange(121-fLO+.01,120+fLO,.01))), pulse(), [0])); #y axis
subplot(211);
plot(f,V2)#,[5],rect = [0,0,240,2])
suptitle('Spectral diagram')
xlabel('f,MHz')
ylabel('V2(f)');
#for V3(f)
f = arange(0,11+.02,0.01); #x axis
V3 = concatenate((zeros(len(arange(0,120-fLO,.01))), pulse(), [0])); #y axis
subplot(212);
plot(f,V3)#,[5],rect = [0,0,20,2])
suptitle('Spectral Diagram')
xlabel('f,MHz')
ylabel('V3(f)');
%matplotlib inline
from numpy import zeros,concatenate,array,arange,ones
from matplotlib.pyplot import plot,suptitle,xlabel,ylabel,subplot
import math
fLO = 40; #MHz
#function for ascending pulse
def pulse_a():
return arange(1,2.005,0.005)
#function for descending pulse
def pulse_d():
return arange(2,1-.005,-0.005)
#for V2(f)
f = arange(0,48+.03,0.01); #x axis
V2 = concatenate((zeros(len(arange(0,-8+fLO,.01))), pulse_d(), zeros(len(arange(-6+fLO+.01,6+fLO,.01))), pulse_a(), [0])); #y axis
subplot(211);
plot(f,V2)#,[5],rect = [0,0,50,2])
suptitle('Spectral diagram')
xlabel('f,MHz')
ylabel('V2(f)');
#for V3(f)
f = arange(0,48+.02,0.01); #x axis
V3 = concatenate((zeros(len(arange(0,6+fLO,.01))), pulse_a() ,[0])); #y axis
subplot(212);
plot(f,V3)
suptitle('Spectral Diagram')
xlabel('f,MHz')
ylabel('V3(f)');
%matplotlib inline
from numpy import zeros,concatenate,array,arange,ones
from matplotlib.pyplot import plot,suptitle,xlabel,ylabel,subplot
import math
#page no 159
#prob no. 5.8
#function for ascending pulse
def pulse_a():
return arange(1,1.505,0.005)
#function for descending pulse
def pulse_d():
return arange(1.5,1-.005,-0.005)
fLO = 200.-10;
#for fLO = 190 MHz
f = arange(0,10.5+.02,.01) #x axis
V = concatenate((zeros(len(arange(0,199.5-fLO,.01))), pulse_a(), [0])); #y axis
subplot(211);
plot(f,V)#,[5],rect = [0,0,12,2])
suptitle('Spectral diagram:for fLO = 190')
xlabel('f,MHz')
ylabel('V(f)');
#for fLO = 210
fLO = 200.+10; #MHz
f = arange(0,10.5+.02,.01); #x axis
V = concatenate((zeros(len(arange(0,-200.5+fLO,.01))), pulse_d(), [0])); #y axis
subplot(212);
plot(f,V)#,[5],rect = [0,0,12,2])
suptitle('Spectral Diagram:for fLO = 210')
xlabel('f,MHz')
ylabel('V(f)');
%matplotlib inline
from numpy import zeros,concatenate,array,arange,ones
from matplotlib.pyplot import plot,suptitle,xlabel,ylabel,subplot
import math
#page no 160
#prob no. 5.9
#function for ascending pulse
def pulse_a():
return arange(1,1.5+.005,0.005)
#function for descending pulse
def pulse_d():
return arange(1.5,1-.005,-.005)
#plots of page 161
#spectrum at point 1
f1 = arange(17.5-.01,20.5+.01,0.01); #x axis
V1 = concatenate(([0], pulse_d(), zeros(len(arange(18.5+.01,19.5,.01))), pulse_a(), [0])); #y axis
subplot(221);
plot(f1,V1)#[5],rect = [17,0,21,2])
suptitle('Spectrum at Point 1')
xlabel('f,MHz')
#spectrum at point 2
f2 = arange(17.5-.01,20.5+.01,0.01); #x axis
V2 = concatenate(([0], zeros(len(arange(17.5,19.5,.01))), pulse_a(), [0])); #y axis
subplot(222);
plot(f2,V2)#,[5],rect = [17,0,21,2])
suptitle('Spectrum at Point 2')
xlabel('f,MHz')
#spectrum at point 3
f3 = arange(359.5-.01,400.5+.03,0.01); #x axis
V3 = concatenate(([0], pulse_d(), zeros(len(arange(360.5+.01,399.5,.01))), pulse_a(), [0])); #y axis
subplot(223);
plot(f3,V3)#,[5],rect = [359,0,401,2])
suptitle('Spectrum at Point 3')
xlabel('f,MHz')
#spectrum at point 4
f4 = arange(359.5-.01,400.5+.02,0.01); #x axis
V4 = concatenate(([0], zeros(len(arange(359.5,399.5,.01))), pulse_a(), [0])); #y axis
subplot(224);
plot(f4,V4)#,[5],rect = [359,0,401,2])
suptitle('Spectrum at Point 4')
xlabel('f,MHz')
# Variables
#All frequencies in MHz
fc = 40.;
fIF = 5.
# Calculations and Results
fLO = fc+fIF;
print '(a) The LO frequency is ',fLO
fImage = fLO+fIF;
print '(b) The image frequency is ',fImage
# Variables
#All frequencies in MHz
fc = 40;
fIF = 5
# Calculations and Results
fLO = fc-fIF;
print '(a) The LO frequency is ',fLO
fImage = fLO-fIF;
print '(b) The image frequency is ',fImage
# Variables
#All frequencies in Hz
B = 200.*10**3; #The bandwidth allocated by FCC (in Hz)
fl = 88.*10**6;
fh = 108.*10**6; #FM broadcast band low and high end freq
# Calculations and Results
Q = fl/B;
print '(a) At the low end of FM band ,Q required is',Q
Q = fh/B;
print ' At the high end of FM band ,Q required is',Q
fIF = 10.7*10**6;# IF frequwncy (in Hz)
Q = fIF/B;
print '(b) At the IF frequency ,Q required is ',Q
print ('(c) Signal freq = 88 to 108 MHz')
print (' LO freq = 98.7 to 118.7 MHz')
print (' Image freq = 109.4 to 129.4MHz')
print ('(d) Signal freq = 88 to 108 MHz')
print (' LO freq = 77.3 to 97.3 MHz')
print (' Image freq = 66.6 to 86.6MHz')