{
 "metadata": {
  "name": "",
  "signature": "sha256:6400e06363df718a0205b64ca5c3fc7d61a14e362b1dd10172150d22b3db1e89"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 : Communication Filters and Signal Transmission"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5  Page No : 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array,log10,sqrt\n",
      "\n",
      "# Variables\n",
      "f = array([500., 2000., 10000.]);    #frequency in Hz\n",
      "\n",
      "# Calculations\n",
      "Af = 1/sqrt(1+(f/1000)**8);   #Linear amplitude response\n",
      "AdBf = 20*log10(Af);\n",
      "\n",
      "# Results\n",
      "print '   f,Hz     (Af)        (AdBf)'\n",
      "for i in range(3):\n",
      "    print ' %5i Hz   %.5f     %.3f dB'%(f[i],Af[i],AdBf[i])\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "   f,Hz     (Af)        (AdBf)\n",
        "   500 Hz   0.99805     -0.017 dB\n",
        "  2000 Hz   0.06238     -24.099 dB\n",
        " 10000 Hz   0.00010     -80.000 dB\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6  Page No : 123"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "L = 4.*10**-6;   #Henry\n",
      "C = 9.*10**-12;  #Farad\n",
      "R = 20.*10**3;    #ohm\n",
      "\n",
      "# Calculations and Results\n",
      "f0 = 1/(2*math.pi*math.sqrt(L*C));    #frequency in Hz\n",
      "print 'a) The resonant frequency is f0 = %.2f  MHz'%(f0*10**-6)\n",
      "Q = R*math.sqrt(C/L)\n",
      "print ' b) The Q is %i'%(Q);\n",
      "B = f0/Q;\n",
      "print ' c) The 3-dB bandwidth is B = %i KHz'%(B*10**-3);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) The resonant frequency is f0 = 26.53  MHz\n",
        " b) The Q is 30\n",
        " c) The 3-dB bandwidth is B = 884 KHz\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7  Page No : 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "#misprinted example number\n",
      "pulse_width = 2*10**-6;    #second\n",
      "rise_time = 10*10**-9;      #second\n",
      "\n",
      "# Calculations and Results\n",
      "B = .5/pulse_width;       #in Hz\n",
      "print 'a) The aproximate bandwidth for coarse reproduction is B = %i  KHz'%(B*10**-3)\n",
      "B = .5/rise_time;\n",
      "print ' b) The aproximate bandwidth for fine reproduction is B = %i  MHz'%(B*10**-6)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) The aproximate bandwidth for coarse reproduction is B = 250  KHz\n",
        " b) The aproximate bandwidth for fine reproduction is B = 50  MHz\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}