{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter - 19 : SINGLE STAGE BJT AMPLIFIERS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.1 Pg 456"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ib=9.30 microA\n",
      "Ic=0.93 mA\n",
      "re=26.88 ohm\n",
      "Ri=2.69 kohm\n",
      "Ris=2.68 kohm\n",
      "R0=10.00 kOhm\n",
      "Av=372.00\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vcc=10#\n",
    "Rc=10*10**3#\n",
    "Rb=1*10**6#\n",
    "beta=100#\n",
    "Vbe=0.7#\n",
    "Ib=(Vcc-Vbe)/Rb#\n",
    "print 'Ib=%0.2f microA'%(Ib*10**6)\n",
    "Ic=beta*Ib#\n",
    "print 'Ic=%0.2f mA'%(Ic*10**3)\n",
    "Ie=Ic#\n",
    "re=25/(Ie*10**3)\n",
    "print 're=%0.2f ohm'%re\n",
    "Ri=beta*re#\n",
    "print 'Ri=%0.2f kohm'%(Ri*10**-3)\n",
    "Ris=(Rb*beta*re)/(Rb+beta*re)\n",
    "print 'Ris=%0.2f kohm'%(Ris*10**-3)\n",
    "R0=Rc#\n",
    "print 'R0=%0.2f kOhm'%(R0*10**-3)\n",
    "Av=Rc/re#\n",
    "print \"Av=%0.2f\"%Av"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.2 Pg 458"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ib=2.00 microA\n",
      "ic=100.00 microA\n",
      "Ap=10000.00\n",
      "Gp=40.00 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "Ri=2.5*10**3#\n",
    "Av=200#\n",
    "Vs=5*10**-3#\n",
    "beta=50#\n",
    "ib=(Vs/Ri)\n",
    "print 'ib=%0.2f microA'%(ib*10**6)\n",
    "ic=beta*ib#\n",
    "print 'ic=%0.2f microA'%(ic*10**6)\n",
    "Ai=beta#\n",
    "Ap=Ai*Av#\n",
    "print \"Ap=%0.2f\"%Ap\n",
    "Gp=10*log10(Ap)\n",
    "print 'Gp=%0.2f dB'%Gp"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.3 Pg 460"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ic=12.00 mA\n",
      "re=2.08 ohm\n",
      "Ri=150.31 kohm\n",
      "rIS=60.05 kohm\n",
      "Av=5.00\n",
      "Gp=6.99 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "Vcc=20#\n",
    "Rc=5*10**3#\n",
    "Re=1*10**3#\n",
    "Rb=100*10**3#\n",
    "beta=150#\n",
    "Vbe=0.7\n",
    "Ic=Vcc/(Re+(Rb/beta))\n",
    "print 'Ic=%0.2f mA'%(Ic*10**3)\n",
    "Ie=Ic#\n",
    "re=25/(Ie*10**3)\n",
    "print 're=%0.2f ohm'%re\n",
    "Ri=beta*(re+Re)\n",
    "print 'Ri=%0.2f kohm'%(Ri*10**-3)\n",
    "Ris=(Rb*Ri)/(Rb+Ri)\n",
    "print 'rIS=%0.2f kohm'%(Ris*10**-3)\n",
    "Av=Rc/Re#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Gp=10*log10(Av)\n",
    "print 'Gp=%0.2f dB'%Gp"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.4 Pg 462"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ic=1.09 mA\n",
      "re=22.92 ohm\n",
      "Ri=1145.83 ohm\n",
      "Ris=1143.21 ohm\n",
      "Av=436.36\n",
      "Av=10.00\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vcc=12#\n",
    "Rc=10*10**3#\n",
    "Re=1*10**3#\n",
    "Rb=500*10**3#\n",
    "beta=50#\n",
    "Ic=Vcc/(Re+(Rb/beta))\n",
    "print 'Ic=%0.2f mA'%(Ic*10**3)\n",
    "Ie=Ic#\n",
    "re=25/(Ie*10**3)\n",
    "print 're=%0.2f ohm'%re\n",
    "Ri=beta*re#\n",
    "print 'Ri=%0.2f ohm'%Ri\n",
    "Ris=(Rb*Ri)/(Rb+Ri)\n",
    "print 'Ris=%0.2f ohm'%Ris\n",
    "R0=Rc#\n",
    "Av=R0/re#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Av=Rc/Re#\n",
    "print \"Av=%0.2f\"%Av"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.5 Pg 463"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vth=7.26 V\n",
      "Rth=1.14e+04 ohm\n",
      "IE=0.79 mA\n",
      "re=31.48 ohm\n",
      "rl=2.48 kohm\n",
      "Av=78.83 \n",
      "V0=394.14 mV\n",
      "Ri=6.30 kohm\n",
      "Ris=4.05 kohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vcc=30#\n",
    "Rc=10*10**3#\n",
    "RL=3.3*10**3#\n",
    "R1=47*10**3#\n",
    "R2=15*10**3#\n",
    "Re=8.2*10**3#\n",
    "beta=200#\n",
    "Vs=5*10**-3#\n",
    "Vbe=0.7#\n",
    "Vth=(Vcc*R2)/(R1+R2)\n",
    "print 'Vth=%0.2f V'%Vth\n",
    "Rth=(R1*R2)/(R1+R2)\n",
    "print 'Rth=%0.2e ohm'%Rth\n",
    "Ie=(Vth-Vbe)/(Re+(Rth/beta))\n",
    "print 'IE=%0.2f mA'%(Ie*10**3)\n",
    "re=25/(Ie*10**3)\n",
    "print 're=%0.2f ohm'%re\n",
    "rl=(Rc*RL)/(Rc+RL)\n",
    "print 'rl=%0.2f kohm'%(rl*10**-3)\n",
    "Av=rl/re#\n",
    "print \"Av=%0.2f \"%Av\n",
    "Vin=5#\n",
    "V0=Av*Vin\n",
    "print 'V0=%0.2f mV'%V0\n",
    "Ri=beta*re#\n",
    "print 'Ri=%0.2f kohm'%(Ri*10**-3)\n",
    "Ris=(Rth*Ri)/(Rth+Ri)\n",
    "print 'Ris=%0.2f kohm'%(Ris*10**-3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.6 Pg 465"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vth=1.67 V\n",
      "Rth=8.33e+03 ohm\n",
      "IE=0.83 mA\n",
      "re=30.17 ohm\n",
      "Ris=1277.37 ohm\n",
      "rl=4.55 kohm\n",
      "Av=150.65\n",
      "Vin=6.80 mV\n",
      "V0=1.03 mV\n",
      "Avs=102.50\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vcc=10#\n",
    "Rc=5*10**3#\n",
    "Re=1*10**3#0\n",
    "RL=50*10**3#\n",
    "R1=50*10**3#\n",
    "R2=10*10**3#\n",
    "Rs=600#\n",
    "beta=50#\n",
    "Vs=10*10**-3#\n",
    "Vbe=0.7#\n",
    "Vth=(Vcc*R2)/(R1+R2)\n",
    "print 'Vth=%0.2f V'%Vth\n",
    "Rth=(R1*R2)/(R1+R2)\n",
    "print 'Rth=%0.2e ohm'%Rth\n",
    "Ie=(Vth-Vbe)/(Re+(Rth/beta))\n",
    "print 'IE=%0.2f mA'%(Ie*10**3)\n",
    "re=25/(Ie*10**3)\n",
    "print 're=%0.2f ohm'%re\n",
    "Ri=beta*re#\n",
    "Ris=(Rth*Ri)/(Rth+Ri)\n",
    "print 'Ris=%0.2f ohm'%Ris\n",
    "rl=(Rc*RL)/(Rc+RL)\n",
    "print 'rl=%0.2f kohm'%(rl*10**-3)\n",
    "Av=rl/re#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Vin=(Vs*Ris)/(Ris+Rs)\n",
    "print 'Vin=%0.2f mV'%(Vin*10**3)\n",
    "V0=Av*Vin#\n",
    "print 'V0=%0.2f mV'%V0\n",
    "Avs=(Av*Vin)/Vs#\n",
    "print \"Avs=%0.2f\"%Avs"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.7 Pg 467"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vth=-3.13 V\n",
      "Rth=6.78 kohm\n",
      "IE=-2.35 mA\n",
      "re1=12.78 ohm\n",
      "Ris=3.19 kohm\n",
      "re=1.77 kohm\n",
      "Av=138.28\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vcc=-18#\n",
    "Rc=4.3*10**3#\n",
    "Re=1*10**3#0\n",
    "RL=3*10**3#\n",
    "R1=39*10**3#\n",
    "R2=8.2*10**3#\n",
    "beta1=200#\n",
    "Vbe=-0.7#\n",
    "Vth=(Vcc*R2)/(R1+R2)\n",
    "print 'Vth=%0.2f V'%Vth\n",
    "Rth=(R1*R2)/(R1+R2)\n",
    "print 'Rth=%0.2f kohm'%(Rth*10**-3)\n",
    "Ie=(Vth-Vbe)/(Re+(Rth/beta1))\n",
    "print 'IE=%0.2f mA'%(Ie*10**3)\n",
    "re1=(30*10**-3)/(-Ie)\n",
    "print 're1=%0.2f ohm'%re1\n",
    "Ri=beta1*re#\n",
    "Ris=(Rth*Ri)/(Rth+Ri)\n",
    "print 'Ris=%0.2f kohm'%(Ris*10**-3)\n",
    "re=(Rc*RL)/(Rc+RL)\n",
    "print 're=%0.2f kohm'%(re*10**-3)\n",
    "Av=re/re1#\n",
    "print \"Av=%0.2f\"%Av"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.8 Pg 468"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vth=1.82 V\n",
      "Rth=9.09 kohm\n",
      "IE=1.02 mA\n",
      "re=24.39 ohm\n",
      "Ris=1923.08 ohm\n",
      "Av=233.70\n",
      "Vin=0.01 mV\n",
      "V0=0.00 V\n",
      "Avs=222.15\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vcc=20#\n",
    "Rc=5.7*10**3#\n",
    "Re=1*10**3#\n",
    "R1=100*10**3#\n",
    "R2=10*10**3#\n",
    "Rs=100#\n",
    "beta1=100#\n",
    "Vbe=0.7#\n",
    "Vth=(Vcc*R2)/(R1+R2)\n",
    "print 'Vth=%0.2f V'%Vth\n",
    "Rth=(R1*R2)/(R1+R2)\n",
    "print 'Rth=%0.2f kohm'%(Rth*10**-3)\n",
    "Ie=(Vth-Vbe)/(Re+(Rth/beta1))\n",
    "print 'IE=%0.2f mA'%(Ie*10**3)\n",
    "re=25/(Ie*10**3)\n",
    "print 're=%0.2f ohm'%re\n",
    "Ri=beta1*re#\n",
    "Ris=(Rth*Ri)/(Rth+Ri)\n",
    "print 'Ris=%0.2f ohm'%Ris\n",
    "rl=Rc#\n",
    "Av=rl/re#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Vin=(Vs*Ris)/(Ris+Rs)\n",
    "print 'Vin=%0.2f mV'%Vin\n",
    "V0=Av*Vin#\n",
    "print 'V0=%0.2f V'%(V0*10**-3)\n",
    "Avs=(Av*Vin)/Vs#\n",
    "print \"Avs=%0.2f\"%Avs"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.9 Pg 469"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vth=1.67 V\n",
      "Rth=8.33e+00 ohm\n",
      "RE=1000.00 ohm\n",
      "Ie=0.83 mA\n",
      "re=30.17 ohm\n",
      "Ri=26.51 kohm\n",
      "Ris=6340.21 ohm\n",
      "rl=4.55 kohm\n",
      "Av=8.57 \n",
      "VinBYVs=0.91\n",
      "Avs=7.83\n",
      "V0=783.23 mV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vcc=10#\n",
    "Rc=5*10**3#\n",
    "RE1=500#\n",
    "R1=50*10**3#\n",
    "R2=10*10**3#\n",
    "Rs=600#\n",
    "rE=500#\n",
    "beta1=50#\n",
    "Vbe=0.7#\n",
    "vs=100*10**-3#\n",
    "Rl=50*10**3#\n",
    "Vth=(Vcc*R2)/(R1+R2)\n",
    "print 'Vth=%0.2f V'%Vth\n",
    "Rth=(R1*R2)/(R1+R2)\n",
    "print 'Rth=%0.2e ohm'%(Rth*10**-3)\n",
    "RE=RE1+rE#\n",
    "print 'RE=%0.2f ohm'%RE\n",
    "Ie=(Vth-Vbe)/(RE+(Rth/beta1))\n",
    "print 'Ie=%0.2f mA'%(Ie*10**3)\n",
    "re=25/(Ie*10**3)\n",
    "print 're=%0.2f ohm'%re\n",
    "Ri=beta1*(re+rE)\n",
    "print 'Ri=%0.2f kohm'%(Ri*10**-3)\n",
    "Ris=(Rth*Ri)/(Rth+Ri)\n",
    "print 'Ris=%0.2f ohm'%Ris\n",
    "rl=(Rc*Rl)/(Rc+Rl)\n",
    "print 'rl=%0.2f kohm'%(rl*10**-3)\n",
    "Av=rl/(re+rE)\n",
    "print \"Av=%0.2f \"%Av\n",
    "VinBYVs=(Ris)/(Ris+Rs)\n",
    "print \"VinBYVs=%0.2f\"%VinBYVs\n",
    "Avs=Av*VinBYVs#\n",
    "print \"Avs=%0.2f\"%Avs\n",
    "V0=Avs*vs#\n",
    "print 'V0=%0.2f mV'%(V0*10**3) #answer printed in the book is wrong(variation in decimal point) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " ## Ex 19.10 Pg 470"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ris=53.62 ohm\n",
      "Ai=0.98\n",
      "Av=62.82\n",
      "Ap=61.56\n",
      "Gp=17.89 dB\n",
      "Vo=628.21 mV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "\n",
    "VS=10*10**-3#\n",
    "a=0.98#\n",
    "VBE=0.7#\n",
    "VCC=10#\n",
    "RC=10*10**3#\n",
    "RL=5.1*10**3#\n",
    "RE=20*10**3#\n",
    "VEE=10#\n",
    "IE=(VEE-VBE)/RE#\n",
    "re=25/IE*10**-3#\n",
    "Ri=re#\n",
    "Ris=(RE*re)/(RE+re)\n",
    "print 'Ris=%0.2f ohm'%Ris\n",
    "Ai=a#\n",
    "print \"Ai=%0.2f\"%Ai\n",
    "rL=(RC*RL)/(RC+RL)\n",
    "Av=rL/re#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Ap=Av*Ai#\n",
    "print \"Ap=%0.2f\"%Ap\n",
    "Gp=10*log10(Ap)\n",
    "print 'Gp=%0.2f dB'%Gp\n",
    "Vin=VS#\n",
    "Vo=Av*Vin#\n",
    "print 'Vo=%0.2f mV'%(Vo*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.11 Pg 471"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Avs=32.56\n",
      "Av=62.83\n",
      "vin=5.18 mV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Rs=50#\n",
    "IE=0.465*10**-3#\n",
    "re1=53.8#\n",
    "Ri=53.8#\n",
    "Ris=52.4#\n",
    "rL=3.38*10**3#\n",
    "Avs=rL/(Rs+re1)\n",
    "print \"Avs=%0.2f\"%Avs\n",
    "Av=rL/re1#\n",
    "print \"Av=%0.2f\"%Av\n",
    "Vs=10#\n",
    "vo=Avs*Vs#\n",
    "vin=vo/Av#\n",
    "print 'vin=%0.2f mV'%vin"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.12 Pg 473"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ri=501.61 kohm\n",
      "Ro=32.26 ohm\n",
      "Av=1.00 \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VEE=10#\n",
    "RE=10*10**3#\n",
    "RB=100*10**3#\n",
    "B=50#\n",
    "VBE=0.7#\n",
    "IE=(VEE-VBE)/(RE+(RB/B))\n",
    "re=25/IE*10**-3#\n",
    "Ri=B*(RE+re)\n",
    "print 'Ri=%0.2f kohm'%(Ri*10**-3)\n",
    "Ris=(RB*Ri)/(RB+Ri)\n",
    "Rs=0#\n",
    "Ro=re+((RB*Rs)/(RB+Rs))/B#\n",
    "print 'Ro=%0.2f ohm'%Ro\n",
    "Av=RE/(re+RE)\n",
    "print \"Av=%0.2f \"%Av"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 19.13 Pg 475"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "IE=0.82 mA\n",
      "Ris=9.12 kohm\n",
      "Ro=51.44 ohm\n",
      "Vin=4.10 mV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "B=80#\n",
    "VBE=0.7#\n",
    "VCC=15#\n",
    "R1=20*10**3#\n",
    "R2=20*10**3#\n",
    "RS=2*10**3#\n",
    "VS=5*10**-3#\n",
    "RE=8.2*10**3#\n",
    "RL=1.5*10**3#\n",
    "VTH=VCC*R2/(R1+R2)\n",
    "RTH=(R1*R2)/(R1+R2)\n",
    "IE=(VTH-VBE)/(RE+(RTH/B))\n",
    "print 'IE=%0.2f mA'%(IE*10**3)\n",
    "re=25/IE*10**-3#\n",
    "rL=(RE*RL)/(RE+RL)\n",
    "Ri=B*(rL+re)\n",
    "Ris=(RTH*Ri)/(RTH+Ri)\n",
    "print 'Ris=%0.2f kohm'%(Ris*10**-3)\n",
    "Ro=re+((RS*RTH)/(RS+RTH))/B#\n",
    "print 'Ro=%0.2f ohm'%Ro\n",
    "Vin=VS*Ris/(RS+Ris)\n",
    "print 'Vin=%0.2f mV'%(Vin*10**3)"
   ]
  }
 ],
 "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
}
