{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter- 1 : Differential And Cascode Amplifiers\n",
      "    "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.1 - Page No 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_CC= 10 # in volt\n",
      "V_EE= V_CC \n",
      "V_BE= 0.715 # in volt\n",
      "R_c1= 2.7 # in k ohm\n",
      "R_c1= R_c1*10**3 # in ohm\n",
      "R_c2= R_c1 # in ohm\n",
      "R_E=3.9 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "Bita_ac= 100 \n",
      "Bita_dc= Bita_ac \n",
      "I_E= (V_EE-V_BE)/(2*R_E) # in amp\n",
      "I_C= I_E # in amp\n",
      "V_C= V_CC-I_C*R_c1 # in volt\n",
      "V_E= 0-V_BE # in volt\n",
      "V_CE= V_C-V_E # in volt\n",
      "re_desh= 25*10**-3/I_E \n",
      "A_d= R_c1/re_desh \n",
      "print \"Operating current = %0.2f mA\" %(I_C*10**3)\n",
      "print \"Operating voltage = %0.1f V\" %V_CE\n",
      "print \"Voltage gain = %0.1f\" %A_d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Operating current = 1.19 mA\n",
        "Operating voltage = 7.5 V\n",
        "Voltage gain = 128.6\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.2 - Page No 12\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_CC= 10 # in volt\n",
      "V_EE= 10 # in volt\n",
      "V_BE=0.7# in volt\n",
      "I_C=0.5 # in mA\n",
      "I_C=I_C*10**-3 # in amp\n",
      "R_C= 10 # in k ohm\n",
      "R_C= R_C*10**3 # in ohm\n",
      "R_E= 9.3 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "I_E= (V_EE-V_BE)/(2*R_E) # in amp\n",
      "I_CQ= I_E # in amp\n",
      "print \"Quiescent collector current = %0.1f mA\" %(I_CQ*10**3)\n",
      "V_CEQ= V_CC+V_BE-I_C*R_C # in volt\n",
      "print \"Quiescent collector emitter voltage = %0.1f V\" %V_CEQ"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Quiescent collector current = 0.5 mA\n",
        "Quiescent collector emitter voltage = 5.7 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.3  - Page No 13\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "V_CC= 12 # in volt\n",
      "V_EE= 12 # in volt\n",
      "V_BE= 0.7 # in volt\n",
      "R_C= 10 # in k ohm\n",
      "R_C= R_C*10**3 # in ohm\n",
      "R_E= 10 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "R_B= 20 # in k ohm\n",
      "R_B= R_B*10**3 # in ohm\n",
      "Bita_dc= 75 \n",
      "# Part (i)\n",
      "#Ignoring V_BE\n",
      "I_T= V_EE/R_E#in amp   \n",
      "I_E= I_T/2 # in amp\n",
      "I_C=I_E \n",
      "V_out= V_CC-I_C*R_C# in volt\n",
      "print \"Part : a\"\n",
      "print \"Output Voltage = %0.f volt (Ignoring V_BE)\" %V_out\n",
      "#Considering V_BE\n",
      "I_T= (V_EE-V_BE)/R_E#in amp   \n",
      "I_E= I_T/2 # in amp\n",
      "I_C=I_E \n",
      "V_out= V_CC-I_C*R_C# in volt\n",
      "print \"Output Voltage = %0.2f volt (Condidering V_BE)\" %V_out\n",
      "I_T= (V_EE-V_BE)/(R_E+R_B/(2*Bita_dc)) # in amp\n",
      "I_E= I_T/2 # in amp\n",
      "I_C=I_E \n",
      "V_out= V_CC-I_C*R_C# in volt\n",
      "print \"Output Voltage = %0.3f volt (With Bita_dc)\" %V_out\n",
      "\n",
      "# Part(ii)\n",
      "I_C= 0.6 # in mA\n",
      "I_C=I_C*10**-3 \n",
      "I_B= I_C/Bita_dc # in amp\n",
      "print \"\\nPart : b\"\n",
      "print \"Base current = %0.f micro amphere\" %(I_B*10**6)\n",
      "V_B= -I_B*R_B # in volt\n",
      "print \"Base Voltage = %0.2f V\" %V_B\n",
      "\n",
      "# Part (iii)\n",
      "Bita_dc= 60 \n",
      "I_B1= I_C/Bita_dc # in amp\n",
      "print \"\\nPart : c\"\n",
      "print \"Base current for transistor Q1 = %0.f micro amphere\" %(I_B1*10**6)\n",
      "V_B1= -I_B1*R_B # in volt\n",
      "print \"Base Voltage for transistor Q1 = %0.1f V\" %V_B1\n",
      "Bita_dc= 80 \n",
      "I_B2= I_C/Bita_dc # in amp\n",
      "print \"Base current for transistor Q2 = %0.1f micro amphere\" %(I_B2*10**6)\n",
      "V_B2= -I_B2*R_B # in volt\n",
      "print \"Base Voltage for transistor Q2 = %0.2f V\" %V_B2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part : a\n",
        "Output Voltage = 6 volt (Ignoring V_BE)\n",
        "Output Voltage = 6.35 volt (Condidering V_BE)\n",
        "Output Voltage = 6.424 volt (With Bita_dc)\n",
        "\n",
        "Part : b\n",
        "Base current = 8 micro amphere\n",
        "Base Voltage = -0.16 V\n",
        "\n",
        "Part : c\n",
        "Base current for transistor Q1 = 10 micro amphere\n",
        "Base Voltage for transistor Q1 = -0.2 V\n",
        "Base current for transistor Q2 = 7.5 micro amphere\n",
        "Base Voltage for transistor Q2 = -0.15 V\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.4 - Page No 14\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_CC= 10 # in volt\n",
      "V_EE= 10 # in volt\n",
      "V_BE= 0.7 # in volt\n",
      "R_C= 2.2 # in k ohm\n",
      "R_C= R_C*10**3 # in ohm\n",
      "R_E= 4.7 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "Ri_1= 50 # in ohm\n",
      "Ri_2= Ri_1 # in ohm\n",
      "Bita_dc= 100 \n",
      "Bita_ac = Bita_dc \n",
      "# Part (a)\n",
      "I_CQ = (V_EE-V_BE)/(2*R_E+Ri_1/Bita_dc) # in amp\n",
      "I_E= I_CQ # in amp\n",
      "print \"Part : a\"\n",
      "print \"Value of I_CQ = %0.4f mA\" %(I_CQ*10**3)\n",
      "V_CEQ= V_CC + V_BE - I_CQ*R_C # in volt\n",
      "print \"Value of V_CEQ = %0.4f volt\" %V_CEQ\n",
      "\n",
      "# Part(b)\n",
      "re_desh= (26*10**-3)/I_E # in ohm\n",
      "# A_d= V_out/V_ind = R_C/re_desh\n",
      "A_d = R_C/re_desh \n",
      "print \"\\nPart : b\"\n",
      "print \"Voltage gain = %0.2f \" %A_d\n",
      "\n",
      "# Part(c)\n",
      "# R_in1= R_in2= 2*Bita_ac*re_desh\n",
      "R_in1= 2*Bita_ac*re_desh # in ohm\n",
      "print \"\\nPart : c\"\n",
      "print \"Input resistance = %0.3f k ohm\" %(R_in1*10**-3)\n",
      "\n",
      "# Part(d)\n",
      "# R_out1= R_out2= R_C\n",
      "R_out1= R_C # in ohm\n",
      "print \"\\nPart : d\"\n",
      "print \"Output resistance = %0.1f k ohm\" %(R_out1*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part : a\n",
        "Value of I_CQ = 0.9893 mA\n",
        "Value of V_CEQ = 8.5235 volt\n",
        "\n",
        "Part : b\n",
        "Voltage gain = 83.71 \n",
        "\n",
        "Part : c\n",
        "Input resistance = 5.256 k ohm\n",
        "\n",
        "Part : d\n",
        "Output resistance = 2.2 k ohm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.5 - Page No 14\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_CC= 15 # in volt\n",
      "V_EE= 15 # in volt\n",
      "V_BE= 0.7 # in volt\n",
      "R_C= 1 # in M ohm\n",
      "R_C= R_C*10**6 # in ohm\n",
      "R_E= R_C # in ohm\n",
      "\n",
      "Bita_ac= 100 \n",
      "I_E = (V_EE-V_BE)/(2*R_E) # in amp\n",
      "re_desh= (26*10**-3)/I_E # in ohm\n",
      "A_d = R_C/re_desh \n",
      "print \"Voltage gain = %0.f \" %A_d\n",
      "Z_in= 2*Bita_ac*re_desh # in ohm\n",
      "print \"Input impedence = %0.4f M ohm\" %(Z_in*10**-6)\n",
      "Z_out= R_C # in ohm\n",
      "print \"Output impedence = %0.f M ohm\" %(Z_out*10**-6)\n",
      "A_cm= R_C/(2*R_E+re_desh) \n",
      "CMRR= A_d/A_cm \n",
      "print \"Common-mode rejection ratio = %0.f\" %CMRR\n",
      "I_C=I_E \n",
      "V_out= V_CC-I_C*R_C # in volt\n",
      "print \"Total output voltage at the quiescent value = %0.2f volt\" %V_out\n",
      "# when v_in = 1\n",
      "v_in= 1 # in mV\n",
      "v_in= v_in*10**-3 # in volt\n",
      "v_out= A_d*v_in \n",
      "print \"The ac output voltage = %0.3f volt\" %v_out\n",
      "\n",
      "# Note : Answer of CMRR in the book is wrong due to wrong calculation of A_cm"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gain = 275 \n",
        "Input impedence = 0.7273 M ohm\n",
        "Output impedence = 1 M ohm\n",
        "Common-mode rejection ratio = 551\n",
        "Total output voltage at the quiescent value = 7.85 volt\n",
        "The ac output voltage = 0.275 volt\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.6 - Page No 17\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_EE= 5 # in volt\n",
      "R_C= 2 # in k ohm\n",
      "R_C= R_C*10**3 # in ohm\n",
      "R_E= 4.3 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "V_BE=0.7 # in volt (Assuming)\n",
      "V_T= 26*10**-3 # in volt\n",
      "I_E = (V_EE-V_BE)/(2*R_E) # in amp\n",
      "re_desh= V_T/I_E # in ohm\n",
      "A_d = R_C/(2*re_desh) \n",
      "print \"Voltage gain = %0.2f \" %A_d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gain = 19.23 \n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.7 - Page No 17\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_EE= 5 # in volt\n",
      "R_C= 2 # in k ohm\n",
      "R_C= R_C*10**3 # in ohm\n",
      "R_E= 4.3 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "V_BE=0.7 # in volt (Assuming)\n",
      "V_T= 26*10**-3 # in volt\n",
      "I_E = (V_EE-V_BE)/(2*R_E) # in amp\n",
      "re_desh= V_T/I_E # in ohm\n",
      "A_d = R_C/(2*re_desh) \n",
      "A_cm= R_C/(2*R_E+re_desh) \n",
      "print \"Common mode gain= %0.4f\" %A_cm \n",
      "CMRR= A_d/A_cm \n",
      "print \"Common mode rejection ratio = %0.1f\" %CMRR"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Common mode gain= 0.2312\n",
        "Common mode rejection ratio = 83.2\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.8 - Page No 20\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_CC= 9 # in volt\n",
      "V_EE= 9 # in volt\n",
      "V_BE= 0.7 # in volt (Assuming value)\n",
      "R_C= 47 # in k ohm\n",
      "R_C= R_C*10**3 # in ohm\n",
      "R_E= 43 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "Ri_1= 20 # in ohm\n",
      "Ri_2= Ri_1 # in ohm\n",
      "v_in1= 2.5 # in mv\n",
      "v_in1=v_in1*10**-3 # in volt\n",
      "Bita_1= 75 \n",
      "Bita_2= Bita_1 \n",
      "I_CQ = (V_EE-V_BE)/(2*R_E+Ri_1/Bita_1) # in amp\n",
      "I_E= I_CQ # in amp\n",
      "V_CEQ= V_CC + V_BE - I_CQ*R_C # in volt\n",
      "re_desh= (26*10**-3)/I_E # in ohm\n",
      "A_d = R_C/re_desh \n",
      "v_out= A_d*v_in1 # in volt\n",
      "print \"Output voltage = %0.3f volt\" %v_out"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage = 0.436 volt\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.9 - Page No 20\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "RC= 2.2;#in k\u03a9\n",
      "RE= 4.7;# in k\u03a9\n",
      "Ri1= 50*10**-3;# in k\u03a9\n",
      "Ri2= 50*10**-3;# in k\u03a9\n",
      "VCC= 10;#in V\n",
      "VEE= 10;# in V\n",
      "VBE= 0.7;# in V\n",
      "beta_dc= 100;\n",
      "beta_ac= 100;\n",
      "\n",
      "# Part (i)\n",
      "# Formula Used : ICQ= IE= (VEE-VBE)/(2*RE+Ri/beta_dc)\n",
      "ICQ= (VEE-VBE)/(2*RE+Ri1/beta_dc);#quiescent collector current in mA\n",
      "IE= ICQ;# in mA\n",
      "print \"Part (i) : Dual-input, unbalanced output\"\n",
      "print \"The value of ICQ = %0.4f mA\" %ICQ\n",
      "# Quiescent collector-emitter voltage,\n",
      "VCEQ= VCC+VBE-ICQ*RC;# in V\n",
      "print \"The value of VCEQ = %0.4f V\" %VCEQ\n",
      "re_desh= 26/IE;# AC emitter resistance in \u03a9\n",
      "Rin1= 2*beta_ac*re_desh;# input resistance in \u03a9\n",
      "Rin1= Rin1*10**-3;#in k\u03a9\n",
      "Rin2= Rin1;# in k\u03a9\n",
      "print \"The value of Rin1 = %0.3f k\u03a9 \" %Rin1\n",
      "print \"The value of Rin2 = %0.3f k\u03a9 \" %Rin1\n",
      "Rout= RC;# in k\u03a9\n",
      "print \"The value of Rout = %0.1f k\u03a9\" %Rout \n",
      "print \"The value of RC = %0.1f k\u03a9\" %RC\n",
      "# Formula Used : Ad= Vout/Vind= RC/re_desh\n",
      "Ad= RC*10**3/(re_desh*2);# voltage gain of dual input, unbalanced output\n",
      "print \"The value of Ad = %0.3f \" %Ad\n",
      "\n",
      "# Part (ii)\n",
      "print \"\\nPart (ii) : Single-output, balanced output\"\n",
      "print \"The value of ICQ = %0.4f mA\" %ICQ\n",
      "print \"The value of VCEQ = %0.4f V\" %VCEQ\n",
      "print \"The value of Rin = %0.3f k\u03a9\" %Rin1\n",
      "print \"The value of Rout1 = %0.1f k\u03a9\" %Rout\n",
      "print \"The value of Rout2 = %0.1f k\u03a9\" %Rout\n",
      "# Formula Used : Ad= Vout/Vind= RC/re_desh\n",
      "Ad= RC*10**3/(re_desh);# voltage gain of dual input, unbalanced output\n",
      "print \"The value of Ad = %0.2f\" %Ad\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (i) : Dual-input, unbalanced output\n",
        "The value of ICQ = 0.9893 mA\n",
        "The value of VCEQ = 8.5235 V\n",
        "The value of Rin1 = 5.256 k\u03a9 \n",
        "The value of Rin2 = 5.256 k\u03a9 \n",
        "The value of Rout = 2.2 k\u03a9\n",
        "The value of RC = 2.2 k\u03a9\n",
        "The value of Ad = 41.855 \n",
        "\n",
        "Part (ii) : Single-output, balanced output\n",
        "The value of ICQ = 0.9893 mA\n",
        "The value of VCEQ = 8.5235 V\n",
        "The value of Rin = 5.256 k\u03a9\n",
        "The value of Rout1 = 2.2 k\u03a9\n",
        "The value of Rout2 = 2.2 k\u03a9\n",
        "The value of Ad = 83.71\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.10 - Page No 23\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "VEE= 9;#in V\n",
      "VCC= 9;#in V \n",
      "RC= 47*10**3;# collector resistance in \u03a9\n",
      "RE= 43*10**3;# emitter resistance in \u03a9\n",
      "vin1= 2.5*10**-3;# in V\n",
      "Ri1= 20*10**3;# in \u03a9\n",
      "Ri2= Ri1;# in \u03a9\n",
      "VBE= 0.7;# in V\n",
      "VT= 26*10**-3;# in V\n",
      "beta1= 75;\n",
      "beta2= 75;\n",
      "IE= (VEE-VBE)/(2*RE+Ri1/beta1);#emitter current in A\n",
      "ICQ= IE;# quiescent current in A\n",
      "VCEQ= VCC+VBE-ICQ*RC;# quiescent collector voltage in V\n",
      "re_desh= VT/IE;#AC emitter resistance in \u03a9\n",
      "Ad= RC/(2*re_desh);# voltage gain\n",
      "vout= Ad*vin1;# output voltage in V\n",
      "print \"The output voltage = %0.3f V\" %vout"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The output voltage = 0.217 V\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.11  - Page No 25\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "R_E_desh= 200 # in ohm\n",
      "V_CC= 10 # in volt\n",
      "V_EE= 10 # in volt\n",
      "V_BE= 0.7 # in volt\n",
      "R_C= 2.2 # in k ohm\n",
      "R_C= R_C*10**3 # in ohm\n",
      "R_E= 4.7 # in k ohm\n",
      "R_E= R_E*10**3 # in ohm\n",
      "Ri_1= 50 # in ohm\n",
      "Ri_2= Ri_1 # in ohm\n",
      "Bita_dc= 100 \n",
      "Bita_ac = Bita_dc \n",
      "I_CQ = (V_EE-V_BE)/(2*R_E+ R_E_desh+Ri_1/Bita_dc) # in amp\n",
      "I_E= I_CQ # in amp\n",
      "print \"Value of I_CQ = %0.4f mA\" %(I_CQ*10**3)\n",
      "V_CEQ= V_CC + V_BE - I_CQ*R_C # in volt\n",
      "print \"Value of V_CEQ = %0.3f volt\" %V_CEQ\n",
      "re_desh= (26*10**-3)/I_E # in ohm\n",
      "A_d = R_C/(re_desh+R_E_desh) \n",
      "print \"Voltage gain= %0.2f\" %A_d\n",
      "R_in1= 2*Bita_ac*(re_desh+R_E_desh) # in ohm\n",
      "print \"Input resistance = %0.3f k ohm\" %(R_in1*10**-3)\n",
      "R_out1= R_C # in ohm\n",
      "print \"Output resistance = %0.1f k ohm\" %(R_out1*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of I_CQ = 0.9687 mA\n",
        "Value of V_CEQ = 8.569 volt\n",
        "Voltage gain= 9.70\n",
        "Input resistance = 45.368 k ohm\n",
        "Output resistance = 2.2 k ohm\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.12 - Page No 29\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "VEE= 15 #in V\n",
      "VD1= 0.7 # in V\n",
      "VD2= 0.7 # in V\n",
      "VBE= 0.7 # in V\n",
      "Beta= 100 \n",
      "VT= 26 # in mV\n",
      "R3= 180 #in \u03a9\n",
      "RC= 470 # in \u03a9\n",
      "VB3= -VEE+VD1+VD2 #in V\n",
      "VE3= VB3-VBE #voltage at emitter terminal of transistor Q3 in V\n",
      "IE3= (VE3-(-VEE))/R3 #emitter current through transistor Q3 in A\n",
      "\n",
      "#Part  (i) \n",
      "ICQ= IE3/2 #quiescent current in A\n",
      "ICQ= round(ICQ*10**3) #in mA\n",
      "IE= ICQ #emitter current in mA\n",
      "print \"Part (i) : Quiescent current = %0.f mA \" %ICQ\n",
      "VCEQ= VEE+VBE-ICQ*10**-3*RC #quiescent collector-emitter voltage in V\n",
      "print \"The quiescent collector-emitter voltage = %0.2f V\" %VCEQ\n",
      "re_desh= VT/IE #AC emitter resistance in \u03a9\n",
      "\n",
      "# Part (ii)\n",
      "Ad= RC/re_desh # differential voltage gain\n",
      "print \"Part (ii) : Differential voltage gain = %0.2f \" %Ad\n",
      "\n",
      "# Part (iii)\n",
      "Rin1= 2*Beta*re_desh # in \u03a9\n",
      "Rin1= Rin1*10**-3 # in k\u03a9\n",
      "print \"Part (iii) : The input resistance = %0.1f k\u03a9\" %Rin1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (i) : Quiescent current = 2 mA \n",
        "The quiescent collector-emitter voltage = 14.76 V\n",
        "Part (ii) : Differential voltage gain = 36.15 \n",
        "Part (iii) : The input resistance = 2.6 k\u03a9\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.13 - Page No 30\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "VEE= 10 #in V\n",
      "VCC=10 # in V\n",
      "VD1= 0.715 # in V\n",
      "Vz= 6.2# in V\n",
      "VBE= VD1 # in V\n",
      "Izt= 41 # in mA\n",
      "R3= 2.7 # in k\u03a9\n",
      "RC= 4.7 # in k\u03a9\n",
      "VT= 26 # in mV\n",
      "beta_ac= 100 \n",
      "beta_dc= 100 \n",
      "VB3= -VEE+Vz+VD1 #voltage at the base of transistor Q3 in V\n",
      "VE3= VB3-VBE # voltage at the emitter of transistor Q3 in V\n",
      "IE3= (VE3-(-VEE))/R3 #emitter current through transistor Q3 in mA\n",
      "ICQ= IE3/2 #quiescent current in mA\n",
      "VCEQ= VCC+VBE-ICQ*RC # in V\n",
      "print \"Part (c) : The Q-point values : \" \n",
      "print \"The value of ICQ = %0.3f mA\" %ICQ\n",
      "print \"The value of VCEQ = %0.2f V\" %VCEQ\n",
      "re_desh= VT/ICQ #dynamic emitter resistance in \u03a9\n",
      "Ad= RC*10**3/re_desh # voltage gain\n",
      "print \"Part (a) : The voltage gain = %0.1f\" %Ad\n",
      "Rin= 2*beta_ac*re_desh # differential input resistance in \u03a9\n",
      "Rin=Rin*10**-3 # in k\u03a9\n",
      "print \"Part (b) : The differential input resistance = %0.2f k\u03a9\" %Rin"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (c) : The Q-point values : \n",
        "The value of ICQ = 1.148 mA\n",
        "The value of VCEQ = 5.32 V\n",
        "Part (a) : The voltage gain = 207.5\n",
        "Part (b) : The differential input resistance = 4.53 k\u03a9\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.14 - Page No 34\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_CC=12 # in volt\n",
      "V_BE=0.7 # in volt\n",
      "R1= 25 # in k ohm\n",
      "R1=R1*10**3 # in ohm\n",
      "# I=I_REF= (V_CC-V_BE)/R1\n",
      "I= (V_CC-V_BE)/R1  # in amp\n",
      "print \"Mirrored current = %0.3f mA\" %(I*10**3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mirrored current = 0.452 mA\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.15 - Page No 34\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "VCC= 10 # in V\n",
      "VBE= 0.7 # in V\n",
      "R1= 15 # in k\u03a9\n",
      "Beta= 100 \n",
      "I_REF= (VCC-VBE)/R1 #reference current in mA\n",
      "print \"The reference current = %0.2f mA\" %I_REF\n",
      "Iout= I_REF*Beta/(Beta+2) # output current in mA\n",
      "print \"The output current = %0.3f mA\" %Iout"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reference current = 0.62 mA\n",
        "The output current = 0.608 mA\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.16 - Page No 34\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "VCC= 15 # in V\n",
      "VBE= 0.7 # in V\n",
      "R1= 2.2 # in k\u03a9\n",
      "Beta= 220 \n",
      "I_REF= (VCC-VBE)/R1 #reference current in mA\n",
      "# Formula : I= IC= I_REF*(Beta/(Beta+2))\n",
      "IC= I_REF*Beta/(Beta+2) # in mA\n",
      "print \"The value of current = %0.2f mA\" %IC"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of current = 6.44 mA\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.17 - Page No 35\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Vz= 1.8 # in V\n",
      "VBE= 0.7 # in V\n",
      "RE= 1 # in k\u03a9\n",
      "Beta= 180 \n",
      "VB= Vz-VBE # in V\n",
      "IE= VB/RE #emitter current in mA\n",
      "# Formula : I= IC= IE*(Beta/(Beta+1))\n",
      "IC= IE*Beta/(Beta+1) # in mA\n",
      "print \"The value of current = %0.3f mA\" %IC"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of current = 1.094 mA\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.18 - Page No 35\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "VCC= 9 # in V\n",
      "R1= 12 # in k\u03a9\n",
      "VBE= 0.7 # in V\n",
      "Beta= 100 \n",
      "I_REF= (VCC-2*VBE)/R1 #reference current in mA\n",
      "print \"The reference current = %0.4f mA\" %I_REF\n",
      "Iout= I_REF/(1+2/(Beta*(1+Beta))) #output current in mA\n",
      "print \"The output current = %0.4f mA\" %Iout\n",
      "IC2= Iout #collector current in mA\n",
      "print \"The collector current = %0.4f mA\" %IC2\n",
      "# IB3= I_REF-IC1= I_REF-IC2  (since IC1= IC2)\n",
      "IB3= I_REF-IC2 #base current of transistor Q3 in mA\n",
      "IB3= IB3*10**3 # in \u00b5A\n",
      "print \"The base current of transistor Q3 = %0.1f \u00b5A\" %IB3\n",
      "IB3= 0.1 # in \u00b5A\n",
      "IE3= (1+Beta)*IB3 # emitter current of transistor Q3 in \u00b5A\n",
      "print \"The emitter current of transistor Q3 = %0.1f \u00b5A\" %IE3\n",
      "IB1= IE3/2 #base current in \u00b5A\n",
      "IB2= IB1 # in \u00b5A\n",
      "print \"The base current = %0.2f \u00b5A\" %IB1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reference current = 0.6333 mA\n",
        "The output current = 0.6332 mA\n",
        "The collector current = 0.6332 mA\n",
        "The base current of transistor Q3 = 0.1 \u00b5A\n",
        "The emitter current of transistor Q3 = 10.1 \u00b5A\n",
        "The base current = 5.05 \u00b5A\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.19 - Page No 36\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_BE=0.715 # in volt\n",
      "V_CC=9 # in volt\n",
      "Bita_dc=100 \n",
      "Bita_ac= Bita_dc \n",
      "V_EE= 10 # in volt\n",
      "R=5.6 # in k ohm\n",
      "R= R*10**3 # in ohm\n",
      "I_REF= (V_EE-V_BE)/R # in amp\n",
      "# From 2*I_B + I_C1 -I_REF =0\n",
      "I_C1= I_REF*Bita_dc/(2+Bita_dc) # in amp\n",
      "# By symmetry\n",
      "I_C2= I_C1 \n",
      "I_C3= I_C2 \n",
      "I=3*I_C1 # current through R_C in amp\n",
      "print \"Current through R_C = %0.2f mA\" %(I*10**3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current through R_C = 4.88 mA\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.20 - Page No 36\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_BE=0.7 # in volt\n",
      "V_CC=5 # in volt\n",
      "V_EE=-5 # in volt\n",
      "Bita=100 \n",
      "R=18.6 # in k ohm\n",
      "R= R*10**3 # in ohm\n",
      "I2= (V_CC-V_BE-V_EE)/R # in amp\n",
      "I_C3=I2 \n",
      "I_E= I_C3/2 # in amp\n",
      "re_desh= (26*10**-3)/I_E # in ohm\n",
      "re1_desh=re_desh \n",
      "re2_desh=re1_desh \n",
      "R_in1= 2*Bita*re_desh # in ohm\n",
      "R_in2= R_in1\n",
      "print \"Differential input resistance = %0.1f k ohm\" %(R_in1*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Differential input resistance = 20.8 k ohm\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21 - Page No 44\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_BE=0.7 # in volt\n",
      "V_CC=18 # in volt\n",
      "R_E=1.1 # in k ohm\n",
      "R_C=1.8 # in k ohm\n",
      "R_C=R_C*10**3 # in ohm\n",
      "R1=4.7 # in k ohm\n",
      "R2=5.6 # in k ohm\n",
      "R3=6.8 # in k ohm\n",
      "I_E1= (V_CC*R1/(R1+R2+R3)-V_BE)/R_E # in mA\n",
      "re_desh= 26/I_E1 # in ohm\n",
      "re2_desh=re_desh\n",
      "Av= -R_C/re2_desh \n",
      "print \"Voltage gain of the cascode amplifier = %0.1f\" %Av\n",
      "\n",
      "\n",
      "\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gain of the cascode amplifier = -267.3\n"
       ]
      }
     ],
     "prompt_number": 33
    }
   ],
   "metadata": {}
  }
 ]
}