{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Cathode Ray Oscilloscope"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_1,pg 169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Time required for each conversion\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "n  = 8.0                          #8-bit resolution(conversion of 1 in 256)\n",
      "Tr = 10.0*10**-6                  #total trace time(256 conversions in 10*10^-6 s)\n",
      "Nc = 256.0                        #total conversions\n",
      "\n",
      "#Calculations\n",
      "S  = (Tr/Nc)                    #speed of ADC\n",
      "\n",
      "#Result\n",
      "print(\"Time required for each conversion = %d ns\"%(S*10**9))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time required for each conversion = 39 ns\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example6_2,pg 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find frequency at horizontal plate\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "fy=1.8*10**3                  #frequency at vertical plates\n",
      "Nv=2.0                        #vertical tangencies\n",
      "Nh=3.0                        #horizontal tangencies\n",
      "\n",
      "#Calculations\n",
      "fx=fy*(Nv/Nh)                 #frequency at horizontal plates\n",
      "\n",
      "#Result\n",
      "print(\"frequency of other wave:\")\n",
      "print(\"fx = %.1f kHz\"%(fx/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "frequency of other wave:\n",
        "fx = 1.2 kHz\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_3,pg 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find length of vertical axis of ellipse\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "phi   = math.pi*30/180            #conversion into radian\n",
      "bplus = 3                         #ellipse cutting +ve minor axis\n",
      "bminus=-3                         #ellipse cutting -ve minor axis\n",
      "\n",
      "#Calculations\n",
      "theta = math.atan(2.0/1.0)        #angle of major axis of ellipse(Vy/Vh=2:1)\n",
      "y1=(bplus/math.sin(phi))          #length of vertical axis\n",
      " \n",
      "\n",
      "#Result\n",
      "print(\"length of vertical axis:\")\n",
      "print(\"y1 = (+/-)%.2f cm\"%y1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "length of vertical axis:\n",
        "y1 = (+/-)6.00 cm\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_4,pg 493"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find voltage applied between plates\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "d=1*10**-3                  #separation between plates\n",
      "fe=300                      #acceleration of electron\n",
      "e=1.6*10**-19               #charge of 1 electron\n",
      "me=9.1*10**-31              #mass of 1 electron\n",
      "\n",
      "#Calculations\n",
      "Vp=((me*fe*d)/e)            #voltage apllied between plates\n",
      "\n",
      "#Result\n",
      "print(\"Voltage applied between plates:\")\n",
      "print(\"Vp = %.2f * 10^-12 Kgm^2/s^2C\"%(Vp*10**12))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage applied between plates:\n",
        "Vp = 1.71 * 10^-12 Kgm^2/s^2C\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_5,pg 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# deflection sensitivity\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "l=1*10**-2                    #axial length of plates\n",
      "D=22*10**-2                   #distance between centre of plate and screen \n",
      "Vap=1.3*10**3                 #acceleration mode voltage\n",
      "d = 1*10**-3                  #output in mm\n",
      "\n",
      "#Calculations\n",
      "Sd=500*l*(D/(d*Vap))        #deflection senstivity\n",
      "\n",
      "#Result\n",
      "print(\"deflection sensitivity:\")\n",
      "print(\"Sd = %.2f mm/V\"%Sd) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "deflection sensitivity:\n",
        "Sd = 0.85 mm/V\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_6,pg 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find deflection of electron\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vp=0.1*10**3                    #deflection plate voltage\n",
      "e=1.6*10**-19                   #charge of electron\n",
      "l=1*10**-2                      #axial length of plates\n",
      "del1=1*10**-3                   #output in mm\n",
      "m=9.1*10**-31                   #mass of electron\n",
      "D=0.22*10**-2                   #distance between centre of plates and screen\n",
      "t=0.1*10**-6                    #time of flight\n",
      "\n",
      "#Calculations\n",
      "del2=((Vp*e*l*D)/(del1*m))*(10**-10)\n",
      "\n",
      "#Result\n",
      "print(\"deflection of electron beam from null pos:\")\n",
      "print(\"del = %.f cm\"%(math.floor(del2)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "deflection of electron beam from null pos:\n",
        "del = 38 cm\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_7,pg 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# cutoff frequency of filter\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "R=10*10**5                   #scope input impedance\n",
      "C1=0.31*62*10**-12           #probe capacitance\n",
      "C2=22*10**-12                #probe input impedance\n",
      "\n",
      "#Calculations\n",
      "fcut = (1/(2*math.pi*R*(C1+C2)))\n",
      "fcut = fcut/1000             # kHz   \n",
      "#Result\n",
      "print(\"cutoff frequency:\")\n",
      "print(\"fcut = %.1f kHz\"%(math.floor(fcut*10)/10))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency:\n",
        "fcut = 3.8 kHz\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_8,pg 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# phase difference\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "bplus=3.0           #ellipse parameter\n",
      "bminus=-3.0         #ellipse parameter\n",
      "aplus=1.5           #ellipse parameter\n",
      "aminus=-1.5         #ellipse parameter\n",
      "\n",
      "\n",
      "#case-1\n",
      "y=6.0               #y-intercept\n",
      "x=3.0               #x-intercept \n",
      "phi1=math.asin(x/y) #phase difference\n",
      "phi1=(180/math.pi)*phi1\n",
      "\n",
      "#case-2\n",
      "phi2=180-phi1       #major axis in 2 and 4 quad.\n",
      "\n",
      "#case-3\n",
      "phi3=math.asin(0)   #y2=0\n",
      " \n",
      "#case-4\n",
      "phi4=180-phi3       #y2=0 (major axis in 2 and 4 quad.)\n",
      "\n",
      "#Calculation\n",
      "print(\"phi1 = %.1f\u00b0 \"%phi1)\n",
      "print(\"phi2 = %.1f\u00b0 \"%phi2)\n",
      "print(\"phi3 = %.1f\u00b0  or 360\u00b0 \"%phi3)\n",
      "print(\"phi4 = %.1f\u00b0 \"%phi4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "phi1 = 30.0\u00b0 \n",
        "phi2 = 150.0\u00b0 \n",
        "phi3 = 0.0\u00b0  or 360\u00b0 \n",
        "phi4 = 180.0\u00b0 \n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_9,pg 495"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# rise time of pulse\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "B=25*10**6                   #bandwidth of scope\n",
      "\n",
      "#Calculatoins\n",
      "tr=(3.5/B)                   #rise time of scope\n",
      "\n",
      "#Result\n",
      "print(\"Rise time of scope:\")\n",
      "print(\"tr = %.2f micro-sec\"%(tr*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rise time of scope:\n",
        "tr = 0.14 micro-sec\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_10,pg 495"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find speed of conversion\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Res=(1.0/2**8)        #resolution\n",
      "T=8.0*10**-6            #total time \n",
      "n=256.0               #no. of conversions\n",
      "\n",
      "#Calculations\n",
      "t=(T/n)               #time req. by one conversion\n",
      "S=(1.0/t)               #speed of conversion\n",
      "\n",
      "#Result\n",
      "print(\"speed of conversion:\")\n",
      "print(\"S = %.1f MHz\\n\"%(S*10**-6))\n",
      "#Answer is not matching with the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of conversion:\n",
        "S = 32.0 MHz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_11,pg 495"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Find total collector resistance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "C=0.01*10**-6           #timing capacitor\n",
      "T=10*10**-3             #time period\n",
      "\n",
      "#Calculations\n",
      "Rt=T/(4*C)              #total collector resistance\n",
      "\n",
      "#Result\n",
      "print(\"Total collector resistance:\")\n",
      "print(\"Rt = %.f k-ohm\"%(Rt/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total collector resistance:\n",
        "Rt = 250 k-ohm\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6_12,pg 495"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# deflection plates voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "d1=1.03*10**-2            #separation of plates\n",
      "theta=(6.0/5.0)           #deflection of electron(1(deg.)12'=(6/5)deg.)\n",
      "l=2.2*10**-2              #length of deflection plate\n",
      "Vap=2.2*10**3             #accelerating potential\n",
      "\n",
      "#Calculations\n",
      "x=math.tan((math.pi/180)*(6.0/5.0))\n",
      "x = 0.019     # value of above expression should be this\n",
      "Vp=(x/l)*d1*Vap*2\n",
      "\n",
      "#Result\n",
      "print(\"Potential between plates:\")\n",
      "print(\"Vp = %d V\"%Vp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Potential between plates:\n",
        "Vp = 39 V\n"
       ]
      }
     ],
     "prompt_number": 52
    }
   ],
   "metadata": {}
  }
 ]
}