{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Feedback Amplifier"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.1, Page No 481"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Rs=0          #in V\n",
      "hfe=50.0      #in K\n",
      "hie=1.1       #in K\n",
      "hre=0         #in K\n",
      "hoe=0         #in K\n",
      "\n",
      "print('We first calculate the effective load Rl1 at the first calculator')\n",
      "r1=10         #in K\n",
      "r2=47         #in K\n",
      "r3=33.0       #in K\n",
      "r4=1+0.1      #in K\n",
      "\n",
      "#Calculations\n",
      "Rl1=(r1*r2*r3*r4)/((r1*r2*r3)+(r1*r2*r4)+(r1*r3*r4)+(r2*r3*r4))\n",
      "print(\"Rl1= %.2f K \" %Rl1)\n",
      "\n",
      "print('Similarly for 2nd Transistor')\n",
      "R1=0.1            #in K\n",
      "R2=4.7            #in K\n",
      "Rc1=R1+R2\n",
      "Rc2=4.7          #in K\n",
      "\n",
      "Rl2=(Rc1*Rc2)/(Rc1+Rc2)\n",
      "print(\"Rl2= %.2f K\" %Rl2)\n",
      "\n",
      "\n",
      "Re=(R1*R2)/(R1+R2)\n",
      "\n",
      "print('Voltage Gain of Transistor Q1')\n",
      "Av1 = -(hfe*Rl1)/(hie+((1+hfe)*Re))\n",
      "print(\"Av1= %.2f v \" %Av1)\n",
      "\n",
      "print('Voltage Gain of Transistor Q2')\n",
      "Av2=-(hfe*Rl2)/hie\n",
      "print(\"Av2= %.2f v \" %Av2)\n",
      "print('Voltage Gain of two transistors in cascade without feedback')\n",
      "Av=Av1*Av2\n",
      "print(\"Av= %.2f v \" %Av)\n",
      "\n",
      "B=R1/(R1+R2)#beta which is feedback\n",
      "D=1+(B*Av)\n",
      "\n",
      "Avf=Av/D\n",
      "print(\"Avf= %.2f v \" %Avf)\n",
      "\n",
      "print('Input resistance without external feedback')\n",
      "Ri=hie+(1+hfe)*Re\n",
      "print(\"Ri= %.2f K \" %Ri)\n",
      "\n",
      "Rif=Ri*D\n",
      "\n",
      "#Results\n",
      "print(\"Rif= %.2f K \" %Rif)\n",
      "Ro=Rl2\n",
      "Rof=Ro/D*1000\n",
      "print(\"Rof= %.2f ohm\" %Rof)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We first calculate the effective load Rl1 at the first calculator\n",
        "Rl1= 0.94 K \n",
        "Similarly for 2nd Transistor\n",
        "Rl2= 2.37 K\n",
        "Voltage Gain of Transistor Q1\n",
        "Av1= -7.74 v \n",
        "Voltage Gain of Transistor Q2\n",
        "Av2= -107.94 v \n",
        "Voltage Gain of two transistors in cascade without feedback\n",
        "Av= 835.02 v \n",
        "Avf= 45.39 v \n",
        "Input resistance without external feedback\n",
        "Ri= 6.09 K \n",
        "Rif= 112.10 K \n",
        "Rof= 129.09 ohm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2a, Page No 484"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Gmf=-1           #Transconductance in mA/V\n",
      "D=50.0           #Desensivity\n",
      "Avf=-4           #Voltage Gain\n",
      "Rs=1.0           #in K\n",
      "hfe=150.0\n",
      "Vt=0.026        #in V\n",
      "\n",
      "#Calculations\n",
      "Gm=Gmf*D\n",
      "print(\"Gm= %.2f mA/V \" %Gm)\n",
      "\n",
      "#B=-Re, D = 1+B*Gm = 1-B*Gm\n",
      "Re=(1.0-D)/Gm         #in K\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"Re= %.2f K \" %Re)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gm= -50.00 mA/V \n",
        "Re= 0.98 K \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2b Page No 484"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Rc1=3#in K\n",
      "Rc2=0.5#in K\n",
      "Re=0.05#in K\n",
      "Rs=1.2#in K\n",
      "hfe=50.0\n",
      "hie=1.1#in K\n",
      "hre=0\n",
      "hoe=0\n",
      "\n",
      "R=Rs\n",
      "\n",
      "#Calculations\n",
      "#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)\n",
      "# -Ic2/Ib2 =- hfe = -50\n",
      "# Ic1/Ib1 = hfe\n",
      "#Let Ib2/Ic1 = k\n",
      "Ri2= hie+((1+hfe)*(Re*R/(Re+R)))\n",
      "k=-Rc1/(Rc1+Ri2)\n",
      "\n",
      "r= Rs*(Rs+Re)/(Rs+R+Re)\n",
      "#Let Ib1/Is = l\n",
      "l=r/(r+hie)\n",
      "\n",
      "Ai=(-hfe)*(k)*(hfe)*(l)\n",
      "\n",
      "B=Re/(Re+R)#beta\n",
      "D=1+(B*Ai)\n",
      "\n",
      "Aif=Ai/D\n",
      "\n",
      "Avf=(Aif*Rc2)/Rs\n",
      "\n",
      "#To find Rif\n",
      "\n",
      "Ri=(r*hie)/(r+hie)\n",
      "Rif=Ri/D\n",
      "\n",
      "#Results\n",
      "print(\"The value of Rif= %.2f ohm \" %(Rif*1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Rif= 22.63 ohm \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2c, Page No 484"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Gmf=-1     #Transconductance in mA/V\n",
      "D=50.0     #Desensivity\n",
      "Avf=-4     #Voltage Gain\n",
      "Rs=1.0     #in K\n",
      "hfe=150.0     \n",
      "Vt=0.026    #in V\n",
      "Gm=Gmf*D\n",
      "\n",
      "#Calculations\n",
      "#B=-Re, D = 1+B*Gm = 1-B*Gm\n",
      "Re=(1-D)/Gm#in K\n",
      "Rl=Avf/Gmf#in K\n",
      "# Gm= -hfe/(Rs+hie+Re)\n",
      "hie= -(hfe/Gm)-Rs-Re\n",
      "Ri = Rs + hie +Re\n",
      "Rif = Ri*D\n",
      "\n",
      "#Results\n",
      "print(\"The value of Rif= %.2f K \" %Rif)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Rif= 150.00 K \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2d Page No 484"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Gmf=-1       #Transconductance in mA/V\n",
      "D=50.0       #Desensivity\n",
      "Avf=-4       #Voltage Gain\n",
      "Rs=1.0       #in K\n",
      "hfe=150.0 \n",
      "Vt=0.026     #in V\n",
      "Gm=Gmf*D\n",
      "\n",
      "#Calculations\n",
      "#B=-Re, D = 1+B*Gm = 1-B*Gm\n",
      "Re=(1-D)/Gm#in K\n",
      "Rl=Avf/Gmf#in K\n",
      "\n",
      "# Gm= -hfe/(Rs+hie+Re)\n",
      "hie= -(hfe/Gm)-Rs-Re\n",
      "Ri = Rs + hie +Re\n",
      "Rif = Ri*D\n",
      "Ic=(hfe*Vt)/hie\n",
      "\n",
      "#Results\n",
      "print(\"Quiscent Collector Current =  %.2f mA \" %Ic)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Quiscent Collector Current =  3.82 mA \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3a Page No 489"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Rc1=3#in K\n",
      "Rc2=0.5#in K\n",
      "Re=0.05#in K\n",
      "Rs=1.2#in K\n",
      "hfe=50.0\n",
      "hie=1.1#in K\n",
      "hre=0\n",
      "hoe=0\n",
      "R=Rs\n",
      "\n",
      "#Calculations\n",
      "#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)\n",
      "# -Ic2/Ib2 =- hfe = -50\n",
      "# Ic1/Ib1 = hfe\n",
      "#Let Ib2/Ic1 = k\n",
      "Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))\n",
      "k=-Rc1/(Rc1+Ri2)\n",
      "r= Rs*(Rs+Re)/(Rs+R+Re)\n",
      "#Let Ib1/Is = l\n",
      "l=r/(r+hie)\n",
      "Ai=(-hfe)*(k)*(hfe)*(l)\n",
      "\n",
      "print(\"The value of Ai = %.2f \" %Ai)\n",
      "\n",
      "B=Re/(Re+R)#beta\n",
      "D=1+(B*Ai)\n",
      "\n",
      "Aif=Ai/D\n",
      "print(\"The value of Aif = %.2f v \" %Aif)\n",
      "\n",
      "Avf=(Aif*Rc2)/Rs\n",
      "\n",
      "#Results\n",
      "print(\"The value of Avf = %.2f v \" %Avf)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Ai = 409.55 \n",
        "The value of Aif = 23.56 v \n",
        "The value of Avf = 9.82 v \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3b, Page No 489"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Rc1=3.0     #in K\n",
      "Rc2=0.5     #in K\n",
      "Re=0.05     #in K\n",
      "Rs=1.2      #in K\n",
      "hfe=50.0 \n",
      "hie=1.1    #in K\n",
      "hre=0\n",
      "hoe=0\n",
      "R=Rs\n",
      "\n",
      "#Calculations\n",
      "#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)\n",
      "# -Ic2/Ib2 =- hfe = -50\n",
      "# Ic1/Ib1 = hfe\n",
      "#Let Ib2/Ic1 = k\n",
      "Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))\n",
      "k=-Rc1/(Rc1+Ri2)\n",
      "r= Rs*(Rs+Re)/(Rs+R+Re)\n",
      "#Let Ib1/Is = l\n",
      "l=r/(r+hie)\n",
      "Ai=(-hfe)*(k)*(hfe)*(l)\n",
      "B=Re/(Re+R)#beta\n",
      "D=1+(B*Ai)\n",
      "Aif=Ai/D\n",
      "Avf=(Aif*Rc2)/Rs\n",
      "\n",
      "#To find Rif\n",
      "Ri=(r*hie)/(r+hie)\n",
      "Rif=Ri/D\n",
      "\n",
      "#Results\n",
      "print(\"The value of Rif =  %.2f ohm \" %(Rif*1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Rif =  22.63 ohm \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3c Page No 489"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "Rc1=3.0   #in K\n",
      "Rc2=0.5   #in K\n",
      "Re=0.05   #in K\n",
      "Rs=1.2    #in K\n",
      "hfe=50.0 \n",
      "hie=1.1   #in K\n",
      "hre=0\n",
      "hoe=0\n",
      "R=Rs\n",
      "\n",
      "#Calculations\n",
      "#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)\n",
      "# -Ic2/Ib2 =- hfe = -50\n",
      "# Ic1/Ib1 = hfe\n",
      "#Let Ib2/Ic1 = k\n",
      "Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))\n",
      "k=-Rc1/(Rc1+Ri2)\n",
      "\n",
      "r= Rs*(Rs+Re)/(Rs+R+Re)\n",
      "#Let Ib1/Is = l\n",
      "l=r/(r+hie)\n",
      "\n",
      "Ai=(-hfe)*(k)*(hfe)*(l)\n",
      "\n",
      "B=Re/(Re+R)#beta\n",
      "D=1+(B*Ai)\n",
      "\n",
      "Aif=Ai/D\n",
      "\n",
      "Avf=(Aif*Rc2)/Rs\n",
      "\n",
      "Ri=(r*hie)/(r+hie)\n",
      "Rif=Ri/D\n",
      "\n",
      "rif=(Rif*Rs)/(Rs-Rif)\n",
      "\n",
      "#Results\n",
      "print(\"Resistance with feedback seen by voltage source is %.2f K \" %(rif+Rs))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance with feedback seen by voltage source is 1.22 K \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3d Page No 489"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Rc1=3.0        #in K\n",
      "Rc2=0.5        #in K\n",
      "Re=0.05        #in K\n",
      "Rs=1.2         #in K\n",
      "hfe=50.0\n",
      "hie=1.1        #in K\n",
      "hre=0\n",
      "hoe=0\n",
      "R=Rs\n",
      "\n",
      "#Calculations\n",
      "#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)\n",
      "# -Ic2/Ib2 =- hfe = -50\n",
      "# Ic1/Ib1 = hfe\n",
      "#Let Ib2/Ic1 = k\n",
      "Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))\n",
      "k=-Rc1/(Rc1+Ri2)\n",
      "r= Rs*(Rs+Re)/(Rs+R+Re)\n",
      "#Let Ib1/Is = l\n",
      "l=r/(r+hie)\n",
      "Ai=(-hfe)*(k)*(hfe)*(l)\n",
      "B=Re/(Re+R)#beta\n",
      "D=1+(B*Ai)\n",
      "\n",
      "Aif=Ai/D\n",
      "Avf=(Aif*Rc2)/Rs\n",
      "Rof=(Avf*Rs)/Aif\n",
      "\n",
      "#Results\n",
      "print(\"Output Resistance = %.2f K \" %Rof)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output Resistance = 0.50 K \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4a Page No 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Rc=4#in K\n",
      "r=40#in K\n",
      "Rs=10#in K\n",
      "hie=1.1#in K\n",
      "hfe=50\n",
      "hre=0\n",
      "hoe=0\n",
      "\n",
      "#Calculations\n",
      "#Required Formulae\n",
      "rc=(Rc*r)/(Rc+r)\n",
      "R=(Rs*r)/(Rs+r)\n",
      "Rm=-(hfe*rc*R)/(R+hie)\n",
      "print(\"The value of Rm = %.2f K \" %Rm)\n",
      "B=-1/r#in mA/V\n",
      "D=1+(B*Rm)\n",
      "Rmf=Rm/D\n",
      "#Avf = Vo/Vs = Vo/(Is*Rs) = Rmf/Rs\n",
      "Avf=Rmf/Rs\n",
      "\n",
      "#Results\n",
      "print(\"The value of Avf = %.2f v \" %Avf)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Rm = -131.87 K \n",
        "The value of Avf = -0.10 v \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4b , Page No 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Rc=4.0     #in K\n",
      "r=40.0     #in K\n",
      "Rs=10.0    #in K\n",
      "hie=1.1    #in K\n",
      "hfe=50.0\n",
      "hre=0\n",
      "hoe=0\n",
      "\n",
      "#Calculations\n",
      "#Required Formulae\n",
      "rc=(Rc*r)/(Rc+r)\n",
      "R=(Rs*r)/(Rs+r)\n",
      "Rm=-(hfe*rc*R)/(R+hie)\n",
      "B=-1.0/r#in mA/V\n",
      "D=1+(B*Rm)\n",
      "Rmf=Rm/D\n",
      "#Avf = Vo/Vs = Vo/(Is*Rs) = Rmf/Rs\n",
      "Avf=Rmf/Rs\n",
      "Ri = (R*hie)/(R+hie)\n",
      "Rif=Ri/D\n",
      "\n",
      "#Results\n",
      "print(\"The value of Rif = %.2f v \" %Rif)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Rif = 0.19 v \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4c, Page No 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Rc=4.0    #in K\n",
      "r=40.0    #in K\n",
      "Rs=10.0   #in K\n",
      "hie=1.1   #in K\n",
      "hfe=50.0\n",
      "hre=0\n",
      "hoe=0\n",
      "\n",
      "#Calculations\n",
      "#Required Formulae\n",
      "rc=(Rc*r)/(Rc+r)\n",
      "R=(Rs*r)/(Rs+r)\n",
      "Rm=-(hfe*rc*R)/(R+hie)\n",
      "\n",
      "print(\"The value of Rm = %.2f v \" %Rm)\n",
      "B=-1/r#in mA/V\n",
      "D=1+(B*Rm)\n",
      "Rmf=Rm/D\n",
      "#Avf = Vo/Vs = Vo/(Is*Rs) = Rmf/Rs\n",
      "Avf=Rmf/Rs\n",
      "Ri = (R*hie)/(R+hie)\n",
      "Rif=Ri/D\n",
      "\n",
      "#If the input resistance looking to the right of Rs is rif then Rif=(rif*Rs)/(rif+Rs)\n",
      "rif=(Rif*Rs)/(Rs-Rif)\n",
      "\n",
      "print(\"The impedence seen by the voltage source=Rif = %.2f K \" %(Rs+rif))\n",
      "Ro=40.0    #in K\n",
      "r=40.0     #in K\n",
      "Rm = -(hfe*r*R)/(R+hie)\n",
      "Rof=Ro/(1+(B*Rm))\n",
      "#We are writting Rof' = rof\n",
      "rof=(Rof*Rc)/(Rof+Rc)\n",
      "\n",
      "#Results\n",
      "print(\"The value of rof =  %.2f K \" %rof)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Rm = -159.84 v \n",
        "The impedence seen by the voltage source=Rif = 10.20 K \n",
        "The value of rof =  0.73 K \n"
       ]
      }
     ],
     "prompt_number": 12
    }
   ],
   "metadata": {}
  }
 ]
}