In [3]:

```
from __future__ import division
# Given data
A= 800 # unit less
Af= 50 # unit less
# Formula Af= A/(1+Bita*A)
Beta= 1/Af-1/A
print "Percentage of output which is feedback to the input = %0.3f %%" %(Beta*100)
```

In [4]:

```
# Given data
Af= 100 # unit less
Vi= 50 # in mV
Vi= Vi*10**-3 # in V
Vs= 0.5 # in V
# Formula Af= Vo/Vs
Vo= Af*Vs # in V
A= Vo/Vi
print "Value of A is %0.f "%A
# Formula Af= A/(1+B*A)
B= 1/Af-1/A
B=B*100 # in %
print "Value of B is %0.1f %%" %B
```

In [5]:

```
# Given data
Beta= 5/100
f_H= 50 # in kHz
f_H= f_H*10**3 # in Hz
f_L= 50 # in kHz
Amid= 1000
f_LF= f_L/(1+Beta*Amid) # in Hz
f_HF= f_H*(1+Beta*Amid) # in Hz
print "Value of f_LF = %0.2f Hz" %f_LF
print "Value of f_HF = %0.2f MHz" %(f_HF*10**-6)
```

In [6]:

```
# Given data
dAf_by_Af= 0.2/100
dA_by_A= 150/2000
A=2000
# Formula dAf_by_Af = 1/(1+Bita*A) * dA_by_A
Beta= dA_by_A/(A*dAf_by_Af )-1/A
Af= A/(1+Beta*A)
print "Value of Beta = %0.3f %%" %(Beta*100)
print "Value of Af is %0.2f " %Af
```

In [7]:

```
# Given data
Av= 140
Avf= 17.5
# Formula Avf= Av/(1+Av*Beta)
Beta= 1/Avf-1/Av
print "Fraction of the output is %0.2f "%Beta
```

In [8]:

```
# Given data
Av= 100
Avf= 50
# Formula Avf= Av/(1+Av*Beta)
Beta= 1/Avf-1/Av
print "The vlaue of beta is %0.2f" %Beta
# Part(ii)
Avf= 75
# Formula Avf= Av/(1+Av*Beta)
Av= Avf/(1-Beta*Avf)
print "Value of amplifier gain is %0.f "%Av
```

In [9]:

```
# Given data
Av= 50
Avf= 25
# Formula Avf= Av/(1+Av*Beta)
Beta= 1/Avf-1/Av
# Part(i)
Av=50
Avf= 40
Perc_reduction= (Av-Avf)/Av*100 # Percentage of reduction in stage gain in %
print "Without feedback, percentage of reduction in stage gain = %0.f %%" %(Perc_reduction)
# Part(ii)
Av= 40
Avf= 25
gain_with_neg_feed= Av/(1+Beta*Av)
Perc_reduction= (Avf-gain_with_neg_feed)/Avf*100 # in %
print "With feedback, percentage reduction in stage gain = %0.1f %%" %Perc_reduction
```

In [10]:

```
from numpy import pi
# Given data
Ao= 10**4
Afo= 50
omega_H= 2*pi*100 # in rad/s
# Formula Afo= Ao/(1+Ao*Beta)
Beta= 1/Afo-1/Ao
omega_f_H= omega_H*(1+Ao*Beta)
print "Closed loop bandwidth in rad/s is",omega_f_H,"or 2*pi*20*10**3"
```

In [11]:

```
from numpy import inf
# Given data
gm=50
R_E= 100 # in ohm
R_S= 1 # in kohm
R_S=R_S*10**3 # in ohm
r_pi= 1100 # in ohm
h_ie= r_pi
# Formula Av= Vo/Vs, But Vo= gm*vpi*R_E and Vs= Ib*(Ri+rpi), so
Av= gm*R_E/(R_S+h_ie)
# As Vo=Vf, so
Beta=1
D= 1+Beta*Av
Avf= Av/D
Ri= R_S+r_pi # in ohm
Ri= Ri*10**-3 # in kohm
R_if= Ri*D # in kohm
Ro= inf # ohm
Rof= Ro*D # ohm
print "Value of Av = %0.2f " %Av
print "Value of Beta = %0.f" %Beta
print "Value of Avf = %0.2f" %Avf
print "Value of Ri = %0.2f kohm" %Ri
print "Value of R_if = %0.2f kohm" % R_if
print "Value of R_of = %0.2f " % Rof
# Answer slightly mismatch because of calculation accuracy in the textbook.
```

