summaryrefslogtreecommitdiff
path: root/sample_notebooks/S PRASHANTHS PRASHANTH/Untitled.ipynb
blob: 8d7fb2e16956f4e91bc564c78be9b32c7035554c (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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "adm= -1482\n",
      "acm= -1\n",
      "cmrr= 76.4838188131 db\n"
     ]
    }
   ],
   "source": [
    "#problem 1 page 1.81\n",
    "#given\n",
    "rc=50000;\n",
    "re=100000;\n",
    "rs=10000;\n",
    "rp=50000;\n",
    "beta0=2000;\n",
    "r0=400000;\n",
    "#determine adm,acm,cmrr\n",
    "rc1=(rc*r0)/(rc+r0);\n",
    "print 'adm=',(-(beta0*rc1)/(rs+rp))\n",
    "print 'acm=',(-(beta0*rc1)/(rs+rp+2*re*(beta0+1)))\n",
    "import math\n",
    "print 'cmrr=',20*(math.log10((1+((2*re*(beta0+1))/(rs+rp))))),'db'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum peak amplitude at 100khz 3.1847133758 V\n"
     ]
    }
   ],
   "source": [
    "#problem 2 page 1.83\n",
    "#given\n",
    "sr=0.000001;#volt/sec\n",
    "freq=100000;\n",
    "vsat=12;\n",
    "baw=100000;\n",
    "#determine vx\n",
    "print 'maximum peak amplitude at 100khz',2*(1/(sr*2*3.14*freq)),'V'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "slew rate= 5 volt/μsec\n"
     ]
    }
   ],
   "source": [
    "#problem 3 page 1.84\n",
    "#given\n",
    "V=20;\n",
    "t=4;\n",
    "#determine slew rate\n",
    "print'slew rate=',V/t,'volt/μsec'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "max frequency of input is  79617.8343949 hz\n"
     ]
    }
   ],
   "source": [
    "#problem 4 page 1.84\n",
    "#given\n",
    "a=50;\n",
    "vi=20e-3;\n",
    "sr=0.5e6;\n",
    "#determine max frequency\n",
    "vm=a*vi;\n",
    "print 'max frequency of input is ',sr/(2*3.14*vm),'hz'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "max peak to peak input signal  0.398089171975 V\n"
     ]
    }
   ],
   "source": [
    "#problem 5 page 1.84\n",
    "#given\n",
    "sr=0.5e6;\n",
    "freq=40e3;\n",
    "a=10;\n",
    "#determine max peak to peak input signal\n",
    "vm=sr/(2*3.14*freq);\n",
    "vm=2*vm;\n",
    "print'max peak to peak input signal ',vm/a,'V'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "noise  0.0063247 V\n"
     ]
    }
   ],
   "source": [
    "#problem 6  page 1.85\n",
    "#given\n",
    "adm=400;\n",
    "cmrr=50;\n",
    "vin1=50e-3;\n",
    "vin2=60e-3;\n",
    "vnoise=5e-3;\n",
    "v0=(vin2-vin1)*adm;\n",
    "acm=adm/316.22;\n",
    "print'noise ',round(vnoise*acm,7),'V'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " time to change from 0 t0 15  4e-07 sec\n",
      "slew rate 1.5 volt/μsec\n"
     ]
    }
   ],
   "source": [
    "#problem 7 page 1.86\n",
    "#given\n",
    "sr=35e6;#volt/sec\n",
    "vsat=15;#volt\n",
    "#determine time to change from 0 to 15V\n",
    "print 'time to change from 0 t0 15 ',round(vsat/sr,7),'sec'\n",
    "c=100e-12;#farad\n",
    "i=150e-6;#A\n",
    "print'slew rate',(i/c)/1000000,'volt/μsec'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bandwidth  21231.4225053 hz\n"
     ]
    }
   ],
   "source": [
    "#problem 8 page 1.86\n",
    "#given\n",
    "sr=2e6;#v/sec\n",
    "vsat=15;#volt\n",
    "#determine bandwidth \n",
    "print'bandwidth ',sr/(2*3.14*vsat),'hz'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "output offset  3.0 V\n"
     ]
    }
   ],
   "source": [
    "#problem 9 page 1.87\n",
    "#given\n",
    "iin=30e-9;#A\n",
    "a=1e5;\n",
    "rin=1000;#ohm\n",
    "#determine output offset voltage\n",
    "vid=iin*rin;\n",
    "print'output offset ',a*vid,'V'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "input offset current  4e-06 A\n",
      "input base current  2.4e-05 A\n"
     ]
    }
   ],
   "source": [
    "#problem 10 page 1.86\n",
    "#given\n",
    "inb1=22e-6;#A\n",
    "inb2=26e-6;#A\n",
    "#determine input offset current input base current\n",
    "print'input offset current ',inb2-inb1,'A'\n",
    "print'input base current ',(inb2+inb1)/2,'A'\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "input base current  8e-08 A\n",
      "input offset current  2e-08 A\n",
      "input offset   2.0 V\n"
     ]
    }
   ],
   "source": [
    "#problem 11 page 1.86\n",
    "#given\n",
    "inb2=90e-9;#A\n",
    "inb1=70e-9;#A\n",
    "a=1e5;\n",
    "#determine input offset current\n",
    "print'input base current ',(inb2+inb1)/2,'A'\n",
    "print'input offset current ',inb2-inb1,'A'\n",
    "print'input offset  ',((inb2-inb1)*1000)*a,'V'\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "output voltage cmrr  100      0.05125 V\n",
      "output voltage cmrr  200      0.050625 V\n",
      "output voltage cmrr  450      0.0502777777778 V\n",
      "output voltage cmrr  105      0.0511904761905 V\n"
     ]
    }
   ],
   "source": [
    "#problem 12 page 1.88\n",
    "#given\n",
    "vin1=150e-6;#volt\n",
    "vin2=100e-6;#volt\n",
    "a=1000;\n",
    "from array import *\n",
    "cmrr=array('i',[100,200,450,105])\n",
    "#determine output voltage\n",
    "vc=(vin1+vin2)/2;\n",
    "vd=(vin1-vin2);\n",
    "j=0;\n",
    "while j<=3 : print 'output voltage cmrr ',cmrr[j],'    ',(a*vd*(1+(vc/(cmrr[j]*vd)))),'V';j=j+1;\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "output voltage  0.00316455696203 V\n"
     ]
    }
   ],
   "source": [
    "#problem 13 page 1.87\n",
    "#given\n",
    "rin=100e3;#ohm\n",
    "rf1=900e3;#ohm\n",
    "vc=1;#volt\n",
    "cmrr=70;\n",
    "#determine the output voltage\n",
    "print 'output voltage ',(1+(rf1/rin))*vc/3160,'V'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "input voltage  0.0796178343949 V\n"
     ]
    }
   ],
   "source": [
    "#problem 14 page 1.89\n",
    "#given\n",
    "sr=0.5e6;#volt/sec\n",
    "a=50;\n",
    "freq=20e3;#hz\n",
    "#determine max peak to peak voltage\n",
    "print'input voltage ',sr/(2*3.14*freq*a),'V'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "max frequency  265392.781316 hz\n"
     ]
    }
   ],
   "source": [
    "#problem 15 page 1.90\n",
    "#given\n",
    "sr=50e6;#volt/sec\n",
    "rin=2;\n",
    "vimax=10;\n",
    "#determine max frequency\n",
    "vm=vimax*(1+rin);\n",
    "print 'max frequency ',sr/(2*3.14*vm),'hz'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}