{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 : Multistage Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.1\n",
      " - Page No : 275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import log10\n",
      "#Given data\n",
      "Av1 = 60 # voltage gain of first stage\n",
      "Av2 = 100 # voltage gain of second stage \n",
      "Av3 = 160 # voltage gain of third stage \n",
      "Av= Av1*Av2*Av3 # overall voltage gain \n",
      "Av_indB= 20*log10(Av) # overall voltage gain in dB\n",
      "print \"The overall voltage gain of the amplifier = %0.3f dB \" %Av_indB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The overall voltage gain of the amplifier = 119.645 dB \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.2\n",
      " - Page No : 275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Av = 80 # overall voltage gain in dB\n",
      "Av2 = 20*log10(150) # voltage gain of second stage in dB\n",
      "Av1= Av-Av2 #voltage gain of first stage in dB\n",
      "print \"The voltage gain of first stage = %0.2f dB \" %Av1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage gain of first stage = 36.48 dB \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.3\n",
      " - Page No : 286"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Av1 = -60 # voltage gain of first stage \n",
      "R_C = 500 # in ohm\n",
      "Rin = 1 # in k ohm\n",
      "Rin = Rin * 10**3 # in ohm\n",
      "h_fe = 50 # unit less\n",
      "Av2 = -h_fe*(R_C/Rin) # voltage gain of second stage \n",
      "Av = Av1*Av2 # overall voltage gain stage \n",
      "print \"The overall voltage gain = %0.f\" %Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The overall voltage gain = 1500\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.4\n",
      " - Page No : 287"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R11 = 4 # in k ohm\n",
      "R21 = 20 # in k ohm\n",
      "h_ie = 1.1 # in k ohm\n",
      "R_C1=4 # in k ohm\n",
      "R22= 10 # in k ohm\n",
      "R12= 2 # in k ohm\n",
      "Zb = h_ie # in k ohm\n",
      "Zin = (R11*R21*Zb)/( (R11*R21)+(R21*Zb)+(Zb*R11) ) # in k ohm\n",
      "print \"The input impedance = %0.3f k ohm \" %Zin\n",
      "h_oe = 0 # unit less\n",
      "R_C2 = 2 # in k ohm\n",
      "# Zout= 1/h_oe || R_C2 = R_C2\n",
      "Zout = R_C2 # in k ohm\n",
      "print \"The output impedance = %0.f k ohm \" %Zout\n",
      "h_fe = 50 # unit less\n",
      "R_L = 10 # in k ohm\n",
      "Av2= -h_fe/h_ie*(R_C2*R_L/(R_C2+R_L)) # voltage gain of second stage\n",
      "Rac1= 1/(1/R_C1+1/R22+1/R12+1/h_ie) # in k ohm\n",
      "Av1= -h_fe/h_ie*Rac1 # voltage gain of first stage\n",
      "Av= Av1*Av2 # overall voltage gain \n",
      "print \"The overall voltage gain = %0.f \" %Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The input impedance = 0.827 k ohm \n",
        "The output impedance = 2 k ohm \n",
        "The overall voltage gain = 1958 \n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.5\n",
      " - Page No : 287"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R1 = 10 # in k ohm\n",
      "R2 = 5 # in k ohm\n",
      "Zb = 1 # in k ohm\n",
      "Zin = (R1*R2*Zb)/( (R1*R2)+(R2*Zb)+(Zb*R1) ) # in k ohm\n",
      "print \"The input impedance = %0.3f k ohm \" %Zin\n",
      "R_C1 = 2 # in k ohm\n",
      "R_E1 = 2 # in k ohm\n",
      "R_C2 = 2 # in k ohm\n",
      "R_E2 = 2 # in k ohm\n",
      "h_oe = 0 # unit less\n",
      "#Zout= 1/h_oe || R_C2\n",
      "Zout = R_C2 # in k ohm\n",
      "print \"The output impedance = %0.f k ohm \" %Zout\n",
      "h_fe = 100 # unit less\n",
      "h_ie = 1 # in k ohm\n",
      "R_ac=0.222 # in k ohm\n",
      "Av2= -h_fe/h_ie*R_C2 # voltage gain of second stage\n",
      "Rac1= 1/(1/R_C1+1/R1+1/R2+1/h_ie) # in k ohm\n",
      "Av1= -h_fe/h_ie*R_ac # voltage gain of first stage\n",
      "Av= Av1*Av2 # overall voltage gain \n",
      "print \"The overall voltage gain = %0.f \" %Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The input impedance = 0.769 k ohm \n",
        "The output impedance = 2 k ohm \n",
        "The overall voltage gain = 4440 \n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.7\n",
      " - Page No : 291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt \n",
      "#Given data\n",
      "Z_L = 16 # in ohm\n",
      "Z_desh_L = 10 # in k ohm\n",
      "Z_desh_L = Z_desh_L* 10**3 # in ohm\n",
      "# a = N1/N2 = sqrt( ZdasL/Z_L ) \n",
      "a = sqrt( Z_desh_L/Z_L ) # ratio of primary to secondary turns of step-down transformer\n",
      "print \"The transformer turm ratio = %0.f \" %a"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The transformer turm ratio = 25 \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.8\n",
      " - Page No : 291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Z_L = 10 # in ohm\n",
      "Z_desh_L = 1 # in k ohm\n",
      "Z_desh_L = Z_desh_L * 10**3 # in ohm\n",
      "Zs = Z_desh_L # in ohm\n",
      "# a = N1/N2 = sqrt(Z_desh_L/Z_L) \n",
      "a = sqrt(Z_desh_L/Z_L) #turn ratio of the transformer \n",
      "print \"The turn ratio of the transformer = %0.f \" %a"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The turn ratio of the transformer = 10 \n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.9\n",
      " - Page No : 291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Z_L = 25 # in ohm\n",
      "Z_S = 10 # in k ohm\n",
      "Z_S = Z_S * 10**3 # in k ohm\n",
      "# Z_S = (a**2)*Z_L \n",
      "a = sqrt(Z_S/Z_L) #turn ratio of the transformer \n",
      "print \"The transformer turn ratio = %0.f \" %a\n",
      "#V2 = V1/a = Vs/a \n",
      "Vs = 8 # in V\n",
      "V2 = Vs/a # in V\n",
      "V_L =V2 # in V\n",
      "print \"The load voltage = %0.1f V \" %V_L"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The transformer turn ratio = 20 \n",
        "The load voltage = 0.4 V \n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.10\n",
      " - Page No : 292"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi \n",
      "#Given data\n",
      "V_CC = 12 # in V\n",
      "r_e = 25 # in mV\n",
      "r_e = r_e * 10**-3 # in V\n",
      "R1 = 1.2 # in Mohm\n",
      "R1 = R1 * 10**6 # in ohm\n",
      "R3 = 1.2 # in Mohm\n",
      "R3 = R3 * 10**6 # in ohm\n",
      "R4 = 8 # in k ohm\n",
      "R4 = R4 * 10**3 # in ohm\n",
      "R5 = 24 # in k ohm\n",
      "R5 = R5 * 10**3 # in ohm\n",
      "Beta1 = 100 # unit less\n",
      "Beta2 = 100 # unit less\n",
      "I_B2 = V_CC/R3 # in A\n",
      "I_C2 = Beta2*I_B2 # in A\n",
      "I_E2 = I_C2 # in A\n",
      "r_e2 = r_e/I_E2 # in ohm\n",
      "Rac2 = (R4*R5)/(R4+R5) # in ohm\n",
      "Av2 = -(Rac2/r_e2) #voltage gain of second stage \n",
      "print \"The voltage gain of second stage = %0.f \" %Av2\n",
      "Rac1 = (R3*(Beta2*r_e2))/(R3+(Beta2*r_e2)) # in  ohm\n",
      "L = 1 # in H\n",
      "f = 4 # in kHz\n",
      "f = f * 10**3 # in Hz\n",
      "X_L = 2*pi*f*L # in ohm\n",
      "r_e1 = r_e2 # in ohm\n",
      "Av1 = round(-Rac1/r_e1 ) # voltage gain of first stage\n",
      "print \"The voltage gain of first stage at 4 kHz = %0.f \" %Av1\n",
      "Av = Av1*Av2 # overall voltage gain\n",
      "Av = 20*log10(Av) # in dB\n",
      "print \"The overall voltage gain = %0.1f dB \" %Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage gain of second stage = -240 \n",
        "The voltage gain of first stage at 4 kHz = -100 \n",
        "The overall voltage gain = 87.6 dB \n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.11\n",
      " - Page No : 294"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "V_CC = 25 # in V\n",
      "R1 = 180 # in k ohm\n",
      "R1 = R1*10**3 # in ohm\n",
      "R2 = 20 # in k ohm\n",
      "R2 = R2 * 10**3 # in ohm\n",
      "R_C2 = 20 # in k ohm\n",
      "R_C2 = R_C2 * 10**3 # in ohm\n",
      "R_C1 = R_C2 # in ohm\n",
      "R_E1 = 1.8 # in k ohm\n",
      "R_E1 = R_E1 * 10**3 # in ohm\n",
      "R_E2 = 4.3 # in k ohm\n",
      "R_E2 = R_E2 * 10**3 # in ohm\n",
      "R_L = 30 # in k ohm\n",
      "R_L = R_L * 10**3 # in ohm\n",
      "V_BE = 0.7 # in V\n",
      "Beta2 = 50 # unit less\n",
      "Beta1 = 50 # unit less\n",
      "V_Th1 = (V_CC/(R1+R2))*R2 # in V\n",
      "R_Th1 = (R1*R2)/(R1+R2) # in  ohm\n",
      "I_B = (V_Th1-V_BE)/( R_Th1+((Beta1+1)*R_E1) ) # in A\n",
      "I_E1 = (Beta1+1)*I_B # in A\n",
      "V_T = 25 # in mV\n",
      "V_T = V_T * 10**-3 # in V\n",
      "r_e1 = V_T/I_E1 # in ohm\n",
      "I_C1 = I_E1 # in A\n",
      "V_C1 = V_CC-(I_C1*R_C1) # in V\n",
      "#V_E2 = V_B2-V_BE = V_C1-V_BE # in V\n",
      "V_E2 = V_C1-V_BE # in V\n",
      "I_E2 = V_E2/R_E2 # in A\n",
      "r_e2 = V_T/I_E2 # in ohm\n",
      "Rac2 = (R_C1*R_L)/(R_C1+R_L) # in  ohm\n",
      "Av2 = -Rac2/(r_e2+R_E2) # voltage gain of second stage \n",
      "Rac1 = (R_C1*(Beta1*(r_e2+R_E2)))/(R_C1+(Beta1*(r_e2+R_E2))) # in ohm\n",
      "Av1 = -Rac1/(r_e1+R_E1) # voltage gain of first stage \n",
      "Av = Av1*Av2 # voltage gain\n",
      "print \"The voltage gain = %0.2f \" %Av\n",
      "r_in = R1*R2*Beta1*(r_e1+R_E1)/( (R1*R2)+(R2*(Beta1*(r_e1+R_E1)))+((Beta1*(r_e1+R_E1))*R1) ) # in ohm\n",
      "r_in= r_in*10**-3 # in k ohm\n",
      "print \"The input resistance = %0.2f k ohm \" %r_in"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage gain = 27.82 \n",
        "The input resistance = 15.04 k ohm \n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.12\n",
      " - Page No : 296"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "I_DSS = 15 # in mA\n",
      "I_DSS  = I_DSS * 10**-3 # in A\n",
      "V_P = -4 # in V\n",
      "g_mo = (-2*I_DSS)/V_P # in S\n",
      "V_GSQ = -2 # in V\n",
      "g_m = g_mo*( 1-(V_GSQ/V_P) ) # in S\n",
      "R_D = 2.7 # in k ohm\n",
      "R_D = R_D * 10**3 # in ohm\n",
      "Av1 = -g_m*R_D # voltage gain of first stage\n",
      "Av2 = Av1 # voltage gain of second stage\n",
      "Av = Av1*Av2 # overall voltage gain\n",
      "print \"The overall voltage gain = %0.1f \" %Av\n",
      "R_G = 2 # in Mohm\n",
      "Rin = R_G # in Mohm\n",
      "print \"The input impedance = %0.f Mohm \" %Rin\n",
      "Rout = R_D # in ohm\n",
      "Rout= Rout*10**-3 # in k ohm\n",
      "print \"The output impedance = %0.1f k ohm \" %Rout\n",
      "Rout= Rout*10**3 # in ohm\n",
      "Vin = 15 # in mV\n",
      "Vin = Vin  * 10**-3 # in V\n",
      "Vout = Av*Vin # in V\n",
      "print \"The output voltage = %0.2f V \" %Vout\n",
      "R_L = 15 # in k ohm\n",
      "R_L = R_L * 10**3 # in ohm\n",
      "V_L = (R_L/(Rout+R_L))*Vout # in V\n",
      "print \"The output voltage across load resistance = %0.1f V \" %V_L"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The overall voltage gain = 102.5 \n",
        "The input impedance = 2 Mohm \n",
        "The output impedance = 2.7 k ohm \n",
        "The output voltage = 1.54 V \n",
        "The output voltage across load resistance = 1.3 V \n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.13\n",
      " - Page No : 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data)\n",
      "f2 = 100 # in kHz\n",
      "f_H = f2/(sqrt(2**(1/3)-1 )) # in kHz\n",
      "print \"The upper 3-dB frequency of each stage = %0.2f kHz \" %f_H\n",
      "f1 = 25 # in kHz\n",
      "f_L = f1/(sqrt(2**(1/3)-1 )) # in kHz\n",
      "print \"The lower 3-dB frequency of each stage = %0.2f kHz \" %f_L\n",
      "\n",
      "# Note: The value of upper 3-dB frequency in the book is not accurate and the \n",
      "#       calculated value of f_L is wrong. because 25 will be divided by 0.51 not multiplied."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The upper 3-dB frequency of each stage = 196.15 kHz \n",
        "The lower 3-dB frequency of each stage = 49.04 kHz \n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 8.14\n",
      " - Page No : 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R_E= 1 # in k ohm\n",
      "h_ie= R_E # in k ohm\n",
      "h_fe= 100 # unit less\n",
      "#V1= I1*[h_ie+(1+h_fe)*h_ie+(1+h_fe)**2*R_E]+I2*R_E                          (i)\n",
      "#V2= I1*(1+h_fe)**2*R_E + I2*R_E                                             (ii)\n",
      "#Z= [(h_ie+(1+h_fe)*h_ie+(1+h_fe)**2*R_E) R_E (1+h_fe)**2*R_E R_E]\n",
      "Z11= (h_ie+(1+h_fe)*h_ie+(1+h_fe)**2*R_E) # k ohm\n",
      "Z12= R_E # k ohm\n",
      "Z21= (1+h_fe)**2*R_E # k ohm\n",
      "Z22= R_E # k ohm\n",
      "print \"The value of Z11 = %0.1f M ohm \" %(Z11*10**-3)\n",
      "print \"The value of Z12 = %0.f k ohm \" %(Z12)\n",
      "print \"The value of Z21 = %0.1f M ohm \" %(Z21*10**-3)\n",
      "print \"The value of Z22 = %0.f k ohm \" %(Z22)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Z11 = 10.3 M ohm \n",
        "The value of Z12 = 1 k ohm \n",
        "The value of Z21 = 10.2 M ohm \n",
        "The value of Z22 = 1 k ohm \n"
       ]
      }
     ],
     "prompt_number": 24
    }
   ],
   "metadata": {}
  }
 ]
}