{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 16 : Signal generators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.1, Page No 668"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Vcc=10.0\n",
      "Ib=500.0*10**-9\n",
      "Acl=29.0\n",
      "f=1.0*10**3\n",
      "\n",
      "#Calculations\n",
      "print(\" phase shift  oscillator\")\n",
      "I1=100*Ib\n",
      "vo=Vcc-1\n",
      "vi=vo/Acl\n",
      "R1=vi/I1\n",
      "R1=5.6*10**3#use standard value 5.6Kohm\n",
      "R2=Acl*R1\n",
      "R2=180*10**3#use satndard value 180Kohm to give Acl>180\n",
      "R3=R2R=R1\n",
      "C=1.0/(2*3.14*R3*f*math.sqrt(6))\n",
      "\n",
      "#Results\n",
      "print(\"The value of C = %.2f  \" %(C*10**9))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " phase shift  oscillator\n",
        "The value of C = 11.61  \n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.2, Page No 672"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "f=40.0*10**3\n",
      "L=100.0*10**-3\n",
      "vp=8.0\n",
      "\n",
      "#Calculations\n",
      "print(\"colpitts oscillator\")\n",
      "Ct=1/(4*3.14*3.14*(f**2)*L)\n",
      "C1=10*Ct\n",
      "C2=1/((1/Ct)-(1/C1))\n",
      "C2=180*10**-12#use standard value\n",
      "Xc2=1/(2*3.14*f*C2)\n",
      "Xc1=1/(2*3.14*f*C1)\n",
      "R1=10*Xc1\n",
      "R1=27*10**3#use standard value\n",
      "Acl=C1/C2\n",
      "R2=Acl*R1\n",
      "R2=270*10**3#use stabdard value\n",
      "R3=(R1*R2)/(R1+R2)\n",
      "f2=Acl*f\n",
      "SR=2*3.14*f*vp\n",
      "\n",
      "#Results\n",
      "print(\"The value of SR is %.2f \" %(SR/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "colpitts oscillator\n",
        "The value of SR is 2009.60 \n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.3 Page No 678"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "vo=8.0\n",
      "f=100.0*10**3\n",
      "print(\" hartley oscillator\")\n",
      "Vcc=vo+1\n",
      "Xl2=1.0*10**3\n",
      "\n",
      "#Calculations\n",
      "L2=Xl2/(2*3.14*f)\n",
      "L2=1.5*10**-3#use standard value\n",
      "L1=L2/10.0\n",
      "Lt=L1+L2#(assuming M=0)\n",
      "C1=1/(4*(3.14**2)*(f**2)*Lt)\n",
      "C1=1500*10**-12#use 1500pF with aadditional parallel capacitance if necessary\n",
      "#C1>>stray capacitance\n",
      "Xl1=2*3.14*f*L1#R1>>Xl1\n",
      "R1=1*10**3\n",
      "Acl=L2/L1\n",
      "R2=Acl*R1\n",
      "R3=(R1*R2)/(R1+R2)\n",
      "print(\"full power bandwidth \")\n",
      "f2=Acl*f\n",
      "SR=2*3.14*f*vo\n",
      "\n",
      "#Results\n",
      "print(\"The value of SR is %.2f \" %(SR/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " hartley oscillator\n",
        "full power bandwidth \n",
        "The value of SR is 5024.00 \n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.4, Page No 680"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "f=100.0*10**3\n",
      "Vo=9.0\n",
      "Acl=3.0\n",
      "\n",
      "#Calculations\n",
      "print(\" design of wein bridge oscillator\")\n",
      "Vcc=Vo+1\n",
      "C1=1000.0*10**-12#standard value\n",
      "C2=C1\n",
      "R1=1.0/(2*3.14*f*C1)\n",
      "R2=R1\n",
      "R4=R2\n",
      "R3=2*R4\n",
      "R3=3.3*10**3#use standard value\n",
      "print(\" minimum full power bandwidth\")\n",
      "f2=Acl*f\n",
      "SR=2*3.14*f*Vo\n",
      "\n",
      "#Results\n",
      "print(\"The value of SR is %.2f \" %(SR/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " design of wein bridge oscillator\n",
        " minimum full power bandwidth\n",
        "The value of SR is 5652.00 \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.5 Page No 683"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "f=5.0*10**3\n",
      "vo=5.0\n",
      "I1=1.0*10**-3\n",
      "Vf=0.7\n",
      "\n",
      "#Calculations\n",
      "print(\"phase shift oscillator\")\n",
      "R1=(vo/29.0)/I1\n",
      "R1=150#use standard value\n",
      "R2=29*R1\n",
      "R4=(2*Vf)/I1\n",
      "R4=1.5*10**3#use 1.5kohm standard value\n",
      "R5=R2-R4\n",
      "R6=.4*R5\n",
      "R7=.8*R5\n",
      "R=R1\n",
      "C=1.0/(2*3.14*R*f*math.sqrt(6))\n",
      "\n",
      "#Results\n",
      "print(\"The value of C is %.2f mF\" %(C*10**9))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "phase shift oscillator\n",
        "The value of C is 86.68 mF\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.6 Page No 686"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "rds=600.0\n",
      "Vgs=1.0\n",
      "Vd1=0.7\n",
      "f=100.0*10**3\n",
      "\n",
      "#Calculations\n",
      "print(\"wien bridge ocillator\")\n",
      "R4=560.0\n",
      "R3=2*((R4*rds)/(R4+rds))\n",
      "I5=200.0*10**-6\n",
      "Vo=6\n",
      "R6=Vgs/I5\n",
      "R5=(Vo-(Vgs+Vd1))/I5\n",
      "print(\" C4 discharge voltage \")\n",
      "Vc=.1*Vgs\n",
      "print(\"C4 discharge time\")\n",
      "T=1/f\n",
      "Ic=I5\n",
      "C4=(Ic*T)/Vc\n",
      "Xc3=rds/10#at oscillating frequency\n",
      "C3=1/(2*3.14*f*Xc3)\n",
      "\n",
      "#Results\n",
      "print(\"The value of C3 is %.2f mF\" %(C3*10**9))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "wien bridge ocillator\n",
        " C4 discharge voltage \n",
        "C4 discharge time\n",
        "The value of C3 is 26.54 mF\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.7, Page No 689"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Vo=14.0\n",
      "Vr3=.5\n",
      "Ib=500.0*10**-9\n",
      "f=1.0*10**3\n",
      "\n",
      "#Calculations\n",
      "print(\"square wave generator\")\n",
      "Vcc=Vo+1\n",
      "UTP=Vr3\n",
      "LTP=UTP\n",
      "I2=100*Ib\n",
      "R3=Vr3/I2\n",
      "R2=(Vo-Vr3)/I2\n",
      "t=1/(2*f)\n",
      "V=UTP-(-LTP)\n",
      "C1=.1*10**-6\n",
      "I1=(C1*V)/t\n",
      "R1=Vo/I1\n",
      "\n",
      "#Results\n",
      "print(\"The value of R1 is %.2f kohm\" %(R1/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "square wave generator\n",
        "The value of R1 is 70.00 kohm\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.8 Page No 694"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "R1=2.2*10**3\n",
      "R2=2.7*10**3\n",
      "C2=.5*10**-6\n",
      "Vcc=15.0\n",
      "\n",
      "#Calculations\n",
      "t1=.693*C2*(R1+R2)\n",
      "t2=.693*C2*R2\n",
      "T=t1+t2\n",
      "f=1/T\n",
      "Ic1=(Vcc/3)/(R1+R2)\n",
      "\n",
      "#Results\n",
      "print(\"The value of Ic1 is %.2f mA\" %(Ic1*10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Ic1 is 1.02 mA\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.10 Page No 699"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Vcc=9.0\n",
      "Vo=3\n",
      "I1=1.0*10**-3\n",
      "f=500.0\n",
      "UTP=3.0\n",
      "\n",
      "#Calculations\n",
      "print(\"design the triangular wave\")\n",
      "Vi=Vcc-1\n",
      "V=Vo-(-Vo)\n",
      "print(\" I1>>Ibmax for op-amp\")\n",
      "R1=Vi/I1\n",
      "t=1.0/(2*f)\n",
      "C1=(I1*t)/V\n",
      "print(\"schmitt design\")\n",
      "I2=1.0*10**-3\n",
      "R2=UTP/I2\n",
      "R3=(Vcc-1)/I2\n",
      "\n",
      "#Results\n",
      "print(\"The value of R3 is %.2f kohm\" %(R3/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "design the triangular wave\n",
        " I1>>Ibmax for op-amp\n",
        "schmitt design\n",
        "The value of R3 is 8.00 kohm\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.11 Page No 705"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "f=100.0*10**3\n",
      "Rs=1.5*10**3\n",
      "R1=2.0*Rs\n",
      "\n",
      "\n",
      "#Calculations\n",
      "R1=2.7*10**3#use standard value\n",
      "R2=R1+Rs\n",
      "C1=1/(2*3.14*f*R2)\n",
      "R4=R2\n",
      "R3=2*R4\n",
      "\n",
      "#Results\n",
      "print(\"The value of R3 is %.2f kohm\" %(R3/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R3 is 8.40 kohm\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.12, Page No 705"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "fs=1.0*10**6\n",
      "Rs=700.0\n",
      "C1=1000.0*10**-12\n",
      "C2=100.0*10**-12\n",
      "R1=1.0*10**6\n",
      "R2=10.0*10**3\n",
      "Rs=700.0\n",
      "Vdd=5\n",
      "\n",
      "#Calculations\n",
      "Ct=(C1*C2)/(C1+C2)\n",
      "print(\" at resonance Xl=Xct    2*pi*f*L=1/2*pi*f*Ct\")\n",
      "L=1/(((2*3.14*f)**2)*Ct)\n",
      "ip=Vdd/(R1+R2+Rs)\n",
      "Pd=(((.707*ip)**2)*Rs)*10**9\n",
      "\n",
      "#Results\n",
      "print(\" peak power dissipated is %.3fnW \" %Pd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " at resonance Xl=Xct    2*pi*f*L=1/2*pi*f*Ct\n",
        " peak power dissipated is 8.563nW \n"
       ]
      }
     ],
     "prompt_number": 38
    }
   ],
   "metadata": {}
  }
 ]
}