{
 "metadata": {
  "name": "",
  "signature": "sha256:d7081c1de999174dc8f97847c2d374ebdce489247c4f5cd4f78037286264617c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 - IC Operational Amplifiers in Switching Circuits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a non inverting amplifier by determining Required resistances and output voltage\n",
      "Av=28.#Voltage gain\n",
      "E=50.#Input voltage(in mV)\n",
      "Ib=500.#Base current(in nA)\n",
      "i=100.*Ib*0.001\n",
      "R3=E/i\n",
      "Vo=Av*E*0.001\n",
      "r=Vo*1000./i\n",
      "R2=r-R3\n",
      "R1=(R2*R3)/(R2+R3)\n",
      "print '%s %.1f %s %.f %s %.f %s %.f' %('Output voltage(in volts)=',Vo,'\\nRequired resistances\\nR3(in kilo ohm)=',R3,'\\nR2(in kilo ohm)=',R2,'\\nR1(in kilo ohm)=',R1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage(in volts)= 1.4 \n",
        "Required resistances\n",
        "R3(in kilo ohm)= 1 \n",
        "R2(in kilo ohm)= 27 \n",
        "R1(in kilo ohm)= 1\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design an inverter by determining input resistance,current and capacitance \n",
      "Vo=11.#Output voltage(in volts)\n",
      "Vcc=12.#Collector voltage(in volts)\n",
      "Vi=6.#Input voltage(in volts)\n",
      "f=1.#Frequency(in Khz)\n",
      "Vb=0.5#Base voltage(in volts)\n",
      "Vee=-12.#Emitter voltage(in volts)\n",
      "Ib=500.#Max base current(in nA)\n",
      "Vc=2.#Collector voltage(in volts)\n",
      "Vr2=Vb-Vee\n",
      "I2=100.*Ib*0.001\n",
      "R2=Vr2/I2\n",
      "i=Vr2/R2\n",
      "R1=(Vcc-Vb)/i\n",
      "Ri=99.\n",
      "Ii=60.6\n",
      "pw=1000./(2.*f)\n",
      "C=(Ii*pw)*10.**(-6)/Vc\n",
      "print '%s %.f %s %.1f %s %.3f' %('Input resistance(in kilo ohm)=',Ri,'\\nInput current(in micro ampere)=',Ii,'\\nCapacitance(in micro farad)=',C)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input resistance(in kilo ohm)= 99 \n",
        "Input current(in micro ampere)= 60.6 \n",
        "Capacitance(in micro farad)= 0.015\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a differentiating circuit by determining required resistances and capacitance\n",
      "Vo=5.#Output voltage(in volts)\n",
      "Vi=1.#Change in input voltage(in volts)\n",
      "t=100.#Time period(in micro sec)\n",
      "I=1.#Circuit current(in mA)\n",
      "R2=Vo/I\n",
      "R1=235.\n",
      "R3=R2\n",
      "C=Vo*t/(R2*Vi*1000.)\n",
      "print '%s %.1f %s %.f %s %.f %s %.f' %('Required components for circuit are \\nCapacitance(in micro farad)=',C,'\\nResistances R1(in ohm)=',R1,'\\nR2(in kilo ohm)=',R2,'\\nR3(in kilo ohm)=',R3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required components for circuit are \n",
        "Capacitance(in micro farad)= 0.1 \n",
        "Resistances R1(in ohm)= 235 \n",
        "R2(in kilo ohm)= 5 \n",
        "R3(in kilo ohm)= 5\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate lowest operating frequency for circuit\n",
      "import math\n",
      "V=4.#Peak to peak amplitude of output waveform(in volts)\n",
      "Vi=10.#Input voltage(in volts)\n",
      "Vs=15.#Supply voltage(in volts)\n",
      "Ib=500.#Maximum Base current(in nA)\n",
      "f=250.#Frequency of input waveform(in hz)\n",
      "I=1.#Circuit current(in mA)\n",
      "R1=Vi/I\n",
      "R3=20.*R1\n",
      "R2=(R3*R1)/(R1+R3)\n",
      "t=1000./(2.*f)\n",
      "C=(I*t)/V\n",
      "F=22.*1000./(2.*math.pi*C*R3)\n",
      "print '%s %.f' %('Required frequency(in hz)=',F)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required frequency(in hz)= 35\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}