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
|
{
"metadata": {
"name": "",
"signature": "sha256:4e82c096f59276d07f565f054e36b76b972f48192010c629f646cb460b6d633f"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"chapter06:Microwave components"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.2, Page number 234"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Chapter-6, Example 6.2, Page 234\n",
"#=============================================================================\n",
"#Input parameters\n",
"#[s]=[0,(0.3+(%i)*(0.4));(0.3+(%i)*(0.4)),0];#scattering matrix of a two port\n",
"#Calculations\n",
"#to find l such that S12 and S21 will be real when port1 is shifted lm to the left\n",
"#let port 1 be shifted by phi1 degree to the left and port2 position be remained unchanged i.e.,phi2=delta\n",
"#Then [phi]=[e**-(j*phi1),0;0,1]\n",
"#[S']=[phi]*[s]*[phi]\n",
"#for S12 and S21 to be real\n",
"import math\n",
"phi1=53.13;#in degrees\n",
"phi1=phi1*(math.pi/180);#phi in radians\n",
"b=34.3;#measured in rad/m\n",
"l=(phi1)/b;#distance of shift in m\n",
"#Output\n",
"print \"distance that the position of part1 should be shifted to the left so that S21 and S12 will be real numbers is (m) = \",round(l,3)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"distance that the position of part1 should be shifted to the left so that S21 and S12 will be real numbers is (m) = 0.027\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.3, Page number 236"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Chapter-6, Example 6.3, Page 236\n",
"#=============================================================================\n",
"import math\n",
"import numpy\n",
"from math import sqrt\n",
"#Input parameters\n",
"D=30.;#directivity in dB\n",
"VSWR=1.;#VSWR at each port under matched conditions\n",
"C=10.;#coupling factor\n",
"#Calculations\n",
"S41=sqrt(0.1);\n",
"S14=S41;#under matched and lossless conditions\n",
"S31=sqrt(((S41)**2)/(10)**(D/10));\n",
"S13=S31;\n",
"S11=(VSWR-1)/(VSWR+1);\n",
"S22=S11;\n",
"S33=S22;\n",
"S44=S33;\n",
"#let input power is given at port1 \n",
"#p1=p2+P3+p4\n",
"S21=sqrt(1-(S41)**2-(S31)**2);\n",
"S12=S21;\n",
"S34=sqrt((0.5)*(1+(S12)**2-0.1-0.0001));\n",
"S43=S34\n",
"S23=sqrt(1-10**-4-(S34)**2)\n",
"S32=S23;\n",
"S24=sqrt(1-0.1-(S34)**2)\n",
"S42=S24;\n",
"S=numpy.matrix([[S11,S12,S13,S14],[S21,S22,S23,S24],[S31,S32,S33,S34],[S41,S42,S43,S44]]);\n",
"#Output\n",
"print \"The scattering matrix is\"\n",
"print S\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The scattering matrix is\n",
"[[ 0. 0.94863059 0.01 0.31622777]\n",
" [ 0.94863059 0. 0.31622777 0.01 ]\n",
" [ 0.01 0.31622777 0. 0.94863059]\n",
" [ 0.31622777 0.01 0.94863059 0. ]]\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.4, Page number 238"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Chapter-6, Example 6.4, Page 238\n",
"#=============================================================================\n",
"import numpy\n",
"#Input parameters\n",
"a1=32*10**-3;#power in watts\n",
"a2=0;\n",
"a3=0;\n",
"#Calculations\n",
"S=numpy.array([[0.5,-0.5,0.707],[-0.5,0.5,0.707],[0.707,0.707,0]]);#S-matrix for H-plane tee\n",
"X=numpy.array([[a1,0,0],[0,0,0],[0,0,0]]);\n",
"#[B]=[b1,b2,b3]\n",
"B =S*X\n",
"b1=(0.5)**2*a1;#power at port 1\n",
"b2=(-0.5)**2*a1;#power at port 2\n",
"b3=(0.707)**2*a1;#power at port 3\n",
"#Output\n",
"print \"Thus b1,b2,b3 are\",b1,\"W,\",b2,\"W,\",round(b3,5),\"W respectively\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Thus b1,b2,b3 are 0.008 W, 0.008 W, 0.016 W respectively\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.5, Page number 239"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Chapter-6, Example 6.5, Page 239\n",
"#=============================================================================\n",
"\n",
"#Input parameters\n",
"S=([[0.5,-0.5,0.707],[-0.5,0.5,0.707],[0.707,0.707,0]]);\n",
"R1=60.;#load at port1 in ohms\n",
"R2=75.;#load at port2 in ohms\n",
"R3=50.;#characteristic impedance in ohms\n",
"P3=20*10**-3;#power at port 3 in Watts\n",
"#calculations\n",
"p1=(R1-R3)/(R1+R3);\n",
"p2=(R2-R3)/(R2+R3);\n",
"P1=0.5*P3*(1-(p1)**2);#power delivered to the port1 in Watts\n",
"P2=0.5*P3*(1-(p2)**2);#power delivered to the port2 in Watts\n",
"#Output\n",
"print \"Thus power delivered to the port1 and port2 are\",round(P1,5), \"W,\",P2,\" W respectively\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Thus power delivered to the port1 and port2 are 0.00992 W, 0.0096 W respectively\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.7, Page number 240"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Calculate\n",
"from numpy import array\n",
"\n",
"#Variable declaration\n",
"Il=0.5 #inserion loss(dB)\n",
"Is = 30 #isolation loss(dB)\n",
"\n",
"#Calculations\n",
"#Il = -20log(S21)\n",
"S21 = 10**(-Il/20)\n",
"#Is = -20log(S12)\n",
"S12 = 10**(-Is/20)\n",
"#Perfectly matched ports\n",
"S11=0\n",
"S22=0\n",
"\n",
"S = array([[S11,S12],[S21,S22]])\n",
"\n",
"#Result\n",
"print \"The scattering matrix is:\\n\",S\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The scattering matrix is:\n",
"[[ 0. 0.01 ]\n",
" [ 0.94406088 0. ]]\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.9, Page number 241"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Chapter-6, Example 6.9, Page 241\n",
"#=============================================================================\n",
"\n",
"#Input parameters\n",
"ins=0.5;#insertion loss in db\n",
"iso=20;#isolation loss in db\n",
"S=2;#VSWR \n",
"#Calculations\n",
"S21=10**-(ins/20.);#insertion loss=0.5=-20*log[S21]\n",
"S13=S21;\n",
"S32=S13;\n",
"S12=10**-(iso/20.);#isolation loss=30=-20*log[s12]\n",
"S23=S12;\n",
"S31=S23;\n",
"p=(S-1)/(S+1);\n",
"S11=p;\n",
"S22=p;\n",
"S33=p;\n",
"S=([[S11,S12,S13],[S21,S22,S23],[S31,S32,S33]]);\n",
"print S\n",
"#for a perfectly matched,non-reciprocal,lossless 3-port circulator,[S] is given by\n",
"#[S]=[0,0,S13;S21,0,0;,0,S32,0]\n",
"#i.e.,S13=S21=S32=1\n",
"#[S]=[0,0,1;1,0,0;0,1,0]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[0, 0.1, 0.9440608762859234], [0.9440608762859234, 0, 0.1], [0.1, 0.9440608762859234, 0]]\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.10, Page number 242"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Calculate The output power at the port\n",
"import math\n",
"\n",
"#Variable declaration\n",
"Pi = 90. #power source(W)\n",
"C = 20 #dB\n",
"D = 35 #dB\n",
"Is = 0.5 #insertion loss(dB)\n",
"\n",
"#Calculations\n",
"#C = 20=10log(Pi/Pf)\n",
"Pf = Pi/(10**(20./10.))\n",
"#D=350=10log(Pf/Pb)\n",
"Pb = Pf/(10**(35./10.))\n",
"Pr = Pi-Pf-Pb #received power\n",
"Pr_db = 10*math.log10(Pi/Pr)\n",
"Pr_dash=Pr_db-Is\n",
"\n",
"#Result\n",
"print \"The output power at the port is\",round(Pr_dash,3),\"dB\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The output power at the port is -0.456 dB\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.11, Page number 243"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Chapter-6, Example 6.11, Page 242\n",
"#=============================================================================\n",
"import math\n",
"import cmath\n",
"from math import sin\n",
"from math import cos,log10\n",
"#Calculations\n",
"S13=0.1*(cos(90*math.pi/180.)+(1j)*sin(90*math.pi/180.));#conversion from polar to rectangular\n",
"S13=abs(S13);\n",
"C=-20*log10(S13);#coupling coefficient in dB\n",
"S14=0.05*(cos(90*math.pi/180.)+(1j)*sin(90*math.pi/180.));#conversion from polar to rectangular\n",
"S14=abs(S14);\n",
"D=20*log10(S13/S14);#directivity in dB\n",
"I=-20*log10(S14);#isolation in dB\n",
"print \"Thus coupling,directivity and isolation are\",C,\" dB\",round(D,1),\"dB and\",round(I,0),\"dB respetively \"\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Thus coupling,directivity and isolation are 20.0 dB 6.0 dB and 26.0 dB respetively \n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.12, Page number 244"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Calculate VSWR\n",
"import math\n",
"\n",
"#Variable declaration\n",
"lamda2 = 3.5 #distance between 2 minimas(cm)\n",
"lamda_g = 7 #guided wavelength(cm)\n",
"d2_1 = 2.5*10**-1 #distance between minimum power points(cm)\n",
"\n",
"#Calculation\n",
"S = lamda_g/(math.pi*d2_1)\n",
"\n",
"#Result\n",
"print \"VSWR =\",round(S,4)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"VSWR = 8.9127\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.13, Page number 244"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate Phase shift introduced\n",
"#chapter-6 page 244 example 6.13\n",
"import math\n",
"wg=7.2##guide wavelength in cm\n",
"x=10.5##Position of reference null without the waveguide component in cm\n",
"y=9.3##Position of reference null with the waveguide component in cm\n",
"\n",
"#CALCULATION\n",
"z=x-y##Path difference introduced due to the component in cm\n",
"p=(2.*(math.pi)*(z/wg))##Phase difference introduced in rad\n",
"Pd=(p*180.)/(math.pi)##Phase shift introduced in deg\n",
"\n",
"#OUTPUT\n",
"print '%s %.2f %s' %('\\nPhase shift introduced is Pd=',Pd,'deg')#\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Phase shift introduced is Pd= 60.00 deg\n"
]
}
],
"prompt_number": 10
}
],
"metadata": {}
}
]
}
|