{
 "metadata": {
  "name": "",
  "signature": "sha256:ea4ffd68aac20fcc9a7413fc9ab8e0a2e574e16a66c6b5413621ddd0c8d4148d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter12:Sinusoidal Oscillators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 423"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate frequency of oscillations\n",
      "#given\n",
      "import math\n",
      "L=55.*10.**-6.;#H\n",
      "C=300.*10.**-12.;#F\n",
      "fo=1./(2.*math.pi*math.sqrt(L*C));\n",
      "print '%s %.f %s' %(\"The frequency of oscillations =\",fo/1000,\"kHz\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of oscillations = 1239 kHz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 425"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate frequency of oscillations and feedback factor and voltage gain\n",
      "#given\n",
      "def  prll(r1,r2):\n",
      "\tz=r1*r2/(r1+r2)#\n",
      "\treturn z\n",
      "import math\n",
      "C1=0.001*10.**-6.;#F\n",
      "C2=0.01*10.**-6.;#F\n",
      "L=15.*10.**-6.;#H\n",
      "C=prll(C1,C2);\n",
      "fo=1./(2.*math.pi*math.sqrt(L*C));\n",
      "print '%s %.2f %s' %(\"The frequency of oscillations =\",fo/10**6,\"MHz\\n\");\n",
      "B=C1/C2;\n",
      "Amin=1./B;\n",
      "print '%s %.1f %s' %(\"The feedback factor of the circuit =\",B,\"\\n\");\n",
      "print '%s %.f' %(\"The circuit needs a minimum voltage gain of\",Amin);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of oscillations = 1.36 MHz\n",
        "\n",
        "The feedback factor of the circuit = 0.1 \n",
        "\n",
        "The circuit needs a minimum voltage gain of 10\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate frequency of oscillations\n",
      "#given\n",
      "import math\n",
      "R=10.*10.**3.;#ohm\n",
      "C=0.01*10.**-6.;#F\n",
      "fo=1./(2.*math.pi*R*C*math.sqrt(6.));\n",
      "print '%s %.1f %s' %(\"The frequency of oscillations =\",fo,\"Hz\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of oscillations = 649.7 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate frequency of oscillations\n",
      "#given\n",
      "import math\n",
      "R=22.*10.**3.;#ohm\n",
      "C=100.*10.**-12.;#F\n",
      "fo=1./(2.*math.pi*R*C);\n",
      "print '%s %.2f %s' %(\"The frequency of oscillations =\",fo/1000,\"KHz\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of oscillations = 72.34 KHz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 434"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the series and parallel resonant frequencies\n",
      "#given\n",
      "def  prll(r1,r2):\n",
      "\tz=r1*r2/(r1+r2)#\n",
      "\treturn z\n",
      "import math\n",
      "L=3.;#H\n",
      "Cm=10.*10.**-12.;#F\n",
      "Cs=0.05*10.**-12.;#F\n",
      "fs=1./(2.*math.pi*math.sqrt(L*Cs));\n",
      "print '%s %.f %s' %(\"The series resonant frequency =\",fs/1000,\"kHz\\n\");\n",
      "\n",
      "Cp=prll(Cm,Cs);\n",
      "fp=1./(2.*math.pi*math.sqrt(L*Cp));\n",
      "print '%s %.f %s' %(\"The parallel resonant frequency =\",fp/1000,\"kHz\");\n",
      "#Determine the series and parallel resonant frequencies\n",
      "#given\n",
      "def  prll(r1,r2):\n",
      "\tz=r1*r2/(r1+r2)#\n",
      "\treturn z\n",
      "import math\n",
      "L=3.;#H\n",
      "Cm=10.*10.**-12.;#F\n",
      "Cs=0.05*10.**-12.;#F\n",
      "fs=1./(2.*math.pi*math.sqrt(L*Cs));\n",
      "print '%s %.f %s' %(\"The series resonant frequency =\",fs/1000,\"kHz\\n\");\n",
      "\n",
      "Cp=prll(Cm,Cs);\n",
      "fp=1./(2.*math.pi*math.sqrt(L*Cp));\n",
      "print '%s %.f %s' %(\"The parallel resonant frequency =\",fp/1000,\"kHz\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The series resonant frequency = 411 kHz\n",
        "\n",
        "The parallel resonant frequency = 412 kHz\n",
        "The series resonant frequency = 411 kHz\n",
        "\n",
        "The parallel resonant frequency = 412 kHz\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}