summaryrefslogtreecommitdiff
path: root/Electronic_Principles/Chapter_22_New.ipynb
blob: ebbb0124b222e9cab91fc6442ba7fc23d10da32f (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "CHAPTER 22 NONLINEAR OP-AMP CIRCUITS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-4, Page 854"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "Vin=10                                #ac input(V)\n",
      "Vs=15                                 #non-inverting input voltage(V)\n",
      "R1=200.0*10**3                        #non-inverting input resistance R1(Ohm)\n",
      "R2=100.0*10**3                        #non-inverting input resistance R2(Ohm)\n",
      "C=10*10**-6                           #capacitance at non-inverting input(F)\n",
      "\n",
      "Vref=Vs/3                                      #reference voltage at trip point(V)\n",
      "fc=(2*math.pi*((R1**-1+R2**-1)**-1)*C)**-1      #cutoff frequency(Hz)\n",
      "\n",
      "print 'trip point voltage Vref = ',Vref,'V'\n",
      "print 'cutoff frequency of bypass circuit fc = ',round(fc,2),'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "trip point voltage Vref =  5 V\n",
        "cutoff frequency of bypass circuit fc =  0.24 Hz\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-5, Page 855"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "Vp=10.0                                #sine peak(V)\n",
      "Vin=5.0                                #input voltage(V)    \n",
      "\n",
      "theta=math.ceil((math.asin(Vin/Vp))*180/math.pi)  #angle theta (deg)\n",
      "D=(150-theta)/360.0                              #duty cycle\n",
      "\n",
      "print 'theta = ',theta,'degrees'\n",
      "print 'duty cycle D = ',round((D*100),2),'%'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "theta =  31.0 degrees\n",
        "duty cycle D =  33.06 %\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-6, Page 860"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "R1=1.0                              #non-inverting input resistance R1(KOhm)\n",
      "R2=47.0                             #feedback path resistance R2(KOhm)\n",
      "Vsat=13.5                           #saturation voltage(V)\n",
      "\n",
      "B=R1/(R1+R2)                       #feedback fraction\n",
      "UTP=B*Vsat                         #upper trip point\n",
      "LTP=-B*Vsat                        #lower trip point\n",
      "H=UTP-LTP                          #hysteresis\n",
      "\n",
      "print 'lower trip point LTP = ',round(LTP,2),'V'\n",
      "print 'upper trip point LTP = ',round(UTP,2),'V'\n",
      "print 'hysteresis is ',round(H,2),'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "lower trip point LTP =  -0.28 V\n",
        "upper trip point LTP =  0.28 V\n",
        "hysteresis is  0.56 V\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-7, Page 865"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "R=2                                #inverting input resistance R1(KOhm)\n",
      "C=1*10**-6                         #feedback path capacitance (F)\n",
      "T=1*10**-3                         #time period(s)\n",
      "Vin=8                              #input pulse voltage(V)\n",
      "AVOL=100000                        #open loop voltage gain\n",
      "\n",
      "V=Vin*T/(R*C)/1000                      #output voltage(V)\n",
      "t=R*C*(AVOL+1)*1000                     #time constant(s)\n",
      "\n",
      "print 'Magnitude of negative output voltage at end of the pulse = ',V,'V'\n",
      "print 'closed loop time constant = ',t,'s'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnitude of negative output voltage at end of the pulse =  4.0 V\n",
        "closed loop time constant =  200.002 s\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-8, Page 868"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "R1=1*10**3                         #inverting input resistance R1(Ohm)\n",
      "R2=10*10**3                        #feedback path resistance R2(Ohm)\n",
      "C=10*10**-6                        #feedback path capacitance (F)\n",
      "Vin=5                              #input pulse voltage(V)\n",
      "f=1*10**3                          #input frequency(Hz)\n",
      "\n",
      "Vout=Vin/(2*f*R1*C)                 #output voltage(V)\n",
      "\n",
      "print 'peak to peak output voltage = ',Vout,'Vpp'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "peak to peak output voltage =  0.25 Vpp\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-9, Page 868"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Vs=15.0                               #non-inverting input voltage(V)\n",
      "Rw=5.0*10**3                          #inverting input wiper resistance(Ohm)\n",
      "R1=10.0*10**3                         #inverting input resistance R1(Ohm)\n",
      "f=1.0                                 #input frequency(KHz) \n",
      "\n",
      "Vref=Vs*(Rw/(Rw+R1))                  #reference voltage(V)\n",
      "T=1/f                                 #period of signal(s)\n",
      "W=2*(T/2)*((Vs/2)-Vref)/Vs            #output pulse width\n",
      "D=W/T                                 #duty cycle\n",
      "\n",
      "print 'duty cycle D = ',round((D*100),2),'%'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "duty cycle D =  16.67 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-10, Page 871"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "R1=18.0                             #non-inverting input resistance R1(KOhm)\n",
      "R2=2.0                              #feedback path resistance R2(KOhm)\n",
      "R=1.0                               #feedback path resistance R(KOhm)\n",
      "C=0.1*10**-6                        #feedback path capacitance (F)\n",
      "\n",
      "B=R1/(R1+R2)                             #feedback fraction\n",
      "T=10**9*2*R*C*math.log((1+B)/(1-B))      #period of output(us)\n",
      "f=1000*1/T                               #frequency(KHz)\n",
      "\n",
      "print 'period T = ',round(T,2),'us'\n",
      "print 'frequency f = ',round(f,2),'KHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "period T =  588.89 us\n",
        "frequency f =  1.7 KHz\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-11, Page 871"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Vsat=13.5                          #saturation voltage given(V)\n",
      "R4=10*10**3                        #given resistance R4(Ohm)\n",
      "C2=10*10**-6                       #given capacitance C2(F)\n",
      "T=589*10**-6                       #period from preceding example(s)\n",
      "\n",
      "Vout=Vsat*T/(2*R4*C2)              #output voltage (V) \n",
      "\n",
      "print 'Output voltage = ',round((Vout*1000),2),'mVpp'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage =  39.76 mVpp\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22-12, Page 873"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "R1=1*10**3                        #resistance R1(Ohm)\n",
      "R2=100*10**3                      #resistance R2(Ohm)\n",
      "R3=10*10**3                       #resistance R3(Ohm)\n",
      "C=10*10**-6                       #capacitance (F)\n",
      "\n",
      "UTP=Vsat*R1/R2                     #UTP value (V)\n",
      "Vout=2*UTP                         #output voltage/hysteresis (V)\n",
      "f=R2/(4*R1*R3*C)                   #frequency(Hz)\n",
      "\n",
      "print 'Vout = H = ',Vout,'V'\n",
      "print 'frequency f = ',f,'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vout = H =  0.27 V\n",
        "frequency f =  250.0 Hz\n"
       ]
      }
     ],
     "prompt_number": 37
    }
   ],
   "metadata": {}
  }
 ]
}