{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Amplifier with negative feedback"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.1, Page No 547"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Av=100000.0\n",
      "B=1.0/100\n",
      "print(\"when Av=100000\")\n",
      "\n",
      "#Calculations\n",
      "Acl=Av/(1+Av*B)\n",
      "print(\"when Av is 150000\")\n",
      "Av=150000\n",
      "Acl=Av/(1+Av*B)\n",
      "\n",
      "#Results\n",
      "print(\"when Av is 50000\")\n",
      "Av=50000\n",
      "Acl=Av/(1+Av*B)\n",
      "print('The value of Acl= %.2f ' %(Acl))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when Av=100000\n",
        "when Av is 150000\n",
        "when Av is 50000\n",
        "The value of Acl= 99.80 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2, Page No 549"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Rf2=560.0\n",
      "Rf1=56.0*10**3\n",
      "Av=100000.0\n",
      "Zb=1.0*10**3\n",
      "R1=68.0*10**3\n",
      "R2=33.0*10**3\n",
      "\n",
      "#Calculations\n",
      "B=Rf2/(Rf2+Rf1)\n",
      "Zi=(1+Av*B)*Zb\n",
      "Zin=(Zi*R1*R2)/(R1*R2+R1*Zi+R2*Zi)\n",
      "\n",
      "#Results\n",
      "print(\"input impedance with negative feedback is %.2f ohm \" %(Zin/10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "input impedance with negative feedback is 21.73 ohm \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3 Page No 552"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Zb=1.0*10**3\n",
      "B=1.0/100\n",
      "Av=5562.0\n",
      "R1=68.0*10**3\n",
      "R2=47.0*10**3\n",
      "hoe=1.0/(50*10**3)\n",
      "Rc=3.9*10**3\n",
      "\n",
      "#Calculations\n",
      "Zi=(1+Av*B)*Zb\n",
      "Zin=(R1*R2*Zi)/(R1*R2+R2*Zi+R1*Zi)\n",
      "Zo=(1/hoe)/(1+Av*B)\n",
      "Zout=(Rc*Zo)/(Rc+Zo)\n",
      "\n",
      "#Results\n",
      "print(\" circuit output impedance is %.2f ohm \" %Zout)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " circuit output impedance is 720.04 ohm \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4, Page No 554"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Zb=1.0*10**3\n",
      "hoe=1.0/(85*10**3)\n",
      "Av=58000.0\n",
      "Rf2=220.0\n",
      "Rf1=16.2*10**3\n",
      "R1=120.0*10**3\n",
      "R2=39.0*10**3\n",
      "R7=12.0*10**3\n",
      "\n",
      "#Calculations\n",
      "B=Rf2/(Rf2+Rf1)\n",
      "print(\"voltage gain\")\n",
      "Acl=Av/(1+Av*B)\n",
      "Zi=Zb*(1+Av*B)\n",
      "Zin=(Zi*R1*R2)/(Zi*R1+R2*R1+R2*Zi)\n",
      "Zo=(1/hoe)/(1+Av*B)\n",
      "Zout=(R7*Zo)/(R7+Zo)\n",
      "\n",
      "#Results\n",
      "print(\"output impedance is %.2f ohm \" %Zout)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain\n",
        "output impedance is 108.25 ohm \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.5 Page No 558"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Rf2=220.0\n",
      "R4=3.9*10**3\n",
      "Acl=75.0\n",
      "f=100.0\n",
      "\n",
      "#Calculations\n",
      "Rf1=(Acl-1)*Rf2\n",
      "Xc2=Rf2\n",
      "C2=1/(2*3.14*f*Rf2)\n",
      "Xcf1=Rf1/100\n",
      "Cf1=1/(2*3.14*f*Xcf1)\n",
      "\n",
      "#Results\n",
      "print('The value of Cf1= %.2f mF' %(Cf1*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Cf1= 9.78 mF\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.6 Page No 560"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Acl=300.0\n",
      "Rf2=220.0\n",
      "R4=4.7*10**3\n",
      "f=100.0\n",
      "\n",
      "#Calculations\n",
      "Rf1=(Acl-1)*Rf2\n",
      "xc2=Rf2\n",
      "C2=1.0/(2*3.14*f*Rf2)\n",
      "\n",
      "#Results\n",
      "print('The value of C2= %.2f mf' %(C2*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of C2= 7.24 mf\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.7, Page No 565"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "hfe=100.0\n",
      "Vbe=0.7\n",
      "Ic1=1.0*10**-3\n",
      "\n",
      "#Calculations\n",
      "Ic2=Ic1\n",
      "Ic3=Ic2\n",
      "Ic4=Ic3\n",
      "Vee=10.0\n",
      "Vce=3.0\n",
      "Acl=33.0\n",
      "print(\"different resistor value of circuit\")\n",
      "R1=Vbe/((10*Ic1)/hfe)\n",
      "R3=(Vee-Vbe)/(Ic1+Ic2)\n",
      "Vr2=Vee+Vbe-Vce\n",
      "R4=Vr2/Ic1\n",
      "R2=R4\n",
      "R7=(Vr2-Vbe)/(Ic3+Ic4)\n",
      "R8=Vee/Ic3\n",
      "R6=6.8*10**3\n",
      "R5=(Acl-1)*R6\n",
      "\n",
      "#Results\n",
      "print('The value of R5= %.2f  kohm' %(R5/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "different resistor value of circuit\n",
        "The value of R5= 217.60  kohm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.8 Page No 566"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "Av=25000.0\n",
      "hie=2.0*10**3\n",
      "hib=25.0\n",
      "hoe=1.0/(100*10**3)\n",
      "R6=6.8*10**3\n",
      "R5=220.0*10**3\n",
      "R1=R6\n",
      "\n",
      "#Calculations\n",
      "R8=10*10**3\n",
      "B=R6/(R5+R6)\n",
      "Acl=Av/(1+Av*B)\n",
      "Zi=2*hie*(1+Av*B)\n",
      "Zin=(Zi*R1)/(Zi+R1)\n",
      "Zo=(1/hoe)/(1+Av*B)\n",
      "Zout=(R8*Zo)/(R8+Zo)\n",
      "\n",
      "#Results\n",
      "print(\"output impedance is %.2f ohm \" %Zout)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "output impedance is 131.48 ohm \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.9 Page No 568"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "hic=2.0*10**3\n",
      "hie=hic\n",
      "hfe=100.0\n",
      "hfc=100.0\n",
      "Av=25000.0\n",
      "B=1.0/33.4\n",
      "\n",
      "#Calculations\n",
      "R8=10*10**3\n",
      "R5=R8\n",
      "Ze=(hic+R8)/hfc\n",
      "Zo=Ze/(1+Av*B)\n",
      "Zout=(R5*Zo)/(R5+Zo)\n",
      "\n",
      "#Results\n",
      "print(\"output impedance is %.2fohm \" %Zout)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "output impedance is 0.16ohm \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.10 Page No 570"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "hfemin=100.0\n",
      "hfemax=400.0\n",
      "hiemin=2.0*10**3\n",
      "hiemax=5.0*10**3\n",
      "Rc=12.0*10**3\n",
      "Rl=120.0*10**3\n",
      "Re1=150.0\n",
      "\n",
      "#Calculations\n",
      "print(\" voltage gain at extreme value \")\n",
      "Avmax=(hfemax*((Rc*Rl)/(Rc+Rl)))/(hiemax+Re1*(1+hfemax))\n",
      "Avmin=(hfemin*((Rc*Rl)/(Rc+Rl)))/(hiemin+Re1*(1+hfemin))\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"approximate voltage gain\")\n",
      "Av=((Rc*Rl)/(Rc+Rl))/Re1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " voltage gain at extreme value \n",
        "approximate voltage gain\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.11, Page No 571"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Av=70.0\n",
      "f=100.0\n",
      "rs=600.0\n",
      "Rc=12.0*10**3\n",
      "Rl=120*10**3\n",
      "Re2=3.9*10**3\n",
      "hie=2.0*10**3\n",
      "hfe=100.0\n",
      "R1=Rl\n",
      "R2=39.0*10**3\n",
      "Re1=150.0\n",
      "\n",
      "#Calculations\n",
      "Zb=hie+Re1*(1+hfe)\n",
      "Zin=(R1*R2*Zb)/(R1*R2+R1*Zb+R2*Zb)\n",
      "C1=1/(2*3.14*f*((Zin+rs)/10))\n",
      "C2=1/(2*3.14*f*Re1)\n",
      "\n",
      "#Results\n",
      "print('The value of C2= %.2f mF ' %(C2*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of C2= 10.62 mF \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.12, Page No 573"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Av=1000.0\n",
      "f=100.0\n",
      "hie=2.0*10**3\n",
      "hfe=100.0\n",
      "R8=12.0*10**3\n",
      "Rl=120*10**3\n",
      "R10=3.9*10**3\n",
      "R6=Rl\n",
      "R7=39.0*10**3\n",
      "\n",
      "#Calculations\n",
      "R3=R8\n",
      "Av1=math.sqrt(Av)\n",
      "Av2=Av1\n",
      "R9=((R8*Rl)/(R8+Rl))/Av2\n",
      "R9=330#use standard value\n",
      "Av2=((R8*Rl)/(R8+Rl))/R9\n",
      "Av1=Av/Av2\n",
      "Zb=hie+R9*(1+hfe)\n",
      "Zin=(R6*R7*Zb)/(R6*R7+R6*Zb+R7*Zb)\n",
      "R4=((R3*Zin)/(R3+Zin))/Av1\n",
      "R5=R10-R4\n",
      "\n",
      "#Results\n",
      "print('The value of R5= %.2f ' %(R5/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R5= 3.67 \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.13, Page No 574"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "f=100.0\n",
      "hie=2.0*10**3\n",
      "hfe=100.0\n",
      "R8=12.0*10**3\n",
      "Rl=120.0*10**3\n",
      "R10=3.9*10**3\n",
      "R6=Rl\n",
      "R7=39.0*10**3\n",
      "R3=R8\n",
      "R4=220.0\n",
      "rs=600.0\n",
      "Zin2=16.0*10**3\n",
      "R9=330.0\n",
      "\n",
      "#Calculations\n",
      "Zb=hie+R4*(1+hfe)\n",
      "Zin=(R1*R2*Zb)/(R1*R2+R1*Zb+R2*Zb)\n",
      "C1=1.0/(2*3.14*f*((Zin+rs)/10))\n",
      "Xc2=0.65*R4\n",
      "C2=1.0/(2*3.14*f*Xc2)\n",
      "C3=1.0/(2*3.14*f*((Zin2+R3)/10))\n",
      "C4=1.0/(2*3.14*f*.65*R9)\n",
      "C5=1.0/(2*3.14*f*((R8+Rl)/10))\n",
      "\n",
      "#Results\n",
      "print('The value of C5= %.2f mF ' %(C5*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of C5= 0.12 mF \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.14, Page No 580"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "hfe=100.0\n",
      "hie=2.0*10**3\n",
      "R4=100.0\n",
      "R1=5.6*10**3\n",
      "R6=2.2*10**3\n",
      "\n",
      "#Calculations\n",
      "Zi=hie+(1+hfe)*R4\n",
      "print(\"open loop current gain\")\n",
      "Ai=(hfe*hfe*R1)/(R1+Zi)\n",
      "B=R4/(R4+R6)\n",
      "print(\"closed loop gain\")\n",
      "Acl=Ai/(1+Ai*B)\n",
      "Zi=hie/(1+Ai*B)\n",
      "\n",
      "#Results\n",
      "print('The value of Zi= %.2f ohm ' %(Zi))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "open loop current gain\n",
        "closed loop gain\n",
        "The value of Zi= 14.43 ohm \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.15, Page No 585"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Av=60000.0\n",
      "Acl=300.0\n",
      "f1=15.0*10**3\n",
      "B=1.0/300\n",
      "\n",
      "#Calculations\n",
      "f2=(Av*f1)/Acl\n",
      "print(\"% distortion with NFB\")\n",
      "NFB=(.1/(1+Av*B))*100.0\n",
      "\n",
      "#Results\n",
      "print(\" percenatge  distortion with NFB is %.3f percent \" %NFB)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "% distortion with NFB\n",
        " percenatge  distortion with NFB is 0.050 percent \n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}