summaryrefslogtreecommitdiff
path: root/sample_notebooks/PreetiRani/Operational.ipynb
blob: ffbfbdf31bd49797d86eb8045387ad795189a7b0 (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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
{
 "metadata": {
  "name": "Preeti",
  "signature": "sha256:b8dcb8af15a997e111f6feb032fec7a056888e6b8b149ec767b2b1cbf63692d5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Operational Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 1.1 : page 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "G= -100.0 # Gain\n",
      "R1= 2.2 # in kohm\n",
      "R1=R1*10**3 # in ohm\n",
      "# Formula G=-Rf/R1\n",
      "Rf= -G*R1 # ohm\n",
      "Rf*= 10**-3 # kohm\n",
      "print \"The value of Rf is %d kohm\" %Rf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Rf is 220 kohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 1.2 : page 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Rf= 200 # in kohm\n",
      "R1= 2 # in kohm\n",
      "vin=2.5 # in mV\n",
      "vin=vin*10**-3 # in volt\n",
      "G= -Rf/R1 \n",
      "vo= G*vin # in V\n",
      "print \"The output voltage is %0.2f volt\" %vo"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The output voltage is -0.25 volt\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 1.3 : page 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "G=-10.0 \n",
      "Ri= 100.0 # in kohm\n",
      "R1= Ri # in kohm\n",
      "R1=R1*10**3 # in ohm\n",
      "R1*= 10**-3 # kohm\n",
      "# Formula G=-R2/R1\n",
      "R2= R1*abs(G) # ohm\n",
      "R2*= 10**-3 # Mohm\n",
      "print \"Value of R1 is %0.2f kohm\" %R1\n",
      "print \"and value of R2 is %0.2f Mohm\" %R2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of R1 is 100.00 kohm\n",
        "and value of R2 is 1.00 Mohm\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 1.4 : page 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "R1= 100.0 # in kohm\n",
      "R2= 500 # in kohm\n",
      "V1= 2.0 # in volt\n",
      "Vo= (1+R2/R1)*V1 # in volt\n",
      "print \"Output voltage for noninverting amplifier is %0.2f volt\" %Vo"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage for noninverting amplifier is 12.00 volt\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 1.5 : page 38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Rf= 1 # in Mohm\n",
      "Rf=Rf*10**6 #in ohm\n",
      "\n",
      "# Part(a)\n",
      "V1=1.0 #in volt\n",
      "V2=2.0 #in volt\n",
      "V3=3.0 #in volt\n",
      "R1= 500.0 # in kohm\n",
      "R1=R1*10**3 #in ohm\n",
      "R2= 1 # in Mohm\n",
      "R2=R2*10**6 #in ohm\n",
      "R3= 1.0 # in Mohm\n",
      "R3=R3*10**6 #in ohm\n",
      "Vo= -Rf*(V1/R1+V2/R2+V3/R3) # in volt\n",
      "print \"(a) Output voltage is %0.2f volt\" %Vo\n",
      "\n",
      "# Part(b)\n",
      "V1=-2.0 #in volt\n",
      "V2=3.0 #in volt\n",
      "V3=1.0 #in volt\n",
      "R1= 200.0 # in kohm\n",
      "R1=R1*10**3 #in ohm\n",
      "R2= 500.0 # in kohm\n",
      "R2=R2*10**3 #in ohm\n",
      "R3= 1.0 # in Mohm\n",
      "R3=R3*10**6 #in ohm\n",
      "Vo= -Rf*(V1/R1+V2/R2+V3/R3) # in volt\n",
      "print \"(b) Output voltage is %0.2f volt\" %Vo"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Output voltage is -7.00 volt\n",
        "(b) Output voltage is 3.00 volt\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 1.6 : page 38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "print \"Minimum closed loop voltage gain for R2=0 and R1= 2 kohm is \"\n",
      "R2=0 \n",
      "R1=2.0 # in kohm\n",
      "R1=R1*10**3 # in ohm\n",
      "Av_min= (1+R2/R1)\n",
      "print Av_min\n",
      "\n",
      "print \"Maximum closed loop voltage gain for maximum value of R2=100 kohm and R1= 2 kohm is\"\n",
      "R2=100 # in kohm\n",
      "R1=2 # in kohm\n",
      "Av_max= (1+R2/R1)\n",
      "print Av_max "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum closed loop voltage gain for R2=0 and R1= 2 kohm is \n",
        "1.0\n",
        "Maximum closed loop voltage gain for maximum value of R2=100 kohm and R1= 2 kohm is\n",
        "51\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 1.7 : page 39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V1= 745 # in \u00b5V\n",
      "V2= 740 # in \u00b5V\n",
      "V1=V1*10**-6 # in volt\n",
      "V2=V2*10**-6 # in volt\n",
      "CMRR=80 # in dB\n",
      "Av=5*10**5 \n",
      "# (i)\n",
      "# CMRR in dB= 20*log(Ad/Ac)\n",
      "Ad=Av \n",
      "Ac= Ad/10**(CMRR/20) \n",
      "# (ii)\n",
      "Vo= Ad*(V1-V2)+Ac*(V1+V2)/2 \n",
      "print \"Output voltage is %0.2f volt\" %Vo"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage is 2.54 volt\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}