{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10: Feedback in Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, Page 236"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "A=(-100.)#A=voltage gain of an amplifier\n",
      "B=(-0.04)#B=feedback ratio\n",
      "\n",
      "#Calculations&Results\n",
      "Af=A/(1+(A*B))#Af=voltage gain with feedback\n",
      "print \"1.Voltage gain with feedback Af=%.f\"%Af\n",
      "F=20*math.log10(abs(Af/A))#F=amount of feedback\n",
      "print \"2.Amount of feedback F=%.2f dB\"%F\n",
      "Vi=40*(10**-3)#Vi=input voltage\n",
      "Vo=Af*Vi#Vo=output voltage\n",
      "print \"3.Output voltage Vo=%.1f V\"%Vo\n",
      "f=(-A*B)#f=feedback factor\n",
      "print \"4.Feedback factor f=%.f\"%f\n",
      "Vf=B*Vo#Vf=feedback voltage\n",
      "print \"5.Feedback voltage is Vf=%.f mV\"%(Vf/10**-3)#Vf is converted in terms of mV\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1.Voltage gain with feedback Af=-20\n",
        "2.Amount of feedback F=-13.98 dB\n",
        "3.Output voltage Vo=-0.8 V\n",
        "4.Feedback factor f=-4\n",
        "5.Feedback voltage is Vf=32 mV\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, Page 236"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "print \"Negative feedback has to be applied for gain stability\"\n",
      "#A=open loop gain of an amplifier\n",
      "#B=feedback ratio\n",
      "\n",
      "#Calculations&Results\n",
      "Af=10.#Af=voltage gain with feedback\n",
      "#dAf/Af=(1/(1+(A*B)))*(dA/A)\n",
      "y=2#(dAf/Af)=y=percent change of gain that is allowable\n",
      "x=20.#(dA/A)=x=percent change in open loop gain of an amplifier\n",
      "a=(x/y)#(1+(A*B))=a\n",
      "print \"(1+(A*B))=%.f\"%a\n",
      "#Af=A/((1+(A*B)))\n",
      "A=(Af*a)\n",
      "print \"Open loop gain A=%.f\"%A\n",
      "#1+(A*B)=a\n",
      "B=(a-1)/A\n",
      "print \"Minimum value of feedback ratio B=%.2f\"%B\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Negative feedback has to be applied for gain stability\n",
        "(1+(A*B))=10\n",
        "Open loop gain A=100\n",
        "Minimum value of feedback ratio B=0.09\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, Page 237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "VD=0.1#VD=outputdistortion voltage\n",
      "VDf=0.05#VDf=output distortion voltage with feedback\n",
      "A=-80#A=open loop gain of an amplifier\n",
      "\n",
      "#Calculations\n",
      "#VDf=VD/(1+(A*B))\n",
      "B=((VD/VDf)-1)/A#B=reverse transmission factor\n",
      "\n",
      "#Result\n",
      "print \"Reverse transmission factor B=%.4f\"%B"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reverse transmission factor B=-0.0125\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, Page 237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "B=50.#B=reverse transmission factor for silicon transistor T1\n",
      "\n",
      "#Calculations&Results\n",
      "VB=((640.)*10)/(640+360)#calculating voltage at point B i.e VB by applying voltage divider rule in the given circuit\n",
      "print \"VB=%.1f V\"%VB\n",
      "VBE=VB-5.6#VBE=base emitter voltage drop for silicon transistors T1 and T2 both\n",
      "print \"VBE=%.1f V\"%VBE\n",
      "VA=10-0.8#VA=voltage at point A in the given circuit\n",
      "print \"VA=%.1f V\"%VA\n",
      "I1=10./(360+640)#I1=current through resistor of 360 ohm\n",
      "print \"I1=%.2f A\"%I1\n",
      "IE1=I1+1#IE1=emitter current of transistor T1\n",
      "print \"IE1=%f A\"%IE1\n",
      "#IC1=-IB1+IE1\n",
      "IB1=IE1/(B+1)#IB1=base current of transistor T1\n",
      "print \"IB1=%.2f mA\"%(IB1/10**-3)#IB1 is converted in terms of mA\n",
      "I2=(20-VA)/300#I2=current through resistor of 300 ohm\n",
      "print \"I2=%.f mA\"%(I2/10**-3)#I2 is converted in terms of mA\n",
      "IC2=I2-IB1#IC2=collector current of transistor T2\n",
      "print \"IC2=%.2f mA\"%(IC2/10**-3)#IC2 is converted in terms of mA\n",
      "#Assuming the base current IB2 of transistor T2 is negligibly small\n",
      "IE2=IC2#IE2=emitter current of transistor T2\n",
      "print \"IE2=%.2f mA\"%(IE2/10**-3)#IE2 is converted in terms of mA\n",
      "I3=(20-5.6)/1000#I3=current through 1000 ohm resistor\n",
      "print \"I3=%.1f mA\"%(I3/10**-3)#I3 is converted in terms of mA\n",
      "IZ=I3+IE2#IZ=current through zener diode\n",
      "print \"IZ=%.2f mA\"%(IZ/10**-3)#IZ is converted in terms of mA\n",
      "VCE=20-10#VCE=collector emitter voltage drop for transistor T1\n",
      "print \"VCE=%.f V\"%VCE\n",
      "IC1=B*IB1\n",
      "P=VCE*IC1#P=power dissipation in transistor T1\n",
      "print \"P=%.1f W\"%P"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "VB=6.4 V\n",
        "VBE=0.8 V\n",
        "VA=9.2 V\n",
        "I1=0.01 A\n",
        "IE1=1.010000 A\n",
        "IB1=19.80 mA\n",
        "I2=36 mA\n",
        "IC2=16.20 mA\n",
        "IE2=16.20 mA\n",
        "I3=14.4 mA\n",
        "IZ=30.60 mA\n",
        "VCE=10 V\n",
        "P=9.9 W\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, Page 238"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "A=50.#A=voltage gain of transistor amplifier\n",
      "Ri=1000#Ri=input resistance of transistor amplifier without feedback\n",
      "Ro=40*1000#Ro=output resistance of transistor amplifier feedback\n",
      "\n",
      "#Calculations&Results\n",
      "#Vf=0.1*Vo (given) where Vf=feedback voltage and Vo=output voltage\n",
      "B=0.1#B=(Vf/Vo)=feedback fraction\n",
      "Af=A/(1+(A*B))#Af=gain of the feedback amplifier\n",
      "print \"Gain of feedback amplifier Af=%.2f\"%Af\n",
      "Rif=Ri*(1+(A*B))#Rif=input resistance of the feedback amplifier\n",
      "Rof=Ro/(1+(A*B))#Rof=output resistance of the feedback amplifier\n",
      "print \"Input resistance with feedback Rif=%.f K ohms\"%(Rif/10**3)#Rif is converted in terms of kilo ohm\n",
      "print \"Output resistance with feedback Rof=%.2f K ohms\"%(Rof/10**3)#Rof is converted in terms of kilo ohm"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain of feedback amplifier Af=8.33\n",
        "Input resistance with feedback Rif=6 K ohms\n",
        "Output resistance with feedback Rof=6.67 K ohms\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}