{
 "metadata": {
  "name": "",
  "signature": "sha256:d7e6ca5b0b3b9273677b365c5a5c5dfae6429b091a9cdd3065bc98b47d3ef56f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13: Detectors and Mixers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.1, Page 546"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "P=10000.   #average power (W)\n",
      "V=1000.    #amplitude (V)\n",
      "\n",
      "#Calculations&Results\n",
      "W1=4*math.pi*10**6\n",
      "Wc=2*math.pi*10**8\n",
      "alpha = P/V**2\n",
      "print \"alpha=%.2f\"%alpha\n",
      "#(b)=\n",
      "A=1000+2*225+2*150+2*75\n",
      "peak_power=alpha*A**2\n",
      "print \"A=%.0f V\\npeak_power=%.0f W\"%(A,peak_power)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "alpha=0.01\n",
        "A=1900 V\n",
        "peak_power=36100 W\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2, Page 551"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "n=1\n",
      "q=1.602*10**-19  #C\n",
      "k=1.38*10**-23\n",
      "T=290            #K\n",
      "Is=10**-8        #A\n",
      "\n",
      "#Calculations&Results\n",
      "a=q/(n*k*T)\n",
      "Ib=0            #A\n",
      "Rj=1/(a*(Ib+Is))\n",
      "print \"(a)Rj=%d kohm\"%(Rj*10**-3)\n",
      "Ib=100*10**-6\n",
      "Rj=1/(a*(Ib+Is))\n",
      "print \"(b)Rj=%.1f ohm\"%Rj"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Rj=2498 kohm\n",
        "(b)Rj=249.8 ohm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3, Page 557"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "fc = 5*10**6   #hz\n",
      "Vm = 1         #V\n",
      "fm = 1*10**3   #Hz\n",
      "\n",
      "#Calculations&Results\n",
      "#(a)\n",
      "#Since the i/p frequency is multiplied by 12\n",
      "fd = 10*12  #Hz\n",
      "print \"Frequency deviation at output = +/-%d KHz\"%fd\n",
      "\n",
      "#(b)\n",
      "fosc = 55*10**6  #i/p signal from oscillator (Hz)\n",
      "fs = fosc+fc+fd*10**3\n",
      "print \"\\nSum frequency at output = %.2f MHz\"%(fs*10**-6)\n",
      "\n",
      "#(c)\n",
      "a=1\n",
      "delf=10*1000\n",
      "fm=1000\n",
      "B=a*delf/fm\n",
      "print \"\\nFrequency deviation = %d\"%B\n",
      "\n",
      "#(d)\n",
      "a=2\n",
      "delf=10*1000\n",
      "fm=500\n",
      "B=a*delf/fm\n",
      "print \"\\nFrequency deviation = %d \"%B"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequency deviation at output = +/-120 KHz\n",
        "\n",
        "Sum frequency at output = 60.12 MHz\n",
        "\n",
        "Frequency deviation = 10\n",
        "\n",
        "Frequency deviation = 40 \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.5, Page 573"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "IDss=50*10**-3  #mA\n",
      "gm=200*10**-3   #mS\n",
      "VL=.25         #V \n",
      "RL=50          #ohms\n",
      "\n",
      "#Calculations&Results\n",
      "Vp=2*VL         #V\n",
      "#gm=-2*IDss/Vp\n",
      "Vp=2*IDss/gm    #V\n",
      "print \"Vp=%.2f V\"%Vp\n",
      "gc=IDss/(2*Vp)\n",
      "print \"gc=%.e S\"%gc\n",
      "Av=gc*RL\n",
      "print \"Av=%.1f\"%Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vp=0.50 V\n",
        "gc=5e-02 S\n",
        "Av=2.5\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}