{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 6: Amplification"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.1, Page 92"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ouput voltage of and amplifier = 15.2 V\n"
     ]
    }
   ],
   "source": [
    "#Initialisation\n",
    "Ri=1000                    #Input Resistance of amplifier in Ohm\n",
    "Rs=100                    #Output Resistance of sensor in Ohm\n",
    "Rl=50                     #Load Resistance\n",
    "Ro=10                    #Output Resistance of amplifier in Ohm\n",
    "Av=10                     #Voltage gain\n",
    "Vs=2                       #Sensor voltage\n",
    "\n",
    "#Calculation\n",
    "Vi=Ri*Vs*(Rs+Ri)**-1               #Input Voltage of Amplifier\n",
    "Vo=Av*Vi*Rl*(Ro+Rl)**-1               #Output Voltage of Amplifier\n",
    "\n",
    "#Result\n",
    "print'Ouput voltage of and amplifier = %.1f V'%Vo\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.2, Page 93"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage Gain, Av = 8.35\n"
     ]
    }
   ],
   "source": [
    "#Initialisation\n",
    "Vo=15.2               #Output Voltage of Amplifier\n",
    "Vi=1.82               #Input Voltage of Amplifier\n",
    "\n",
    "#Calculation\n",
    "Av=Vo/Vi                     #Voltage gain\n",
    "\n",
    "#Result\n",
    "print'Voltage Gain, Av = %.2f'%Av\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.3, Page 94"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ouput voltage of and amplifier = 20.0 V\n"
     ]
    }
   ],
   "source": [
    "#Initialisation\n",
    "Av=10                     #Voltage gain\n",
    "Vi=2                      #Input Voltage of Amplifier\n",
    "Rl=50                     #Load Resistance\n",
    "Ro=0                    #Output Resistance of amplifier in Ohm\n",
    "\n",
    "\n",
    "#Calculation\n",
    "Vo=Av*Vi*Rl/(Ro+Rl)               #Output Voltage of Amplifier\n",
    "\n",
    "#Result\n",
    "print'Ouput voltage of and amplifier = %.1f V'%Vo\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.4, Page 96"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Output Power, Po = 4.6 W\n"
     ]
    }
   ],
   "source": [
    "#Initialisation\n",
    "Vo=15.2                               #Output Voltage\n",
    "Rl=50                                 #Load Resistance\n",
    "\n",
    "#Calculation \n",
    "Po=(Vo**2)/Rl                           #Output Power\n",
    "\n",
    "#Result\n",
    "print'Output Power, Po = %.1f W'%Po"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.5, Page 98"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Power Gain, Ap = 1395\n"
     ]
    }
   ],
   "source": [
    "#Initialisation\n",
    "Vi=1.82                     #Input Voltage of Amplifier\n",
    "Ri=1000                    #Input Resistance of amplifier in Ohm\n",
    "Vo=15.2                     #Output Voltage of Amplifier\n",
    "Rl=50                     #Load Resistance\n",
    "\n",
    "\n",
    "#Calculation\n",
    "Pi=(Vi**2)*Ri**-1                #Input Power in Watt\n",
    "Po=(Vo**2)*Rl**-1                #Output Power in Watt\n",
    "Ap=Po/Pi                          #Power Gain\n",
    " \n",
    "\n",
    "#Result\n",
    "print'Power Gain, Ap = %d'%Ap            #wrong answer in textbook     \n",
    "             "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.6, Page 99"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Power Gain (dB) = 31.5 dB\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#Initialisation\n",
    "P=1400                          #Power gain\n",
    "\n",
    "#Calculation\n",
    "pdb=10*math.log10(P)                 #Power Gain in dB\n",
    "\n",
    "#Result\n",
    "print'Power Gain (dB) = %.1f dB'%pdb\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "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.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}