{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter5 - Feedback amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.1 - page 383"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "A= 800 # unit less\n",
      "Af= 50 # unit less\n",
      "# Formula Af= A/(1+Bita*A)\n",
      "Beta= 1/Af-1/A \n",
      "print \"Percentage of output which is feedback to the input  = %0.3f %%\" %(Beta*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage of output which is feedback to the input  = 1.875 %\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.2 - page 384"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Af= 100 # unit less\n",
      "Vi= 50 # in mV\n",
      "Vi= Vi*10**-3 # in V\n",
      "Vs= 0.5 # in V\n",
      "# Formula Af= Vo/Vs\n",
      "Vo= Af*Vs # in V\n",
      "A= Vo/Vi \n",
      "print \"Value of A is %0.f \"%A\n",
      "# Formula Af= A/(1+B*A)\n",
      "B= 1/Af-1/A \n",
      "B=B*100 # in %\n",
      "print \"Value of B is %0.1f %%\" %B"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of A is 1000 \n",
        "Value of B is 0.9 %\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.3 - page 385"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Beta= 5/100 \n",
      "f_H= 50 # in kHz\n",
      "f_H= f_H*10**3 # in Hz\n",
      "f_L= 50 # in kHz\n",
      "Amid= 1000 \n",
      "f_LF= f_L/(1+Beta*Amid) # in Hz\n",
      "f_HF= f_H*(1+Beta*Amid) # in Hz\n",
      "print \"Value of f_LF = %0.2f Hz\" %f_LF\n",
      "print \"Value of f_HF = %0.2f MHz\" %(f_HF*10**-6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of f_LF = 0.98 Hz\n",
        "Value of f_HF = 2.55 MHz\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.4 - page 385"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "dAf_by_Af= 0.2/100 \n",
      "dA_by_A= 150/2000 \n",
      "A=2000 \n",
      "# Formula dAf_by_Af = 1/(1+Bita*A) * dA_by_A\n",
      "Beta= dA_by_A/(A*dAf_by_Af )-1/A \n",
      "Af= A/(1+Beta*A) \n",
      "print \"Value of Beta = %0.3f %%\" %(Beta*100)\n",
      "print \"Value of Af is %0.2f \" %Af"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Beta = 1.825 %\n",
        "Value of Af is 53.33 \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.5 - page 386"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Av= 140 \n",
      "Avf= 17.5 \n",
      "# Formula Avf= Av/(1+Av*Beta)\n",
      "Beta= 1/Avf-1/Av \n",
      "print \"Fraction of the output is %0.2f \"%Beta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of the output is 0.05 \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.6 - page 386"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Av= 100 \n",
      "Avf= 50 \n",
      "# Formula Avf= Av/(1+Av*Beta)\n",
      "Beta= 1/Avf-1/Av \n",
      "print \"The vlaue of beta is %0.2f\" %Beta\n",
      "\n",
      "# Part(ii)\n",
      "Avf= 75 \n",
      "# Formula Avf= Av/(1+Av*Beta)\n",
      "Av= Avf/(1-Beta*Avf)\n",
      "print \"Value of amplifier gain is %0.f \"%Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The vlaue of beta is 0.01\n",
        "Value of amplifier gain is 300 \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.7 - page 387"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Av= 50 \n",
      "Avf= 25 \n",
      "# Formula Avf= Av/(1+Av*Beta)\n",
      "Beta= 1/Avf-1/Av \n",
      "# Part(i)\n",
      "Av=50 \n",
      "Avf= 40 \n",
      "Perc_reduction= (Av-Avf)/Av*100 # Percentage of reduction in stage gain in %\n",
      "print \"Without feedback, percentage of reduction in stage gain = %0.f %%\" %(Perc_reduction)\n",
      "\n",
      "# Part(ii)\n",
      "Av= 40 \n",
      "Avf= 25 \n",
      "gain_with_neg_feed= Av/(1+Beta*Av) \n",
      "Perc_reduction= (Avf-gain_with_neg_feed)/Avf*100 # in %\n",
      "print \"With feedback, percentage reduction in stage gain = %0.1f %%\" %Perc_reduction"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Without feedback, percentage of reduction in stage gain = 20 %\n",
        "With feedback, percentage reduction in stage gain = 11.1 %\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.8 - page 387"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# Given data\n",
      "Ao= 10**4 \n",
      "Afo= 50 \n",
      "omega_H= 2*pi*100 # in rad/s\n",
      "# Formula Afo= Ao/(1+Ao*Beta)\n",
      "Beta= 1/Afo-1/Ao \n",
      "omega_f_H= omega_H*(1+Ao*Beta) \n",
      "print \"Closed loop bandwidth in rad/s is\",omega_f_H,\"or 2*pi*20*10**3\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Closed loop bandwidth in rad/s is 125663.706144 or 2*pi*20*10**3\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.10 - page 399"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import inf\n",
      "# Given data\n",
      "gm=50 \n",
      "R_E= 100 # in ohm\n",
      "R_S= 1 # in kohm\n",
      "R_S=R_S*10**3 # in ohm\n",
      "r_pi= 1100 # in ohm\n",
      "h_ie= r_pi \n",
      "# Formula Av= Vo/Vs, But Vo= gm*vpi*R_E and Vs= Ib*(Ri+rpi), so\n",
      "Av= gm*R_E/(R_S+h_ie)\n",
      "# As Vo=Vf, so\n",
      "Beta=1 \n",
      "D= 1+Beta*Av \n",
      "Avf= Av/D \n",
      "Ri= R_S+r_pi # in ohm\n",
      "Ri= Ri*10**-3 # in kohm\n",
      "R_if= Ri*D # in kohm\n",
      "Ro= inf # ohm\n",
      "Rof= Ro*D # ohm\n",
      "print \"Value of Av = %0.2f \" %Av\n",
      "print \"Value of Beta = %0.f\" %Beta\n",
      "print \"Value of Avf = %0.2f\" %Avf\n",
      "print \"Value of Ri = %0.2f kohm\" %Ri\n",
      "print \"Value of R_if = %0.2f kohm\" % R_if\n",
      "print \"Value of R_of = %0.2f \" % Rof\n",
      "# Answer slightly mismatch because of calculation accuracy in the textbook."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Av = 2.38 \n",
        "Value of Beta = 1\n",
        "Value of Avf = 0.70\n",
        "Value of Ri = 2.10 kohm\n",
        "Value of R_if = 7.10 kohm\n",
        "Value of R_of = inf \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.11 - page 400"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "gm=2 # in mA/V\n",
      "gm=gm*10**-3 # in A/V\n",
      "r_d= 40 # in kohm\n",
      "r_d= r_d*10**3 # in ohm\n",
      "Rs= 3 # in kohm\n",
      "Rs= Rs*10**3 # in ohm\n",
      "miu= gm*r_d \n",
      "Bita=1 \n",
      "Av= miu*Rs/(r_d+Rs) \n",
      "D= 1+Bita*Av \n",
      "Avf= Av/D \n",
      "Ri=inf # ohm\n",
      "R_if = Ri*D # ohm\n",
      "Rof= r_d/D # in ohm\n",
      "print \"Value of Av = %0.2f \" %Av\n",
      "print \"Value of D = %0.2f \" %D\n",
      "print \"Value of Avf = %0.3f \" %Avf\n",
      "print \"Value of R_if = %0.2f \" % R_if\n",
      "print \"Value of R_of = %0.2e \" % Rof"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Av = 5.58 \n",
        "Value of D = 6.58 \n",
        "Value of Avf = 0.848 \n",
        "Value of R_if = inf \n",
        "Value of R_of = 6.08e+03 \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.12 - page 406"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "gm=75 # in A/V\n",
      "Rs= 1 # in kohm\n",
      "Rs= Rs*10**3 # in ohm\n",
      "R_E= 1 # in kohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "rpi= 1 # in kohm\n",
      "rpi= rpi*10**3 # in ohm\n",
      "hie=rpi \n",
      "\n",
      "Io= -gm \n",
      "Vi= Rs+R_E+rpi \n",
      "Gm= Io/Vi \n",
      "print \"Value of Gm = %0.3f \" %Gm\n",
      "Beta=-R_E \n",
      "print \"Value of Beta = %0.f  \" %Beta\n",
      "D= 1+Beta*Gm \n",
      "print \"Value of D = %0.f  \" %D\n",
      "Gmf= -Gm/D \n",
      "print \"Value of Gmf = %0.1e\" %Gmf\n",
      "Ri= Rs+R_E+hie # in ohm\n",
      "Rif= Ri*D # in ohm\n",
      "Rif=Rif*10**-3 # in kohm\n",
      "print \"Value of Rif = %0.f kohm\" %Rif\n",
      "Ro=inf  \n",
      "R_of = Ro*D  # ohm\n",
      "print \"Value of R_of = %0.2f  \" %R_of"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Gm = -0.025 \n",
        "Value of Beta = -1000  \n",
        "Value of D = 26  \n",
        "Value of Gmf = 9.6e-04\n",
        "Value of Rif = 78 kohm\n",
        "Value of R_of = inf  \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.19 - page 417"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "A= 10**5 \n",
      "Af= 100 \n",
      "# Formula Af= A/(1+A*Bita)\n",
      "Bita= 1/Af-1/A \n",
      "\n",
      "\n",
      "#when A= 10**3\n",
      "A=10**3 \n",
      "Af_desh= A/(1+A*Bita) \n",
      "\n",
      "delta_Af= Af_desh-Af \n",
      "Perc_Change_inAf= delta_Af/Af*100 # in %\n",
      "print \"Percentage change in Af = %0.f %% \" %Perc_Change_inAf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage change in Af = -9 % \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.20 - page 417"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import log10\n",
      "# Given data\n",
      "A= 100 \n",
      "Vs=1 # in volt\n",
      "Beta=1 # as in the voltage follower, the output voltage is same as input\n",
      "Af= A/(1+Beta*A) \n",
      "CLG= 1+A*Beta # closed loop gain\n",
      "print \"Closed loop gain = %0.f\" %CLG\n",
      "CLG_dB= 20*log10(CLG) \n",
      "print \"Closed loop gain = %0.1f dB\" %CLG_dB\n",
      "Vo= Af*Vs # in V\n",
      "print \"Value of Vo = %0.2f Volt\" %Vo\n",
      "Vi= Vs-Vo # in V\n",
      "print \"Value of Vi = %0.2f mV\" %round(Vi*10**3)\n",
      "# If A decrease 10%,i.e.\n",
      "A=90 \n",
      "Af_desh= A/(1+Beta*A) \n",
      "Per_gain_reduction= (Af_desh-Af)/Af*100 # in %\n",
      "print \"Percentage of gain reduction = %0.1f %%\" %Per_gain_reduction"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Closed loop gain = 101\n",
        "Closed loop gain = 40.1 dB\n",
        "Value of Vo = 0.99 Volt\n",
        "Value of Vi = 10.00 mV\n",
        "Percentage of gain reduction = -0.1 %\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.21 - page 418"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "# Part (a)\n",
      "PerError= 1 # in %\n",
      "A= 10**5 # (Assumed value)\n",
      "ABita= 1/PerError*100 \n",
      "Bita= 1/(PerError*A) \n",
      "print \"% error                A                     A\u00df                   1+A\u00df\"\n",
      "print PerError,\"                   %.e\"%A,\"              \",ABita,\"                 \",1+ABita\n",
      "# Part (b)\n",
      "PerError= 5 # in %\n",
      "ABita= 1/PerError*100 \n",
      "Bita= 1/(PerError*A) \n",
      "print PerError,\"                   %.e\"%A,\"               \",ABita,\"                  \",1+ABita\n",
      "# Part (c)\n",
      "PerError= 50 # in %\n",
      "ABita= 1/PerError*100 \n",
      "Bita= 1/(PerError*A) \n",
      "print PerError,\"                  %.e\"%A,\"                \",ABita,\"                   \",1+ABita"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "% error                A                     A\u00df                   1+A\u00df\n",
        "1                    1e+05                100.0                   101.0\n",
        "5                    1e+05                 20.0                    21.0\n",
        "50                   1e+05                  2.0                     3.0\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.22 - page 419"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "S= -20 # sensitivity of closed to open loop gain in dB\n",
      "# sensitivity of closed to open loop gain = 1/(1+AB) = S\n",
      "# or (1+AB) = -S\n",
      "AB= 10**(-S/20) - 1 \n",
      "print \"The loop gain AB  = %0.2f, \\nfor which the sensitivity of closed loop gain to open loop gain is -20 dB\" %AB\n",
      "\n",
      "# Part (b) when \n",
      "S= 1/2 # sensitivity of closed to open loop gain in dB\n",
      "#S= 1/(1+AB)\n",
      "AB= 1/S-1 \n",
      "print \"The loop gain AB = %0.2f, \\nfor which the sensitivity of closed loop gain to open loop gain is 1/2 \" %AB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The loop gain AB  = 9.00, \n",
        "for which the sensitivity of closed loop gain to open loop gain is -20 dB\n",
        "The loop gain AB = 1.00, \n",
        "for which the sensitivity of closed loop gain to open loop gain is 1/2 \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.23 - page 419"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given Data\n",
      "A = 1e5\n",
      "Af = 1e3\n",
      "Beta = 0.99*1e-3 \n",
      "GDF = 1+A*Beta\n",
      "print \"Gain density factor %0.2f\" %GDF\n",
      "# part (a)\n",
      "A_dash = A*90/100\n",
      "Af_dash = A_dash/(1+A_dash*Beta)\n",
      "cp = (Af-Af_dash)/Af*100 # Corresponding %\n",
      "print \"(a) Corresponding % =\",round(cp,2),\"%\"\n",
      "# part (a)\n",
      "A_dash = A*70/100\n",
      "Af_dash = A_dash/(1+A_dash*Beta)\n",
      "cp = (Af-Af_dash)/Af*100 # Corresponding %\n",
      "print \"(b) Corresponding % =\",round(cp,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain density factor 100.00\n",
        "(a) Corresponding % = 0.11 %\n",
        "(b) Corresponding % = 0.43 %\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.24 - page 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "A=100 \n",
      "Af= 10 \n",
      "f_L= 100 # in Hz\n",
      "f_H= 10 # in kHz\n",
      "# Af= A/(1+A*Bita)\n",
      "Bita= 1/Af-1/A \n",
      "f_desh_L= f_L/(1+A*Bita) # in Hz\n",
      "f_desh_H= f_H/(1+A*Bita) # in kHz\n",
      "print \"Low frequency = %0.2f Hz\" %f_desh_L\n",
      "print \"High frequency = %0.2f kHz\" %f_desh_H\n",
      "\n",
      "# Note: In the book Calculation to find the value of high frequency i.e. f_desh_H is wrong so the answer in the book is wrong "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Low frequency = 10.00 Hz\n",
        "High frequency = 1.00 kHz\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.25 - page 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Vs= 100 # in mV\n",
      "Vf= 95 # in mV\n",
      "Vs= Vs*10**-3 # in V\n",
      "Vf= Vf*10**-3 # in V\n",
      "Vo=10 # in V\n",
      "Vi= Vs-Vf # in V\n",
      "Av= Vo/Vi # in V/V\n",
      "print \"Value of Av = %0.e V/V\" %Av\n",
      "Beta= Vf/Vo # in V/V\n",
      "print \"Value of Bita = %0.1e V/V\" %Beta\n",
      "\n",
      "# Note: In the book Calculation to find the value of Beta is wrong so the asnwer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Av = 2e+03 V/V\n",
        "Value of Bita = 9.5e-03 V/V\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.26 - page 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Is= 100 # in \u00b5A\n",
      "Is= Is*10**-6 # in A\n",
      "If= 95 # in \u00b5A\n",
      "Io= 10 # in mA\n",
      "A= Io*1e-3/((Is-If)*1e-6) # n A/A\n",
      "Beta= If/Io # A/A\n",
      "print \"Value of Av = %0.e V/V\" %Av\n",
      "print \"Value of Beta = %0.1f \u00b5A/mA\" %Beta\n",
      "# Note: In the book , to evaluating the value of Beta, they putted wrong value of If (90 at place of 95)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Av = 2e+03 V/V\n",
        "Value of Beta = 9.5 \u00b5A/mA\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.28 - page 422"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "A=2000 #V/V\n",
      "Beta= 0.1 # inV/V\n",
      "Ri= 1 # in kohm\n",
      "Ri= Ri*10**3 # in ohm\n",
      "Ro= 1 # in kohm\n",
      "Ro= Ro*10**3 # in ohm\n",
      "Af= A/(1+A*Bita) \n",
      "print \"The gain Af = %0.2f \"%Af\n",
      "Rif= Ri*(1+A*Beta) # in ohm\n",
      "print \"The input resistance = %0.f kohm\" %(Rif*10**-3)\n",
      "Rof= Ro*1e3/(1+A*Beta) # in ohm\n",
      "print \"The output resistance = %0.3f kohm\" %(Rof*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The gain Af = 11.05 \n",
        "The input resistance = 201 kohm\n",
        "The output resistance = 4.975 kohm\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.29 - page 423"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "\n",
      "# Part (b)\n",
      "Af= 10 \n",
      "A= 10**4 \n",
      "# Af= A/(1+A*Beta) \n",
      "Beta= 1/Af-1/A \n",
      "# Beta= R1/(R1+R2)\n",
      "R2_by_R1= 1/Beta-1 \n",
      "print \"(b) Value of R2/R1 = %0.2f\" %R2_by_R1\n",
      "\n",
      "# Part (c)\n",
      "Vs= 1 # in V\n",
      "Vo= (1+R2_by_R1)*Vs \n",
      "print \"(c) Value of Vo = %0.2f Volt\" %Vo\n",
      "Vf= Vo/(1+R2_by_R1)\n",
      "print \"Value of Vf = %0.2f Volt\" %Vf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(b) Value of R2/R1 = 9.01\n",
        "(c) Value of Vo = 10.01 Volt\n",
        "Value of Vf = 1.00 Volt\n"
       ]
      }
     ],
     "prompt_number": 23
    }
   ],
   "metadata": {}
  }
 ]
}