summaryrefslogtreecommitdiff
path: root/sample_notebooks/DivyangGandhi/ch1.ipynb
blob: c3414fde8a9a42cbbd69530d652d390d2a1c6c5b (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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
{
 "metadata": {
  "name": "",
  "signature": "sha256:a1a2fd08204d20b25cb8797d32a1268bd037e7b99587377263388f4580e76a47"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Introduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1  Page No : 4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "c = 3*10**8;     #in m/s\n",
      "f = 1.*10**6;     #in Hz\n",
      "\n",
      "# Calculations\n",
      "lembda = c/f;\n",
      "\n",
      "# Results\n",
      "print 'Wavelength (in m):',lembda\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength (in m): 300.0\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2  Page No : 4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "c = 3*10**8;     #in m/s\n",
      "f = 100.*10**6;     #in Hz\n",
      "\n",
      "# Calculations\n",
      "lembda = c/f;\n",
      "\n",
      "# Results\n",
      "print 'Wavelength (in m):',lembda\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength (in m): 3.0\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3  Page No : 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G = 175.;     #absolute gain\n",
      "\n",
      "# Calculations\n",
      "Gdb = 10*math.log10(175);   #decibell gain\n",
      "\n",
      "# Results\n",
      "print 'The decibell power gain is:',Gdb,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The decibell power gain is: 22.4303804869 dB\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4  Page No : 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Gdb = 28.;   #decibell gain\n",
      "\n",
      "# Calculations\n",
      "G = 10**(Gdb/10);  #Absolute power gain\n",
      "\n",
      "# Results\n",
      "print 'The absolute power gain is:',G\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute power gain is: 630.95734448\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5  Page No : 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Gdb = 28.;   #decibell gain\n",
      "\n",
      "# Calculations\n",
      "G = 10**(Gdb/10);  #Absolute power gain\n",
      "Av = G**0.5;  #Voltage gain\n",
      "\n",
      "# Results\n",
      "print 'The voltage gain is:',Av\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage gain is: 25.1188643151\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6  Page No : 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G = 0.28; #Absolute gain\n",
      "P1 = 1;  \n",
      "P2 = .28;  #28 % of input power\n",
      "\n",
      "# Calculations and Results\n",
      "Gdb = 10*math.log10(G);\n",
      "print 'Decibell gain is',Gdb,'dB'\n",
      "\n",
      "Ldb = 10*math.log10(P1/P2); #dB loss\n",
      "print 'Decibell loss is:',Ldb,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Decibell gain is -5.52841968658 dB\n",
        "Decibell loss is: 5.52841968658 dB\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7  Page No : 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "PmW = 100.; #power in mW\n",
      "\n",
      "# Calculations and Results\n",
      "PdBm = 10*math.log10(PmW/1);  #P in dBm level\n",
      "print '(a).   Power in dBm level is:',PdBm,'dBm'\n",
      "\n",
      "PdBW = PdBm-30;  #P in dBW level\n",
      "print '(b).   Power in dBW level is:',PdBW,'dBW'\n",
      "\n",
      "PdBf = PdBm+120;  #Pin dBf level\n",
      "print '(c)   Power in dBf level is:',PdBf,'dBf'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).   Power in dBm level is: 20.0 dBm\n",
        "(b).   Power in dBW level is: -10.0 dBW\n",
        "(c)   Power in dBf level is: 140.0 dBf\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8  Page No : 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G1 = 5000.;\n",
      "L = 2000.;\n",
      "G2 = 400.;\n",
      "\n",
      "# Calculations and Results\n",
      "G = G1*(1/L)*G2;   #Absolute gain\n",
      "print '(a)  Net absolute gain is:',G\n",
      "\n",
      "GdB = 10*math.log10(G);  #System decibell gain\n",
      "print '(b)  System Decibel gain is:',GdB,'dB'\n",
      "\n",
      "G1dB = 10*math.log10(G1);\n",
      "LdB = 10*math.log10(L);\n",
      "G2dB = 10*math.log10(G2);\n",
      "print ('(c)   Individual stage gains are:');\n",
      "print 'G1dB = ',G1dB\n",
      "print 'LdB = ',LdB\n",
      "print 'G2dB = ',G2dB\n",
      "\n",
      "GdB = G1dB-LdB+G2dB;\n",
      "print 'The net dB gain is:',GdB,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  Net absolute gain is: 1000.0\n",
        "(b)  System Decibel gain is: 30.0 dB\n",
        "(c)   Individual stage gains are:\n",
        "G1dB =  36.9897000434\n",
        "LdB =  33.0102999566\n",
        "G2dB =  26.0205999133\n",
        "The net dB gain is: 30.0 dB\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.9  Page No : 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G1 = 5000.;\n",
      "L = 2000.;\n",
      "G2 = 400.;\n",
      "Ps = 0.1;  #in mW\n",
      "\n",
      "# Calculations and Results\n",
      "P1 = G1*Ps;  #in mW\n",
      "print '(a)  Power level P1 is:',P1,'mW'\n",
      "\n",
      "P2 = P1/L;  #in mW\n",
      "print 'Line output power P2:',P2,'mW'\n",
      "\n",
      "Po = G2*P2;  #in mW\n",
      "print 'System output power Po:',Po,'mW'\n",
      "\n",
      "PsdBm = 10*math.log10(Ps/1);\n",
      "G1dB = 10*math.log10(G1);\n",
      "LdB = 10*math.log10(L);\n",
      "G2dB = 10*math.log10(G2);\n",
      "\n",
      "print ('(b)  Output power power levels in dBm are');\n",
      "P1dBm = PsdBm+G1dB;\n",
      "print 'P1(dBm) = ',P1dBm,'dBm'\n",
      "\n",
      "P2dBm = P1dBm-LdB;\n",
      "print 'P2(dBm) = ',P2dBm,'dBm'\n",
      "\n",
      "PodBm = P2dBm+G2dB;\n",
      "print 'Po(dBm) = ',PodBm,'dBm'\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  Power level P1 is: 500.0 mW\n",
        "Line output power P2: 0.25 mW\n",
        "System output power Po: 100.0 mW\n",
        "(b)  Output power power levels in dBm are\n",
        "P1(dBm) =  26.9897000434 dBm\n",
        "P2(dBm) =  -6.02059991328 dBm\n",
        "Po(dBm) =  20.0 dBm\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.10  Page No : 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "def voltage(PdBm):\n",
      "    P = 1*10**(-3)*(10**(PdBm/10));\n",
      "    return (75*P)**0.5;\n",
      "\n",
      "# Variables\n",
      "S = 10.;  #dBm\n",
      "G1 = 13.;  #dB\n",
      "L1 = 26.;  #dB\n",
      "G2 = 20.;  #dB\n",
      "L2 = 29.;  #dB\n",
      "\n",
      "# Calculations and Results\n",
      "print '(a)  The output levels are',\n",
      "PdBm = S;\n",
      "V = voltage(PdBm);\n",
      "print PdBm,'1. Signal source in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1;\n",
      "V = voltage(PdBm);\n",
      "print '2. Line Amplifier in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1-L1;\n",
      "V = voltage(PdBm);\n",
      "print '3. Cable section A in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1-L1+G2;\n",
      "V = voltage(PdBm);\n",
      "print '4. Booster amplifier in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1-L1+G2-L2;\n",
      "V = voltage(PdBm);\n",
      "print '5. Cable section B in dBm:',PdBm,'in Volts : ',V\n",
      "print ('(b).  The output power to get a voltage of 6V'),\n",
      "V = 6.;   #volts\n",
      "R = 75.;  #ohm\n",
      "Po = (V**2)/R;\n",
      "print Po,'W';\n",
      "PodBm = 10*math.log10(Po*1000/1);\n",
      "print 'power in dBm',PodBm,'dBm'\n",
      "\n",
      "GrdB = PodBm-PdBm;\n",
      "print 'The required gain is',GrdB,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  The output levels are 10.0 1. Signal source in dBm: 10.0 in Volts :  0.866025403784\n",
        "2. Line Amplifier in dBm: 23.0 in Volts :  3.86839338256\n",
        "3. Cable section A in dBm: -3.0 in Volts :  0.193878937799\n",
        "4. Booster amplifier in dBm: 17.0 in Volts :  1.93878937799\n",
        "5. Cable section B in dBm: -12.0 in Volts :  0.0687908430214\n",
        "(b).  The output power to get a voltage of 6V 0.48 W\n",
        "power in dBm 26.8124123738 dBm\n",
        "The required gain is 38.8124123738 dB\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.11  Page No : 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "P = 5.;   #In mW\n",
      "N = 100.*10**-6;  #in mW\n",
      "\n",
      "# Calculations and Results\n",
      "S2N = P/N;\n",
      "print '(a)    Absolute signal to noise ratio :',S2N\n",
      "\n",
      "S2NdB = 10*math.log10(S2N);\n",
      "print '(b)   dB signal to noise ratio is:',S2NdB,'dB'\n",
      "\n",
      "PdBm = 10*math.log10(P/1);\n",
      "print '(c)    Signal Power is',PdBm,'dBm'\n",
      "\n",
      "NdBm = 10*math.log10(N/1);\n",
      "print 'Noise power is',NdBm,'dBm'\n",
      "\n",
      "S2NdB = PdBm-NdBm;\n",
      "print 'Decinel S/N ratio is',S2NdB,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)    Absolute signal to noise ratio : 50000.0\n",
        "(b)   dB signal to noise ratio is: 46.9897000434 dB\n",
        "(c)    Signal Power is 6.98970004336 dBm\n",
        "Noise power is -40.0 dBm\n",
        "Decinel S/N ratio is 46.9897000434 dB\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}