{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3:Transistor Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.1, page No.117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Gain Impedence and ac load\n",
      "import math\n",
      "#Variable declaration\n",
      "ib=10.0                   #in uA\n",
      "ic=1.0                    #in mA\n",
      "ic=ic*10**3               #in uA\n",
      "vi=0.02                   #in Volt\n",
      "RC=5.0                    #in kohm\n",
      "RL=10.0                   #in kohm\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Part (i)\n",
      "Ai=-ic/ib                 #unitless\n",
      "Beta=Ai                   #unitless\n",
      "\n",
      "#Part (ii)\n",
      "Rie=vi/(ib*10**-6)        #in Ohm\n",
      "\n",
      "#Part (iii)\n",
      "Rac=RC*RL/(RC+RL)         #in kohm\n",
      "\n",
      "#Part (iv)\n",
      "Av=-Rac*10**3*Beta/Rie    #unitless\n",
      "\n",
      "#Part (v)\n",
      "PowerGain=Av*Ai           #unitless\n",
      "\n",
      "#Result\n",
      "print(\"(i)\\tCurrent gain : %.2f\"%Ai)\n",
      "print(\"(ii)\\tInput impedence in kohm :%.0f\"%(Rie*10**-3))\n",
      "print(\"(iii)\\tAC load in kohm : %.1f\"%Rac)\n",
      "print(\"(iv)\\tVoltage gain :%.3f\"%Av)\n",
      "print(\"(v)\\tPower Gain is : %.3f\"%PowerGain)\n",
      "#Note : Ans of Av and Power gain is wrong in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)\tCurrent gain : -100.00\n",
        "(ii)\tInput impedence in kohm :2\n",
        "(iii)\tAC load in kohm : 3.3\n",
        "(iv)\tVoltage gain :166.667\n",
        "(v)\tPower Gain is : -16666.667\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.2, page No.125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Gain input and output impedence\n",
      "import math\n",
      "\n",
      "#Varible declaration\n",
      "RL=10.0                    #in kohm\n",
      "RS=1.0                     #in kohm\n",
      "hie=1.1                    #in kOhm\n",
      "hre=2.5*10**-4             #unitless\n",
      "hfe=50.0                   #unitless\n",
      "hoe=25.0                   #in u mho\n",
      "\n",
      "#Calculations\n",
      "Aie=-hfe/(1+hoe*10**-6*RL*10**3)#unitless\n",
      "Zie=hie+hre*Aie*RL              #in kOhm\n",
      "Zie=math.ceil(Zie)\n",
      "Ave=Aie*RL/Zie                  #unitless\n",
      "Avs_e=Ave*Zie/(Zie+RS)\n",
      "deltah=hoe*10**-6*hie*10**3-hfe*hre\n",
      "Zoe=(hie*10**3+RS*10**3)/(hoe*10**-6*RS*10**3+deltah)\n",
      "Ais_e=Aie*RS/(Zie+RS)\n",
      "Ape=Ave*Aie\n",
      "Aps_e=Avs_e*Ais_e\n",
      "\n",
      "#Result\n",
      "print(\"Current gain :%.0f \"%Aie)\n",
      "print(\"\\nCurrent gain with source resistance : %.0f\"%Ais_e)\n",
      "print(\"\\nVoltage gain : %.0f\"%Ave)\n",
      "print(\"\\nVoltage gain with source resistance : %.0f\"%Avs_e)\n",
      "print(\"\\nPower gain :%.0f \"%Ape)\n",
      "print(\"\\nPower gain with source resistance :%.0f \"%Aps_e)\n",
      "print(\"\\nInput impedence in kohm :%.1f\"%Zie)\n",
      "print(\"\\nOutput impedence in kohm :%.1f\"%(Zoe/10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current gain :-40 \n",
        "\n",
        "Current gain with source resistance : -20\n",
        "\n",
        "Voltage gain : -400\n",
        "\n",
        "Voltage gain with source resistance : -200\n",
        "\n",
        "Power gain :16000 \n",
        "\n",
        "Power gain with source resistance :4000 \n",
        "\n",
        "Input impedence in kohm :1.0\n",
        "\n",
        "Output impedence in kohm :52.5\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.3, Page No. 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Input Output impedence and output voltage\n",
      "import math\n",
      "#Variable declaration\n",
      "InputVoltage=1.0                     #in mV\n",
      "RL=5.6                               #in kohm\n",
      "RS=600.0                             #in ohm\n",
      "hre=6.5*10**-4                       #unitless\n",
      "hie=1.7                              #in kOhm\n",
      "hfe=125.0                            #unitless\n",
      "hoe=80.0                             #in uA/V\n",
      "\n",
      "#Calculations\n",
      "deltah=hoe*10**-6*hie*10**3-hfe*hre\n",
      "Zie=(hie*10**3+RL*10**3*deltah)/(1+hoe*10**-6*RL*10**3)\n",
      "Zoe=(hie*10**3+RS)/(hoe*10**-6*RS+deltah)\n",
      "Ave=-(hfe*RL*10**3)/(hie*10**3+RL*10**3*deltah)\n",
      "Avs_e=Ave*Zie/(Zie+RS)\n",
      "OutputVoltage=Avs_e*InputVoltage\n",
      "\n",
      "#Result\n",
      "print(\"Input impedence in kohm :%.3f\"%(Zie/1000))\n",
      "print(\"Output impedence in kohm :%.3f\"%(Zoe/10**3))\n",
      "print(\"Voltage gain : %.3f\"%Ave)\n",
      "print(\"Voltage gain with source resistance : %.3f\"%Avs_e)\n",
      "print(\"Output Voltage in mV :%.3f \"%OutputVoltage)\n",
      "#Note : Answers are wrong in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input impedence in kohm :1.386\n",
        "Output impedence in kohm :22.384\n",
        "Voltage gain : -348.849\n",
        "Voltage gain with source resistance : -243.444\n",
        "Output Voltage in mV :-243.444 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.4, Page no.129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Net voltage gain in dB\n",
      "import math\n",
      "#variable declaration\n",
      "A1=100.0                            #unitless\n",
      "A2=200.0                            #unitless\n",
      "A3=400.0                            #unitless\n",
      "\n",
      "#calculations\n",
      "A1=20*math.log10(A1)                #in dB\n",
      "A2=20*math.log10(A2)                #in dB\n",
      "A3=20*math.log10(A3)                #in dB\n",
      "NetVoltageGain=A1+A2+A3             #in dB\n",
      "\n",
      "#Result\n",
      "print(\"Net Voltage Gain in decibels :%.3f\"%NetVoltageGain)\n",
      "#Note : Answer in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Net Voltage Gain in decibels :138.062\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.5, Page No.129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Bandwidth and cut off frequencies \n",
      "import math\n",
      "#Variable declaration\n",
      "MaxGain=1000.0                    #unitless(at 2kHz)\n",
      "f1=50.0                           #in Hz\n",
      "f2=10.0                           #in KHz\n",
      "\n",
      "#Result\n",
      "print(\"Bandwidth is from %.0f Hz to %.0f kHz\"%(f1,f2))\n",
      "print(\"Lower cutoff frequency %.0f Hz\"%f1)\n",
      "print(\"Upper cutoff frequency %.0f kHz\"%f2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth is from 50 Hz to 10 kHz\n",
        "Lower cutoff frequency 50 Hz\n",
        "Upper cutoff frequency 10 kHz\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.6, Page No.137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Overall voltage gain\n",
      "import math\n",
      "#Variable declaration\n",
      "RC=10.0                       #in kohm\n",
      "hfe=330.0                     #unitless\n",
      "hie=4.5                       #in kOhm\n",
      "\n",
      "#Calculation\n",
      "#RS<<hie\n",
      "AVM=hfe*RC*10**3/(hie*10**3+RC*10**3)\n",
      "AVM1=AVM                      #Gain of 1st stage\n",
      "AVM2=AVM                      #Gain of 2nd stage\n",
      "AVM3=hfe*RC*10**3/(hie*10**3) #unitless(//Gain of 3rd stage)\n",
      "OverallGain=AVM1*AVM2*AVM3    #unitless\n",
      "\n",
      "#Result\n",
      "print(\"Gain in mid frequeny range : %.1f\"%AVM)\n",
      "print(\"This is the gain of 1st and 2nd stage.\")\n",
      "print(\"Overall Voltage gain for mid frequency range : %.1f * 10^7\"%(OverallGain/10**7))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain in mid frequeny range : 227.6\n",
        "This is the gain of 1st and 2nd stage.\n",
        "Overall Voltage gain for mid frequency range : 3.8 * 10^7\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.7, Page No.138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Couopling capacitor\n",
      "import math\n",
      "#variable declaration\n",
      "RC=5.5                 #in kohm\n",
      "hfe=330.0              #unitless\n",
      "hie=4.5                #in kohm\n",
      "f1=30.0                #in Hz\n",
      "\n",
      "#Calculation\n",
      "#Formula : f1=1/(2*%pi*C*(hie+RC))\n",
      "C=1/(2*math.pi*f1*(hie*10**3+RC*10**3))\n",
      "\n",
      "#Result\n",
      "print(\"Value of coupling capacitor in micro farad : %.2f\"%(C*10**6))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of coupling capacitor in micro farad : 0.53\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.8, Page No.142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Voltage gain\n",
      "import math\n",
      "#Variable declaration\n",
      "RC=10.0                    #in kohm\n",
      "Rin=1.0                    #in kohm\n",
      "Beta=100.0                 #unitless\n",
      "RL=100.0                   #in ohm\n",
      "\n",
      "#Calculation\n",
      "RCdash=RC*10**3*RL/(RC*10**3+RL)\n",
      "VoltageGain=Beta*RCdash/(Rin*10**3)\n",
      "\n",
      "#Result\n",
      "print(\"Voltage Gain :%.2f \"%VoltageGain)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage Gain :9.90 \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.9, Page No. 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Inductance of primary and secondary\n",
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Rout=10.0                   #in kohm\n",
      "Rin=2.5                     #in kohm\n",
      "f=200.0                     #in Hz\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Formula : Rout=omega*Lp=2*%pi*f*Lp\n",
      "Lp=Rout*10**3/(2*math.pi*f) #in H\n",
      "#Formula : Rin=omega*Ls=2*%pi*f*Ls\n",
      "Ls=Rin*10**3/(2*math.pi*f)  #in H\n",
      "\n",
      "#Result\n",
      "print(\"Inductance of primary in Henry : %.0f\"%Lp)\n",
      "print(\"Inductance of seondary in Henry : %.0f\"%Ls)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inductance of primary in Henry : 8\n",
        "Inductance of seondary in Henry : 2\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.10, Page No.142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Turn ratio of transformer\n",
      "import math\n",
      "#variable declaration\n",
      "ZL=10.0                #in ohm\n",
      "ZP=1000.0              #in ohm\n",
      "\n",
      "#For max power : ZP=n^2*ZL\n",
      "n=math.sqrt(ZP/ZL)      #turn ratio\n",
      "\n",
      "#Result\n",
      "print(\"Turn ratio : %.0f\"%n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Turn ratio : 10\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.11, Page No.149 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Collector eficieny and power rating\n",
      "import math\n",
      "#Variable declaration\n",
      "Po_dc=10.0                     #in watt\n",
      "Po_ac=3.5                      #in watt\n",
      "\n",
      "#calculation\n",
      "ETAcollector=Po_ac/Po_dc       #unitless\n",
      "ETAcollector=ETAcollector*100  #collector efficiency in %\n",
      "\n",
      "#Result\n",
      "print(\"Collector Efficiency : %.0f%%\"%ETAcollector)\n",
      "print(\"\\nZero signal condition represents maximum power loss.\")\n",
      "print(\"Therefore, all the 10 W power is dissipated by it. Hence Powe Rating of transistor in Watt : %.0f\"%Po_dc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector Efficiency : 35%\n",
        "\n",
        "Zero signal condition represents maximum power loss.\n",
        "Therefore, all the 10 W power is dissipated by it. Hence Powe Rating of transistor in Watt : 10\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.12, Page No.149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Power and eficiency\n",
      "import math\n",
      "#variable declaration\n",
      "VCC=20.0                      #in volt\n",
      "RC=20.0                       #in ohm\n",
      "VCEQ=10.0                     #in volt\n",
      "ICQ=500.0                     #in mA\n",
      "\n",
      "#calculations\n",
      "#part (i) :\n",
      "Pin_dc=VCC*ICQ*10**-3         #in watt\n",
      "\n",
      "#part (ii) :\n",
      "PRc_dc=ICQ**2*10**-6*RC       #in watt\n",
      "\n",
      "#part (iii) :\n",
      "Io=250                        #in mA(maximum value of output ac current)\n",
      "Irms=Io/math.sqrt(2)          #in mA\n",
      "Po_ac=Irms**2*10**-6*RC       #in watt\n",
      "\n",
      "#part (iv) :\n",
      "Ptr_dc=Pin_dc-PRc_dc          #in watt\n",
      "\n",
      "#part (v) :\n",
      "PC_dc=Pin_dc-PRc_dc-Po_ac     #in watt\n",
      "\n",
      "#part (vi) :\n",
      "ETAoverall=Po_ac*100/Pin_dc   #Overall Efficiency (in %)\n",
      "\n",
      "#part (vii) :\n",
      "ETAcollector=Po_ac*100/PRc_dc#Collector Efficiency (in %)\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"(i)\\nTotal dc power taken by the circuit in Watt : %.0f\"%Pin_dc)\n",
      "print(\"\\n(ii)\\ndc power dissipated by the collector load in Watt : %.0f\"%PRc_dc)\n",
      "print(\"\\n(iii)\\nPower developed across the load in Watt :%.3f \"%Po_ac)\n",
      "print(\"\\n((iv)\\ndc power dissipated by the collector load in Watt :%.0f \"%Ptr_dc)\n",
      "print(\"\\n(v)\\ndc power dissipated by the collector load in Watt : %.3f\"%PC_dc)\n",
      "print(\"\\n(vi)\\nOverall Efficiency :%.3f%%\"%ETAoverall)\n",
      "print(\"\\n(vii)\\nCollector Efficiency  :%.2f%%\"%ETAcollector)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)\n",
        "Total dc power taken by the circuit in Watt : 10\n",
        "\n",
        "(ii)\n",
        "dc power dissipated by the collector load in Watt : 5\n",
        "\n",
        "(iii)\n",
        "Power developed across the load in Watt :0.625 \n",
        "\n",
        "((iv)\n",
        "dc power dissipated by the collector load in Watt :5 \n",
        "\n",
        "(v)\n",
        "dc power dissipated by the collector load in Watt : 4.375\n",
        "\n",
        "(vi)\n",
        "Overall Efficiency :6.250%\n",
        "\n",
        "(vii)\n",
        "Collector Efficiency  :12.50%\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.13, Page No.151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Maximum ac power output\n",
      "import math\n",
      "#variable declaration\n",
      "n=10.0                 #turn ratio\n",
      "RL=100.0               #in ohm\n",
      "ICQ=100.0              #in mA\n",
      "\n",
      "#calculations\n",
      "RLdash=n**2*RL       \n",
      "MaxPowerOut=(ICQ*10**-3)**2*RLdash/2\n",
      "\n",
      "#result\n",
      "print(\"Maximum Power output in watt : %.0f\"%MaxPowerOut)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum Power output in watt : 50\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 3.14, Page No.152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Maximum permissible power dissipation\n",
      "import math\n",
      "#Part (i) : without heat sink\n",
      "\n",
      "#variable declaration\n",
      "ThetaMax=90.0             #in degree C\n",
      "Theta_o=30.0              #in degree C\n",
      "R=300.0                   #in degree C/W\n",
      "\n",
      "#calculation\n",
      "Pr=(ThetaMax-Theta_o)/R #in watt\n",
      "\n",
      "#Result\n",
      "print(\"Without heat sink, Maximum permissible power dissipatio in watt :%.1f\"%Pr)\n",
      "\n",
      "#Part (ii) : with heat sink\n",
      "\n",
      "#variable declaration\n",
      "ThetaMax=90.0             #in degree C\n",
      "Theta_o=30.0              #in degree C\n",
      "R=60.0                    #in degree C/W\n",
      "\n",
      "#calculation\n",
      "Pr=(ThetaMax-Theta_o)/R   #in watt\n",
      "\n",
      "#Result\n",
      "print(\"With heat sink, Maximum permissible power dissipatio in watt :%.0f\"%Pr)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Without heat sink, Maximum permissible power dissipatio in watt :0.2\n",
        "With heat sink, Maximum permissible power dissipatio in watt :1\n"
       ]
      }
     ],
     "prompt_number": 51
    }
   ],
   "metadata": {}
  }
 ]
}