# Chapter 3 Current Voltage Sources and Differential Amplifiers¶

## Example 3.1 Pg 53¶

In :
from __future__ import division
# Determine the collector current Ic1 and collector-emitter voltage Vce1 for the difference amplifier circuit

V1 = 0 #    # volt
V2 = -5 #   #volt
Vcm =  5 #   #volt
Vcc = 10#   #volt
Vee = -10 #  #volt
Ie =  1 #  #mA
Rc =  10 #  #kilo ohm

# Transistor parameters
# base current are negligible
Vbe = 0.7 #  # volt

# The collector current of difference amplifier is
Ic1 = Ie/2 #
print 'The  collector  current  of  difference  amplifier  Ic1 = Ic2 = %0.2f'%Ic1,' mA '

# The collector voltages of transistors Q1 and Q2 are expressed as

Vc1  = Vcc-Ic1*Rc #
print 'The collector voltages of transistors Q1 and Q2 are  Vc1 = Vc2 = %0.2f'%Vc1,' volt '

# We know common mode voltage (Vcm) , from this the emitter voltage can be identified as follows
# For the common mode voltage Vcm = 0 V , the emitter voltage is Ve = -0.7 V
# For the common mode voltage Vcm = 5 V , the emitter voltage is Ve =  4.3 V
# For the common mode voltage Vcm = -5 V , the emitter voltage is Ve = -5.7 V

# For the different emitter voltages the collector-emitter voltage can be calculated as

Ve = -0.7 #  # volt
Vce1 = Vc1-Ve#
print 'For Ve = -0.7 Volt  the  collector - emitter  voltage  Vce1  = %0.2f'%Vce1,' Volt'

Ve = 4.3 #  # volt
Vce1 = Vc1-Ve#
print 'For Ve = 4.3 Volt  the  collector - emitter  voltage  Vce1  = %0.2f'%Vce1,' Volt'

Ve = -5.7 #  # volt
Vce1 = Vc1-Ve#
print 'For Ve = -5.7 Volt  the  collector - emitter  voltage  Vce1  = %0.2f'%Vce1,' Volt'

The  collector  current  of  difference  amplifier  Ic1 = Ic2 = 0.50  mA
The collector voltages of transistors Q1 and Q2 are  Vc1 = Vc2 = 5.00  volt
For Ve = -0.7 Volt  the  collector - emitter  voltage  Vce1  = 5.70  Volt
For Ve = 4.3 Volt  the  collector - emitter  voltage  Vce1  = 0.70  Volt
For Ve = -5.7 Volt  the  collector - emitter  voltage  Vce1  = 10.70  Volt


## Example 3.2 Pg 54¶

In :
# To determine the difference-mode and common-mode gain of the difference amplifier

Vcc = 10 # # volt
Vee = -10 #  #volt
Iq  =  0.8 #  #mA
Ie  =  0.8 #  #mA
Rc = 12 #  #kilo-Ohm
Vt = 0.026 #  # volt

# Transistor parameter
beta = 100 #
Rs = 0 #  #Ohm
Ro = 25 #  #kilo-Ohm
# The differential mode gain Ad
gm = (Ie/ 2*Vt) #
# Ad = (gm*r*Rc/r+Rc) #   # where r is r-pi
# For Rb=0 , the differential mode gain is

#But

#The common mode gain Acm
# Acm = - (gm*Rc/1+2*gm*Re+2*Re/r)
print ' The common mode gain Acm = %0.3f'%Acm

 The differential mode gain Ad = 184.6
The common mode gain Acm = -0.237


## Example 3.3 Pg 56¶

In :
# To find the output of a difference amplifier when only common mode signal is applied

# V1 = V2 = Vcm = 200*sin(wt) #   # micro volt (uV)
Acm  = -0.237 #

# When the common mode input signal is applied to the difference amplifier , the difference mode gain is zero
Vcm = 200 #
Vo = Acm*Vcm #
print 'The output of a difference amplifier is  Vo  = %0.2f'%Vo,'sinwt uV '  # multiply by sinwt because it is in Vcm

The output of a difference amplifier is  Vo  = -47.40 sinwt uV


## Example 3.4 Pg 56¶

In :
from math import log10
#Determine the common mode rejection ratio(CMRR) of the difference amplifier

Vcc = 10 # # volt
Vee = -10 #  #volt
Iq  =  0.8 #  #mA
Ie  =  0.8 #  #mA
Rc = 12 #  #kilo-Ohm
Vt = 0.026 #  # volt

# Transistor parameter
beta = 100 #
Rs = 0 #  #Ohm
Ro = 25 #  #kilo-Ohm

# The differential mode gain Ad
gm = (Ie/ 2*Vt) #
# Ad = (gm*r*Rc/r+Rc) #   # where r is r-pi
# For Rb=0 , the differential mode gain is

#But

#The common mode gain Acm
# Acm = - (gm*Rc/1+2*gm*Re+2*Re/r)
print 'The common mode gain Acm = %0.3f'%Acm

# The CMRR of difference amplifier is given as
print 'The CMRR of difference amplifier is = %0.f'%CMRR

# In decibel it can be expressed as
CMRRdb = 20*log10(CMRR)
print 'In decibel CMRR is = %0.2f'%CMRRdb

The differential mode gain Ad = 184.6
The common mode gain Acm = -0.237
The CMRR of difference amplifier is = 389
In decibel CMRR is = 51.80


## Example 3.5 Pg 58¶

In :
# To determine emitter resistance of the difference amplifier

Vcc = 10 # # volt
Vee = -10 #  #volt
Iq  =  0.8 #  #mA
Ie  =  0.8 #  #mA
CMRRdb = 90 #  #dB
Vt = 0.026 #

# Transistor parameter
beta = 100 #

# the CMRR of the difference amplifier is defined as
#CMRR = ((1/2)*(1+((1+beta)*Ie*Re)/beta*Vt))

# CMRRdb = 20*log10(CMRR)
CMRR = 10**(CMRRdb/20)
print ' The CMRR of difference amplifier is = %0.2e'%CMRR

# The resistance RE is calculated as

RE = (((2*CMRR)-1)/((1+beta)*Ie))*(beta*Vt)/1e3
print ' The value of resistance RE is = %0.2f'%RE,' Mohm '

 The CMRR of difference amplifier is = 3.16e+04
The value of resistance RE is = 2.04  Mohm


## Example 3.6 Pg 59¶

In :
from __future__ import division
# determine the differential mode gain when load resistance RL = 100 k ohm

RL = 100*10**3 # # k ohm  # load resistance
IE = 0.20*10**-3 # # mA  # biasing current
VA = 100 # # V # early voltage
VT = 0.026 #  # threshold volt

# the differential gain of differential amplifier with an active load circuit
#Ad = Vo/Vd  = gm(ro2 || ro4 || RL  )
ro2 = (2*VA)/IE#
ro4 = ro2 #
gm = IE/(2*VT) #


 The differential mode gain Ad is = 321