In [12]:

```
# Given data
gm=2 # in mA/V
gm=gm*10**-3 # in A/V
r_d= 40 # in kohm
r_d= r_d*10**3 # in ohm
Rs= 3 # in kohm
Rs= Rs*10**3 # in ohm
miu= gm*r_d
Bita=1
Av= miu*Rs/(r_d+Rs)
D= 1+Bita*Av
Avf= Av/D
Ri=inf # ohm
R_if = Ri*D # ohm
Rof= r_d/D # in ohm
print "Value of Av = %0.2f " %Av
print "Value of D = %0.2f " %D
print "Value of Avf = %0.3f " %Avf
print "Value of R_if = %0.2f " % R_if
print "Value of R_of = %0.2e " % Rof
```

In [13]:

```
# Given data
gm=75 # in A/V
Rs= 1 # in kohm
Rs= Rs*10**3 # in ohm
R_E= 1 # in kohm
R_E= R_E*10**3 # in ohm
rpi= 1 # in kohm
rpi= rpi*10**3 # in ohm
hie=rpi
Io= -gm
Vi= Rs+R_E+rpi
Gm= Io/Vi
print "Value of Gm = %0.3f " %Gm
Beta=-R_E
print "Value of Beta = %0.f " %Beta
D= 1+Beta*Gm
print "Value of D = %0.f " %D
Gmf= -Gm/D
print "Value of Gmf = %0.1e" %Gmf
Ri= Rs+R_E+hie # in ohm
Rif= Ri*D # in ohm
Rif=Rif*10**-3 # in kohm
print "Value of Rif = %0.f kohm" %Rif
Ro=inf
R_of = Ro*D # ohm
print "Value of R_of = %0.2f " %R_of
```

In [14]:

```
# Given data
A= 10**5
Af= 100
# Formula Af= A/(1+A*Bita)
Bita= 1/Af-1/A
#when A= 10**3
A=10**3
Af_desh= A/(1+A*Bita)
delta_Af= Af_desh-Af
Perc_Change_inAf= delta_Af/Af*100 # in %
print "Percentage change in Af = %0.f %% " %Perc_Change_inAf
```

In [15]:

```
from numpy import log10
# Given data
A= 100
Vs=1 # in volt
Beta=1 # as in the voltage follower, the output voltage is same as input
Af= A/(1+Beta*A)
CLG= 1+A*Beta # closed loop gain
print "Closed loop gain = %0.f" %CLG
CLG_dB= 20*log10(CLG)
print "Closed loop gain = %0.1f dB" %CLG_dB
Vo= Af*Vs # in V
print "Value of Vo = %0.2f Volt" %Vo
Vi= Vs-Vo # in V
print "Value of Vi = %0.2f mV" %round(Vi*10**3)
# If A decrease 10%,i.e.
A=90
Af_desh= A/(1+Beta*A)
Per_gain_reduction= (Af_desh-Af)/Af*100 # in %
print "Percentage of gain reduction = %0.1f %%" %Per_gain_reduction
```

In [16]:

```
# Given data
# Part (a)
PerError= 1 # in %
A= 10**5 # (Assumed value)
ABita= 1/PerError*100
Bita= 1/(PerError*A)
print "% error A Aß 1+Aß"
print PerError," %.e"%A," ",ABita," ",1+ABita
# Part (b)
PerError= 5 # in %
ABita= 1/PerError*100
Bita= 1/(PerError*A)
print PerError," %.e"%A," ",ABita," ",1+ABita
# Part (c)
PerError= 50 # in %
ABita= 1/PerError*100
Bita= 1/(PerError*A)
print PerError," %.e"%A," ",ABita," ",1+ABita
```

In [17]:

