In [2]:

```
import math
#Variable declaration
AVm=120#AVm=mid-band gain of an RC-coupled amplifier
fm=100#fm=frequency in Hz corresponding to the mid-band gain
AVl=60#AVl=reduced gain
AVh=AVl
f=100*10**3#f=frequency in Hz corresponding to the reduced gain
#Calculations&Results
#|AVl|=(|AVm|)/sqrt(1+(fl/fm)^2) where fl=lower half power frequency
fl=math.sqrt((abs(AVm)/abs(AVl))**2 -1)*fm
print "The lower half-power frequency is = %.1f Hz"%fl
#|AVh|=(|AVm|)/sqrt(1+(f/fh)^2) where fh=upper half power frequency
fh=f/math.sqrt((abs(AVm)/abs(AVh))**2 -1)
print "The upper half-power frequency is = %.1f KHz"%(fh/10**3)#fh is converted in terms of kHz
```

In [4]:

```
import math
#Variable declaration
#For two identical transistors employed by an RC-coupled amplifier
hfe=100.#hfe=current gain
hie=2*10**3#hie=input impedance in ohm
Cob=2.0*10**-12#Cob=capacitance in farad quoted by the transistor manufacturers
C=0.4*10**-6#C=coupling capacitance in farad
RL=8*10**3#RL=load resistance in ohms for each transistor
CW=10*10**-12#CW=wiring capacitance in farad
#Calculations&Results
fl=1./(2*math.pi*C*(hie+RL))#fl=lower half power frequency
print "The lower half-power frequency is = %.1f Hz"%fl
hfb=-hfe/(1+hfe)#hfb=current gain for common base transistor
Coc=Cob/(1+hfb)#Coc=transistor collector capacitance in farad
Cs=Coc+CW#Cs=shunt capacitance in farad
Ro=(hie*RL)/(hie+RL)#Ro=equivalent resistance of the parallel combination of hie and RL
fh=1/(2*math.pi*Cs*Ro)#fh=upper half power frequency
print "The upper half-power frequency is = %.f KHz"%(fh/10**3)#fh is converted in terms of kHz
```

In [10]:

```
import math
#Variable declaration
#AVm=mid-band gain of an RC-coupled amplifier
fm=60#fm=frequency in Hz corresponding to the mid-band gain
#AVl=reduced gain
#AVh=AVl
f=600*10**3#f=frequency in Hz corresponding to the reduced gain
fl=30.#fl=The lower half-power frequency in Hz
fh=300*10**3#fh=The upper half-power frequency in Hz
#Calculations&Results
#|AVl|=(|AVm|)/sqrt(1+(fl/fm)**2)
#Suppose (AVl/AVm)=a=low frequency gain with respect to the mid frequency gain
#a=1/math.sqrt(1+(fl/fm)**2)#a=magnitude of the low frequency gain
a=1./math.sqrt(1+(fl/fm)**2)
o=math.degrees(math.atan(fl/fm))#o=phase angle in degree of the low frequency gain
print "For the low frequency gain with respect to the mid frequency gain"
print "Magnitude=%.3f"%a
print "Phase angle=%.1f degree"%o
#|AVh|=(|AVm|)/sqrt(1+(f/fh)**2)
#Suppose (AVh/AVm)=b=high frequency gain with respect to the mid frequency gain
#b=1/sqrt(1+(f/fh)**2)#b=magnitude of the high frequency gain
b=1./math.sqrt(1+(f/fh)**2)
O=-math.degrees(math.atan(f/fh))#O=phase angle in degree of the high frequency gain
print "\nFor the high frequency gain with respect to the mid frequency gain "
print "Magnitude=%.3f"%b
print "Phase angle=%.1f degree"%O
```

In [12]:

```
#Variable declaration
#In a CE class A power amplifier
RL=12#RL=load resistance in ohms
n=8#n=primary-to-secondary turns ratio of a transformer
#Calculations
#Peak-to-peak swing of the signal current is 250mA
Im=(250*10**-3)/2#Im=ac collector current in Ampere
RL1=(n**2)*RL#RL1=RL'=resistance reflected to the primary for the resistance RL in presence of an ac signal
#Pac=(1./2)*Vm*Im where Pac=ac output power
#Pac=(1./2)*(Im**2)*RL1
Pac=(1./2)*(Im**2)*RL1
#Result
print "The output power is = %.f W"%Pac
```

In [14]:

