{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1:Introductory Topics  "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1 Page No 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P1=0.001                                             #power\n",
      "x=10**0\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "dB=10*math.log(0.001/0.001)\n",
      "y=x*P1*600\n",
      "V=math.sqrt(y)\n",
      "\n",
      "#Result\n",
      "print\"V2 =\",round(V,3),\"V\"\n",
      "print\"dBm(600)=20log(V2/0.775)\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V2 = 0.775 V\n",
        "dBm(600)=20log(V2/0.775)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2 Page No 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P=0.001                             #power\n",
      "R=75                                #resistance of audio system\n",
      "R1=50                                \n",
      "x=(8/20.0)\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "y=(10**x)\n",
      "V2=(y*0.775)\n",
      "V=math.sqrt(P*R)\n",
      "V1=math.sqrt(P*R1)\n",
      "dBm= 20*math.log(V2/0.775)\n",
      "\n",
      "#Result\n",
      "print\"the dBm voltage reference for 50 ohm system is: \",round(V1,4),\"V\"\n",
      "print\"dBm(50)= 20log(V/0.2236)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the dBm voltage reference for 50 ohm system is:  0.2236 V\n",
        "dBm(50)= 20log(V/0.2236)\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3 Page No 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "x=(10/10.0)                      #laser diode output\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "y=(10**x)\n",
      "P2=(y*0.001)\n",
      "a=(math.log10(0.01/1.0))\n",
      "z=(10*a)\n",
      "\n",
      "#result\n",
      "print\"(a) P2 = \",P2,\"W\"              #convert +10dB to Watts\n",
      "print\"(b) dBW =\",z,\"dBW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) P2 =  0.01 W\n",
        "(b) dBW = -20.0 dBW\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4 Page No 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "kT=(1.6*10**-20)\n",
      "f=(1*10**6)                               #bandwidt, Hz\n",
      "R=(1*10**6)                               #resistance, ohm\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "x=math.sqrt(kT*f*R)\n",
      "#4kT at room temperature (17 degree C) is 1.6*10**-20 Joules\n",
      "\n",
      "#Result\n",
      "print\"en = \",round(x,6),\"Vrms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "en =  0.000126 Vrms\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5 Page No 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "\n",
      "k=(1.38*10**-23)\n",
      "T=(27+273)                             #temperature\n",
      "f=(4*10**6)                            #bandwidth,Hz\n",
      "R=100                                  #source resistance, ohm\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "x=math.sqrt(4*k*T*f*R)\n",
      "# to convert degres to kelvin, add 273 in it\n",
      "\n",
      "#result\n",
      "print\"en= \",round(x,8),\"Vrms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "en=  2.57e-06 Vrms\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6 Page No 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "x=10                           #input S/N power\n",
      "y=5.0                          #utput S/N power\n",
      "z=(x/y)\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "a=(10*math.log10(z))\n",
      "b=(10*math.log10(x))\n",
      "c=(10*math.log10(y))\n",
      "d=(b-c)\n",
      "\n",
      "#Result\n",
      "print\"(a)NR = \",z\n",
      "print\"(b)NF = \",round(a,1),\"dB\"\n",
      "print\"(c) 10log(Si/Ni) =\",b,\"dB\"\n",
      "print\" 10log(So/No) = \",round(c,0),\"dB\"\n",
      "print\"their difference = \",round(d,0),\"dB\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)NR =  2.0\n",
        "(b)NF =  3.0 dB\n",
        "(c) 10log(Si/Ni) = 10.0 dB\n",
        " 10log(So/No) =  7.0 dB\n",
        "their difference =  3.0 dB\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7 Page No 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "BW=200*10**3                #bandwidth\n",
      "k=(1.38*10**-23)\n",
      "T=(273+22)                  #converting degrees C into kelvin\n",
      "R=(10*10**3)\n",
      "R1=300\n",
      "NF1=3\n",
      "NF2=8\n",
      "NR1=2\n",
      "NR2=6.31\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "df=((math.pi/2.0)*BW)\n",
      "Pn=(k*T*df)\n",
      "en=math.sqrt(4*Pn*R)\n",
      "x=(14+20+20)                  #sum of the power gain of the three stages\n",
      "y=(x/10.0)\n",
      "Pg=(10**y)\n",
      "Po=(Pn*Pg)\n",
      "eno=math.sqrt(Po*R1)\n",
      "pg1=(10**(1.4))\n",
      "pg2=(10**(20))\n",
      "NR=(NR1+((NR2-1)/pg1)+((NR2-1)/(pg1*pg2)))\n",
      "NF=10*math.log10(NR)\n",
      "No=(NR*Pn*Pg)\n",
      "a=math.sqrt(No*R1)\n",
      "\n",
      "#Result\n",
      "print\"(a) en(out)= \",round(eno,5),\"V\"\n",
      "print\"(b) NF = \",round(NF,2),\"dB\"\n",
      "print\"(c) No = \",round(a,6),\"V\"             #outputnoise voltage\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) en(out)=  0.00031 V\n",
        "(b) NF =  3.45 dB\n",
        "(c) No =  0.000462 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8 Page No 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "k=1.38*10**-23\n",
      "T=(35+40+52)             #total temperature\n",
      "df=(1*10**6)\n",
      "Teq=52\n",
      "To=290.0\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "Pn=(k*T*df)\n",
      "x=(Teq/To)\n",
      "NR=(x+1)\n",
      "NF=(10*math.log10(NR))\n",
      "\n",
      "#Result\n",
      "print\"NR = \",round(NR,2)      #noise ratio\n",
      "print\"NF =\",round(NF,3),\"dB\"     #noise figure"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "NR =  1.18\n",
        "NF = 0.716 dB\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.9 Page No 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "x=7*10**-3               # o/p power measured 400-Hz audio signal modulates a carrier                    \n",
      "y=0.18*10**-3            # o/p power measured when a filter cancels 400-Hz portion of the o/p\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "z=10*math.log10(x/y)\n",
      "\n",
      "#Result\n",
      "print\"SINAD = \",round(z,2),\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "SINAD =  15.9 dB\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.10 Page No 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "i= 14*10**-3                 #dc current\n",
      "R=50                         #resistance, ohm\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "x=(20*i*R)\n",
      "y=10*math.log10(x)\n",
      "\n",
      "#Result\n",
      "print\"NF=\",round(y,2),\"dB\"            #noise figure"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "NF= 11.46 dB\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.11 Page No 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "f=(12*10**3)\n",
      "L=3*10**-3\n",
      "C=(0.1*10**-6)\n",
      "R=30             #resistance,ohm\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "x=L*C\n",
      "y=math.sqrt(x)\n",
      "z=(2*math.pi*y)\n",
      "a=(1/z)\n",
      "Xl=(2*math.pi*f*L)\n",
      "Xc=(1/(2*math.pi*f*C))\n",
      "b=(Xl-Xc)**2\n",
      "c=R**2\n",
      "d=math.sqrt(c+b)\n",
      "\n",
      "#Result\n",
      "print\"fr = \",round(a,2),\"Hz\"\n",
      "#at 12kHz\n",
      "print\"Z = \",round(d,2),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fr =  9188.81 Hz\n",
        "Z =  98.26 ohm\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.12 Page No 38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "R1=20                   #resistance, ohm\n",
      "R2=1                  \n",
      "L=1*10**-3              #inductor \n",
      "C=0.4*10**-6            #capacitor\n",
      "ein=50*10**-3\n",
      "f=12*10**3             #frequency\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "x=math.sqrt(L*C)\n",
      "y=(1/(2*math.pi*x))\n",
      "eo= ein*(R2/(R2+R1))\n",
      "XL=(2*math.pi*f*L)\n",
      "XC=(1/(2*math.pi*f*C))\n",
      "a=(R1+R2)**2\n",
      "b=(XL-XC)**2\n",
      "z=math.sqrt(a+b)\n",
      "zo=math.sqrt((R2**2)+b)\n",
      "m=(ein*(zo/z))\n",
      "\n",
      "#Result\n",
      "print\"resonant frequency is\",round(y,2),\"Hz\"\n",
      "print\"o/p voltage at 12kHz =\",round(m,3),\"V\"                  \n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "resonant frequency is 7957.75 Hz\n",
        "o/p voltage at 12kHz = 0.045 V\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.13 Page No 40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a=460*10**3\n",
      "b=450*10**3\n",
      "fr=455*10**3                         #frequency\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "BW=a-b\n",
      "Q=(fr/BW)\n",
      "C=0.001*10**-6\n",
      "x=(fr*2*math.pi)\n",
      "y=(1/x)**2\n",
      "z=y/C\n",
      "R=(2*math.pi*z*BW)\n",
      "\n",
      "#Result\n",
      "print\"(a)Bandwidth = \",BW,\"Hz\"\n",
      "#filter's peak o/p occurs at 455kHz\n",
      "print\"(b)Quality factor = \",Q,\"KHz\"\n",
      "print\"(c)inductance =\",round(z,5),\"H\"\n",
      "print\"(d)total circuit resistance= \",round(R,2),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Bandwidth =  10000 Hz\n",
        "(b)Quality factor =  45 KHz\n",
        "(c)inductance = 0.00012 H\n",
        "(d)total circuit resistance=  7.69 ohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.14 Page No 42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "R=2                      #resistance,ohm\n",
      "L=3*10**-3               #inductance\n",
      "C=0.47*10**-6            #capacitance\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "x=(2*math.pi*math.sqrt(L*C))\n",
      "y=1/x\n",
      "XL=(2*math.pi*y*L)\n",
      "Q=(XL/R)\n",
      "Z=((Q**2)*R)\n",
      "BW=(R/(2*math.pi*L))\n",
      "\n",
      "#Result\n",
      "print\"(a) Resonant frequency= \",round(y,2),\"Hz\"\n",
      "print\"(b)Quality factor = \",round(Q,2)\n",
      "print\"(c)Maximam impedence= \",round(Z,1),\"Ohm\"\n",
      "print\"(d)Bandwidth = \",round(BW,1),\"Hz\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Resonant frequency=  4238.48 Hz\n",
        "(b)Quality factor =  39.95\n",
        "(c)Maximam impedence=  3191.5 Ohm\n",
        "(d)Bandwidth =  106.1 Hz\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}