```
# Given data
S= -20 # sensitivity of closed to open loop gain in dB
# sensitivity of closed to open loop gain = 1/(1+AB) = S
# or (1+AB) = -S
AB= 10**(-S/20) - 1
print "The loop gain AB = %0.2f, \nfor which the sensitivity of closed loop gain to open loop gain is -20 dB" %AB
# Part (b) when
S= 1/2 # sensitivity of closed to open loop gain in dB
#S= 1/(1+AB)
AB= 1/S-1
print "The loop gain AB = %0.2f, \nfor which the sensitivity of closed loop gain to open loop gain is 1/2 " %AB
```

In [18]:

```
from __future__ import division
#Given Data
A = 1e5
Af = 1e3
Beta = 0.99*1e-3
GDF = 1+A*Beta
print "Gain density factor %0.2f" %GDF
# part (a)
A_dash = A*90/100
Af_dash = A_dash/(1+A_dash*Beta)
cp = (Af-Af_dash)/Af*100 # Corresponding %
print "(a) Corresponding % =",round(cp,2),"%"
# part (a)
A_dash = A*70/100
Af_dash = A_dash/(1+A_dash*Beta)
cp = (Af-Af_dash)/Af*100 # Corresponding %
print "(b) Corresponding % =",round(cp,2),"%"
```

In [19]:

```
# Given data
A=100
Af= 10
f_L= 100 # in Hz
f_H= 10 # in kHz
# Af= A/(1+A*Bita)
Bita= 1/Af-1/A
f_desh_L= f_L/(1+A*Bita) # in Hz
f_desh_H= f_H/(1+A*Bita) # in kHz
print "Low frequency = %0.2f Hz" %f_desh_L
print "High frequency = %0.2f kHz" %f_desh_H
# Note: In the book Calculation to find the value of high frequency i.e. f_desh_H is wrong so the answer in the book is wrong
```

In [20]:

```
# Given data
Vs= 100 # in mV
Vf= 95 # in mV
Vs= Vs*10**-3 # in V
Vf= Vf*10**-3 # in V
Vo=10 # in V
Vi= Vs-Vf # in V
Av= Vo/Vi # in V/V
print "Value of Av = %0.e V/V" %Av
Beta= Vf/Vo # in V/V
print "Value of Bita = %0.1e V/V" %Beta
# Note: In the book Calculation to find the value of Beta is wrong so the asnwer in the book is wrong
```

In [21]:

```
# Given data
Is= 100 # in µA
Is= Is*10**-6 # in A
If= 95 # in µA
Io= 10 # in mA
A= Io*1e-3/((Is-If)*1e-6) # n A/A
Beta= If/Io # A/A
print "Value of Av = %0.e V/V" %Av
print "Value of Beta = %0.1f µA/mA" %Beta
# Note: In the book , to evaluating the value of Beta, they putted wrong value of If (90 at place of 95)
```

In [22]:

```
# Given data
A=2000 #V/V
Beta= 0.1 # inV/V
Ri= 1 # in kohm
Ri= Ri*10**3 # in ohm
Ro= 1 # in kohm
Ro= Ro*10**3 # in ohm
Af= A/(1+A*Bita)
print "The gain Af = %0.2f "%Af
Rif= Ri*(1+A*Beta) # in ohm
print "The input resistance = %0.f kohm" %(Rif*10**-3)
Rof= Ro*1e3/(1+A*Beta) # in ohm
print "The output resistance = %0.3f kohm" %(Rof*10**-3)
```

In [23]:

```
from __future__ import division
# Given data
# Part (b)
Af= 10
A= 10**4
# Af= A/(1+A*Beta)
Beta= 1/Af-1/A
# Beta= R1/(R1+R2)
R2_by_R1= 1/Beta-1
print "(b) Value of R2/R1 = %0.2f" %R2_by_R1
# Part (c)
Vs= 1 # in V
Vo= (1+R2_by_R1)*Vs
print "(c) Value of Vo = %0.2f Volt" %Vo
Vf= Vo/(1+R2_by_R1)
print "Value of Vf = %0.2f Volt" %Vf
```