{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4: Small signal amplifliers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1, Page No.118"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Rc=4.7            # in ohm\n",
      "Vcc=24.0          # in V\n",
      "Ic1=0             # in A\n",
      "Ic=1.5            # in mA\n",
      "#this is given as 15 mA in textbook which is wrong\n",
      "\n",
      "#Calculations\n",
      "Vce=Vcc-(Ic*Rc*10**-3*10**3)\n",
      "Vce1=Vcc-Ic1*Rc\n",
      "\n",
      "#Result\n",
      "print(\"(i) Collector to emitter voltage,Vce(V)  =  %.2f\"%Vce)\n",
      "print(\"(ii) Collector to emitter voltage,Vce(V) =  %.f\"%Vce1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Collector to emitter voltage,Vce(V)  =  16.95\n",
        "(ii) Collector to emitter voltage,Vce(V) =  24\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2, Page No. 118"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# vce\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Beta=100.0\n",
      "Rb=200*10**3          # in ohm\n",
      "Rc=1*10**3            # in ohm\n",
      "Vcc=10.0              # in V\n",
      "\n",
      "#Calculations\n",
      "Ib=Vcc/Rb             # in A\n",
      "Ic=Beta*Ib            # in A\n",
      "Vce=Vcc-(Ic*Rc)\n",
      "\n",
      "#Result\n",
      "print(\"Collector to emitter voltage,Vce(V) =  %.f\"%Vce)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector to emitter voltage,Vce(V) =  5\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page No. 119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# base resistance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vcc=20.0               # in V\n",
      "Vbe=0.73               # in V\n",
      "Rc=2.0                 # in kilo-ohm\n",
      "Icsat= Vcc/Rc          #in mA\n",
      "Beta=200.0\n",
      "\n",
      "#RCalculatons\n",
      "Ib=(Icsat/Beta)*10**3     # in micro-A\n",
      "Rb=((Vcc-Vbe)/(Ib))*10**3 # in kilo-ohm\n",
      "\n",
      "#Result\n",
      "print(\"Rb < %.f  kilo-ohm\"%(math.ceil(Rb)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rb < 386  kilo-ohm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page No. 119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# operating point\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vcc=15.0             # in V\n",
      "Rb=200.0             # in k-ohm\n",
      "Rc=2.0               # in k-ohm\n",
      "Beta=50.0\n",
      "\n",
      "#Calculations\n",
      "Ib=(Vcc/(Rb*10**3+(Beta*Rc*10**3)))*10**6\n",
      "Ic=Beta*Ib*10**-3\n",
      "Vce=Vcc-(Ic*10**-3*(Rc*10**3))\n",
      "\n",
      "#Result\n",
      "print(\"collector current,Ic(mA) = %.1f\"%Ic)\n",
      "print(\"Collector to emitter voltage,Vce(V) = %.f\"%Vce)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "collector current,Ic(mA) = 2.5\n",
        "Collector to emitter voltage,Vce(V) = 10\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5, Page No. 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistor\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vcc=15.0             # in V\n",
      "Vce=6.0              # in V\n",
      "Rc=3*10**3           # in ohm\n",
      "Beta=50.0\n",
      "\n",
      "\n",
      "#Calculations\n",
      "Ic=(Vcc-Vce)/Rc\n",
      "Ib=Ic/Beta;\n",
      "Rb=((Vcc/Ib)-(Beta*Rc))*10**-3\n",
      "\n",
      "#Result\n",
      "print(\"The value of resistoe,Rb(k-ohm) = %.f\"%Rb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of resistoe,Rb(k-ohm) = 100\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6, Page No. 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# operating point\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vcc=12.0            # in V\n",
      "Rb1=70.0            # in k-ohm\n",
      "Rb2=70.0            # in k-ohm\n",
      "Beta=50.0\n",
      "Rc=2.0              # in k-ohm\n",
      "\n",
      "#Calculations\n",
      "Ib=Vcc/((Rb1+Rb2+(Beta*Rc))*10**3)\n",
      "Ic=Beta*Ib*10**3\n",
      "Vce=Vcc-(Ic*Rc)\n",
      "\n",
      "#Result\n",
      "print(\"Collector current,Ic(mA) = %.1f\"%Ic)\n",
      "print(\"Collector to emitter voltage,Vce(V) = %.f\"%Vce)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector current,Ic(mA) = 2.5\n",
        "Collector to emitter voltage,Vce(V) = 7\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7, Page No. 121"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# operating point\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vcc=9.0             # in V\n",
      "Rb=50.0             # in k-ohm\n",
      "Rc=250.0            # in ohm\n",
      "Re=500.0            # in ohm\n",
      "Beta=80.0\n",
      "\n",
      "#Calculations\n",
      "Ib=Vcc/(Rb*10**3+(Beta*Re))\n",
      "Ic=Beta*Ib*10**3\n",
      "Vce=Vcc-(Ic*10**-3*(Rc+Re));\n",
      "\n",
      "#Result\n",
      "print(\"collector current,Ic(mA) = %.f\"%Ic)\n",
      "print(\"Collector to emitter voltage,Vce(V) = %.f\"%Vce)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "collector current,Ic(mA) = 8\n",
        "Collector to emitter voltage,Vce(V) = 3\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8, Page No. 121"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# operating point\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "R2=4.0            # in k-ohm\n",
      "R1=40.0           # in k-ohm\n",
      "Vcc=22.0          # in V\n",
      "Rc=10.0           # in k-ohm\n",
      "Re=1.5            # in k-ohm\n",
      "Vbe=0.5           # in V\n",
      "\n",
      "#Calculations\n",
      "Voc=R2*10**3*Vcc/((R1+R2)*10**3)\n",
      "Ic=(Voc-Vbe)/(Re*10**3)\n",
      "Vce=Vcc-(Rc+Re)*Ic*10**3\n",
      "\n",
      "#Result\n",
      "print(\"Collector to emitter voltage,Vce(V) = %.1f\"%Vce)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector to emitter voltage,Vce(V) = 10.5\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9, Page No.124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# maximum collector current\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Bv=12.0           # battery voltage in V\n",
      "Cl=6.0            # collector load in k-ohm\n",
      "\n",
      "#Calculations\n",
      "CC=Bv/Cl\n",
      "\n",
      "#Result\n",
      "print(\"Collector current,(mA) = %.f\"%CC)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector current,(mA) = 2\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10, Page No. 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# maximum collector current\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Bv=12.0           # battery voltage in V\n",
      "P=2.0             # power in Watt\n",
      "\n",
      "#Calculations\n",
      "Ic=(P/Bv)*10**3\n",
      "\n",
      "#Result\n",
      "print(\"The maximum collector current,Ic(mA) = %.1f\"%Ic)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum collector current,Ic(mA) = 166.7\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11, Page No. 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# gain\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "del_ic=1.0        # in mA\n",
      "del_ib=10.0       # in micro-A\n",
      "del_Vbe=0.02      # in V\n",
      "del_ib=10*10**-6  # in A\n",
      "Rc=2.0            # in k-ohm\n",
      "Rl=10.0           # in k-ohm\n",
      "\n",
      "#Calculations\n",
      "Beta=del_ic/(del_ib*10**3)\n",
      "Ri=(del_Vbe/del_ib)*10**-3\n",
      "Rac=Rc*Rl/(Rc+Rl);\n",
      "Av=round(Beta*Rac/Ri);\n",
      "Ap=Beta*Av;\n",
      "\n",
      "#Result\n",
      "print(\"Current gain,Beta         = %.f\"%Beta)\n",
      "print(\"Input impedence,Ri(k-ohm) = %.f\"%Ri)\n",
      "print(\"Effective load,Rac(k-ohm) = %.2f\"%(math.floor(Rac*100)/100))\n",
      "print(\"Voltage gain,Av           = %.f\"%Av)\n",
      "print(\"power gain,Ap             = %.f\"%Ap)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current gain,Beta         = 100\n",
        "Input impedence,Ri(k-ohm) = 2\n",
        "Effective load,Rac(k-ohm) = 1.66\n",
        "Voltage gain,Av           = 83\n",
        "power gain,Ap             = 8300\n"
       ]
      }
     ],
     "prompt_number": 70
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12, Page No. 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# output voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Rc=10.0         # in k-ohm\n",
      "Rl=10           # in k-ohm\n",
      "Beta=100.0\n",
      "Ri=2.5\n",
      "Iv=2.0          # input voltage in mV\n",
      "\n",
      "#Calculations\n",
      "Rac=Rc*Rl/(Rc+Rl)\n",
      "Av=round(Beta*Rac/Ri)\n",
      "Ov=Av*Iv*10**-3\n",
      "\n",
      "#Result\n",
      "print(\"Output voltage,(V) = %.1f\"%Ov)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage,(V) = 0.4\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13, Page No.133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# gain and resistance \n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "I=1.0\n",
      "hfe=46.0\n",
      "hoe=80*10**-6\n",
      "hre=5.4*10**-4\n",
      "hie=800.0             # in ohm\n",
      "RL=5*10**3            # in ohm\n",
      "Rg=500                # in ohm\n",
      "\n",
      "#Result\n",
      "Aie=hfe/(I+(hoe*RL))\n",
      "Aie = math.floor(Aie*10)/10\n",
      "Zie=hie-(hre*RL*Aie)\n",
      "Ave=(Aie*RL)/Zie\n",
      "Ave=math.floor(Ave*10)/10\n",
      "Zoe=((hie+Rg)/(hoe*(hie+Rg)-(hfe*hre)))/10**3\n",
      "Ape=Aie*Ave\n",
      "\n",
      "#Result\n",
      "print(\"Current gain,Aie             = %.1f\"%(Aie))\n",
      "print(\"Input resistance,Zie(ohm)    = %.1f\"%(Zie))\n",
      "print(\"Voltage gain,Ave             = %.1f\"%Ave)\n",
      "print(\"Output resistance,Zoe(k-ohm) = %.1f\"%Zoe)\n",
      "print(\"Power gain,Ape               = %.1f\"%Ape)\n",
      "#voltage gain and power gain are calculated wrong in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current gain,Aie             = 32.8\n",
        "Input resistance,Zie(ohm)    = 711.4\n",
        "Voltage gain,Ave             = 230.5\n",
        "Output resistance,Zoe(k-ohm) = 16.4\n",
        "Power gain,Ape               = 7560.4\n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14, Page No.141"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# gain and voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "A=100.0              # gain without feedback\n",
      "Beta=1.0/25          # feed back ratio\n",
      "vi=50.0              # mV\n",
      "Af=(A/(1+(Beta*A)))  # gain with feedback\n",
      "ff=Beta*A            # feedback factor\n",
      "Vo=Af*vi*10**-3      # in V\n",
      "fv=Beta*Vo           # in V\n",
      "vin=vi*(1+Beta*A)    # mV\n",
      "\n",
      "#Result\n",
      "print(\"gain with feedback is ,              = %.f\"%Af)\n",
      "print(\"feedback factor is,                  = %.f\"%ff)\n",
      "print(\"output voltage is ,(V)               = %.f\"%Vo)\n",
      "print(\"feedback voltage is ,(V)             = %.2f\"%fv)\n",
      "print(\"new increased input voltage is ,(mV) = %.f\"%vin)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gain with feedback is ,              = 20\n",
        "feedback factor is,                  = 4\n",
        "output voltage is ,(V)               = 1\n",
        "feedback voltage is ,(V)             = 0.04\n",
        "new increased input voltage is ,(mV) = 250\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15, Page No. 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# voltage gain\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "A=1000.0               # gain without feedback\n",
      "fctr=0.40              # gain reduction factor\n",
      "\n",
      "A2=800.0               # redued gain\n",
      "\n",
      "#Calculations\n",
      "Af=A-fctr*A                # gain with feedback\n",
      "Beta=((A/Af)-1)/A          # feed back ratio\n",
      "Af2=((A2)/(1+(Beta*A2)))\n",
      "prfb= ((A-A2)/A)*100       #percentage reduction without feedback\n",
      "prwfb= ((Af-Af2)/Af)*100   #percentage reduction without feedback\n",
      "\n",
      "#Result\n",
      "print(\"(i) voltage gain  is ,                             = %.1f\"%Af2)\n",
      "print(\"(ii) percentage reduction without feedback is,(%%) = %.f\"%prfb)\n",
      "print(\"     percentage reduction with feedback is,(%%)    = %.2f\"%(math.ceil(prwfb*100)/100))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) voltage gain  is ,                             = 521.7\n",
        "(ii) percentage reduction without feedback is,(%) = 20\n",
        "     percentage reduction with feedback is,(%)    = 13.05\n"
       ]
      }
     ],
     "prompt_number": 81
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16, Page No. 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# small change in gain\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "A=200.0            #gain without feedback\n",
      "Beta=0.25          #feed back ratio\n",
      "gc=10              #percent gain change\n",
      "\n",
      "#Calculations\n",
      "dA=gc/100.0\n",
      "dAf= ((1/(1+Beta*A)))*dA\n",
      "#Result\n",
      "print(\"small change in gain is, = %.4f\"%(math.floor(dAf*10**4)/10**4))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "small change in gain is, = 0.0019\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17, Page No.143"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# input voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "A=200.0              # gain without feedback\n",
      "Beta=0.05            # feed back ratio\n",
      "Dn=10.0              # percentage distortion\n",
      "vo=0.5               # initial output voltage\n",
      "\n",
      "#Calculations\n",
      "Af=(A/(1+(Beta*A)))  # gain with feedback\n",
      "Dn1=(Dn/(1+A*Beta))  # percentage Distortion with negative feedback\n",
      "ff=Beta*A            # feedback factor\n",
      "vi=A*vo              # in V\n",
      "vin=vi/Af            # in V\n",
      "\n",
      "#Result\n",
      "print(\"gain with negative feedback is ,                      = %.1f\"%Af)\n",
      "print(\"percentage Distortion with negative feedback is ,(%%)  = %.3f\"%Dn1)\n",
      "print(\"new input voltage is ,(V)                             = %.1f\"%vin)\n",
      "#gain and input voltage are calculated wrong in the textbook   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gain with negative feedback is ,                      = 18.2\n",
        "percentage Distortion with negative feedback is ,(%)  = 0.909\n",
        "new input voltage is ,(V)                             = 5.5\n"
       ]
      }
     ],
     "prompt_number": 83
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.18, Page No. 143"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# percentage of feedback\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "A=50.0                     # gain without feedback\n",
      "Af=10.0                    # gain with feedback\n",
      "\n",
      "#Calculations\n",
      "Beta=(((A/Af)-1)/A)*100    # feed back ratio\n",
      "print(\"percentage of feedback is ,(%%) = %.f\"%Beta)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "percentage of feedback is ,(%) = 8\n"
       ]
      }
     ],
     "prompt_number": 84
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.19, Page No. 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# band width\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Bw=200.0                # bandwidth in kHz\n",
      "vg=40.0                 # dB\n",
      "fb=5.0                  # percentage negetive feedback\n",
      "A=40.0                  # gain without feedback\n",
      "\n",
      "#Calculations\n",
      "Beta=fb/100             # feed back ratio\n",
      "Af=(A/(1+(Beta*A)))     # gain with feedback\n",
      "Bwf= (A*Bw)/Af          # Bandwidth with feedback\n",
      "\n",
      "#Result\n",
      "print(\" new band-width is ,(kHz) = %.f\"%Bwf)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " new band-width is ,(kHz) = 600\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20, Page No. 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# percentage reduction\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "A=50.0                # gain without feedback\n",
      "Af=25.0               # gain with feedback\n",
      "Ad=40.0               # new gain after ageing\n",
      "\n",
      "#Calculations\n",
      "Beta=(((A/Af)-1)/A)   # feed back ratio\n",
      "Af1=(Ad/(1+(Beta*Ad)))# new gain with feedback\n",
      "df=Af-Af1             # reduction in gain\n",
      "pdf= (df/Af)*100      # percentage reduction in gain\n",
      "\n",
      "#Result\n",
      "print(\" percentage reduction in gain is ,(%%) = %.1f\"%pdf)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " percentage reduction in gain is ,(%) = 11.1\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21, Page No. 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Av and beta\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Af=100.0               # gain with feeback\n",
      "vi=50.0                # in mV\n",
      "vi1=60.0               # in mV\n",
      "\n",
      "#Calcualtion\n",
      "AAf=vi1/vi\n",
      "A=AAf*Af\n",
      "Beta=(((A/Af)-1)/A)\n",
      "\n",
      "#Result\n",
      "print(\"Av is ,= %.f\"%A)\n",
      "print(\"feedback factor is, = %.5f or 1/600\"%Beta)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Av is ,= 120\n",
        "feedback factor is, = 0.00167 or 1/600\n"
       ]
      }
     ],
     "prompt_number": 57
    }
   ],
   "metadata": {}
  }
 ]
}