{
 "metadata": {
  "name": "",
  "signature": "sha256:60cd4e612c661e75774f4e02987168334e7c814ac1287153a9eb4e69ab4db901"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 - Feedback Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 434"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex8_1 pg-434\n",
      "#calculate Input signal,Gain after feedback,Feedback\n",
      "import math\n",
      "A=120. #amplification gain\n",
      "Vi=50.*10.**(-3.) #input voltage\n",
      "Beta=0.1 #feedback factor\n",
      "Vo= A*Vi #output voltage without feedback\n",
      "print '%s %.2f' %(\"Input signal = V\",Vo)\n",
      "Vs=Vi-Beta*Vo \n",
      "#input signal +ve output because of -ve feedback (calue in texxtbook is wrong)\n",
      "print '%s %.2f' %(\"Input signal = V\",abs(Vs))\n",
      "vg=A/(1.+Beta*A) #voltage gain \n",
      "print '%s %.1f' %(\"Gain after feedback =\",vg)\n",
      "fb=(-1.)*20.*math.log10(1+(Beta*A))\n",
      "print '%s %.3f' %(\"Feedback (db)=\",fb)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input signal = V 6.00\n",
        "Input signal = V 0.55\n",
        "Gain after feedback = 9.2\n",
        "Feedback (db)= -22.279\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 435"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex8_2 pg-435\n",
      "#calculate\n",
      "ff=4. #feedback factor\n",
      "BW=6.*10.**(6.) #bandwidth in Hz\n",
      "BW_fb=BW*(1.+ff) #Bandwidth with feedback factor(since Beta is +ve)\n",
      "print '%s %.0f' %(\"Bandwidth with feedback factor = MHz\",BW_fb*10**-6)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth with feedback factor = MHz 30\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 435"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex8_3 pg-435\n",
      "#calculate Negative Feedback factor,Beta\n",
      "openA=60000. #open loop gain \n",
      "closeA=10000. #closed loop gain\n",
      "Beta=((openA/closeA)-1.)/closeA\n",
      "print '%s %.4f' %(\"Negative Feedback factor=\",Beta)\n",
      "BA=Beta*openA #value of Beta*A\n",
      "print '%s %.0f' %(\"Beta*A=\",BA)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Negative Feedback factor= 0.0005\n",
        "Beta*A= 30\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 435"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex8_4 pg-435\n",
      "#calculate Feedback factor,Gain after negative feedback\n",
      "Df=0.5/100. #distortion after negative feedback\n",
      "D=8./100. #harmonic distortion \n",
      "BA=D/Df-1 #value of Beta*A\n",
      "A=200.\n",
      "Beta=BA/A #feedback factor\n",
      "print'%s %.3f'%(\"Feedback factor=\",Beta)\n",
      "Af=A/(1.+BA) #Gain after -ve feedback\n",
      "print'%s %.1f'%(\"Gain after negative feedback=\",Af)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Feedback factor= 0.075\n",
        "Gain after negative feedback= 12.5\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 436"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex8_5 pg-436\n",
      "#calculate Decrement in distortion,Percentage change in distortion\n",
      "A=100. #voltage gain\n",
      "per=10./100. #percentage of negative feedback applied\n",
      "BA=A*per #value of Beta*A\n",
      "Af=A/(1.+BA) #gain after negative feedback\n",
      "print '%s' %(\"Decrement in distortion,D-Df = D-(D/(1+Beta*A))\")\n",
      "print '%s %.1f' %(\"=\",Af)\n",
      "per_dis=(BA/(1.+BA))*100. #percentage change in distortion \n",
      "print '%s %.0f' %(\"Percentage change in distortion=\",per_dis)\n",
      "red=100-per_dis #reduction\n",
      "print '%s %.0f' %(\"Therefore reduction is=\",red)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Decrement in distortion,D-Df = D-(D/(1+Beta*A))\n",
        "= 9.1\n",
        "Percentage change in distortion= 91\n",
        "Therefore reduction is= 9\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 436"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex8_6 pg-436\n",
      "#calculate Voltage gain after negative feedback,Voltage gain after negative feedback,Beta\n",
      "A=50. #voltage gain\n",
      "per=10./100. #percentage of negative feedback applied\n",
      "BA=per*A #value of Beta*A\n",
      "Af=A/(1.+BA) #gain after negative feedback\n",
      "print '%s' %(\"(1) Voltage gain after negative feedback\")\n",
      "print '%s %.2f' %(\"=\",Af)\n",
      "A=50. #voltage gain\n",
      "per=5./100. #percentage of negative feedback applied\n",
      "BA=per*A #value of Beta*A\n",
      "Af1=A/(1.+BA) #gain after negative feedback\n",
      "print '%s' %(\"(2) Voltage gain after negative feedback\")\n",
      "print '%s %.1f' %(\"=\",Af1)\n",
      "print '%s' %(\"\\nSo the new gain is not double the previous case\")\n",
      "print '%s' %(\"The difference between expected value and actual value of gain obtained is\")\n",
      "diff_value=2.*Af-Af1 \n",
      "print '%s %.2f' %(\"=\",diff_value)\n",
      "print '%s' %(\"\\n(3) To have the gain double of case(1) i.e 16.66,let the feedback introduced be Beta(assuming negative feedback)\")\n",
      "Af=16.66 #voltage gain with negative feedback\n",
      "A=50. #voltage gain\n",
      "Beta=((A/Af)-1.)/A #feedback in percentage\n",
      "print '%s %.2f' %(\"Beta=\",Beta)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(1) Voltage gain after negative feedback\n",
        "= 8.33\n",
        "(2) Voltage gain after negative feedback\n",
        "= 14.3\n",
        "\n",
        "So the new gain is not double the previous case\n",
        "The difference between expected value and actual value of gain obtained is\n",
        "= 2.38\n",
        "\n",
        "(3) To have the gain double of case(1) i.e 16.66,let the feedback introduced be Beta(assuming negative feedback)\n",
        "Beta= 0.04\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}