{
 "metadata": {
  "name": "",
  "signature": "sha256:66025946991647ff9e251a330d5b2003c23b73f54893a4b198da6580fdd0210c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 - Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_1 Pg-369\n",
      "#calculate Lowest frequency\n",
      "import math\n",
      "print '%s' %(\"Refer to the figure 7.19\")\n",
      "print '%s' %(\"For good coupling\")\n",
      "print '%s' %(\"Xc <= 0.1*R\")\n",
      "R=10.*10.**(3.) #resistor R in ohm\n",
      "C=68.*10.**(-6.) #capacitance in Farad\n",
      "f=1./(2.*math.pi*C*0.1*R)\n",
      "print '%s' %(\"Lowest frequency,f\")\n",
      "print '%s %.2f' %(\"=Hz\",f)\n",
      "print '%s' %(\"or lowest frequency is approximately 3 Hz\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to the figure 7.19\n",
        "For good coupling\n",
        "Xc <= 0.1*R\n",
        "Lowest frequency,f\n",
        "=Hz 2.34\n",
        "or lowest frequency is approximately 3 Hz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_2 Pg-369\n",
      "#calculate\n",
      "import math\n",
      "print '%s' %(\"Refer to the figure 7.20\")\n",
      "print '%s' %(\"For good coupling\")\n",
      "print '%s' %(\"Xc <= 0.1*R\")\n",
      "R=10.*10.**(3.) #resistor R in ohm\n",
      "C=220.*10.**(-6.) #capacitance in Farad\n",
      "f=1./(2.*math.pi*C*0.1*R)\n",
      "print '%s' %(\"Lowest frequency,f\")\n",
      "print '%s %.2f' %(\"=Hz\",f)\n",
      "print '%s' %(\"or lowest frequency is approximately 1 Hz\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to the figure 7.20\n",
        "For good coupling\n",
        "Xc <= 0.1*R\n",
        "Lowest frequency,f\n",
        "=Hz 0.72\n",
        "or lowest frequency is approximately 1 Hz\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_3 Pg-369\n",
      "#calculate Base voltage,Emitter voltage,Emitter current,AC emitter diode resistance\n",
      "Beta=250. #transistor gain\n",
      "Vcc=15. #supply voltage\n",
      "R1=2000. #resistor R1 in ohm\n",
      "R2=470. #resistor R2 in ohm\n",
      "Vce=0.7 #voltage drop in V\n",
      "Re=220. #emitter resistor in ohm\n",
      "Vb=(Vcc*R2)/(R1+R2) #base voltage in V\n",
      "print '%s' %(\"(1) Base voltage Vb\")\n",
      "print '%s %.2f' %(\"=V\",Vb)\n",
      "Ve=Vb-Vce #emitter voltage in V\n",
      "print '%s' %(\"Emitter voltage Vb\")\n",
      "print '%s %.2f' %(\"=V\",Ve)\n",
      "Ie=Ve/Re #emitter current\n",
      "print '%s' %(\"Emitter current \")\n",
      "print '%s %.3f' %(\"Ie=*10**-2 A\",Ie*10**2)\n",
      "print '%s' %(\"For small signal operation, ie <= 0.1*Ie\")\n",
      "ie=0.1*Ie \n",
      "print '%s %.3f' %(\"=mA\",ie*10**3)\n",
      "print '%s' %(\"(2) AC emitter diode resistance =25mV/ie\")\n",
      "Re_ac=25.*10.**(-3.)/ie #AC emitter diode resistance\n",
      "print '%s %.0f' %(\"=ohm\",Re_ac)\n",
      "print '%s' %(\"(3) Z''vm = Beta*r''e\")\n",
      "Re_ac=26. #AC emitter diode resistance assumed 26 ohm not 25.53 ohm\n",
      "Zvm=Beta*Re_ac\n",
      "print '%s %.0f' %(\"=ohm\",Zvm)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(1) Base voltage Vb\n",
        "=V 2.85\n",
        "Emitter voltage Vb\n",
        "=V 2.15\n",
        "Emitter current \n",
        "Ie=*10**-2 A 0.979\n",
        "For small signal operation, ie <= 0.1*Ie\n",
        "=mA 0.979\n",
        "(2) AC emitter diode resistance =25mV/ie\n",
        "=ohm 26\n",
        "(3) Z''vm = Beta*r''e\n",
        "=ohm 6500\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 370"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_4 Pg-370\n",
      "#calculate Base voltage,Emitter voltage,Emitter current,AC emitter diode resistance,Voltage gai,Zin stage,Input voltage,Output voltage\n",
      "import math \n",
      "Beta=100. #transistor gain\n",
      "Vcc=10.#supply voltage\n",
      "R1=10.*10.**(3.) #resistor R1 in ohm\n",
      "R2=2200. #resistor R2 in ohm\n",
      "Vce=0.7 #voltage drop in V\n",
      "Re=2000. #emitter resistor in ohm\n",
      "Rs=600. #source resistor in ohm\n",
      "Vb=(Vcc*R2)/(R1+R2) #base voltage in V\n",
      "print '%s' %(\"Base voltage Vb\")\n",
      "print '%s %.1f' %(\"=V\",Vb)\n",
      "Ve=Vb-Vce #emitter voltage in V\n",
      "print '%s' %(\"Emitter voltage Vb\")\n",
      "print '%s %.1f' %(\"=V\",Ve)\n",
      "Ie=Ve/Re #emitter current\n",
      "print '%s' %(\"Emitter current\")\n",
      "print '%s %.2f' %(\"=mA\",Ie*10**3)\n",
      "print '%s' %(\"AC emitter diode resistance =25mV/ie\")\n",
      "re=25.*10.**(-3.)/Ie #AC emitter diode resistance\n",
      "print '%s %.0f' %(\"=ohm\",re)\n",
      "rc=((3.6*10.)/(3.6+10.))*10.**(3.) #Collector dioed resistance\n",
      "A=rc/re #voltage gain(value in text book is wrong)\n",
      "print '%s' %(\"Voltage gain A\")\n",
      "print '%s %.0f' %(\"=\",A)\n",
      "zin_1=((10.*2.2)/(10.+2.2))\n",
      "zin=((zin_1*Beta*A)/(zin_1+(Beta*A)))*1000\n",
      "print '%s' %(\"Zin stage\")\n",
      "print '%s %.3f' %(\"=kohm\",zin*10**-3)\n",
      "Vin=(zin/(Rs+zin))*10.**(-3.) #input voltage (value in text book is wrong)\n",
      "print '%s' %(\"Input voltage\")\n",
      "print '%s %.2f' %(\"=mV\",Vin*10**3)\n",
      "Vout=A*Vin #output voltage (value in textbook is wrong)\n",
      "print '%s' %(\"Output voltage\")\n",
      "print '%s %.2f' %(\"=mV\",Vout*10**3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Base voltage Vb\n",
        "=V 1.8\n",
        "Emitter voltage Vb\n",
        "=V 1.1\n",
        "Emitter current\n",
        "=mA 0.55\n",
        "AC emitter diode resistance =25mV/ie\n",
        "=ohm 45\n",
        "Voltage gain A\n",
        "= 58\n",
        "Zin stage\n",
        "=kohm 1.803\n",
        "Input voltage\n",
        "=mV 0.75\n",
        "Output voltage\n",
        "=mV 43.82\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_5 Pg-371\n",
      "#calculate\n",
      "hfe=50. #current gain\n",
      "Rl=10.*10.**(3.) #load resistor in ohm\n",
      "Rs=500. #source resistor in ohm\n",
      "hie=10.**(3.) #input resitance in ohm\n",
      "A=hfe*Rl/(Rs+hie) #volatge gain\n",
      "print '%s %.1f' %(\"Voltage gain=\",A)\n",
      "Vs=0.02 #source voltage in V\n",
      "Vout=A*Vs #output voltage\n",
      "print '%s %.2f' %(\"Output voltage=V\",Vout)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gain= 333.3\n",
        "Output voltage=V 6.67\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_6 Pg-372\n",
      "#calculate Voltage gain,Power gain\n",
      "import math\n",
      "Vout=5. #output voltage\n",
      "Vin=0.5 #input voltage\n",
      "Ri=10.*10.**(3.) #input resistance in ohm\n",
      "Ro=10. #output resistance\n",
      "A=Vout/Vin #voltage gain\n",
      "print '%s %.0f' %(\"Voltage gain =%.0f \\n\",A)\n",
      "Pi=Vin**2./Ri #input power\n",
      "Po=Vout**2./Ro #output power\n",
      "Pow_gain=10.*(math.log10(Po)-math.log10(Pi)) #power gain\n",
      "print '%s %.0f' %(\" Power gain(in decibel) = %.0f dB \\n\\n\",Pow_gain)\n",
      "print '%s' %(\"When Ri=Ro\")\n",
      "Ri=Ro\n",
      "A=Vout/Vin #voltage gain\n",
      "Pi=Vin**2./Ri #input power\n",
      "Po=Vout**2./Ro #output power\n",
      "Pow_gain=10.*(math.log10(Po)-math.log10(Pi)) #power gain \n",
      "print '%s %.0f' %(\" Power gain(in decibel) = %.0f dB\",Pow_gain)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gain =%.0f \n",
        " 10\n",
        " Power gain(in decibel) = %.0f dB \n",
        "\n",
        " 50\n",
        "When Ri=Ro\n",
        " Power gain(in decibel) = %.0f dB 20\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_7 Pg-372\n",
      "#calculate\n",
      "import math\n",
      "Rl=2.*10.**(3.) #load resistance in ohm\n",
      "Ri=500. #input resistance in ohm\n",
      "C=2.*10.**(-6.) #capacitor in microFarad\n",
      "f=(1./(2.*math.pi*C*(Rl+Ri))) #textbook answer is wrong\n",
      "print '%s %.0f' %(\"Lowest cut-off frequency=Hz\",f)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lowest cut-off frequency=Hz 32\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_8 Pg-372\n",
      "#calculate Coupling Capacitor\n",
      "import math\n",
      "Rl=20.*10.**(3.) #loaH resistance in ohm\n",
      "Ri=5000. #input resistance in ohm\n",
      "f=33. #lower cut-off frequency in Hz\n",
      "f2=33.*10.**(3.) #higher cut-off frequency\n",
      "C=(1./(2.*math.pi*f*(Rl+Ri))) #coupling capacitance (value in textbook is wrong)\n",
      "print '%s %.1f' %(\"Coupling Capacitor=uF\",C*10**6)\n",
      "Req=(Rl*Ri)/(Rl+Ri) #equivalent resistance\n",
      "Cs=1/(2*math.pi*f2*Req) #shunting capacitance (value in textbook is wrong)\n",
      "print '%s %.0f' %(\"Coupling Capacitor=uF\",Cs*10**12)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coupling Capacitor=uF 0.2\n",
        "Coupling Capacitor=uF 1206\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9 - Pg 373"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex7_9 Pg-373\n",
      "#calculate Voltage Amplification,Output voltage\n",
      "Rd=3000. #source resistance in ohm\n",
      "Rl=5000. #load resistance in ohm\n",
      "Req=Rd*Rl/(Rd+Rl) #equivqlent resistance\n",
      "gm=4500.*10.**(-6.) #voltage gain in microMhos\n",
      "Av=(-1.)*gm*Req #voltage amplification\n",
      "print '%s %.2f' %(\"Voltage Amplification=\",Av)\n",
      "Vi=100.*10.**(-3.) #input voltage\n",
      "Vout=abs(Av)*Vi #output voltage (value in textbook is wrong)\n",
      "print '%s %.1f' %(\"Output voltage=V\",Vout)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage Amplification= -8.44\n",
        "Output voltage=V 0.8\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}