{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14 : Stability and Oscillators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.1a, Page No 529"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "s1 = -46.2*(10**5)\n",
      "s2 = -45.9*(10**6)\n",
      "s3 = -11.4*(10**8)\n",
      "s4 = -30.4*(10**8)\n",
      "\n",
      "#Calculations\n",
      "#Zeros\n",
      "s5 = 16.65*(10**9)\n",
      "s6 = 15.4*(10**8)\n",
      "s7 = -22.55*(10**8)\n",
      "s = 6.28*(10**6)\n",
      "B = 0.040\n",
      "Ai = 410.0           #Gain\n",
      "j=1\n",
      "\n",
      "n = s2/s1\n",
      "print(\"The value of n= %.2f \" %n)\n",
      "Q = (n*(1+(B*Ai)))**0.5/(n+1)\n",
      "print(\"The value of Q = %.2f \" %Q)\n",
      "k = 1.0/(2*Q)\n",
      "print(\"The value of K = %.2f \" %k)\n",
      "\n",
      "s1f = s1*((n+1)/2)*(1-j*((4*Q*Q)-1)**0.5)\n",
      "\n",
      "#Results\n",
      "print(\"The first pole is = %.2f rad/s \" %s1f)\n",
      "s2f = s1*((n+1)/2)*(1+j*((4*Q*Q)-1)**0.5)\n",
      "print(\"The second pole is = %.2f rad/s\" %s2f)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of n= 9.94 \n",
        "The value of Q = 1.20 \n",
        "The value of K = 0.42 \n",
        "The first pole is = 29982570.54 rad/s \n",
        "The second pole is = -80502570.54 rad/s\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.2a, Page No 529"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Q=1.20\n",
      "w1=45.9\n",
      "w2=4.62\n",
      "k=0.417\n",
      "w0=Q*(w1+w2)\n",
      "\n",
      "#Calculations\n",
      "fpeak=(w0/6.28)*math.sqrt(1.0-(2.0*(k**2.0)))\n",
      "m=1.0/(2.0*k*(math.sqrt(1-(2.0*(k**2.0)))))\n",
      "m2=20*math.log(m,10)\n",
      "\n",
      "#Results\n",
      "print(\"The value of fpeak = %.2f MHZ\" %fpeak)\n",
      "print(\"The value of overshoot = %.2f dB\" %m)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of fpeak = 7.80 MHZ\n",
        "The value of overshoot = 1.48 dB\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}