{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# Chapter 6:Cathode ray oscilloscope"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "amplitude of voltage after 10 ms=4.76 V\n"
     ]
    }
   ],
   "source": [
    "# 6.1\n",
    "import math\n",
    "Vcc=50;\n",
    "t=10*10**-3;\n",
    "R=500*10**3;\n",
    "C=0.2*10**-6;\n",
    "tc=R*C;\n",
    "Vo=Vcc*(1-math.exp(-t/tc));\n",
    "print (\"amplitude of voltage after 10 ms=%.2f V\" %Vo)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage across the capacitor after 50 microsecond=1.36 V\n"
     ]
    }
   ],
   "source": [
    "# 6.2\n",
    "import math\n",
    "Vcc=4.76;\n",
    "t=50*10**-6;\n",
    "R=0.2*10**3;\n",
    "C=0.2*10**-6;\n",
    "tc=R*C;\n",
    "Vo=Vcc*(math.exp(-t/tc));\n",
    "print (\"voltage across the capacitor after 50 microsecond=%.2f V\" %Vo)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rise time=0.03 us\n"
     ]
    }
   ],
   "source": [
    "# 6.3\n",
    "import math\n",
    "BW=10*10**6;\n",
    "tr=0.35/BW*10**6;\n",
    "print (\"Rise time=%.2f us\" %tr)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Attenuation factor=10.0 \n"
     ]
    }
   ],
   "source": [
    "# 6.4\n",
    "import math\n",
    "R=(9.0*10**3)+(900+90+10);\n",
    "Rt=100*10**3;\n",
    "Attenuation=R/Rt;\n",
    "Attenuation_factor=1/Attenuation;\n",
    "print (\"Attenuation factor=%.1f \" %Attenuation_factor)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Attenuation factor=11.0 \n"
     ]
    }
   ],
   "source": [
    "# 6.5\n",
    "import math\n",
    "R=10.0*10**3;\n",
    "Ri=100*10**3;\n",
    "Rt=100*10**3;\n",
    "Rp=(Ri*R)/(Ri+R);\n",
    "Attenuation=Rp/Rt;\n",
    "Attenuation_factor=1/Attenuation;\n",
    "print (\"Attenuation factor=%.1f \" %Attenuation_factor)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For point A Attenuation_factor=400\n",
      "voltage per division value at point A=20.00\n",
      "For point B Attenuation_factor=100\n",
      "voltage per division value at point B=5.00\n",
      "For point C Attenuation_factor=40\n",
      "voltage per division value at point C=2.00\n",
      "For point D Attenuation_factor=10\n",
      "voltage per division value at point D=0.50\n",
      "For point E Attenuation_factor=4\n",
      "voltage per division value at point E=0.20\n",
      "For point F Attenuation_factor=1\n",
      "voltage per division value at point F=0.05\n"
     ]
    }
   ],
   "source": [
    "# 6.6\n",
    "import math\n",
    "Vo=50*10**-3;\n",
    "print ('For point A Attenuation_factor=400')\n",
    "Attenuation_factor=400;\n",
    "Vi=Attenuation_factor*Vo;\n",
    "print (\"voltage per division value at point A=%.2f\" %Vi)\n",
    "print ('For point B Attenuation_factor=100')\n",
    "Attenuation_factor=100;\n",
    "Vi=Attenuation_factor*Vo;\n",
    "print (\"voltage per division value at point B=%.2f\" %Vi)\n",
    "print ('For point C Attenuation_factor=40')\n",
    "Attenuation_factor=40;\n",
    "Vi=Attenuation_factor*Vo;\n",
    "print (\"voltage per division value at point C=%.2f\" %Vi)\n",
    "print ('For point D Attenuation_factor=10')\n",
    "Attenuation_factor=10;\n",
    "Vi=Attenuation_factor*Vo;\n",
    "print (\"voltage per division value at point D=%.2f\" %Vi)\n",
    "print ('For point E Attenuation_factor=4')\n",
    "Attenuation_factor=4;\n",
    "Vi=Attenuation_factor*Vo;\n",
    "print (\"voltage per division value at point E=%.2f\" %Vi)\n",
    "print ('For point F Attenuation_factor=1')\n",
    "Attenuation_factor=1;\n",
    "Vi=Attenuation_factor*Vo;\n",
    "print (\"voltage per division value at point F=%.2f\" %Vi)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Attenuationn for dc=10.0\n",
      "Attenuationn for ac=3.0\n",
      "Therefore the attenuation with ac is different from that of dc\n"
     ]
    }
   ],
   "source": [
    "#6.7\n",
    "import math\n",
    "R2=100*10**3;\n",
    "Vi=1.0;\n",
    "R1=900*10**3;\n",
    "Vo_dc=Vi*R2/(R1+R2);\n",
    "k_dc=1/Vo_dc;\n",
    "print (\"Attenuationn for dc=%.1f\" % k_dc)\n",
    "XC2=1592.0;\n",
    "Vi=1;\n",
    "XC1=3183;\n",
    "Vo_ac=Vi*XC2/(XC1+XC2);\n",
    "k_ac=1/Vo_ac;\n",
    "print (\"Attenuationn for ac=%.1f\" % k_ac)\n",
    "print ('Therefore the attenuation with ac is different from that of dc')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum velocity of the beam of electrons=16772557.39 m/s\n"
     ]
    }
   ],
   "source": [
    "# 6.8\n",
    "import math\n",
    "e=1.6*10**-19;\n",
    "Ea=800;\n",
    "m=9.1*10**-31;\n",
    "Vox=(2*e*Ea/m)**0.5;\n",
    "print (\"maximum velocity of the beam of electrons=%.2f m/s\" %Vox)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum velocity of the beam of electrons=26519741.77 m/s\n",
      "deflection sensitivity=0.38 mm/V\n",
      "Deflection Factor=2.67 V/mm\n"
     ]
    }
   ],
   "source": [
    "# 6.9\n",
    "import math\n",
    "e=1.6*10**-19;\n",
    "Ea=2000;\n",
    "m=9.1*10**-31;\n",
    "Vox=(2*e*Ea/m)**0.5;\n",
    "print (\"maximum velocity of the beam of electrons=%.2f m/s\" %Vox)\n",
    "L=5;\n",
    "ld=1.5*10**-2;\n",
    "d=5*10**-3;\n",
    "S=(L*ld/2*d*Ea);\n",
    "print (\"deflection sensitivity=%.2f mm/V\" %S)\n",
    "G=1/S;\n",
    "print (\"Deflection Factor=%.2f V/mm\" %G)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Input voltage required for deflection of 3mm =1.0 V\n"
     ]
    }
   ],
   "source": [
    "# 6.10\n",
    "import math\n",
    "Ea=2000;\n",
    "L=0.3;\n",
    "ld=2*10**-2;\n",
    "d=5*10**-3;\n",
    "D=3*10**-2;\n",
    "Ed=(2*d*Ea*D)/(L*ld);\n",
    "gain=100;\n",
    "V_require=Ed/gain;\n",
    "print (\"Input voltage required for deflection of 3mm =%.1f V\" %V_require)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 6.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum velocity of the beam of electrons=26519741.77 m/s\n",
      "Cutt off frequency=132.60 MHz\n"
     ]
    }
   ],
   "source": [
    "# 6.11\n",
    "import math\n",
    "e=1.6*10**-19;\n",
    "Ea=2000;\n",
    "m=9.1*10**-31;\n",
    "Vox=(2*e*Ea/m)**0.5;\n",
    "print (\"maximum velocity of the beam of electrons=%.2f m/s\" %Vox)\n",
    "l=50*10**-3;\n",
    "fc=Vox/(4*l)*10**-6;\n",
    "print (\"Cutt off frequency=%.2f MHz\" %fc)\n"
   ]
  }
 ],
 "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.12+"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
