{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter7 Receivers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.3.1,Pg.no.227"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The freq tuning range is 1005000 Hz to 2055000 Hz\n",
      "The tuning range ratio of oscillator is 2 ohm\n",
      "The capacitor tuning range ratio of oscillator is 4\n",
      "The tuning range ratio of RF−ckt is 2\n",
      "The capacitor tuning range ratio of RF−ckt is 4\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "fs_min=550*10**3\n",
    "fs_max=1600*10**3\n",
    "IF=455*10**3 \n",
    "#Determination of freq tuning ranges\n",
    "fo_min=fs_min+IF\n",
    "fo_max=fs_max+IF\n",
    "print 'The freq tuning range is',fo_min,'Hz to',fo_max,'Hz'\n",
    "Rf=(fo_max)/(fo_min)   #calculation of freq tuning range ratio\n",
    "print 'The tuning range ratio of oscillator is',Rf,'ohm'\n",
    "Rc=Rf**2               #calculation of capacitance tuning range ratio\n",
    "print 'The capacitor tuning range ratio of oscillator is',Rc\n",
    "#For RF section\n",
    "Rf1=fs_max/fs_min;\n",
    "print 'The tuning range ratio of RF−ckt is',Rf1\n",
    "Rc1=Rf1**2\n",
    "print 'The capacitor tuning range ratio of RF−ckt is',Rc1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.4.1,Pg.no.230"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Cs min is 84.0 *10^-12 F\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "Rco=8.463\n",
    "Rfo=2.909\n",
    "Rcs=4.182\n",
    "Rfo=2.045\n",
    "fo_max =2055.0*10**3\n",
    "fo_min=1005.0*10**3\n",
    "Cs_max=350.0\n",
    "#For the RF section\n",
    "Cs_min=Cs_max/Rcs\n",
    "Cs_min=round(Cs_min,0)\n",
    "print 'The Cs min is',Cs_min,'*10^-12','F'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.6.1,Pg.no.234"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Image freq is 1930.0 Hz\n",
      "Image rejection is -36.98\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import sqrt\n",
    "IF=465.0  #IF in KHz\n",
    "fs=1000   #Tuning freq in KHz\n",
    "Q=50.0    #Quality factor\n",
    "#Oscillator freq fo is given as\n",
    "fo=fs+IF;\n",
    "#a) Image freq is given as\n",
    "fi=fo+IF\n",
    "print 'Image freq is',fi,'Hz'\n",
    "y=fi/fs-fs/fi\n",
    "#b) image rejection is given as\n",
    "Ar=1/sqrt(1+(y*Q)**2)\n",
    "Ar_dB=20*math.log10(Ar)\n",
    "Ar_dB=round(Ar_dB,2)\n",
    "print 'Image rejection is',Ar_dB"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.7.1,Pg.no.236"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The sum of frequencies are\n",
      "1860\n",
      "The difference of frequencies are\n",
      "950\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "fs=950        #in KHz\n",
    "IF=455        #in KHz\n",
    "m=[1,2]\n",
    "n=[1,2]\n",
    "f0=fs+IF\n",
    "print 'The sum of frequencies are'\n",
    "for i in range (1,2):\n",
    "        for j in range (1,2):\n",
    "                fu1=j/i *f0 + 1/i*IF\n",
    "                print fu1\n",
    "print 'The difference of frequencies are'\n",
    "for i in range (1,2):\n",
    "        for j in range (1,2):\n",
    "                fu2=j/i*f0 - 1/i*IF\n",
    "                print fu2"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}