{
 "metadata": {
  "name": "",
  "signature": "sha256:012ab8557afdcfdae2cdc3da17271647415fc17ab95dd187f4df0903472edf45"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter - 8 : Cathode Ray Oscilloscopes"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.1 - Page No : 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "from __future__ import division\n",
      "#Given data\n",
      "l=25 # in mm\n",
      "l=l*10**-3 # in meter\n",
      "d=5 # in mm\n",
      "d=d*10**-3 # in meter\n",
      "S= 20 # in cm\n",
      "S= S*10**-2 # in meter\n",
      "Va= 3000 # in volts\n",
      "TraceLength= 10 # in cm\n",
      "TraceLength=TraceLength*10**-2 # in meter\n",
      "y=TraceLength/2 \n",
      "Vd= 2*d*Va*y/(l*S) # in volts\n",
      "Vrms= Vd/sqrt(2) # in volts\n",
      "Vrms= int(Vrms) \n",
      "print \"RMS value of the sinusoidal voltage applied to the X-deflecting plates = %0.f volts\" %Vrms  \n",
      "DeflectionSensitivity= l*S/(2*d*Va) # in m/V\n",
      "print \"Deflection Sensitivity = %0.3f mm/V\" %(DeflectionSensitivity*10**3) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "RMS value of the sinusoidal voltage applied to the X-deflecting plates = 212 volts\n",
        "Deflection Sensitivity = 0.167 mm/V\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.2 - Page No : 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "#Given data\n",
      "Va= 1000 # in volts\n",
      "e= 1.6*10**-19 # in C\n",
      "m= 9.1*10**-31 # in kg\n",
      "MaxVel= sqrt(2*Va*e/m) # maximum velocity of electrons in m/s\n",
      "print \"Maximum velocity of electrons = %0.3e m/s\" %MaxVel"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum velocity of electrons = 1.875e+07 m/s\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.3 - Page No : 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "l=20 # in mm\n",
      "l=l*10**-3 # in meter\n",
      "d=5 # in mm\n",
      "d=d*10**-3 # in meter\n",
      "S= 0.20 # in meter\n",
      "Va= 2500 # in volts\n",
      "DeflectionSensitivity= l*S/(2*d*Va) # in m/V\n",
      "print \"Deflection Sensitivity = %0.2f mm/V\" %(DeflectionSensitivity*10**3) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Deflection Sensitivity = 0.16 mm/V\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.4 - Page No : 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import tan, pi\n",
      "#Given data\n",
      "l=2.5 # in cm\n",
      "l=l*10**-2 # in meter\n",
      "d=1 # in cm\n",
      "d=d*10**-2 # in meter\n",
      "Va= 1000 # in volts\n",
      "theta= 1 # in degree\n",
      "# Formula tand(theta) = l*Vd/(2*d*Va)\n",
      "Vd= 2*d*Va/l*tan(theta*pi/180) # in volts\n",
      "print \"Voltage required across the deflection plates = %0.2f volts\" %Vd"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage required across the deflection plates = 13.96 volts\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.5 - Page No : 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "l=2.5 # in cm\n",
      "l=l*10**-2 # in meter\n",
      "d=.5 # in cm\n",
      "d=d*10**-2 # in meter\n",
      "S= 20 # in cm\n",
      "S= S*10**-2 # in meter\n",
      "Va= 2500 # in volts\n",
      "# Formula y = OC*AB/OB = (S*d/2)/(l/2)\n",
      "y = (S*d/2)/(l/2) # in meter\n",
      "print \"The value of deflection = %0.f cm\" %(y*10**2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of deflection = 4 cm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.6 - Page No : 244"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R_E1= 5.6 # in kohm\n",
      "C1= 0.2 # in micro F\n",
      "V_B1= 6.3 # in volt\n",
      "V_BE= 0.7 # in volt\n",
      "TL= 2.5 # trigger level for the Schmitt trigger (UTP,LTP) in volt\n",
      "del_V1= 2*TL # in volt\n",
      "I_C1= (V_B1-V_BE)/R_E1 # in mA\n",
      "print \"Charging current = %0.f mA\" %I_C1 \n",
      "toh= del_V1*C1/I_C1 # in ms\n",
      "print \"Time period = %0.f ms\" %toh"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Charging current = 1 mA\n",
        "Time period = 1 ms\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.7 - Page No : 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "L=10 # trace length in cm\n",
      "DS= 5 # deflection sensitivity in V/cm\n",
      "V_peakTOpeak= L*DS # in volt\n",
      "V_peak= V_peakTOpeak/2 # in volt\n",
      "RMS= V_peak/sqrt(2) # RMS value of unknown as voltage in volt\n",
      "print \"The value of AC voltage = %0.3f volts\" %RMS "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of AC voltage = 17.678 volts\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.8 - Page No : 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from fractions import Fraction \n",
      "#Given data\n",
      "Y= 3 # Positive Y-peaks in pattern\n",
      "X= 2 # Positive X-peaks in pattern\n",
      "# Ratio of frequencies of vertical and horizontal signals\n",
      "# f_y/f_x= omega_y/omega_x = Y/X\n",
      "R= Y/X #Ratio of frequencies \n",
      "print \"Ratio of frequencies of vertical and horizontal signals = \",Fraction(R).limit_denominator(10) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of frequencies of vertical and horizontal signals =  3/2\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.9 - Page No : 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Y= 2+1/2 # Positive Y-peaks in pattern\n",
      "X= 1/2+1/2 # Positive X-peaks in pattern\n",
      "f_h= 3# frequency of horizontal voltage signal in kHz\n",
      "f_yBYf_x= Y/X \n",
      "# frequency of vertical voltage signal= f_yBYf_x * f_h\n",
      "f_v= f_yBYf_x * f_h # frequency of vertical voltage signal in kHz\n",
      "print \"frequency of vertical voltage signal = %0.1f kHz\" %f_v "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "frequency of vertical voltage signal = 7.5 kHz\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.10 - Page No : 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f_x= 1000 # in Hz\n",
      "Y= 2 # points of tangency to vertical line\n",
      "X= 5 # points of tangency to horizontal line\n",
      "f_y= f_x*X/Y # in Hz\n",
      "print \"Frequency of vertical input = %0.f Hz\" %f_y"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequency of vertical input = 2500 Hz\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.11 - Page No : 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from fractions import Fraction \n",
      "#Given data\n",
      "# Taking 1div= 1 cm for CRO wave displays\n",
      "Mark= 0.4 # cm\n",
      "Space= 1.6 # cm\n",
      "SAC= 0.2 # signal amplitude control in V/div\n",
      "TBS= 10 # time base control in micro/div\n",
      "Amplitude= 2.15 # in cm\n",
      "M_S_ratio= Mark/Space # Mark to Space raio \n",
      "print \"Mark to Space ratio = \",Fraction(M_S_ratio).limit_denominator(20) \n",
      "T= (Mark+Space)*TBS # in micro sec\n",
      "T=T*10**-6 # in sec\n",
      "f=1/T # in Hz\n",
      "print \"Pulse frequency = %0.f kHz\" %(f*10**-3)\n",
      "Mag= Amplitude*SAC # Magnitude of pulse voltage in volt\n",
      "print \"Magnitude of pulse voltage = %0.2f volts\" %Mag"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mark to Space ratio =  1/4\n",
        "Pulse frequency = 50 kHz\n",
        "Magnitude of pulse voltage = 0.43 volts\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.12 - Page No : 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import asin\n",
      "from __future__ import division\n",
      "#Given data\n",
      "# Part (a)\n",
      "d_v0= 0 \n",
      "Dv=6 \n",
      "fie= asin(d_v0/Dv) \n",
      "print \"Phase angle of first figure = %0.f degree\" %fie\n",
      "# Part (b)\n",
      "d_v0= 3 \n",
      "Dv=6 \n",
      "fie= asin(d_v0/Dv)*180/pi \n",
      "print \"Phase angle of second figure = %0.f degree\" %fie,\"or %0.f\" %(180-fie)\n",
      "# Part (c)\n",
      "d_v0= 5 \n",
      "Dv=5 \n",
      "fie= asin(d_v0/Dv)*180/pi\n",
      "print \"Phase angle of third figure = %0.f degree\" %fie\n",
      "# Part (d)\n",
      "d_v0= 3 \n",
      "Dv=5 \n",
      "fie= asin(d_v0/Dv)*180/pi\n",
      "# since ellipse is in 2nd and fourth quartes so the valid value of phase angle \n",
      "fie= 180-fie\n",
      "print \"Phase angle of fourth figure = %0.1f degree\" %fie,\"or %0.1f\" %(180-fie)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Phase angle of first figure = 0 degree\n",
        "Phase angle of second figure = 30 degree or 150\n",
        "Phase angle of third figure = 90 degree\n",
        "Phase angle of fourth figure = 143.1 degree or 36.9\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.13 - Page No : 257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f=2000 # in Hz\n",
      "T=1/f # in sec\n",
      "D=0.2 \n",
      "PulseDuration= D*T # in sec\n",
      "print \"The value of pulse duration = %0.1f ms\" %(PulseDuration*10**3) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of pulse duration = 0.1 ms\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.14 - Page No : 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "vertical_attenuation= 0.5 # in V/Div\n",
      "TPD= 2 # time/Div control in micro sec\n",
      "P= 4*vertical_attenuation # peak-to-peak amplitude of the signal in V \n",
      "print \"Peak-to-Peak amplitude of the signal = %0.f V\" %P\n",
      "T= 4*TPD # in micro sec\n",
      "T=T*10**-6 # in sec\n",
      "f=1/T # in Hz\n",
      "print \"The value of frequency = %0.f kHz\" %(f*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Peak-to-Peak amplitude of the signal = 2 V\n",
        "The value of frequency = 125 kHz\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.15 - Page No : 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "C_1N= 36 # in pF\n",
      "C_2= 150 # in pF\n",
      "R_1N= 1 # in M ohm\n",
      "R_1= 10 # in M ohm\n",
      "# R_1/(omega*(C_2+C_1N)) = R_1N/(omega*C_1)\n",
      "C_1= R_1N*(C_2+C_1N)/R_1 # in pF\n",
      "print \"Value of C_1 = %0.1f pF\" %C_1\n",
      "C_T= 1/(1/C_1+1/(C_2+C_1N)) # in pF\n",
      "print \"Value of C_T = %0.2f pF\" %C_T"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of C_1 = 18.6 pF\n",
        "Value of C_T = 16.91 pF\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.16 - Page No : 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "C_1N= 36 # in pF\n",
      "C_2= 150 # in pF\n",
      "R_1N= 1 # in M ohm\n",
      "R_1= 10 # in M ohm\n",
      "R_source= 500 # in ohm\n",
      "# R_1/(omega*(C_2+C_1N)) = R_1N/(omega*C_1)\n",
      "C_1= R_1N*(C_2+C_1N)/R_1 # in pF\n",
      "C_T= 1/(1/C_1+1/(C_2+C_1N)) # in pF\n",
      "C_T= C_T*10**-12 # in F\n",
      "f= 1/(2*pi*C_T*R_source) \n",
      "print \"Signal Frequency = %0.2f MHz\" %(f*10**-6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Signal Frequency = 18.82 MHz\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  8.17 - Page No : 263"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f= 20 # in MHz\n",
      "f=f*10**6 # in Hz\n",
      "toh= 1/f # in sec\n",
      "toh=toh*10**9 # in ns\n",
      "# For one cycle occupying 4 horizontal divisions,\n",
      "MTD= toh/4 # Minimum time/division in ns/division\n",
      "# Using the 10 times magnifier to provide MTD\n",
      "MTD_setting= 10*MTD # minimum time/division setting in ns/division\n",
      "print \"Minimum time/division setting = %0.f ns/division\" %MTD_setting"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum time/division setting = 125 ns/division\n"
       ]
      }
     ],
     "prompt_number": 35
    }
   ],
   "metadata": {}
  }
 ]
}