{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6: Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1 page no-329"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# conversion efficiency\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vdc=9.0\n",
      "Idc= 20*10**-3\n",
      "V0=3.0\n",
      "I0=12*10**-3\n",
      "\n",
      "#Calculations\n",
      "P0=V0*I0\n",
      "Pdc=Vdc*Idc\n",
      "eta=P0/Pdc\n",
      "\n",
      "#Result\n",
      "print(\"\\nEfficiency(Eta) = %.0f%%\"%(eta*100))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Efficiency(Eta) = 20%\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2 page no-348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculation of different parameters of CC circuit\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Ib= 100* 10**-6\n",
      "hie=2000.0\n",
      "R=50*10**3\n",
      "hfe=100.0\n",
      "R4=2.1*10**3\n",
      "Rl=1000.0\n",
      "\n",
      "#Calculations\n",
      "Vbe=Ib*hie\n",
      "Ii=Vbe/R\n",
      "I1=Ii+Ib\n",
      "I0=hfe*Ib*R4/(R4+Rl)\n",
      "Ai=I0/I1\n",
      "V0=-I0*Rl\n",
      "Av=V0/Vbe\n",
      "\n",
      "#Result\n",
      "print(\"Total Current Input, I = %.0f micro A\"%(I1*10**6))\n",
      "print(\"Current through Rl, I0 = %.2fmA\"%(I0*1000))\n",
      "print(\"Current amplification, Ai = %d\"%Ai)\n",
      "print(\"V0 = %.2f\\nAv = %.1f\"%(V0,Av))\n",
      "print(\"\\nNegative sign indicates that there is phase shift of 180\u00b0\")\n",
      "print(\"between input and output voltages,i.e. as base voltage goes more positive,(it is NPN transistor),\")\n",
      "print(\"the collector voltage goes more negative\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total Current Input, I = 104 micro A\n",
        "Current through Rl, I0 = 6.77mA\n",
        "Current amplification, Ai = 65\n",
        "V0 = -6.77\n",
        "Av = -33.9\n",
        "\n",
        "Negative sign indicates that there is phase shift of 180\u00b0\n",
        "between input and output voltages,i.e. as base voltage goes more positive,(it is NPN transistor),\n",
        "the collector voltage goes more negative\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4 page no-349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculation of different parameters of CE circuit\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "hie=1000.0\n",
      "hfe=99.0\n",
      "#hre negligible\n",
      "r2=60.0\n",
      "r3=30.0\n",
      "r4=5.0\n",
      "r7=20.0\n",
      "r6=30.0\n",
      "Rl1=20000.0\n",
      "\n",
      "#Calculations\n",
      "R23=r2*r3/(r2+r3)\n",
      "R47=r4*r7/(r4+r7)\n",
      "Rl=R47\n",
      "Av=-hfe*Rl*10/hie\n",
      "Av=math.floor(Av)\n",
      "Ri=Rl1*1000/(Rl1+1000)\n",
      "\n",
      "#Calculations\n",
      "print(\"Rl = %d kohm\\nAv = %d\\nRi = %.0f Ohm\"%(Rl,Av*100,Ri))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rl = 4 kohm\n",
        "Av = -400\n",
        "Ri = 952 Ohm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5 page no-352"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculation of different parameters of CC circuit\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "hic = 1100.0 \n",
      "hrc = 1.0\n",
      "hfc = -51.0\n",
      "hoc = 25.0*10**-6\n",
      "Rl=10000.0\n",
      "\n",
      "\n",
      "#Calculations\n",
      "Rs=Rl\n",
      "Ai=(-hfc)/(1.0+(hoc*Rl))\n",
      "Ri=(hic+hrc*Ai*Rl)/1000\n",
      "Av=Ai*Rl/Ri\n",
      "Avs=Av*Ri/(Ri+Rs)\n",
      "R0=1/(hoc-(hfc*hrc/(hic+Rs)))\n",
      "\n",
      "#Result\n",
      "print(\"Ai = %.1f\\nRi = %.1f kOhm\\nAv = %.3f\\nAvs = %.3f\\nR0 = %.0f ohm\"%(Ai,Ri,Av,Avs,math.ceil(R0)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ai = 40.8\n",
        "Ri = 409.1 kOhm\n",
        "Av = 997.311\n",
        "Avs = 39.196\n",
        "R0 = 217 ohm\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7 page no-353"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#maximum value of RL in CE configuration\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "hie = 1100.0\n",
      "hfe = 50.0\n",
      "hre = 2.50*10**-4\n",
      "hoe = 25*10**-6\n",
      "\n",
      "#Calculations\n",
      "Rl=0.1*hie/((hfe*hre)-(0.1*hoe*hie))\n",
      "Rl=Rl/1000\n",
      "\n",
      "#Result\n",
      "print(\"Rl= %.1f K Ohm\"%Rl)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rl= 11.3 K Ohm\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8 page no-364"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# voltage gains Avs Av1 and Av2 for given circuit\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "hie =1000.0\n",
      "hre = 10**-4\n",
      "hfe = 50.0\n",
      "hoe = 10**-8\n",
      "Rl2=5000.0\n",
      "Rs=1000.0\n",
      "\n",
      "#Calculations\n",
      "Ri2=hie+(1+hfe)*Rl2\n",
      "Ri2=Ri2/1000\n",
      "Av2=1-(hie/(Ri2*1000))\n",
      "Rl1=(10.0*256)/(10+256.0)\n",
      "Ai1=-50*hfe\n",
      "Av1=-hfe*Rl1/hie\n",
      "o_g=Av1*Av2\n",
      "Avs=o_g*Rs/(Rs+hie)\n",
      "\n",
      "#Result\n",
      "print(\"Ri2 = %d KOhm\"%Ri2)\n",
      "print(\"Av2 = %.3f\"%Av2)\n",
      "print(\"Rl1 = %.2f KOhm\\nAv1 = %.1f\"%(Rl1,Av1*1000))\n",
      "print(\"Overall Gain = %.0f\\nAvs = %.0f\"%(math.floor(o_g*1000),math.floor(Avs*1000)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ri2 = 256 KOhm\n",
        "Av2 = 0.996\n",
        "Rl1 = 9.62 KOhm\n",
        "Av1 = -481.2\n",
        "Overall Gain = -480\n",
        "Avs = -240\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}