{
 "metadata": {
  "name": "",
  "signature": "sha256:cd13dfdb6dd7420874a1c992512f922297a6fa769a755d9c2c04bb32f02bdf3a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7: Radio Transmitters and Receivers "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.1, page no. 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variable Declaration\n",
      "fs1    = 1.00*pow(10,6)             # Sampling Frequency (Hz)\n",
      "fs2    = 25.00*pow(10,6)            # Sampling Frequency (Hz)\n",
      "fi     = 455.00*pow(10,3)           # Intermediate Frequency (Hz)\n",
      "Q      = 100.00                     # Loaded Q of the antenna coupling circuit                \n",
      "\n",
      "# Calculation\n",
      "import math                         # Math Library\n",
      "fsi1   = fs1+2*fi                   # Image Frequency (Hz)\n",
      "rho1   = fsi1/fs1-fs1/fsi1          # Constant 1\n",
      "alpha1 = math.sqrt(1+pow(Q*rho1,2)) # Rejection Ratio 1\n",
      "fsi2   = fs2+2*fi                   # Image Frequency (Hz) \n",
      "rho2   = fsi2/fs2-fs2/fsi2          # Constant 2\n",
      "alpha2 = math.sqrt(1+pow(Q*rho2,2)) # Rejection Ratio 2\n",
      "\n",
      "# Result\n",
      "print \"(a) Image Frequency, fsi   =\",fsi1/pow(10,3),\"kHz\"\n",
      "print \"                     rho   =\",round(rho1,3)\n",
      "print \"    Image Rejection, Alpha =\",round(alpha1,1)\n",
      "print \"(b) Image Frequency, fsi   =\",fsi2/pow(10,6),\"MHz\"\n",
      "print \"                     rho   =\",round(rho2,4)\n",
      "print \"    Image Rejection, Alpha =\",round(alpha2,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Image Frequency, fsi   = 1910.0 kHz\n",
        "                     rho   = 1.386\n",
        "    Image Rejection, Alpha = 138.6\n",
        "(b) Image Frequency, fsi   = 25.91 MHz\n",
        "                     rho   = 0.0715\n",
        "    Image Rejection, Alpha = 7.22\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.2, page no. 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variable Declaration\n",
      "alpha1   = 138.6                                 # Image Rejection From Example 7.1\n",
      "alpha2   = 7.22                                  # Image Rejection From Example 7.1\n",
      "rho      = 0.0715                                # Constant From Example 7.1\n",
      "Q        = 100.00                                # Loaded Q From Example 7.1\n",
      "fsi_dash = 1.91*pow(10,6)                        # Image Frequency (Hz)\n",
      "fs_dash  = 1.00*pow(10,6)                        # Sampling Frequency 1 (Hz)\n",
      "fs       = 25.00*pow(10,6)                       # Sampling Frequency 2 (Hz)\n",
      "\n",
      "\n",
      "# Calculation\n",
      "import math                                      # Math Library\n",
      "Q_dash   = math.sqrt(pow(alpha1/alpha2,2)-1)/rho # Loaded Q of the RF amplifier\n",
      "fi_dash  = (fsi_dash/fs_dash*fs-fs)/2            # Intermediate Frequency (Hz) \n",
      "\n",
      "# Result\n",
      "print \"(a) The Q of the circuit is\",round(math.sqrt(Q*Q_dash)),\", which is the geometric mean of\",round(Q),\"and\",round(Q_dash)\n",
      "print \"(b) Intermediate Frequency, fi_dash =\",round(fi_dash/pow(10,6),1),\"MHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) The Q of the circuit is 164.0 , which is the geometric mean of 100.0 and 268.0\n",
        "(b) Intermediate Frequency, fi_dash = 11.4 MHz\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.3, page no. 164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variable Declaration\n",
      "R1    = 110.00*pow(10,3)                # RESISTANCE 1 (Ohms)\n",
      "R2    = 220.00*pow(10,3)                # RESISTANCE 2 (Ohms)\n",
      "R3    = 470.00*pow(10,3)                # RESISTANCE 3 (Ohms)\n",
      "R4    = 1.00*pow(10,6)                  # RESISTANCE 4 (Ohms)\n",
      "\n",
      "# Calculation\n",
      "import math                             # Math Library\n",
      "Rc    = R1+R2                           # Resistance (Ohm)\n",
      "Zm    = R2*R3*R4/(R2*R3+R3*R4+R2*R4)+R1 # Impedance (Ohm)\n",
      "m_max = Zm/Rc                           # Maximum Modulation Index\n",
      "\n",
      "# Result\n",
      "print \"Maximum Modulation Index, m_max =\",round(m_max*pow(10,2)),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum Modulation Index, m_max = 73.0 %\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}