{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#Chapter 15 , Cathode Ray Oscilloscope"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.1 , Page Number 537"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Deflection sensitivity :  0.167 mm/V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "l = 25.0 * 10**-3                #Length of plates (in meter)\n",
    "d = 5.0 * 10**-3                 #Distance between plates (in meter)\n",
    "S = 0.20                         #Distance between screen and centre of plates (in meter) \n",
    "Va = 3000.0                      #Accelerating voltage (in volts)\n",
    "tracelen = 0.1                   #Trace length (in meter)\n",
    "y = tracelen/2                   #vertical distance (in meter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "Vd = 2*d*Va*y/(l*S)              #Deflecting voltage (in volts)\n",
    "Vrms = Vd/2**0.5                 #RMS value of voltage (in volts)\n",
    "defsen = l*S/(2*d*Va)            #Deflection sensitivity (in meter per volt)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Deflection sensitivity : \",round(defsen * 10**3,3),\"mm/V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.2 , Page Number 537"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum velocity of electrons :  18.75 e+6 m/s.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Va = 1000.0                       #Accelerating voltage (in volts)\n",
    "e = 1.6 * 10**-19                 #Charge on electron (in Coulomb)\n",
    "m = 9.1 * 10**-31                 #Mass of electron (in kilogram) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "v = (2*Va*e/m)**0.5               #Maximum velocity of electrons (in meter per second) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Maximum velocity of electrons : \",round(v*10**-6,2),\"e+6 m/s.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.3 , Page Number 538"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Applied voltage :  100.0 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "defsen = 0.05 * 10**-3           #Deflection Sensitivity (in meter per volt)\n",
    "spotdef = 5.0 * 10**-3           #Deflection factor (in volt per meter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "V = spotdef/defsen               #Applied voltage (in volts)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Applied voltage : \",V,\"V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.4 , Page Number 538"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Deflection sensitivity :  0.1667 mm/V.\n",
      "Deflection factor :  6.0 V/mm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "l = 20.0 * 10**-3                #Length of plates (in meter)\n",
    "d = 5.0 * 10**-3                 #Distance between plates (in meter)\n",
    "S = 0.25                         #Distance between screen and centre of plates (in meter) \n",
    "Va = 3000.0                      #Accelerating voltage (in volts)     \n",
    "\n",
    "#Calculation\n",
    "\n",
    "defsen = l*S/(2*d*Va)            #Deflection Sensitivity (in meter per volt)\n",
    "deffact = 1/defsen               #Deflection factor (in volt per meter)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Deflection sensitivity : \",round(defsen*10**3,4),\"mm/V.\"\n",
    "print \"Deflection factor : \",deffact*10**-3,\"V/mm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.6 , Page Number 549"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ratio of freqency of vertical and horizontal signals :  1.5 .\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "tangv = 3.0                      #Positive of Y - peak to vertical line\n",
    "tangh = 2.0                      #Positive of X - peak to horizontal line \n",
    "\n",
    "#Calculation\n",
    "\n",
    "ratio = tangv/tangh              #Ratio of freq. of vertical and horizontal signals \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Ratio of freqency of vertical and horizontal signals : \",ratio,\".\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.7 , Page Number 549"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Frequency of vertical input :  7500.0 Hz.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "fx = 3.0 * 10**3                 #Frequency of horizontal input (in Hertz)\n",
    "tangv = 2.5                      #Positive of Y - peak to vertical line\n",
    "tangh = 1.0                      #Positive of X - peak to horizontal line \n",
    "\n",
    "#Calculation\n",
    "\n",
    "fy = fx*tangv/tangh              #Frequency of vertical input (in Hertz)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Frequency of vertical input : \",fy,\"Hz.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.8 , Page Number 549"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Frequency of vertical input :  2500.0 Hz.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "fx = 1000.0                      #Frequency of horizontal input (in Hertz)\n",
    "tangv = 2.0                      #Points of tangency to vertical line\n",
    "tangh = 5.0                      #Points of tangency to horizontal line \n",
    "\n",
    "#Calculation\n",
    "\n",
    "fy = fx*tangh/tangv              #Frequency of vertical input (in Hertz)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Frequency of vertical input : \",fy,\"Hz.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.9 , Page Number 549"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mark to Space ratio :  0.25 .\n",
      "Pulse frequency :  50.0 kHz.\n",
      "Magnitude of pulse voltage :  0.43 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "div = 1.0                   #One division = one cm (in cm)\n",
    "mark = 0.4                  #One mark (in cm)\n",
    "space = 1.6                 #One space (in cm)\n",
    "Amp = 2.15                  #Amplitude \n",
    "Ampctrl = 0.2               #Signal amplitude control (in volt per division) \n",
    "tbctrlset = 10.0 * 10**-6   #Time based control setting (in seconds)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "MtoS = mark/space            #Mark to space ratio\n",
    "T = (space + mark)*tbctrlset #Pulse time period (in seconds)\n",
    "f = 1/T                      #Pulse frequency (in Hertz)\n",
    "Vp = Amp * Ampctrl           #Magnitude of pulse voltage (in volts) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Mark to Space ratio : \",round(MtoS,2),\".\"\n",
    "print \"Pulse frequency : \",(f*10**-3),\"kHz.\"\n",
    "print \"Magnitude of pulse voltage : \",Vp,\"V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 15.10 , Page Number 550"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMS value of ac voltage :  17.678 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "L = 10                            #Length of trace (in cm)\n",
    "S = 5                             #Deflection sensitivty (in volt per cm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "Vpktopk = L*S                     #Voltage peak-to-peak (in volts)\n",
    "Vpeak = Vpktopk/2                 #Peak value of voltage (in volts)\n",
    "Vrms = Vpeak/2**0.5               #RMS of peak value (in volts) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"RMS value of ac voltage : \",round(Vrms,3),\"V.\"\n",
    "\n",
    "#Slight variations due to higher precision."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}