summaryrefslogtreecommitdiff
path: root/Electronic_Communication_Systems_by_Roy_Blake/Chapter1.ipynb
blob: 3a9aac5cad274fa3a4409c994e7196fd80c27374 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1: Introduction to Communication System"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1: pg 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WAVELENGTH IN FREE SPACE IS  300.0 m\n",
      "WAVELENGTH IN FREE SPACE IS  11.1 m\n",
      "WAVELENGTH IN FREE SPACE IS  7.5 cm\n"
     ]
    }
   ],
   "source": [
    "# page no 7\n",
    "#calculate the wavelength in all cases\n",
    "# prob no 1.1\n",
    "#part a) freq= 1MHz(AM radio broadcast band)\n",
    "# We have the equation c=freq*wavelength\n",
    "c=3.*10**8;\n",
    "f=1.*10**6;\n",
    "#calculations\n",
    "wl=c/f;\n",
    "print 'WAVELENGTH IN FREE SPACE IS ',wl,'m'\n",
    "#part B) freq= 27MHz(CB radio band)\n",
    "f=27.*10**6;\n",
    "wl=c/f;\n",
    "print 'WAVELENGTH IN FREE SPACE IS ',round(wl,1),'m'\n",
    "#part C) freq= 4GHz(used for satellite television)\n",
    "f=4*10**9;\n",
    "wl=c/f;\n",
    "print 'WAVELENGTH IN FREE SPACE IS ',wl*100,'cm'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4: pg 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "noise power contributed by resistor 4.14e-17 W\n"
     ]
    }
   ],
   "source": [
    "\n",
    "# page no 18\n",
    "#calculate the noise power\n",
    "# prob no. 1.4\n",
    "# In given problem noise power bandwidth is 10kHz; resistor temp T(0c)=27\n",
    "# First we have to convert temperature to kelvins:\n",
    "T0c=27.;\n",
    "Tk=T0c+273.;\n",
    "# noise power contributed by resistor , Pn= k*T*B\n",
    "k=1.38*10**(-23);\n",
    "B=10*10**3;\n",
    "#calculations\n",
    "Pn= k*Tk*B;\n",
    "#results\n",
    "print 'noise power contributed by resistor',Pn,'W'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5: pg 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The noise power is 24.3 pW\n",
      "The noise voltage is 5.4 muvolts\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 20\n",
    "#calculate the noise power and voltage\n",
    "# prob no 1.5\n",
    "from math import sqrt\n",
    "# In the given problem B=6MHz, Tk=293, k=1.38*10**-23\n",
    "B=6*10**6; Tk=293; k=1.38*10**-23;R=300;\n",
    "#calculations\n",
    "Pn=k*Tk*B;\n",
    "# Th noise voltage is given by Vn=sqrt(4*k*Tk*B*R)\n",
    "Vn=sqrt(4*k*Tk*B*R);\n",
    "#results\n",
    "print 'The noise power is',round(Pn*10**15,1),'pW'\n",
    "print 'The noise voltage is',round(Vn*10**6,1),'muvolts'\n",
    "# only one-half of this voltage is appears across the antenna terminals, the other appears across the source resistance. Therefore the actual noise voltag at the input is 2.7 uV"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6: pg 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Noise current is 0.133 muA\n",
      "current through the diode is 278.0 mA\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 21\n",
    "#calculate the current\n",
    "# prob no 1.6\n",
    "# given: FM broadcast receiver :- Vn=10uV, R=75V, B=200 kHz \n",
    "Vn=10.;#in uV\n",
    "R=75.; B=200.*10**3;\n",
    "#calculations\n",
    "#By Ohm's law\n",
    "In=Vn/R;\n",
    "print 'Noise current is',round(In,3),'muA'\n",
    "# Noise votlage is also given as In=sqrt(2*q*Io*B)\n",
    "q=1.6*10**-19;\n",
    "# solving this for Io=In**2/2*q*B;\n",
    "Io=(In*10**-6)**2/(2*q*B);\n",
    "print 'current through the diode is',round(Io*1000.,0),'mA'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7: pg 23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Open-ckt noise voltage is  779.0 nanovolts\n",
      "The load power is 5.06e-16 W\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 23\n",
    "#calculate the load power and open-ckt noise voltage\n",
    "#pro no 1.7\n",
    "from math import sqrt\n",
    "#Given:refer fig.1.12 of page no.23;R1=100ohm,300K;R2=200ohm,400k;B=100kHz;Rl=300ohm\n",
    "R1=100.;T1=300.;R2=200.;T2=400.;B=100.*10**3;Rl=300.;k=1.38*10**-23;\n",
    "#calculations\n",
    "#open-ckt noise voltage is given by\n",
    "#Vn1 =sqrt(Vr1**2 + Vr2**2)\n",
    "#    =sqrt[sqrt(4kTBR1)**2 + sqrt(4kTBR2)**2]\n",
    "#by solving this we get Vn1=sqrt[4kB(T1R1 + T2R2)]\n",
    "Vn1=sqrt(4*k*B*(T1*R1 + T2*R2));\n",
    "# since in this case the load is equal in value to the sum of the resistors,\n",
    "# one-half of this voltage is appear across the load.\n",
    "# Now the load power is P=  Vn1**2/Rl\n",
    "P=  (Vn1/2)**2/Rl;\n",
    "#results\n",
    "print 'Open-ckt noise voltage is ',round(Vn1*1e9),'nanovolts'\n",
    "print 'The load power is',P,'W'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8: pg 24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The power ratio in dB 14.0\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 24\n",
    "#Calculate the power ratio\n",
    "# prob no 1.8\n",
    "import math\n",
    "# Given: N=0.2W; S+N=5W; :. S=4.8W\n",
    "N=0.2; S=4.8;\n",
    "#calculations\n",
    "p=(S+N)/N;\n",
    "pdB=10*math.log10(p);\n",
    "#results\n",
    "print 'The power ratio in dB',round(pdB)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9: pg 25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The noise figure is 3.0\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 25\n",
    "#calculate the noise figure\n",
    "#prob no 1.9\n",
    "#Given: Si=100uW; Ni=1uW; So=1uW; No=0.03W\n",
    "Si=100.; Ni=1.; So=1; No= 0.03# all powers are in uW\n",
    "#calculations\n",
    "r1=Si/Ni;# input SNR\n",
    "r2=So/No;# output SNR\n",
    "NF=r1/r2;# Amplifier noise figure \n",
    "#results\n",
    "print 'The noise figure is',NF"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10: pg 25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "SNR at the output is  36 dB\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 25\n",
    "#calculate the SNR at output\n",
    "#prob no 1.10\n",
    "#giiven: SNRin=42 dB, NF=6dB\n",
    "# NF in dB is given as SNRin(dB)-SNRop(dB)\n",
    "SNRin=42 ; NF=6;\n",
    "#calculations\n",
    "SNRop=SNRin-NF;\n",
    "#results\n",
    "print 'SNR at the output is ',SNRop,'dB'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11: pg 27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The noise temperature is  169.65 K\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 27\n",
    "#calculate the noise temperature\n",
    "# prob no 1.11\n",
    "#Given NFdB=2dB,:.NF=antilog(NFdB)/10=1.585\n",
    "NF=1.585;\n",
    "#calculations\n",
    "Teq=290*(NF-1);\n",
    "#results\n",
    "print 'The noise temperature is ',Teq,'K'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12: pg 29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The power gain is 7500.0\n",
      "The noise figure is 2.316\n",
      "The noise temperature is 382.0 K\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 29\n",
    "#calculate the power gain, noise figure, temperature\n",
    "#prob no 1.12\n",
    "#Given: \n",
    "A1=10.;A2=25.;A3=30.;NF1=2.;NF2=4.;NF3=5.;\n",
    "#calculations\n",
    "At=A1*A2*A3;\n",
    "print 'The power gain is',At\n",
    "# The noise figure is given as \n",
    "NFt=NF1+((NF2-1)/A1) + ((NF3-1)/(A1*A2));\n",
    "print 'The noise figure is',NFt\n",
    "# Noise temp can be found as \n",
    "Teq=290*(NFt-1);\n",
    "print 'The noise temperature is',round(Teq),'K'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 13: pg 34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A)The freq is 110.0 MHz\n",
      "The power in dBm -30 dBm\n",
      "The power is 1e-06 W\n",
      "The voltage is 0.00707 volts\n",
      "B)The freq is 7.4 MHz\n",
      "The power is 79.4 W\n",
      "The power in dBm 9 dBm\n",
      "The voltage is 630.0 volts\n",
      "C)The freq is 546 MHz\n",
      "The voltage is 16.8 mvolts\n",
      "The power is 5.64 uW\n",
      "The power in dBm -22.5 dBm\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 34\n",
    "#calculate the power and voltage in all cases\n",
    "# prob no1.13 refer fig 1.20 of page no 34\n",
    "# part A) The signal frequency is f1=110MHz.\n",
    "from math import log10,sqrt\n",
    "f=110.;# in MHz\n",
    "#calculations and results\n",
    "print 'A)The freq is',f,'MHz'\n",
    "#The signal peak is two divisions below the reference level of -10dBm, with 10dB/division ,so its -30dBm.\n",
    "PdBm=-30;\n",
    "print 'The power in dBm',PdBm,'dBm'\n",
    "# The equivalent power can be found from P(dBm)=10logP/1 mW\n",
    "#P(mW)=antilog dBm/10= antilog -30/10=1*10**-3mW=1uW\n",
    "#the voltage can be found from the graph but it is more accurately from P=V**2/R\n",
    "P=10**-6; R=50;\n",
    "print 'The power is',P,'W'\n",
    "V=sqrt(P*R);\n",
    "print 'The voltage is',round(V*10e3,2),'mvolts'\n",
    "\n",
    "# part B)The signal is 1 division to theleft of center, with 100kHz/div. The freq is 100kHz less than the ref freq of 7.5MHz\n",
    "f=7.5-0.1;# in MHz\n",
    "print 'B)The freq is',f,'MHz'\n",
    "# With regards to the amplitude, the scale is 1dB/div & the signal is 1 div below the reference level. Therefore the signal has a power level given as\n",
    "PdBm=10-1;# in dBm\n",
    "# This can be converted to watts & volts as same in part A\n",
    "#P(mW)=antilog dBm/10= antilog 9/10=7.94mW\n",
    "P=7.94*10**-3; R=50;\n",
    "print 'The power is',round(P*10e3,2),'mW'\n",
    "print 'The power in dBm',PdBm,'dBm'\n",
    "V=sqrt(P*R);\n",
    "print 'The voltage is',round(V*1000.),'mvolts'\n",
    "\n",
    "#part C) The signal is 3 divisions to the right of the center ref freq of 543MHz, with 1MHz/div. Therefore the freq is \n",
    "f=543+3*1;# in MHz\n",
    "print 'C)The freq is',f,'MHz'\n",
    "# from the spectrum, signal level is\n",
    "V=22.4*6/8;\n",
    "print 'The voltage is',V,'mvolts'\n",
    "# power is given as\n",
    "P=V**2/R;\n",
    "print 'The power is',round(P,2),'uW'\n",
    "PdBm=10*log10(P*10**-6/10**-3);\n",
    "print 'The power in dBm',round(PdBm,1),'dBm'"
   ]
  }
 ],
 "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}