```
#Variable declaration
VCQ=6#VCQ=quiescent collector voltage
ICQ=50*10**-3#ICQ=quiescent collector current
VCmin=1
VCmax=11.#VCmin,VCmax=output signal voltage variation
ICmin=10*10**-3
ICmax=90*10**-3#ICmin,ICmax=output signal current variation in Ampere
#Calculations&Results
Ps=VCQ*ICQ#Ps=dc input power to the transistor
print "The dc input power is = %.1f W"%Ps
Pac=(1./8)*(ICmax-ICmin)*(VCmax-VCmin)#Pac=ac output power delivered to the load
print "The ac output power is = %.1f W"%Pac
PT=(VCQ*ICQ)-Pac#PT=the collector dissipation
print "The collector dissipation is = %.1f W"%PT
n=(Pac/Ps)*100#n=the efficiency of the active device
print "The efficiency is = %.1f %%"%n
```

In [16]:

```
import math
#Variable declaration
#In a class B push pull circuit
#Transformer winding resistances are to be ignored
n=3.#n=primary-to-secondary turns ratio of a transformer
RL=9#RL=load resistance in ohms
VCC=15#VCC=collector supply voltage
#Calculations&Results
RL1=((n/2)**2)*RL#RL1=reflected load resistance for one transistor
Pactot=(VCC**2)/(2*RL1)#Pactot=maximum output power
print "The maximum output power is = %.2f W"%Pactot
Pstot=(2*VCC**2)/(math.pi*RL1)#Pstot=the maximum dc power supplied to the two transistors
print "The maximum dc power supplied is = %.2f W"%Pstot
n=(Pactot/Pstot)*100#n=efficiency
print "The efficiency is = %.1f %%"%n
```

In [19]:

```
import math
#Variable declaration
#In a single tuned amplifier
L=120*10**-6#L=inductance in henry
C=100*10**-12#C=capacitance in farad
R=10#R=resistance in ohms
hoe=50*10**-6#hoe=output impedance in mho(or S)
hfe=100#hfe=current gain
hie=2.5*10**3#hie=input impedance in ohm
RT=10*10**3#RT=equivalent resistance of RB and Ri in parallel
#Calculations&Results
fo=1/(2*math.pi*math.sqrt(L*C))#fo=resonant frequency
print "The resonant frequency is = %.2f MHz"%(fo/10**6)#fo is converted in terms of MHz
Qo=(1./R)*math.sqrt(L/C)#Qo=Q-factor of the resonant frequency
Ro=(Qo**2)*R#Ro=maximum impedance Zm
Rp=1/(hoe+(1./Ro)+(1./RT))#Rp=equivalent resistance of the parallel combination of Ro,ro and RT
Qe=(Qo*Rp)/Ro#Qe=effective Q-factor
B=fo/Qe#B=bandwidth
print "The bandwidth is =%.1f KHz"%(B/10**3)#B is converted in terms of kHz
AVm=-(hfe*Rp)/hie#AVm=maximum voltage gain
print "The maximum voltage gain is = %.1f"%AVm
```

In [21]:

```
import math
#Variable declaration
V=10#V=voltage at frequency 5kHz
Vr=7.07#Vr=voltage at frequency 25kHz
#Calculations
#x=10*log10(P/Pr) where x=change in decibel(dB) of power P from some standard power Pr
#P=V^2/R=I^2*R
#Also Pr=Vr^2/R=Ir^2*R
#x=10*(log10(V/Vr))^2=20*log10(V/Vr)
x=20*math.log10(V/Vr)#x=change in decibel(dB) of voltage V from some standard voltage Vr
#Result
print "The decibel change in the output power level is = %.f dB"%x
```

In [23]:

```
import math
#Variable declaration
Vorms=2#Vorms=rms output voltage in the midband region of an amplifier
Pa=42.#Pa=power gain in dB
Pol=0.4#Pol=power output in W at the lower cut-off frequency 100Hz
Ri=10**3#Ri=input resistance in ohms
#Calculations&Results
VOrms=2./math.sqrt(2)#VOrms=rms output voltage at 100Hz
print "1. The rms output voltage at 100Hz,which is the lower cutoff frequency,is = %.3f V"%VOrms
Po=2*Pol#Po=output power in the midband region
print "2. The output power in the midband region is = %.1f W"%Po
#Let Pi=input power
#10*log10(Po/Pi)=Pa
Pi=Po/(10**(Pa/10))
#Pi=(Vi**2)/Ri where Vi=rms input voltage
Vi=math.sqrt(Pi*Ri)
print "3. The rms input voltage is = %.3f V"%Vi
```