{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter - 21 : MULTISTAGE BJT AMPLIFIERS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.1 Pg 565"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Av=8000.00\n",
      "GV=78.06 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "Av1=10#\n",
    "Av2=20#\n",
    "Av3=40#\n",
    "Av=Av1*Av2*Av3#\n",
    "print \"Av=%0.2f\"%Av\n",
    "GV1=20*log10(Av1)#\n",
    "GV2=20*log10(Av2)#\n",
    "GV3=20*log10(Av3)#\n",
    "GV=GV1+GV2+GV3##CORRECTION\n",
    "print 'GV=%0.2f dB'%GV"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.2 Pg 565"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Av=3000.00\n",
      "Av3=10.00\n",
      "Av2=15.00\n",
      "vin2=1.00 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "vin1=0.05#\n",
    "vout3=150#\n",
    "Av1=20#\n",
    "vin3=15#\n",
    "Av=vout3/vin1#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Av3=vout3/vin3#\n",
    "print \"Av3=%0.2f\"%Av3\n",
    "Av2=Av/(Av3*Av1)#\n",
    "print \"Av2=%0.2f\"%Av2\n",
    "vin2=Av2/vin3#\n",
    "print 'vin2=%0.2f V'%vin2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.3 Pg 566"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ri1=2750.00 ohm\n",
      "Ri2=2750.00 ohm\n",
      "Ro1=1774.19 ohm\n",
      "Ro2=3333.33 ohm\n",
      "Av1=64.52\n",
      "Av2=121.21\n",
      "Av=7820.14\n",
      "Gv=77.86 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "VCC=10#\n",
    "Rc=5*10**3#\n",
    "RB=1*10**6#\n",
    "RE=1*10**3#\n",
    "RL=10*10**3#\n",
    "B1=100#\n",
    "B2=100#\n",
    "B=B1#\n",
    "IE=VCC/(RE+(RB/B1))#\n",
    "re=25/(IE*10**3)#\n",
    "Ri1=B*re#\n",
    "print 'Ri1=%0.2f ohm'%Ri1\n",
    "Ri2=B*re#\n",
    "print 'Ri2=%0.2f ohm'%Ri2\n",
    "Ro1=(Rc*Ri2)/(Rc+Ri2)#\n",
    "print 'Ro1=%0.2f ohm'%Ro1\n",
    "Ro2=(Rc*RL)/(Rc+RL)#\n",
    "print 'Ro2=%0.2f ohm'%Ro2\n",
    "Av1=Ro1/re#\n",
    "print \"Av1=%0.2f\"%Av1\n",
    "Av2=Ro2/re#\n",
    "print \"Av2=%0.2f\"%Av2\n",
    "Av=Av1*Av2#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Gv=20*log10(Av)#\n",
    "print 'Gv=%0.2f dB'%Gv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.4 Pg 567"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ri1=1165.73 ohm\n",
      "Ro1=861.43 ohm\n",
      "Ro2=2481.20 ohm\n",
      "Av1=73.90\n",
      "Av2=212.85\n",
      "Av=15728.47\n",
      "Gv=83.93 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "VCC=15#\n",
    "Rc=3.3*10**3#\n",
    "RE=1000#\n",
    "R1=33*10**3#\n",
    "R2=8.2*10**3#\n",
    "RL=10*10**3#\n",
    "B=100#\n",
    "VBE=0.7#\n",
    "VTH=VCC*(R2/(R1+R2))#\n",
    "RTH=(R1*R2)/(R1+R2)#\n",
    "IE=(VTH-VBE)/(RE+(RTH/B))#\n",
    "re=25/(IE*10**3)#\n",
    "Ri2=B*re#\n",
    "print 'Ri1=%0.2f ohm'%Ri2 #the answer of Ri2 varies from the answer printed in the book with slight difference(11.7 in book & 11.65 here),but this affects some answers further.\n",
    "Ro1=(Rc*Ri2)/(Rc+Ri2)#\n",
    "print 'Ro1=%0.2f ohm'%Ro1 \n",
    "Ro2=(Rc*RL)/(Rc+RL)#\n",
    "print 'Ro2=%0.2f ohm'%Ro2 \n",
    "Av1=Ro1/re#\n",
    "print \"Av1=%0.2f\"%Av1\n",
    "Av2=Ro2/re#\n",
    "print \"Av2=%0.2f\"%Av2\n",
    "Av=Av1*Av2#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Gv=20*log10(Av)#\n",
    "print 'Gv=%0.2f dB'%Gv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.5 Pg 568"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "f2=500.03 kHZ\n",
      "Av=84.85\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt\n",
    "bw=500*10**3#\n",
    "Avmax=120#\n",
    "f1=25#\n",
    "f2=bw+f1#\n",
    "print 'f2=%0.2f kHZ'%(f2*10**-3)\n",
    "Av=Avmax/(sqrt(2))\n",
    "print \"Av=%0.2f\"%Av #ans printed in the book is  wrong"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.6 Pg 569"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ri1=1296.41 ohm\n",
      "Ri2=1296.41 ohm\n",
      "Av1=797.79\n",
      "Av2=615.38\n",
      "Av=490949.75\n",
      "Gv=113.82 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "VCC=10#\n",
    "RB=470*10**3#\n",
    "RE=1*10**3#\n",
    "RL=1*10**3#\n",
    "a=4#\n",
    "B=50#\n",
    "IE=VCC/(RE+(RB/B))#\n",
    "re=25/(IE*10**3)#\n",
    "Ri1=(RB*(B*re))/(RB+(B*re))#\n",
    "print 'Ri1=%0.2f ohm'%Ri1\n",
    "Ri2=(RB*(B*re))/(RB+(B*re))#\n",
    "print 'Ri2=%0.2f ohm'%Ri2\n",
    "RI2=(a**2)*Ri2#\n",
    "RO1=RI2#\n",
    "RI2=(a**2)*RL#\n",
    "Av1=RO1/re#\n",
    "print \"Av1=%0.2f\"%Av1\n",
    "RO2=RI2#\n",
    "Av2=RO2/re#\n",
    "print \"Av2=%0.2f\"%Av2\n",
    "Av=Av1*Av2#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Gv=20*log10(Av)#\n",
    "print 'Gv=%0.2f dB'%Gv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.7 Pg 570"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Av1=4.71\n",
      "Av2=4.94\n",
      "Av=23.24\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VCC=12#\n",
    "R1=100*10**3#\n",
    "R2=20*10**3#\n",
    "R3=10*10**3#\n",
    "R4=2*10**3#\n",
    "R5=10*10**3#\n",
    "R6=2*10**3#\n",
    "B=100#\n",
    "B2=100#\n",
    "VTH=VCC*(R2/(R1+R2))#\n",
    "IE1=VTH/R4#\n",
    "re1=25/IE1*10**-3#\n",
    "VR6=VCC-IE1*R3#\n",
    "IE2=VR6/R6#\n",
    "re2=25/IE2*10**-3#\n",
    "Ri2=B2*(re2+R6)#\n",
    "R01=(R3*Ri2)/(R3+Ri2)#\n",
    "RO2=R5#\n",
    "Av1=R01/(re1+R4)#\n",
    "print \"Av1=%0.2f\"%Av1\n",
    "Av2=RO2/(re2+R6)#\n",
    "print \"Av2=%0.2f\"%Av2\n",
    "Av=Av1*Av2#\n",
    "print \"Av=%0.2f\"%Av"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.8 Pg 571"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "IC1=07 mA\n",
      "VCE1=4.80 V\n",
      "VCE2=-6.48 V\n",
      "Av1=2.93 \n",
      "Av2=1.00 \n",
      "Av=2.93 \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VCC=10#\n",
    "R1=800#\n",
    "R2=200#\n",
    "R3=600#\n",
    "R4=200#\n",
    "R5=100#\n",
    "R6=1*10**3#\n",
    "B=100#\n",
    "B2=B#\n",
    "VBE=0.7#\n",
    "RE=200#\n",
    "VR2=VCC*(R2/(R1+R2))#\n",
    "IE1=(VR2-VBE)/RE#\n",
    "IC1=IE1#\n",
    "print 'IC1=%02.f mA'%(IC1*10**3)\n",
    "VC1=VCC-IC1*R3#\n",
    "VE1=IE1*R4#\n",
    "VCE1=VC1-VE1#\n",
    "print 'VCE1=%0.2f V'%VCE1\n",
    "VE2=VC1-(-VBE)#\n",
    "IE2=(VCC-VE2)/R6#\n",
    "IC2=IE2#\n",
    "VC2=IC2*R5#\n",
    "VCE2=VC2-VE2#\n",
    "print 'VCE2=%0.2f V'%VCE2\n",
    "re1=25/IE1*10**-3#\n",
    "re2=25/IE2*10**-3#\n",
    "Ri2=B2*(re2+R6)#\n",
    "R01=(R3*Ri2)/(R3+Ri2)#\n",
    "Av1=R01/(re1+R4)#\n",
    "print \"Av1=%0.2f \"%Av1\n",
    "Av2=1#\n",
    "print \"Av2=%0.2f \"%Av2\n",
    "Av=Av1*Av2#\n",
    "print \"Av=%0.2f \"%Av"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 21.9 Pg 572"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ai=15000.00\n",
      "re2=14.42 ohm\n",
      "re1=1442.31 ohm\n",
      "Ri1=12.00 kohm\n",
      "Av=0.98 \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VCC=10#\n",
    "R1=30*10**3#\n",
    "R2=20*10**3#\n",
    "RE=1.5*10**3#\n",
    "B1=150#\n",
    "B2=100#\n",
    "VBE=0.7#\n",
    "Ai=B1*B2#\n",
    "print \"Ai=%0.2f\"%Ai\n",
    "VR2=VCC*(R2/(R1+R2))#\n",
    "VB2=VR2-VBE#\n",
    "VE2=VB2-VBE#\n",
    "IE2=VE2/RE#\n",
    "re2=25/(IE2*10**3)#\n",
    "print 're2=%0.2f ohm'%re2\n",
    "Ib2=IE2/B2#\n",
    "IE1=Ib2#\n",
    "re1=25/(IE1*10**3)#\n",
    "print 're1=%0.2f ohm'%re1\n",
    "Ri1=(R1*R2)/(R1+R2)#\n",
    "print 'Ri1=%0.2f kohm'%(Ri1*10**-3)\n",
    "Av=RE/((re1/B2)+(re2+RE))#\n",
    "print \"Av=%0.2f \"%Av"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
