summaryrefslogtreecommitdiff
path: root/Grobs_Basic_Electronics_by_M_E_Schultz/Chapter26.ipynb
blob: 471f38d04d393dfef2484e1c948d958e33c4b520 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 26 : Filters"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_1 Page No.  824"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Cutoff Frequency = 1591.55 Hertz\n",
      "i.e 1.592 kHz\n",
      "The Output Voltage = 7.07 Vpp\n",
      "The Phase angle (Theta z) = -45.00 Degree\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt,atan\n",
    "# Calculate (a)the cutoff frequency fc# (b)Vout at fc# (c)Theta at fc (Assume Vin = 10 Vpp for all frequencies)\n",
    "\n",
    "# Given data\n",
    "\n",
    "R = 10.*10**3#        # Resistor=10 kOhms\n",
    "C = 0.01*10**-6#     # Capacitor=0.01 uFarad\n",
    "Vin = 10.#           # Input Voltage=10Vpp\n",
    "# To calculate fc\n",
    "\n",
    "fc = 1./(2*pi*R*C)#\n",
    "print 'The Cutoff Frequency = %0.2f Hertz'%fc\n",
    "print 'i.e 1.592 kHz'\n",
    "\n",
    "# To calculate Vout at fc\n",
    "\n",
    "Xc = 1./(2*pi*fc*C)#\n",
    "\n",
    "Zt = sqrt((R*R)+(Xc*Xc))#\n",
    "\n",
    "Vout = Vin*(Xc/Zt)#\n",
    "print 'The Output Voltage = %0.2f Vpp'%Vout\n",
    "\n",
    "# To calculate Theta\n",
    "\n",
    "Theta = atan(-(R/Xc))*180/pi\n",
    "print 'The Phase angle (Theta z) = %0.2f Degree'%Theta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_2 Page No. 825"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Cutoff Frequency = 3183.10 Hertz i.e 3.183 kHz\n",
      "The Output Voltage = 9.54 Vpp\n",
      "approx 9.52 Volts(p-p)\n",
      "The Phase angle (Theta z) = -17.44 Degree\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt,atan\n",
    "# Calculate (a)the cutoff frequency fc# (b)Vout at 1 kHz# (c)Theta at 1 kHz (Assume Vin = 10 Vpp for all frequencies)\n",
    "\n",
    "# Given data\n",
    "\n",
    "R = 1.*10**3#         # Resistor=1 kOhms\n",
    "L = 50.*10**-3        # Inductor=50 mHenry\n",
    "Vin = 10.#           # Input Voltage=10Vpp\n",
    "f = 1.*10**3#         # Frequency=1 kHz\n",
    "# To calculate fc\n",
    "\n",
    "fc = R/(2*pi*L)#\n",
    "print 'The Cutoff Frequency = %0.2f Hertz'%fc,\n",
    "print 'i.e 3.183 kHz'\n",
    "\n",
    "# To calculate Vout at fc\n",
    "\n",
    "Xl = 2*pi*f*L#\n",
    "\n",
    "Zt = sqrt((R*R)+(Xl*Xl))#\n",
    "\n",
    "Vout = Vin*(R/Zt)#\n",
    "print 'The Output Voltage = %0.2f Vpp'%Vout\n",
    "print 'approx 9.52 Volts(p-p)'\n",
    "\n",
    "# To calculate Theta\n",
    "\n",
    "Theta = atan(-(Xl/R))*180/pi\n",
    "print 'The Phase angle (Theta z) = %0.2f Degree'%Theta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_3 Page No.  826"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Cutoff Frequency for RC High-Pass Filter = 10610.33 Hertz\n",
      "i.e 10.61 kHz\n",
      "The Cutoff Frequency for RL High-Pass Filter = 2387.32 Hertz\n",
      "approx 2.39 kHz\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt\n",
    "# Calculate the cutoff frequency for (a) the RC high-pass filter# (b) the RL high-pass filter\n",
    "\n",
    "# Given data\n",
    "\n",
    "R = 1.5*10**3#       # Resistor=1.5 kOhms\n",
    "L = 100.*10**-3       # Inductor=100 mHenry\n",
    "C = 0.01*10**-6#     # Capacitor=0.01 uFarad\n",
    "\n",
    "# To calculate fc for RC high-pass filter\n",
    "\n",
    "fc = 1./(2*pi*R*C)#\n",
    "print 'The Cutoff Frequency for RC High-Pass Filter = %0.2f Hertz'%fc\n",
    "print 'i.e 10.61 kHz'\n",
    "\n",
    "# To calculate fc for RL high-pass filter\n",
    "\n",
    "fc1 = R/(2*pi*L)#\n",
    "print 'The Cutoff Frequency for RL High-Pass Filter = %0.2f Hertz'%fc1\n",
    "print 'approx 2.39 kHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_4 Page No.  827"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Cutoff Frequency for RC High-Pass filter = 159.15 Hertz\n",
      "i.e 159 Hz\n",
      "The Cutoff Frequency for RC High-Pass filter = 1591.55 Hertz\n",
      "i.e 1.59 kHz\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "# Calculate the cutoff frequencies fc1 and fc2.\n",
    "\n",
    "#Given data\n",
    "\n",
    "R1 = 1.*10**3#        # Resistor 1=1 kOhms\n",
    "C1 = 1.*10**-6#       # Capacitor 1=1 uFarad\n",
    "R2 = 100.*10**3#      # Resistor 2=100 kOhms\n",
    "C2 = 0.001*10**-6#   # Capacitor 2=0.001 uFarad\n",
    "\n",
    "# To calculate fc1 for RC high-pass filter\n",
    "\n",
    "fc1 = 1/(2*pi*R1*C1)#\n",
    "print 'The Cutoff Frequency for RC High-Pass filter = %0.2f Hertz'%fc1\n",
    "print 'i.e 159 Hz'\n",
    "\n",
    "# To calculate fc2 for RC high-pass filter\n",
    "\n",
    "fc2 = 1/(2*pi*R2*C2)#\n",
    "print 'The Cutoff Frequency for RC High-Pass filter = %0.2f Hertz'%fc2\n",
    "print 'i.e 1.59 kHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_5 Page No.  828"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Notch Frequency for RC Low-Pass filter = 7957.75 Hertz\n",
      "i.e 7.96 kHz\n",
      "The Required Value of 2R1 = 2000.00 Ohms\n",
      "i.e 2 kohms\n",
      "The Required Value of 2C1 = 2.00e-08 Ohms\n",
      "0.02 uF\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "# Calculate the notch frequency fn if R1 is 1 kOhms\u0004 and C1 is\u0005 0.01 \u0002uF. Also, calculate the required values for 2R1 and 2C1 in the low-pass filter.\n",
    "\n",
    "# Given data\n",
    "\n",
    "R1 = 1.*10**3#        # Resistor 1=1 kOhms\n",
    "C1 = 0.01*10**-6#    # Capacitor 1=0.01 uFarad\n",
    "\n",
    "# To calculate Notch frequency fn for RC low-pass filter\n",
    "\n",
    "fn = 1/(4*pi*R1*C1)#\n",
    "print 'The Notch Frequency for RC Low-Pass filter = %0.2f Hertz'%fn\n",
    "print 'i.e 7.96 kHz'\n",
    "\n",
    "A = 2*R1#\n",
    "print 'The Required Value of 2R1 = %0.2f Ohms'%A\n",
    "print 'i.e 2 kohms'\n",
    "\n",
    "B = 2*C1#\n",
    "print 'The Required Value of 2C1 = %0.2e Ohms'%B\n",
    "print '0.02 uF'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_6 Page No.  829"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Power Gain of Amplifier = 20.00 dB\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "# A certain amplifier has an input power of 1 W and an output power of 100 W.Calculate the dB power gain of the amplifier.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Pi = 1.#     # Input power=1 Watts\n",
    "Po = 100.#   # Output power=100 Watts\n",
    "\n",
    "N = 10*log10(Po/Pi)#\n",
    "print 'The Power Gain of Amplifier = %0.2f dB'%N"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_7 Page No.  830"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Attenuation offered by the Filter = -13.01 dB\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "# The input power to a filter is 100 mW, and the output power is 5 mW. Calculate the attenuation, in decibels, offered by the filter.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Pi = 100.*10**-3#    # Input power=1 Watts\n",
    "Po = 5.*10**-3#      # Output power=100 Watts\n",
    "\n",
    "N = 10*log10(Po/Pi)#\n",
    "print 'The Attenuation offered by the Filter = %0.2f dB'%N"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 26_8 Page No.  832"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Attenuation at 0 Hz = 0 dB\n",
      "The Attenuation at 1.592 kHz = -3.01 dB\n",
      "The Attenuation at 15.92 kHz = -20.05 dB\n"
     ]
    }
   ],
   "source": [
    "from math import pi,log10,sqrt\n",
    "# Calculate the attenuation, in decibels, at the following frequencies: (a) 0 Hz# (b) 1.592 kHz# (c) 15.92 kHz. (Assume that Vin is 10 V p-p at all frequencies.)\n",
    "\n",
    "# Given data\n",
    "\n",
    "f1 = 0#                 # Frequency 1=0 Hz\n",
    "f2 = 1.592*10**3#        # Frequency 2=1.592 kHz (cutoff frequency)\n",
    "f3 = 15.92*10**3#        # Frequency 3=15.92 kHz\n",
    "Vi = 10.#                # Voltage input=10 Volts(p-p)\n",
    "R = 10.*10**3#            # Resistor 1=10 kOhms\n",
    "C = 0.01*10**-6#         # Capacitor 1=0.01 uFarad \n",
    "\n",
    "Vo1 = Vi#\n",
    "Vo2 = 0.707*Vi#\n",
    "\n",
    "# At 0 Hz\n",
    "\n",
    "N1 = 20*log10(Vo1/Vi)#\n",
    "print 'The Attenuation at 0 Hz = %0.f dB'%N1\n",
    "\n",
    "#At 1.592 kHz (cutoff frequency)\n",
    "\n",
    "N2 = 20*log10(Vo2/Vi)#\n",
    "print 'The Attenuation at 1.592 kHz = %0.2f dB'%N2\n",
    "\n",
    "# At 15.92 kHz\n",
    "\n",
    "Xc = 1./(2*pi*f3*C)#\n",
    "\n",
    "A = R*R#\n",
    "B = Xc*Xc#\n",
    "\n",
    "Zt = sqrt (A+B)#\n",
    "\n",
    "N3 = 20*log10(Xc/Zt)#\n",
    "print 'The Attenuation at 15.92 kHz = %0.2f dB'%N3"
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}