summaryrefslogtreecommitdiff
path: root/sample_notebooks/YogeshPatil/Chapter_2_1.ipynb
blob: 2eef0dcc1a9d0a1843fe3f42811d62b625648cd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter No.2 : Operational Amplifier Fundamentals"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 2.1, Page No. 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Input bias and input offset current\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Ib1 = 18*10**-6             # base current of transistor 1\n",
      "Ib2 = 22*10**-6             # base current of transistor 2\n",
      "\n",
      "#Calculations\n",
      "#(i)\n",
      "Ib = (Ib1+Ib2)/2\n",
      "#(ii)\n",
      "Iios = abs(Ib1-Ib2)\n",
      "\n",
      "#Result\n",
      "print(\"(i)  Input bias current = %d micro-A\\n(ii) Input offset current = %.0f micro-A\"%(Ib*10**6,Iios*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  Input bias current = 20 micro-A\n",
        "(ii) Input offset current = 4 micro-A\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 2.2, Page No. 65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Maximum frequency of operation\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vin = 3.0               # input voltage\n",
      "sr = 0.5*10**6          # slew rate in V/Sec\n",
      "\n",
      "#Calculations\n",
      "Vm = Vin/2\n",
      "fm = sr/(2*math.pi*Vm)\n",
      "fm = fm /1000 \n",
      "\n",
      "#Result\n",
      "print(\"Maximum frequency of operation is %.3f kHz\"%(math.floor(fm*1000)/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum frequency of operation is 53.051 kHz\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 2.3, Page No. 65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Slew rate \n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Icq = 15*10**-6         # Maximum op-amp current \n",
      "C = 35*10**-12          # equivalent capacitance\n",
      "V = 12.0                # input voltage \n",
      "\n",
      "#Calculations\n",
      "S = Icq/C\n",
      "S = S/10**6\n",
      "\n",
      "#Result\n",
      "print(\"Slew rate = %.4f V/micro-sec\"%(math.floor(S*10**4)/10**4))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Slew rate = 0.4285 V/micro-sec\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 2.4, Page No. 66"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Slew rate and maximum possible frequency of input\n",
      "\n",
      "import math\n",
      "# Variable declaration\n",
      "Icq = 10*10**-6             # maximum op-amp current\n",
      "C = 33*10**-12              # equivalent capacitance\n",
      "V = 12                      # peak value of input voltage\n",
      "\n",
      "\n",
      "#Calculations\n",
      "S = Icq/C\n",
      "fm = S/(2*math.pi*V)\n",
      "\n",
      "#Result\n",
      "print(\"Slew rate = %.3f V/micro-sec\\nfm        = %.3f kHz\"%(S/10**6,fm/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Slew rate = 0.303 V/micro-sec\n",
        "fm        = 4.019 kHz\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 2.5, Page No. 66"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Common mode rejection ratio(refere to fig 2.24)\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "R1 = 1000.0            # resistance 1\n",
      "R2_1_E = 90000.0       # resistance R2(1-E)\n",
      "R2 = 100000.0          # resistance R2\n",
      "\n",
      "#Calculations\n",
      "Aid = R2/R1\n",
      "E = 1-(R2_1_E/R2)\n",
      "Acm = R2*E/(R1+R2)\n",
      "CMRR = Aid/Acm\n",
      "CMRR = 20*math.log10(CMRR)\n",
      "\n",
      "#Result\n",
      "print(\"CMRR = %d dB\"%CMRR)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "CMRR = 60 dB\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}