{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter - 3 : Tuned Amplifier"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.1 : page 97"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Close loop voltage gain AF  = 11.00 \n",
      "Value of RiF = 1.82e+10 ohm\n",
      "Value of RoF = 4.12e-03 ohm\n",
      "Value of fF = 91 kHz\n"
     ]
    }
   ],
   "source": [
    "# given data\n",
    "R1=1.5 #in kohm\n",
    "RF=15 #in kohm\n",
    "A=2*10**5 #unitless\n",
    "Ri=1 #in Mohm\n",
    "Ro=75 #in ohm\n",
    "fo=5 #in Hz\n",
    "AF=1+RF/R1 #unitless\n",
    "B=1/AF #unitless\n",
    "RiF=(1+A*B)*Ri*10**6 #in ohm\n",
    "RoF=Ro/(1+A*B) #in ohm\n",
    "fF=fo*(1+A*B) #in ohm\n",
    "print \"Close loop voltage gain AF  = %0.2f \" %AF\n",
    "print \"Value of RiF = %0.2e ohm\"%RiF\n",
    "print \"Value of RoF = %0.2e ohm\"%RoF\n",
    "print \"Value of fF = %0.f kHz\"%(fF/1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.2 : page 98"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Value of RiF = 99.00 kohm\n",
      "Value of RiF = 2.00e+09 ohm\n",
      "Value of RoF = 3.75e-02 ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "# given data\n",
    "AF=100 #unitless\n",
    "A=2*10**5 #unitless\n",
    "Ri=1 #in Mohm\n",
    "Ro=75 #in ohm\n",
    "#let R1 =1 ohm\n",
    "R1=1 #in ohm\n",
    "#formula : AF=1+RF/R1\n",
    "RF=(AF-1)*R1 #in kohm\n",
    "B=1/AF #unitless\n",
    "RiF=(1+A*B)*Ri*10**6 #in ohm\n",
    "RoF=Ro/(1+A*B) #in ohm\n",
    "print \"Value of RF = %0.2f kohm\"%RF\n",
    "print \"Value of RiF = %0.2e ohm\"%RiF\n",
    "print \"Value of RoF = %0.2e ohm\"%RoF"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.3 : page 99"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Value of RiF = 2.00e+11 ohm\n",
      "Value of RoF = 3.75e-04 ohm\n",
      "Value of fF = 1.00 MHz\n"
     ]
    }
   ],
   "source": [
    "# given data\n",
    "AF=1 #unitless\n",
    "B=1 #unitless\n",
    "A=2*10**5 #unitless\n",
    "fo=5 #in Hz\n",
    "Ri=1 #in Mohm\n",
    "Ro=75 #in ohm\n",
    "#let 1+AB=A  as A>>>1\n",
    "RiF=A*Ri*10**6 #in ohm\n",
    "RoF=Ro/A #in ohm\n",
    "fF=fo*A #in ohm\n",
    "print \"Value of RiF = %0.2e ohm\"%RiF\n",
    "print \"Value of RoF = %0.2e ohm\"%RoF\n",
    "print \"Value of fF = %0.2f MHz\"%(fF/10**6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.4 : page 103"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Value of RF = 300 kohm\n"
     ]
    }
   ],
   "source": [
    " # given data\n",
    "R1=50 #in Kohm\n",
    "AF=-6 #unitless\n",
    "# here AF=-RF/R1\n",
    "RF=-AF*R1 #in kohm\n",
    "print \"Value of RF = %0.f kohm\" %RF"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.5 : page 104"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Close loop voltage gain AF = -6.00\n",
      "Value of RiF = 50.00 kohm\n",
      "Value of RoF = 2.62e-03 ohm\n",
      "Value of fF = 143 kHz\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "# given data\n",
    "A=2*10**5 #unitless\n",
    "Ri=1 #in Mohm\n",
    "Ro=75 #in ohm\n",
    "fo=5 #in Hz\n",
    "R1=50 #in kohm\n",
    "RF=300 #in kohm\n",
    "K=RF/(R1+RF) #unitless\n",
    "B=R1/(R1+RF) #unitless\n",
    "AF=-(A*K/(1+A*B)) #unitless\n",
    "RiF=R1 #in kohm   ideal\n",
    "RoF=Ro/(1+A*B) #in ohm\n",
    "fF=-(A*K*fo/AF) #in Hz\n",
    "print \"Close loop voltage gain AF = %0.2f\"%AF\n",
    "print \"Value of RiF = %0.2f kohm\"%RiF\n",
    "print \"Value of RoF = %0.2e ohm\"%RoF\n",
    "print \"Value of fF = %0.f kHz\"%(fF/1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.6 : page 107"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Value of RF = 30 kohm\n"
     ]
    }
   ],
   "source": [
    "# given data\n",
    "# let R1=R2=R3=R=10kohm\n",
    "R=10 #in kohm\n",
    "R1=R #in kohm\n",
    "R2=R #in kohm\n",
    "R3=R #in kohm\n",
    "RF=3*R #in Kohm\n",
    "print \"Value of RF = %0.0f kohm\"%RF"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.7 : page 108"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Value of R1 = 33.33 kohm\n",
      "Value of RiF = 33.33 kohm\n"
     ]
    }
   ],
   "source": [
    " # given data\n",
    "RF=1 #in Mohm\n",
    "AV=-30 #unitless\n",
    "#AV=-RF/R1=Vo/V1\n",
    "R1=-RF*10**6/AV #in ohm\n",
    "#for an inverting amplifier RiF=R1\n",
    "RiF=R1 #in ohm\n",
    "print \"Value of R1 = %0.2f kohm\"%(R1/1000)\n",
    "print \"Value of RiF = %0.2f kohm\"%(RiF/1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.8 : page 108"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Required value of R2 = 533.33 kohm\n",
      "Required value of R1 = 66.67 kohm\n"
     ]
    }
   ],
   "source": [
    " # given data\n",
    "AV=-8 #unitless\n",
    "Vin=-1 #in Volts\n",
    "Imax=15 #in uA\n",
    "Vo=AV*Vin #in Volts\n",
    "#Formula : Vo=Imax*R2min\n",
    "R2min=Vo/(Imax*10**-6) #in kohm\n",
    "R1min=-Vin/(Imax*10**-6) #in kohm\n",
    "print \"Required value of R2 = %0.2f kohm\"%(R2min/1000)\n",
    "print \"Required value of R1 = %0.2f kohm\"%(R1min/1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 3.9 : page 110"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of RF = 75.00 Mohm\n",
      "Value of R1 = 98.80 kohm\n",
      "Value of R2 = 494.00 kohm\n",
      "Value of R3 = 494.00 kohm\n",
      "Value of R4 = 17.64 kohm\n"
     ]
    }
   ],
   "source": [
    " # given data\n",
    "Vo=1.5 #in Volts\n",
    "Vin=10 #in mVolts\n",
    "RiF=500 #in kohm\n",
    "R1=500 #in kohm\n",
    "AF=Vo/(Vin*10**-3) #unitless\n",
    "RF=AF*R1 #in Kohm\n",
    "print \"The value of RF = %0.2f Mohm\"%(RF/1000)\n",
    "#AF=-R2/R1*(1+R3/R2+R3/R4)\n",
    "#Microphone resistance is Rm=1.2 Kohm\n",
    "R1eff=100 #in Kohm\n",
    "Rm=1.2 #in Kohm\n",
    "R1=R1eff-Rm\n",
    "R3=5*R1 \n",
    "R2=R3 #in Kohm\n",
    "R4=R3/28 #in Kohm\n",
    "print \"Value of R1 = %0.2f kohm\" %R1\n",
    "print \"Value of R2 = %0.2f kohm\" %R2\n",
    "print \"Value of R3 = %0.2f kohm\" %R3\n",
    "print \"Value of R4 = %0.2f kohm\" %R4"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}