summaryrefslogtreecommitdiff
path: root/Elements_of_Electromagnetics/chapter_14.ipynb
blob: 1a5d389b06c333d90b5b21659fd8e50d67510871 (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
{
 "metadata": {
  "name": "chapter_14.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 14: Modern Topics<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14.1, Page number: 643<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "The following S-parameters are obtained for a microwave transistor operating \n",
      "at 2.5 GHz: S11 = 0.85 / 30\u00b0 ,S12 = 0.07 /56\u00b0 , S21 = 1.68 /120\u00b0 , \n",
      "S22 = O.85 /-40 . Determine the input reflection coefficient when ZL=Zo=75 ohm. '''\n",
      "\n",
      "import scipy\n",
      "import cmath\n",
      "from numpy import *\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "S11=0.85*scipy.e**(-30j*scipy.pi/180)\n",
      "S12=0.07*scipy.e**(56j*scipy.pi/180)\n",
      "S21=1.68*scipy.e**(120j*scipy.pi/180)\n",
      "S22=0.85*scipy.e**(-40j*scipy.pi/180)\n",
      "Zl=75 \n",
      "Zo=75\n",
      "\n",
      "#Calculations\n",
      "\n",
      "Tl=(Zl-Zo)/(Zl+Zo)\n",
      "Ti=S11+(S12*S21*Tl)/(1-S22*Tl)                      #reflection coefficient\n",
      "Timod=abs(Ti)                                       #mod of Ti\n",
      "Tiang=scipy.arctan(Ti.imag/Ti.real)*180/scipy.pi    #argument of Ti in degrees\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'input reflection coefficient =',Timod,'/',Tiang,'degrees'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "input reflection coefficient = 0.85 / -30.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14.2, Page number: 654<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "A step-index fiber has a core diameter of 80 micro m, a core refractive index \n",
      "of 1.62, and a numerical aperture of 0.21. Calculate: \n",
      "(a) the acceptance angle, (b) the refractive index that the fiber can \n",
      "propagate at a wavelength of 0.8 micro m, (c) the number of modes that the\n",
      "fiber can propagate at a wavelength of 0.8 micro m.'''\n",
      "\n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "d=80*(10)**-6       #diameter in m\n",
      "n1=1.62             #core refractive index\n",
      "NA=0.21             #numerical aperture\n",
      "L=8*(10)**-7        #wavelength in m\n",
      "\n",
      "#Calculations\n",
      "\n",
      "P=scipy.arcsin(NA)*180/scipy.pi             #acceptance angle\n",
      "n2=scipy.sqrt(n1**2-NA**2)                  #refractive index\n",
      "V=(scipy.pi*d/L)*scipy.sqrt(n1**2-n2**2)\n",
      "N=V**2/2                                    #number of modes\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'Acceptance angle =',round(P,2),'degrees'\n",
      "print 'Refractive index =',round(n2,3)\n",
      "print 'No. of modes =',round(N,0)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Acceptance angle = 12.12 degrees\n",
        "Refractive index = 1.606\n",
        "No. of modes = 2176.0\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14.3, Page number: 655<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "Light pulses propagate through a fiber cable with an attenuation of 0.25 dB/km.\n",
      "Determine the distance through which the power of pulses is reduced by 40%. '''\n",
      "\n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "a=0.25          #in dB/km\n",
      "P=1-0.4         #strength of pulse im %\n",
      "\n",
      "#Calculation\n",
      "\n",
      "l=(10/a)*scipy.log(1/P)/scipy.log(10)   #distance in km\n",
      "\n",
      "#Result\n",
      "\n",
      "print 'distance through which the power is reduced by 40% =',round(l,3),'km'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "distance through which the power is reduced by 40% = 8.874 km\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}