{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ch-14 : Feedback Amplifiers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 452 Example 14.1."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The percentage change in gain of the amplifier with feedback is\n",
      "    dAf/Af = dA/A * 1/(1+A*beta) = 0.24 %\n"
     ]
    }
   ],
   "source": [
    "A=1000.\n",
    "beta=0.04\n",
    "dA=10.\n",
    "print \"The percentage change in gain of the amplifier with feedback is\"\n",
    "dAf=dA*(1/(1+(A*beta)))\n",
    "print \"    dAf/Af = dA/A * 1/(1+A*beta) = %0.2f %%\"%dAf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 452 Example 14.2."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1 + A*beta) =10.00\n",
      "Also, the gain with feedback is\n",
      "      Af = A / (1+A*beta)\n",
      "Therefore,      A =1000.00\n",
      "       1 + A*beta = 10# i.e. A*beta = 9\n",
      "Therefore,      beta =0.01\n"
     ]
    }
   ],
   "source": [
    "Af=100.\n",
    "dAf=0.02\n",
    "dA=0.2\n",
    "Ab=dA/dAf\n",
    "print \"(1 + A*beta) =%0.2f\"%Ab\n",
    "print \"Also, the gain with feedback is\"\n",
    "print \"      Af = A / (1+A*beta)\"\n",
    "A=Af*Ab\n",
    "print \"Therefore,      A =%0.2f\"%A\n",
    "print \"       1 + A*beta = 10# i.e. A*beta = 9\"\n",
    "beta=9./A\n",
    "print \"Therefore,      beta =%0.2f\"%beta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 455 Example 14.3."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a) We have BWf = (1 + A*beta) * BW\n",
      "    BWf  =1.50 MHz\n",
      "Gain with feedback,  Af = A / (1+ A*beta) =20.83\n",
      "(b) BWf = (1 + A*beta'') * BW\n",
      "1*10**6 = (1 + 125*beta'')*250*10**3\n",
      "Therefore,     beta =0.02\n",
      "i.e.   beta (in %) =2.40\n"
     ]
    }
   ],
   "source": [
    "A=125.\n",
    "BW=250*10**3\n",
    "beta=0.04\n",
    "print \"(a) We have BWf = (1 + A*beta) * BW\"\n",
    "BWf = (1 + (A*beta))*BW\n",
    "x1=BWf*10**-6\n",
    "print \"    BWf  =%0.2f MHz\"%x1\n",
    "Af=A/(1+(A*beta))\n",
    "print \"Gain with feedback,  Af = A / (1+ A*beta) =%0.2f\"%Af\n",
    "print \"(b) BWf = (1 + A*beta'') * BW\"\n",
    "print \"1*10**6 = (1 + 125*beta'')*250*10**3\"\n",
    "Bd=3./125\n",
    "print \"Therefore,     beta =%0.2f\"%Bd\n",
    "Bd1=Bd*100\n",
    "print \"i.e.   beta (in %%) =%0.2f\"%Bd1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 456 Example 14.4."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The voltage gain with feedback\n",
      "  Af = A / (1 + A*beta) =80.00\n",
      "New lower 3dB frequency,\n",
      "  f_1f = f1 / 1+A*beta =10.00 Hz\n",
      "New upper 3dB frequency,\n",
      "  f2f = (1+A*beta)*f2 =1.00 MHz\n",
      "Distortion with feedback,\n",
      "  Df = D / 1+A*beta =2.00 %\n"
     ]
    }
   ],
   "source": [
    "A=400.\n",
    "f1=50.\n",
    "f2=200*10**3\n",
    "D=10.\n",
    "beta=0.01\n",
    "print \"The voltage gain with feedback\"\n",
    "Af=A/(1+(A*beta))\n",
    "print \"  Af = A / (1 + A*beta) =%0.2f\"%Af\n",
    "print \"New lower 3dB frequency,\"\n",
    "f1f=f1/(1+(A*beta))\n",
    "print \"  f_1f = f1 / 1+A*beta =%0.2f Hz\"%f1f\n",
    "print \"New upper 3dB frequency,\"\n",
    "f2f=(1+(A*beta))*f2\n",
    "x2=f2f*10**-6\n",
    "print \"  f2f = (1+A*beta)*f2 =%0.2f MHz\"%x2\n",
    "print \"Distortion with feedback,\"\n",
    "Df=D/(1+(A*beta))\n",
    "print \"  Df = D / 1+A*beta =%0.2f %%\"%Df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 458 Example 14.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage gain,      Af = A / (1+A*beta) =83.33\n",
      "Input resistance,  Rif = (1+(A*beta))*Ri =18.00 kohm\n",
      "Output resistance, Rof = Ro / (1+A*beta) =3.33 kohm\n"
     ]
    }
   ],
   "source": [
    "A=500.\n",
    "Ri=3*10**3\n",
    "Ro=20*10**3\n",
    "beta=0.01\n",
    "Af=A/(1+(A*beta))\n",
    "print \"Voltage gain,      Af = A / (1+A*beta) =%0.2f\"%Af\n",
    "Rif=(1+(A*beta))*Ri\n",
    "x1=Rif*10**-3\n",
    "print \"Input resistance,  Rif = (1+(A*beta))*Ri =%0.2f kohm\"%x1\n",
    "Rof=Ro/(1+(A*beta))\n",
    "x2=Rof*10**-3\n",
    "print \"Output resistance, Rof = Ro / (1+A*beta) =%0.2f kohm\"%x2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 460 Example 14.6."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  Ai = 1 + hfe =81.00\n",
      "  Ri = hie + (1+hfe)*RL =167.00 kohm\n",
      "  Av = Ai*RL / Ri =0.00\n",
      "  Ro = hie+Rs / 1+hfe =69.14 ohm\n",
      "  Rof = Ro || RL =66.82 ohm\n"
     ]
    }
   ],
   "source": [
    "Ai=1+80\n",
    "print \"  Ai = 1 + hfe =%0.2f\"%Ai\n",
    "Ri=(5*10**3)+((1+80)*(2*10**3))  #in ohm\n",
    "x1=Ri*10**-3 #in k-ohm\n",
    "print \"  Ri = hie + (1+hfe)*RL =%0.2f kohm\"%x1\n",
    "Av=(81*2*10**3)/(167*10**3)\n",
    "print \"  Av = Ai*RL / Ri =%0.2f\"%Av\n",
    "Ro=(5000.+600)/(1.+80) # in ohm\n",
    "print \"  Ro = hie+Rs / 1+hfe =%0.2f ohm\"%Ro\n",
    "Rof=(69.13*2000)/(2069.13)  #in ohm\n",
    "print \"  Rof = Ro || RL =%0.2f ohm\"%Rof"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 461 Example 14.7."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  R''L = RB || RL =1000.00 ohm\n",
      "  Av = -hfe*R''L / hie =-30.48\n",
      "  Rif = hie || (RB / 1-Av) =1013.17 ohm\n",
      "  Avf = Vo/Vs = Av*Rif / RS+Rif =-19.14\n",
      "  Rof = (RB / RS) * (RS+hie / hfe) =4.67 kohm\n",
      "  R''of = Rof || RL =1.40 kohm\n"
     ]
    }
   ],
   "source": [
    "RL=((40*2)/42)*10**3 #in ohm\n",
    "print \"  R''L = RB || RL =%0.2f ohm\"%RL\n",
    "Av=(-80*1905.)/5000.\n",
    "print \"  Av = -hfe*R''L / hie =%0.2f\"%Av\n",
    "x1=(40000.)/(1+30.48)\n",
    "Rif=(x1*5000.)/(x1+5000) #in ohm\n",
    "print \"  Rif = hie || (RB / 1-Av) =%0.2f ohm\"%Rif\n",
    "Avf=(-30.48*1013.172)/(600+1013.172)\n",
    "print \"  Avf = Vo/Vs = Av*Rif / RS+Rif =%0.2f\"%Avf\n",
    "Rof=(40000/600.)*(5600./80) #in ohm\n",
    "x2=Rof*10**-3 #in k-ohm\n",
    "print \"  Rof = (RB / RS) * (RS+hie / hfe) =%0.2f kohm\"%x2\n",
    "Roff=(4.666*2)/(6.666) #in k-ohm\n",
    "print \"  R''of = Rof || RL =%0.2f kohm\"%Roff,"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page No. 462 Example 14.8."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)  A = -hfe*RL / hie =-40.00\n",
      "     Ri = hie = 2 k-ohm\n",
      "(b)  beta = Re / RL =0.10\n",
      "(c)  Rif = hie + (1+hfe)*Re =10.10 kohm\n",
      "(d)  Af = -hfe*RL / Rif =-7.92\n",
      "(e)  Loop gain, beta = -40*0.1 = -4 i.e. 20log4 =12.04 dB\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "R1=20.*10**3\n",
    "R2=20.*10**3\n",
    "hie=2.*10**3\n",
    "RL=1.0*10**3\n",
    "Re=100.\n",
    "hfe=80.\n",
    "A=(-hfe*RL)/hie\n",
    "print \"(a)  A = -hfe*RL / hie =%0.2f\"%A\n",
    "print \"     Ri = hie = 2 k-ohm\"\n",
    "beta=Re/RL\n",
    "print \"(b)  beta = Re / RL =%0.2f\"%beta\n",
    "Rif=hie+((1+hfe)*Re)\n",
    "x1=Rif*10**-3\n",
    "print \"(c)  Rif = hie + (1+hfe)*Re =%0.2f kohm\"%x1\n",
    "Af=(-hfe*RL)/Rif\n",
    "print \"(d)  Af = -hfe*RL / Rif =%0.2f\"%Af\n",
    "lg=20.*log10(4)\n",
    "print \"(e)  Loop gain, beta = -40*0.1 = -4 i.e. 20log4 =%0.2f dB\"%lg"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
