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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h1>Chapter 2: Antenna Basics<h2>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-3.1, Page number: 14<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"e_half_power = 1/math.sqrt(2) #E(theta) at half power (relative quantity)\n",
"\n",
"#Calculation\n",
"theta = math.acos(math.sqrt(e_half_power)) # theta (radians)\n",
"hpbw = 2*theta*180/math.pi # Half power beamwidth (degrees)\n",
"\n",
"#Result\n",
"print \"The half power beamwidth is \", round(hpbw), \"degrees\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The half power beamwidth is 66.0 degrees\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-3.2, Page number: 14<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"e_half_power = 1/math.sqrt(2) #E(theta) at half power(unitless)\n",
"e_null = 0 #E(theta) = 0 at null points (unitless)\n",
"theta_1 = 0 #theta' (degrees)\n",
"theta = 1 #theta (degrees)\n",
"\n",
"#Calculation\n",
"for x in range(3): #Iterate till theta = i\n",
" theta = 0.5*math.acos(e_half_power/math.cos(theta_1*math.pi/180)) \n",
" #theta(radian)\n",
" theta_1 = theta*180/math.pi #set i = theta for next iteration (degrees)\n",
" \n",
"hpbw = 2*(theta*180/math.pi) #Half-power beamwidth (Degrees)\n",
"theta = 0.5*math.acos(e_null) #theta (radians)\n",
"fnbw = 2*(theta*180/math.pi) #Beamwidth between first null (degrees)\n",
"\n",
"#Result\n",
"print \"The half power beamwidth is\", round(hpbw), \"degrees\"\n",
"print \"The beamwidth between first nulls is \", round(fnbw), \"degrees\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The half power beamwidth is 41.0 degrees\n",
"The beamwidth between first nulls is 90.0 degrees\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-4.1, Page number: 17<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import scipy.integrate\n",
"import math\n",
"\n",
"#Variable declaration\n",
"def integrand(x):\n",
" return math.sin(x) #Function sin(theta)\n",
"\n",
"def integrand2(x):\n",
" return 1 #Contant function\n",
"\n",
"#Calculation\n",
"omega = scipy.integrate.quad(integrand, 20*math.pi/180, 40*math.pi/180) \n",
"omega = omega[0]*(180/math.pi) * scipy.integrate.quad(integrand2 ,30 ,70)[0]\n",
"#Integration between the ranges gives solid angle, omega (square degrees)\n",
"\n",
"#Result\n",
"print \"The solid angle, omega is\", round(omega), \"square degrees\" "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The solid angle, omega is 398.0 square degrees\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-4.2, Page number: 17<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"import scipy.integrate\n",
"\n",
"#Variable declaration\n",
"def func1(x,y):\n",
" return (math.cos(x)**4)*math.sin(x)*1 #Function for integration\n",
"\n",
"#Calculation\n",
"beam_area = scipy.integrate.dblquad(func1, 0, 2*math.pi, \n",
" lambda x: 0, lambda x: math.pi/2)\n",
"#Beam area (steradians)\n",
"\n",
"#Result\n",
"print \"The beam area of the given pattern is\", round(beam_area[0], 2), \"sr\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The beam area of the given pattern is 1.26 sr\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-7.1, Page number: 21<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import scipy.integrate\n",
"from math import pi,sin,cos,log10\n",
"\n",
"#Variable declaration\n",
"n = 10 #Number of isotropic point sources\n",
"dr = pi/2 #Distance(radians)\n",
"hpbw = 40 #Half power beamwidth (degrees)\n",
"def integrand(x,phi):\n",
" E_norm = (sin(pi/20))*(sin((pi/2)*(5*cos(phi)-6))/sin((pi/20)*(5*cos(phi)-6)))\n",
" return (E_norm**2)\n",
"\n",
"#Calculation\n",
"gain = scipy.integrate.dblquad(integrand, 0, 2*pi,\n",
" lambda x: 0, lambda x: pi/2)[0]\n",
"gain = (4*pi)/gain #Gain (unitless)\n",
"gain_db = 10*log10(gain)#Gain (dB)\n",
"gain_hpbw = 40000/(hpbw**2) #Gain from approx. equation (unitless)\n",
"gain_hpbw_db = 10*log10(gain_hpbw) #Gain from approx. equation (dB)\n",
"gain_diff = gain_hpbw_db - gain_db #Difference in gain (dB)\n",
"\n",
"#Result\n",
"print \"The gain G is\", round(gain_db,2),\"dB\"\n",
"print \"The gain from approx. equation is\", round(gain_hpbw_db),\"dB\"\n",
"print \"The difference is\", round(gain_diff,2),\"dB\"\n",
"\n",
"#The solution is incorrect due to the incorrect integration of the normalized power pattern\n",
"#As a result, the difference in gain is slightly higher"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The gain G is 10.01 dB\n",
"The gain from approx. equation is 14.0 dB\n",
"The difference is 3.97 dB\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-7.2, Page number: 21<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"import scipy.integrate\n",
"\n",
"#Variable declaration\n",
"theta_hp = 90\n",
"phi_hp = 90\n",
"\n",
"def integrand(theta, phi):\n",
" return ((math.sin(theta)**3)*(math.sin(phi)**2))\n",
"\n",
"#Calculation\n",
"direct_exact = 4*math.pi/scipy.integrate.dblquad(integrand, 0, math.pi,\n",
" lambda x: 0, lambda x: math.pi)[0]\n",
" #Exact Directivity(No unit) \n",
"direct_apprx = 41253.0/(theta_hp*phi_hp) #Approximate directivity (No unit)\n",
"db_diff = 10*math.log10(direct_exact/direct_apprx) #Difference (decibels)\n",
"\n",
"#Result\n",
"print \"The exact directivity is\", round(direct_exact, 1)\n",
"print \"The approximate directivity is\", round(direct_apprx,1)\n",
"print \"The decibel difference is \", round(db_diff, 1), \"dB\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The exact directivity is 6.0\n",
"The approximate directivity is 5.1\n",
"The decibel difference is 0.7 dB\n"
]
}
],
"prompt_number": 18
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-10.1, Page number: 28<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"Z = 120*math.pi #Intrinsic impedence of free space (ohm)\n",
"\n",
"#Calculation\n",
"max_aper = Z/(320*math.pi**2) #Max. effective aperture (lambda^2)\n",
"direct = 4*math.pi*max_aper #directivity (unitless)\n",
"\n",
"#Result\n",
"print \"The maximum effective aperture is\", round(max_aper, 3), \"lambda^2\"\n",
"print \"The direcitivity is\", direct"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The maximum effective aperture is 0.119 lambda^2\n",
"The direcitivity is 1.5\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-10.2, Page number: 29<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"R_r = 73 #Radiation resistance (ohm)\n",
"\n",
"#Calculation\n",
"eff_aper = 30/(R_r*math.pi) #Effective aperture (lambda^2)\n",
"directivity = 4*math.pi*eff_aper #Directivity (unitless)\n",
"\n",
"#Result\n",
"print \"The effective aperture is\", round(eff_aper, 2), \"lambda^2\"\n",
"print \"The directivity is\", round(directivity,2)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The effective aperture is 0.13 lambda^2\n",
"The directivity is 1.64\n"
]
}
],
"prompt_number": 20
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-11.1, Page number: 31<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"P_t = 15 #Transmitter power (W)\n",
"A_et = 2.5 #Effective aperture of transmitter (meter^2)\n",
"A_er = 0.5 #Effective aperture of receiver (meter^2)\n",
"r = 15e3 #Distance between the antennas (Line of sight) (m)\n",
"freq = 5e9 #Frequency (Hz)\n",
"c = 3e8 #speed of light (m/s)\n",
"\n",
"#Calculation\n",
"wave_len = c/freq #Wavelength (m)\n",
"P_r = (P_t*A_et*A_er)/((r**2)*(wave_len**2)) #received power (W)\n",
"\n",
"#Result\n",
"print \"The power delivered to the receiver is\", round(P_r,6), \"watts\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The power delivered to the receiver is 2.3e-05 watts\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-16.1, Page number: 40<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"E1 = 3 #Magnitude of electric field in x direction (V/m)\n",
"E2 = 6 #Magnitude of electric field in y direction (V/m)\n",
"Z = 377 #Intrinsic impedence of free space (ohm)\n",
"\n",
"#Calculation\n",
"avg_power = 0.5*(E1**2 + E2**2)/Z #average power per unit area (W/m^2)\n",
"\n",
"#Result\n",
"print \"The average power per unit area is\", avg_power, \"watts/meter^2\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The average power per unit area is 0.0596816976127 watts/meter^2\n"
]
}
],
"prompt_number": 22
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 2-17.1, Page number: 43<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"AR_w = 4 #Axial Ratio for left elliptically polarized wave (unitless)\n",
"tau_w = 15 #Tilt angle for left elliptically polarized wave (degrees)\n",
"AR_a = -2 #Axial Ratio for right elliptically polarized wave (unitless) \n",
"tau_a = 45 #Tilt angle for right elliptically polarized wave (degrees)\n",
"tau_w2 = 20.7 #2*Tilt angle for left elliptically polarized wave (degrees) \n",
"tau_a2 = 39.3 #2*Tilt angle for right elliptically polarized wave (degrees)\n",
"\n",
"#Calculation\n",
"eps_a2 = 2*math.atan2(1,AR_a)*180/math.pi #polarisation latitude (degrees)\n",
"eps_w2 = 2*math.atan2(1,AR_w)*180/math.pi #antenna latitude (degrees)\n",
"gamma_w2 =math.acos(math.cos(eps_w2*math.pi/180)*math.cos(tau_w2*math.pi/180));\n",
" #great-circle angle - antenna (radians)\n",
"gamma_a2 =math.acos(math.cos(eps_a2*math.pi/180)*math.cos(tau_a2*math.pi/180));\n",
" #great-circle angle - wave (radians)\n",
"M_Ma = (gamma_w2*180/math.pi) + (gamma_a2*180/math.pi) \n",
" #total great-circle angle (degrees)\n",
"F = math.cos((M_Ma/2)*math.pi/180)**2 \n",
" #Polarisation matching factor (relative quantity)\n",
"\n",
"#Result\n",
"print \"The polarization matching factor is\", round(F,2)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The polarization matching factor is 0.44\n"
]
}
],
"prompt_number": 23
}
],
"metadata": {}
}
]
}
|