Vous êtes sur la page 1sur 96

Scilab Code for Engineering Electromagnetics, by William Hayt & John Buck1

Created by Prof. R. Senthilkumar Institute of Road and Transport Technology rsenthil signalprocess@in.com Cross-Checked by 17 January 2011

by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro.This Textbook Companion and scilab codes written in it canbe downloaded from website www.scilab.in

1 Funded

Book Details
Authors: William Hayt and John Buck Title: Engineering Electromagnetics Publisher: Tata McGraw Hill Edition: 7th Year: Place: New Delhi ISBN: 0070612234

Scilab numbering policy used in this document and the relation to the above book. Fig Figure Exa Example (Solved example) Eqn Equation (Particular equation of the above book) ARC Additionally Required Codes For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means a scilab code whose theory is explained in Section 2.3 of the book.

Contents
List of Scilab Codes 1 Vector Analysis 2 Columbs Law and Electric Field Intensity 3 Electric Flux Density, Gausss Law and Divergence 4 Energy and Potential 5 Current and Conductors 6 Dielectrics and Capacitance 7 Poissons and Laplaces Equation 8 The Steady Magnetic Field 9 Magnetic Forces, Materials and Inductance 11 Transmission Lines 12 The Uniform Plane Wave 13 Plane Wave Reection and Dispersion 14 Guided Wave and Radiation 4 2 6 10 16 21 24 27 32 35 47 58 65 76

List of Scilab Codes


Exa 1.1 Exa 1.2 Exa 1.3 Exa 1.4 Exa 2.1 Exa 2.2 Exa 2.3 Exa 3.1 Exa 3.2 Exa 3.3 Exa 3.4 Exa 3.5 Exa 4.1 Exa 4.2 Exa 4.3 Exa 5.1 Program to nd the unit vector . . . . . . . . . . . . . Program to nd the phase angle between two vectors . Transform the vector of Rectangular coordinates into cylindrical coordinates . . . . . . . . . . . . . . . . . . Transform the vector of Rectangular coordinates into spherical coordinates . . . . . . . . . . . . . . . . . . . Program to Calculate force exerted on Q2 by Q1 . . . Program to Calculate Electric Field E at P due to 4 identical charges . . . . . . . . . . . . . . . . . . . . . Program to nd the total charge enclosed in a volume Program to nd Electric Flux density D of a uniform line charge . . . . . . . . . . . . . . . . . . . . . . . . Program to calculate surface charge density, Flux density, Field Intensity of coaxial cable . . . . . . . . . . . Program to calculate the total charge enclosed in a volume at the origin . . . . . . . . . . . . . . . . . . . . . Program to Find the Divergence of D at the origin . Program to verify the Divergence theorem for the eld D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program to nd the work involved W in moving a charge Q along shorter arc of a circle . . . . . . . . . Program to nd the work involved W in moving a charge Q along straight line . . . . . . . . . . . . . . Program to calculate E, D and volume charge density using divergence of D . . . . . . . . . . . . . . . . . . Program to nd the resistance, current and current density . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 3 4 6 7 8 10 11 12 13 14 16 17 18 21

Exa 5.2 Exa 5.3 Exa 6.1 Exa 6.2 Exa 6.3 Exa 7.1 Exa 7.2 Exa 7.3 Exa 7.4 Exa 7.5 Exa 8.1 Exa 8.2 Exa 8.3 Exa 9.1 Exa 9.2 Exa 9.3 Exa 9.4 Exa 9.5 Exa 9.6 Exa 9.7 Exa 9.8 Exa 9.9

Program to nd potential at point P, Electric Field Intensity E, Flux density D . . . . . . . . . . . . . . . . Program to determine the equation of the streamline passing through any point . . . . . . . . . . . . . . . Program to calculate D, E and Polarization P for Teon slab . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program to calculate E and Polarization P for Teon slab . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program to calculate the capacitance of a parallel plate capacitor . . . . . . . . . . . . . . . . . . . . . . . . . Derivation of capacitance of a parallel plate capacitor . Capacitance of a Cylindrical Capacitor . . . . . . . . . Program to determine the electric eld of a two innite radial planes with an interior angle alpha . . . . . . . Derivation of capacitance of a spherical capacitor . . . Potential in spherical coordinates as a function of teta V(teta) . . . . . . . . . . . . . . . . . . . . . . . . . . Program to nd the magnetic eld intensity of a current carrying lament . . . . . . . . . . . . . . . . . . . . . Program to nd the curlH of a square path of side d Program to verify Stokes theorem . . . . . . . . . . . Program to nd magnetic eld and force produced in a square loop . . . . . . . . . . . . . . . . . . . . . . . . Program to determine the dierential force between two dierential current elements . . . . . . . . . . . . . . . Program to calculate the total torque acting on a planar rectangular current loop . . . . . . . . . . . . . . . . . Program to nd the torque and force acting on each side of planar loop . . . . . . . . . . . . . . . . . . . . . . . Program to nd Magnetic Susceptibility, H , Magnetization M . . . . . . . . . . . . . . . . . . . . . . . . . Program to nd the boundary conditions on magnetic eld . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program to nd magnetomotive force Vm and reluctance R . . . . . . . . . . . . . . . . . . . . . . . . . Program to nd total Magnetic Flux Density in Weber Program to calculate self inductances and Mutual Inductances between two coaxial solenoids . . . . . . . . 5

22 23 24 25 25 27 28 29 30 31 32 33 33 35 36 37 38 40 41 42 43 44

Exa 11.1

Program to determine the total voltage as a function of time and position in a loss less transmission line . . . Exa 11.2 Program to nd the characteristic impedance, the phase constant an the phase velocity . . . . . . . . . . . . . Exa 11.3 Program to nd the magnitude and phase of characteristic impedance Zo . . . . . . . . . . . . . . . . . . . . Exa 11.4 Program to nd the output power and attenuation coecient . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 11.5 Program to nd the power dissipated in the lossless transmission line . . . . . . . . . . . . . . . . . . . . . Exa 11.6 Program to nd the total loss in lossy lines . . . . . . Exa 11.7 Program to nd the load impedance of a slotted line . Exa 11.8 Program to nd the input impedance and power delivered to the load . . . . . . . . . . . . . . . . . . . . . Exa 11.9 Program to nd the input impedance for a line terminated with pure capacitive impedance . . . . . . . . . Exa 11.10 Program to nd the input impedance for a line terminated with impedance (with inductive reactance) . . . Exa 11.11 Program to nd the voltage at the load resistor and the current in the battery . . . . . . . . . . . . . . . . . . Exa 11.12 Program to plot the voltage and current through a resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.1 Program to determine the phasor of forward propagating eld . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.2 Program to determine the instantaneous eld of a plane wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.3 Program to nd the Phase constant, Phase velocity, Electric Field Intensity and Intrinsic ratio . . . . . . . Exa 12.4 Program to nd the penetration depth and intrinsic impedance . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.5 Program to nd the attenuation constant, propagation constant and intrinsic impedance . . . . . . . . . . . . Exa 12.6 Program to nd skin depth, loss tangent and phase velocity . . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.7 Program to nd the electric eld of linearly polarized wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 13.1 Program to nd the electric eld of incident, reected and transmitted waves . . . . . . . . . . . . . . . . . . 6

47 47 48 49 49 50 51 51 53 54 54 56 58 58 59 60 61 62 63 65

Exa 13.2 Exa 13.3

Program to nd the maxima and minima electric eld Program to determine the intrinsic impedance of the unknown material . . . . . . . . . . . . . . . . . . . . Exa 13.4 Program to determine the required range of glass thickness for Fabry-perot interferometer . . . . . . . . . . . Exa 13.5 Program to nd the required index for the coating and its thickness . . . . . . . . . . . . . . . . . . . . . . . Exa 13.6 Program to nd the phasor expression for the electric eld . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 13.7 Program to nd the fraction of incident power that is reected and transmitted . . . . . . . . . . . . . . . . Exa 13.8 Program to nd the refractive index of the prism material Exa 13.9 Program to determine incident and transmitted anlges Exa 13.10 Program to determine group velocity and phase velocity of a wave . . . . . . . . . . . . . . . . . . . . . . . . . Exa 13.11 Program to determine the pulse width at the optical ber output . . . . . . . . . . . . . . . . . . . . . . . . Exa 14.1 Program to determine the cuto frequency for the rst waveguide mode(m=1) . . . . . . . . . . . . . . . . . . Exa 14.2 Program to determine the number of modes propagate in waveguide . . . . . . . . . . . . . . . . . . . . . . . Exa 14.3 Program to determine the group delay and dierence in propagation times . . . . . . . . . . . . . . . . . . . . Exa 14.4 Program to determine the operating range of frequency for TE10 mode of air lled rectangular waveguide . . . Exa 14.5 Program to determine the maximum allowable refractive index of the slab material . . . . . . . . . . . . . . Exa 14.6 Program to nd the V number of a step index ber . . ARC 1 Program to calculate the attenuation constant of good dielectric . . . . . . . . . . . . . . . . . . . . . . . . . ARC 2 Program used to convert cartesian coordinates into cylindrical coordinates . . . . . . . . . . . . . . . . . . . . ARC 3 Program used to convert cartesian coordinates into spherical coordinates . . . . . . . . . . . . . . . . . . . . . . ARC 4 Program used to nd the cross product of two vectors ARC 5 Program used to convert the cylindrical coordinates into ARC 6 Program to nd the dot product of two vectors . . . . ARC 7 Program to nd the electrical length . . . . . . . . . . 7

66 68 68 69 70 71 72 73 74 74 76 76 77 78 79 79 79 80 80 80 81 81 81

ARC 8 ARC ARC ARC ARC 9 10 11 12

ARC 13 ARC 14 ARC ARC ARC ARC ARC ARC ARC ARC ARC ARC ARC 15 16 17 18 19 21 22 23 24 25 26

ARC 27 ARC 28

Program used to calculate the electric eld intensity of a line charge . . . . . . . . . . . . . . . . . . . . . . . Program to nid the group delay dierence . . . . . . Program to nd the group delay . . . . . . . . . . . . Program to nd the intrinsic impedance of dielectric . Program to nd the intrinsic imedance of a good dielectric . . . . . . . . . . . . . . . . . . . . . . . . . . Program to nd the free space permittivity and free space permeability . . . . . . . . . . . . . . . . . . . . rogram used to nd the capacitance of a parallel plate Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . Program to nd the impedance of a parallel connection Program used to calculate the phase angle . . . . . . . Program to nd the phase constant of dielectric . . . . Program to nd the phase constant of a good dielectric Program to nd the phase velocity . . . . . . . . . . . Program to nd the propagation constant . . . . . . . Program to nd the reection coecient . . . . . . . . Program to nd the reection coecient . . . . . . . . Program to calculate the skin depth of a good conductor Program to nd the refracted angle using snells law . Program used to convert spherical coordinates into cartesian coordinates . . . . . . . . . . . . . . . . . . . . . Program used to nd the Unit vector . . . . . . . . . . Program to nd the Voltage Standing Wave Ratio VSWR

81 82 82 82 82 83 83 83 84 84 84 85 85 85 85 86 86 86 87 87

List of Figures
11.1 To be provided . . . . . . . . . . . . . . . . . . . . . . . . . 57

Chapter 1 Vector Analysis


Scilab code Exa 1.1 Program to nd the unit vector
1 // C a p t i o n : Program t o f i n d t h e u n i t v e c t o r 2 // Example1 . 1 3 // p a g e 8 4 G = [2 , -2 , -1]; // p o s i t i o n o f p o i n t G i n c a r t e s i a n

c o o r d i n a t e system
5 aG = UnitVector ( G ) ; 6 disp ( aG , U n i t V e c t o r aG = ) 7 // R e s u l t 8 // U n i t V e c t o r aG = 9 // 0.6666667 0.6666667

0.3333333

Refer to the following Scilab code for UnitVector ARC 27

Scilab code Exa 1.2 Program to nd the phase angle between two vectors
1 2 3 4 5 6

// C a p t i o n : Program t o f i n d t h e p h a s e a n g l e b e t w e e n two v e c t o r s // Example1 . 2 // p a g e 11 clc ; Q = [4 ,5 ,2]; // p o i n t Q x = Q (1) ; 2

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

y = Q (2) ; z = Q (3) ; G = [y , -2.5* x ,3]; // v e c t o r f i e l d disp (G , G( rQ ) = ) aN = [2/3 ,1/3 , -2/3]; // u n i t v e c t o r d i r e c t i o n o f Q G_dot_aN = dot (G , aN ) ; // d o t p r o d u c t o f G and aN disp ( G_dot_aN , G. aN = ) G_dot_aN_aN = G_dot_aN * aN ; disp ( G_dot_aN_aN , (G. aN ) aN= ) teta_Ga = Phase_Angle (G , aN ) // p h a s e a n g l e b e t w e e n G and u n i t v e c t o r aN disp ( teta_Ga , p h a s e a n g l e b e t w e e n G and u n i t v e c t o r aN i n d e g r e e s = ) // R e s u l t // G( rQ ) = 5. 10. 3. // G. aN = 2. // (G. aN ) aN = 1.3333333 0.6666667 1.3333333 // p h a s e a n g l e b e t w e e n G and u n i t v e c t o r aN i n degrees = 99.956489 Refer to the following for dot ARC 6 Refer to the following for phase angel

ARC 16

Scilab code Exa 1.3 Transform the vector of Rectangular coordinates into cylindrical coordinates
1 2 3 4 5 6 7

// C a p t i o n : T r a n s f o r m t h e v e c t o r o f R e c t a n g u l a r coordinates into cylindrical coordinates // Example1 . 3 // p a g e 18 clc ; y = sym ( y ) ; x = sym ( x ) ; z = sym ( z ) ; 3

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

ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; ar = sym ( a r ) ; aphi = sym ( a p h i ) ; phi = sym ( p h i ) ; B = y * ax - x * ay + z * az ; disp (B , Given v e c t o r i n c a r t e s i a n coo r d i a n t e s y s t e m B= ) Br = B * ar ; Bphi = B * aphi ; Bz = B * az ; disp ( Components o f c y l i n d r i c a l v e c t o r B ) disp ( Br , Br= ) disp ( Bphi , Bphi= ) disp ( Bz , Bz= ) // R e s u l t // Given v e c t o r i n c a r t e s i a n coo r d i a n t e s y s t e m B= // a z z+ax yay x // Components o f c y l i n d r i c a l v e c t o r B // Br= // a r ( a z z+ax yay x ) // Bphi= // a p h i ( a z z+ax yay x ) // Bz= // a z ( a z z+ax yay x ) // Scilab code Exa 1.4 Transform the vector of Rectangular coordinates into spherical coordinates

1 2 3 4 5 6

// C a p t i o n : T r a n s f o r m t h e v e c t o r o f R e c t a n g u l a r coordinates into spherical coordinates // Example1 . 4 // p a g e 22 clc ; y = sym ( y ) ; x = sym ( x ) ; 4

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

z = sym ( z ) ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; ar = sym ( a r ) ; aTh = sym ( aTh ) ; aphi = sym ( a p h i ) ; G = ( x * z / y ) * ax ; disp (G , Given v e c t o r i n c a r t e s i a n coo r d i a n t e s y s t e m B= ) r = sym ( r ) ; teta = sym ( t e t a ) phi = sym ( p h i ) x1 = r * sin ( teta ) * cos ( phi ) ; y1 = r * sin ( teta ) * sin ( phi ) ; z1 = r * cos ( teta ) ; G1 = ( x1 * z1 / y1 ) * ax ; Gr = G1 * ar ; GTh = G1 * aTh ; Gphi = G1 * aphi ; Gsph = [ Gr , GTh , Gphi ]; disp ( Gr , Gr= ) disp ( GTh , GTh= ) disp ( Gphi , Gphi= ) // R e s u l t // Given v e c t o r i n c a r t e s i a n coo r d i a n t e s y s t e m B = ax x z / y // Gr = a r ax c o s ( p h i ) r c o s ( t e t a ) / s i n ( p h i ) //GTh = ax c o s ( p h i ) r c o s ( t e t a ) aTh/ s i n ( p h i ) // Gphi = a p h i ax c o s ( p h i ) r c o s ( t e t a ) / s i n ( p h i ) //

Chapter 2 Columbs Law and Electric Field Intensity


Scilab code Exa 2.1 Program to Calculate force exerted on Q2 by Q1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// C a p t i o n : Program t o C a c u l a t e f o r c e e x e r t e d on Q2 by Q1 // Example2 . 1 // p a g e 29 clc ; r2 = [2 ,0 ,5]; r1 = [1 ,2 ,3]; R12 = norm ( r2 - r1 ) ; aR12 = UnitVector ( r2 - r1 ) ; disp ( R12 , R12= ) disp ( aR12 , aR12= ) Q1 = 3e -04; // c h a r g e 1 i n Coulombs Q2 = -1e -04; // c h a r g e 2 i n Coulombs Eps = 8.854 e -12; // f r e e s p a c e p e r m i t t i v i t y F2 = (( Q1 * Q2 ) /(4* %pi * Eps * R12 ^2) ) * aR12 ; F1 = - F2 ; disp ( F2 , F o r c e e x e r t e d on Q2 by Q1 i n N/m F2 = ) disp ( F1 , F o r c e e x e r t e d on Q1 by Q2 i n N/m F1 = ) // R e s u l t // R12= // 3. 6

21 22 23 24 25 26

// aR12= // 0.3333333 0.6666667 0.6666667 // F o r c e e x e r t e d on Q2 by Q1 i n N/m F2 = // 9 . 9 8 6 3 8 0 5 19.972761 19.972761 // F o r c e e x e r t e d on Q1 by Q2 i n N/m F1 = // 9.9863805 19.972761 19.972761 Refer to the following Scilab code for UnitVector ARC 27

Scilab code Exa 2.2 Program to Calculate Electric Field E at P due to 4 identical charges
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

// C a p t i o n : Program t o C a c u l a t e E l e c t r i c F i e l d E a t P due t o 4 i d e n t i c a l c h a r g e s // Example2 . 2 // p a g e 33 clc ; P = [1 ,1 ,1]; P1 = [1 ,1 ,0]; P2 = [ -1 ,1 ,0]; P3 = [ -1 , -1 ,0]; P4 = [1 , -1 ,0]; R1 = norm (P - P1 ) ; aR1 = UnitVector (P - P1 ) ; R2 = norm (P - P2 ) ; aR2 = UnitVector (P - P2 ) ; R3 = norm (P - P3 ) ; aR3 = UnitVector (P - P3 ) ; R4 = norm (P - P4 ) ; aR4 = UnitVector (P - P4 ) ; disp ( R1 , R1= ) disp ( aR1 , aR1= ) disp ( R2 , R2= ) disp ( aR2 , aR2= ) disp ( R3 , R3= ) disp ( aR3 , aR3= ) disp ( R4 , R4= ) 7

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

disp ( aR4 , aR4= ) Q = 3e -09; // c h a r g e i n Coulombs Eps = 8.854 e -12; // f r e e s p a c e p e r m i t t i v i t y E1 = ( Q /(4* %pi * Eps * R1 ^2) ) * aR1 ; E2 = ( Q /(4* %pi * Eps * R2 ^2) ) * aR2 ; E3 = ( Q /(4* %pi * Eps * R3 ^2) ) * aR3 ; E4 = ( Q /(4* %pi * Eps * R4 ^2) ) * aR4 ; E = E1 + E2 + E3 + E4 ; disp (E , E l e c t r i c F i e l d I n t e s n i t y a t any p o i n t P due t o f o u r i d e n t i c a l C h a r g e s i n V/m= ) // R e s u l t //R1= 1. // aR1= 0. 0. 1. //R2= 2.236068 // aR2= 0.8944272 0. 0.4472136 //R3= 3. // aR3= 0.6666667 0.6666667 0.3333333 //R4= 2.236068 // aR4= 0. 0.8944272 0.4472136 // E l e c t r i c F i e l d I n t e s n i t y a t any p o i n t P due t o f o u r i d e n t i c a l C h a r g e s i n V/m= // 6 . 8 2 0 6 0 4 8 6.8206048 32.785194 // Refer to the following Scilab code for UnitVector ARC 27

Scilab code Exa 2.3 Program to nd the total charge enclosed in a volume
1 2 3 4 5 6 7 8 9

// Example2 . 3 // p a g e 35 clc ; r = sym ( r ) ; z = sym ( z ) ; phi = sym ( p h i ) ; rv = -5e -06* exp ( -1 e05 * r * z ) ; disp ( rv , Volume Charge d e n s i t y i n C/ c u b i c . m e t r e r v= 8

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

) Q1 = integ ( rv *r , phi ) ; Q1 = limit ( Q1 , phi ,2* %pi ) ; Q2 = integ ( Q1 , z ) ; Q2 = limit ( Q2 ,z ,0.04) - limit ( Q2 ,z ,0.02) ; Q3 = integ ( Q2 , r ) ; Q3 = limit ( Q3 ,r ,0.01) - limit ( Q3 ,r ,0) ; disp ( Q1 , Q1= ) disp ( Q2 , Q2= ) disp ( Q3 , T o t a l Charge E n c l o s e d i n a 2cm l e n g t h of e l e c t r o n beam i n c o u l o m b s Q= ) // R e s u l t // Volume Charge d e n s i t y i n C/ c u b i c . m e t r e r v = %e (100000 r z ) / 2 0 0 0 0 0 //Q1= 103993 r %e (100000 r z ) / 3 3 1 0 2 0 0 0 0 0 //Q2= 103993%e (2000 r ) / 3 3 1 0 2 0 0 0 0 0 0 0 0 0 0 // T o t a l Charge E n c l o s e d i n a 2cm l e n g t h of electron beam i n c o u l o m b s Q= // 1 0 3 9 9 3 / 1 3 2 4 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 3 9 9 3 %e 40/1324080000000000000 //Q a p p r o x i m a t e l y e q u a l t o 1 0 3 9 9 3 / 1 3 2 4 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 = 7 . 8 5 4D14 c o u l o m b s

Chapter 3 Electric Flux Density, Gausss Law and Divergence


Scilab code Exa 3.1 Program to nd Electric Flux density D of a uniform line charge
1 2 3 4 5 6 7 8 9 10 11 12 13

// C a p t i o n : Program t o f i n d E l e c t r i c Flux d e n s i t y D of a uniform l i n e charge // Example3 . 1 // p a g e 54 clc ; e0 = 8.854 e -12; // f r e e s p a c e p e r m i t t i v i t y i n F/m rL = 8e -09; // l i n e c h a r g e d e n s i t y c /m r = 3; // d i s t a n c e i n m e t r e E = Electric_Field_Line_Charge ( rL , e0 , r ) ; // e l e c t r i c f i e l d i n t e n s i t y of l i n e charge D = e0 * E ; disp (D , E l e c t r i c Flux D e n s i t y i n Coulombs p e r s q u a r e metre D = ) // R e s u l t // E l e c t r i c Flux D e n s i t y i n Coulombs p e r s q u a r e metre D = // 4 . 2 4 4D10 Refer to the following for ElectricalFieldLineCharge ARC 8

10

Scilab code Exa 3.2 Program to calculate surface charge density, Flux density, Field Intensity of coaxial cable
1

2 3 4 5 6 7 8 9 10 11 12 13 14 15

16

17 18 19 20 21 22

// C a p t i o n : Program t o c a l c u l a t e s u r f a c e c h a r g e d e n s i t y , Flux d e n s i t y , F i e l d I n t e n s i t y o f c o a x i a l cable // Example3 . 2 // p a g e 64 clc ; Q_innercyl = 30 e -09; // t o t a l c h a r g e on t h e i n n e r conductor i n coulombs a = 1e -03; // i n n e r r a d i u s o f c o a x i a l c a b l e i n m e t r e b = 4e -03; // o u t e r r a d i u s o f c o a x i a l c a b l e i n m e t r e L = 50 e -02; // l e n g t h o f c o a x i a l c a b l e rs_innercyl = Q_innercyl /(2* %pi * a * L ) ; rs_outercyl = Q_innercyl /(2* %pi * b * L ) ; e0 = 8.854 e -12; // f r e e s p a c e r e l a t i v e p e r m i t t i v i t y F /m r = sym ( r ) ; Dr = a * rs_innercyl / r ; Er = Dr / e0 ; disp ( rs_innercyl , S u r f a c e c h a r g e d e n s i t y o f i n n e r c y l i n d e r o f c o a x i a l c a b l e i n C/ s q u a r e . metre , r s i n n e r c y l= ) disp ( rs_outercyl , S u r f a c e c h a r g e d e n s i t y o f o u t e r c y l i n d e r o f c o a x i a l c a b l e i n C/ s q u a r e . metre , r s o u t e r c y l= ) disp ( Dr , E l e c t r i c Flux D e n s i t y i n C/ s q u a r e . m e t r e Dr= ) disp ( Er , E l e c t r i c F i e l d I n t e n s i t y i n V/m Er= ) // R e s u l t // S u r f a c e c h a r g e d e n s i t y o f i n n e r c y l i n d e r o f c o a x i a l c a b l e i n C/ s q u a r e . metre , r s i n n e r c y l = // 0.0000095 // S u r f a c e c h a r g e d e n s i t y o f o u t e r c y l i n d e r o f c o a x i a l c a b l e i n C/ s q u a r e . metre , r s o u t e r c y l = 11

23 24 25 26 27

// 0.0000024 // E l e c t r i c Flux D e n s i t y i n C/ s q u a r e . m e t r e Dr= // 9 . 5 4 8 8 1 8 3 3 3 7 3 1 2 0 1 1 E9/ r // E l e c t r i c F i e l d I n t e n s i t y i n V/m Er= // 1 0 7 8 . 4 7 5 0 7 7 2 2 2 8 6 / r Scilab code Exa 3.3 Program to calculate the total charge enclosed in a volume at the origin

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

// C a p t i o n : Program t o c a l c u l a t e t h e t o t a l c h a r g e e n c l o s e d i n a volume a t t h e o r i g i n // Example3 . 3 // p a g e 67 clc ; V = 1e -09; // volume i n c u b i c m e t r e x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; // Components o f E l e c t r i c Flux D e n s i t y i n c a r t e s i a n c o o r d i n a t e system Dx = exp ( - x ) * sin ( y ) ; Dy = - exp ( - x ) * cos ( y ) ; Dz = 2* z ; // D i v e r g e n c e o f e l e c t r i c f l u x d e n s i t y D dDx = diff ( Dx , x ) ; dDy = diff ( Dy , y ) ; dDz = diff ( Dz , z ) ; // T o t a l c h a r g e e n c l o s e d i n a g i v e n volume del_Q = ( dDx + dDy + dDz ) * V ; disp ( del_Q , T o t a l c h a r g e e n c l o s e d i n an i n c r e m e n t a l volume i n coulombs , d e l Q = ) // T o t a l Charge e n c l o s e d i n a g i v e n volume a t o r i g i n (0 ,0 ,0) del_Q = limit ( del_Q ,x ,0) ; del_Q = limit ( del_Q ,y ,0) ; del_Q = limit ( del_Q ,z ,0) ; disp ( del_Q *1 e09 , T o t a l c h a r g e e n c l o s e d i n an i n c r e m e n t a l volume i n nano c o u l o m b s a t o r i g i n , 12

25 26 27 28

del Q = ) // R e s u l t // T o t a l c h a r g e e n c l o s e d i n an i n c r e m e n t a l volume i n 2 . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 E9 coulombs , d e l Q = // T o t a l c h a r g e e n c l o s e d i n an i n c r e m e n t a l volume i n nano c o u l o m b s a t o r i g i n , d e l Q = // 2 . 0 Scilab code Exa 3.4 Program to Find the Divergence of D at the origin

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

// C a p t i o n : Program t o Find t h e D i v e r g e n c e o f D a t the o r i g i n // Example3 . 4 // p a g e 70 clc ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; // Components o f E l e c t r i c Flux D e n s i t y i n c a r t e s i a n c o o r d i n a t e system Dx = exp ( - x ) * sin ( y ) ; Dy = - exp ( - x ) * cos ( y ) ; Dz = 2* z ; // D i v e r g e n c e o f e l e c t r i c f l u x d e n s i t y D dDx = diff ( Dx , x ) ; dDy = diff ( Dy , y ) ; dDz = diff ( Dz , z ) ; divD = dDx + dDy + dDz disp ( divD , D i v e r g e n c e o f E l e c t r i c Flux D e n s i t y D i n C/ c u b i c . metre , divD = ) divD = limit ( divD ,x ,0) ; divD = limit ( divD ,y ,0) ; divD = limit ( divD ,z ,0) ; disp ( divD , D i v e r g e n c e o f E l e c t r i c Flux D e n s i t y D i n C/ c u b i c . m e t r e a t o r i g i n , divD = ) // R e s u l t // D i v e r g e n c e o f E l e c t r i c Flux D e n s i t y D i n C/ c u b i c . metre , divD = 13

// 2 // D i v e r g e n c e o f E l e c t r i c Flux D e n s i t y D i n C/ c u b i c . m e t r e a t o r i g i n , divD = 26 // 2
24 25

Scilab code Exa 3.5 Program to verify the Divergence theorem for the eld D
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

// C a p t i o n : Program t o v e r i f y t h e D i v e r g e n c e t h e o r e m f o r t h e f i e l d D // Example3 . 5 // p a g e 74 clc ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; // Components o f E l e c t r i c Flux D e n s i t y i n c a r t e s i a n c o o r d i n a t e system Dx = 2* x * y ; Dy = x ^2; Dz = 0; // D i v e r g e n c e o f e l e c t r i c f l u x d e n s i t y D dDx = diff ( Dx , x ) ; dDy = diff ( Dy , y ) ; dDz =0; divD = dDx + dDy + dDz disp ( divD , D i v e r g e n c e o f E l e c t r i c Flux D e n s i t y D i n C/ c u b i c . metre , divD = ) // E v a l u a t e volume i n t e g r a l on d i v e r g e n c e o f D Vol_int_divD = integ ( divD , x ) ; Vol_int_divD = limit ( Vol_int_divD ,x ,1) - limit ( Vol_int_divD ,x ,0) ; Vol_int_divD = integ ( Vol_int_divD , y ) ; Vol_int_divD = limit ( Vol_int_divD ,y ,2) - limit ( Vol_int_divD ,y ,0) ; Vol_int_divD = integ ( Vol_int_divD , z ) ; Vol_int_divD = limit ( Vol_int_divD ,z ,3) - limit ( Vol_int_divD ,z ,0) ; 14

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

disp ( Vol_int_divD , Volume I n t e g r a l o f d i v e r g e n c e o f D, i n c o u l o m b s v o l i n t ( divD )= ) // E v a l u a t e s u r f a c e i n t e g r a l on f i e l d D Dx = limit ( Dx ,x ,1) ; sur_D = integ ( Dx , y ) ; sur_D = limit ( sur_D ,y ,2) - limit ( sur_D ,y ,0) ; sur_D = integ ( sur_D , z ) ; sur_D = limit ( sur_D ,z ,3) - limit ( sur_D ,z ,0) ; disp ( sur_D , S u r f a c e I n t e g r a l o f f i e l d D, i n c o u l o m b s s u r i n t (D . d s )= ) if ( sur_D == Vol_int_divD ) disp ( D i v e r g e n c e Theorem v e r i f i e d ) end // R e s u l t // D i v e r g e n c e o f E l e c t r i c Flux D e n s i t y D i n C/ c u b i c . metre , divD = // 2 y // Volume I n t e g r a l o f d i v e r g e n c e o f D, i n c o u l o m b s v o l i n t ( divD )= // 12 // S u r f a c e I n t e g r a l o f f i e l d D, i n c o u l o m b s s u r i n t ( D . d s )= // 12

15

Chapter 4 Energy and Potential


Scilab code Exa 4.1 Program to nd the work involved W in moving a charge Q along shorter arc of a circle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// C a p t i o n : Program t o f i n d t h e work i n v o l v e d W i n moving a c h a r g e Q a l o n g s h o r t e r a r c o f a c i r c l e // Example4 . 1 // p a g e 84 clc ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; y1 = sym ( y1 ) ; y = sqrt (1 - x ^2) ; Q = 2; // c h a r g e i n c o u l o m b s Edot_dL1 = integ (y , x ) ; disp ( Edot_dL1 , E . dx ax = ) Edot_dL1 = limit ( Edot_dL1 ,x ,0.8) - limit ( Edot_dL1 ,x ,1) ; disp ( Edot_dL1 , V a l u e o f E . dx ax = ) Edot_dL2 = 0; disp ( Edot_dL2 , V a l u e o f E . dz a z= ) x = sqrt (1 - y1 ^2) ; Edot_dL3 = integ (x , y1 ) disp ( Edot_dL3 , E . dy ay= ) Edot_dL3 = limit ( Edot_dL3 , y1 ,0.6) - limit ( Edot_dL3 , y1 16

21 22 23 24 25 26 27 28 29 30 31 32 33

,0) ; disp ( Edot_dL3 , V a l u e o f E . dy ay = ) W = -Q *( Edot_dL1 + Edot_dL2 + Edot_dL3 ) ; disp (W , Work done i n moving a p o i n t c h a r g e a l o n g shorter arc of c i r c l e in Joules , W ) = // R e s u l t // E . dx ax = a s i n ( x ) /2+x s q r t (1x 2 ) /2 // V a l u e o f E . dx ax = ( 2 5 a s i n ( 4 / 5 ) +12) /50%pi /4 // V a l u e o f E . dz a z = 0. // E . dy ay = a s i n ( y1 ) /2+ y1 s q r t (1 y1 2 ) /2 // V a l u e o f E . dy ay = ( 2 5 a s i n ( 3 / 5 ) +12) /50 // Work done i n moving a p o i n t c h a r g e a l o n g s h o r t e r arc of c i r c l e in Joules , W = // 2((25 a s i n ( 4 / 5 ) +12) /50+(25 a s i n ( 3 / 5 ) +12) /50%pi /4) // Which i s e q u i v a l e n t t o // 2 ( ( 2 5 0 . 9 2 7 2 9 5 2 + 1 2 ) / 5 0 + ( 2 5 0 . 6 4 3 5 0 1 1 + 1 2 ) /50%pi / 4 ) = 0.96 J o u l e s Scilab code Exa 4.2 Program to nd the work involved W in moving a charge Q along straight line

1 2 3 4 5 6 7 8 9 10 11 12 13 14

// C a p t i o n : Program t o f i n d t h e work i n v o l v e d W i n moving a c h a r g e Q a l o n g s t r a i g h t l i n e // Example4 . 2 // p a g e 84 clc ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; y1 = sym ( y1 ) ; y = -3*( x -1) ; Q = 2; // c h a r g e i n c o u l o m b s Edot_dL1 = integ (y , x ) ; disp ( Edot_dL1 , E . dx ax = ) Edot_dL1 = limit ( Edot_dL1 ,x ,0.8) - limit ( Edot_dL1 ,x ,1) ; disp ( Edot_dL1 , V a l u e o f E . dx ax = ) 17

15 Edot_dL2 = 0; 16 disp ( Edot_dL2 , V a l u e o f E . dz a z= ) 17 x = (1 - y1 /3) ; 18 Edot_dL3 = integ (x , y1 ) 19 disp ( Edot_dL3 , E . dy ay= ) 20 Edot_dL3 = limit ( Edot_dL3 , y1 ,0.6) - limit ( Edot_dL3 , y1

,0) ;
21 disp ( Edot_dL3 , V a l u e o f E . dy ay = ) 22 W = -Q *( Edot_dL1 + Edot_dL2 + Edot_dL3 ) ; 23 disp (W , Work done i n moving a p o i n t c h a r g e a l o n g 24 25 26 27 28 29 30

shorter arc of c i r c l e in Joules , W ) = // R e s u l t //E . dx ax = 3( x 2/2 x ) // V a l u e o f E . dx ax = 3/50 // V a l u e o f E . dz a z = 0. //E . dy ay = y1y1 2 / 6 // V a l u e o f E . dy ay = 27/50 // Work done i n moving a p o i n t c h a r g e a l o n g s h o r t e r a r c o f c i r c l e i n J o u l e s , W = 24/25 = 0.96 Joules Scilab code Exa 4.3 Program to calculate E, D and volume charge density using divergence of D

1 2 3 4 5 6 7 8 9 10 11 12

// C a p t i o n : Program t o c a l c u l a t e E , D and volume charge density using divergence of D // Example4 . 3 // p a g e 100 clc ; x = -4; y = 3; z = 6; V = 2*( x ^2) *y -5* z ; disp ( float ( V ) , P o t e n t i a l V a t p o i n t P( 4 , 3 , 6 ) i n v o l t s i s Vp = ) x1 = sym ( x1 ) ; y1 = sym ( y1 ) ; z1 = sym ( z 1 ) ; 18

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

ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; V1 = 2*( x1 ^2) * y1 -5* z1 ; // E l e c t r i c F i e l d I n t e n s i t y from g r a d i e n t o f V Ex = - diff ( V1 , x1 ) ; Ey = - diff ( V1 , y1 ) ; Ez = - diff ( V1 , z1 ) ; Ex1 = limit ( Ex , x1 , -4) ; Ex1 = limit ( Ex1 , y1 ,3) ; Ex1 = limit ( Ex1 , z1 ,6) ; Ey1 = limit ( Ey , x1 , -4) ; Ey1 = limit ( Ey1 , y1 ,3) ; Ey1 = limit ( Ey1 , z1 ,6) ; Ez1 = limit ( Ez , x1 , -4) ; Ez1 = limit ( Ez1 , y1 ,3) ; Ez1 = limit ( Ez1 , z1 ,6) ; E = Ex1 * ax + Ey1 * ay + Ez1 * az ; Ep = sqrt ( float ( Ex1 ^2+ Ey1 ^2+ Ez1 ^2) ) ; disp ( Ep , E l e c t r i c F i e l d I n t e n s i t y E a t p o i n t P ( 4 ,3 ,6) in v o l t s E = ) aEp = float ( E / Ep ) ; disp ( aEp , D i r e c t i o n o f E l e c t r i c F i e l d E a t p o i n t P ( 4 , 3 , 6 ) aEp= ) Dx = float (8.854* Ex ) ; Dy = float (8.854* Ey ) ; Dz = float (8.854* Ez ) ; D = Dx * ax + Dy * ay + Dz * az ; disp (D , E l e c t r i c Flux D e n s i t y i n p i c o . C/ s q u a r e . m e t r e D =) dDx = diff ( Dx , x1 ) ; dDx = limit ( dDx , x1 , -4) ; dDx = limit ( dDx , y1 ,3) ; dDx = limit ( dDx , z1 ,6) ; dDy = diff ( Dy , y1 ) ; dDy = limit ( dDy , x1 , -4) ; dDy = limit ( dDy , y1 ,3) ; dDy = limit ( dDy , z1 ,6) ; 19

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

dDz = diff ( Dz , z1 ) ; dDz = limit ( dDz , x1 , -4) ; dDz = limit ( dDz , y1 ,3) ; dDz = limit ( dDz , z1 ,6) ; rV = dDx + dDy + dDz ; disp ( rV , Volume Charge d e n s i t y from d i v e r g e n c e o f D i n pC/ c u b i c . m e t r e i s rV= ) // R e s u l t // P o t e n t i a l V a t p o i n t P( 4 , 3 , 6 ) i n v o l t s i s Vp = 66. // E l e c t r i c F i e l d I n t e n s i t y E a t p o i n t P( 4 , 3 , 6 ) i n v o l t s E = 57.9050947672137 // D i r e c t i o n o f E l e c t r i c F i e l d E a t p o i n t P( 4 , 3 , 6 ) aEp= // 0 . 0 1 7 2 6 9 6 3 7 5 6 8 5 1 ( 5 az 32 ay +48 ax ) // e q u i v a l e n t t o aEp= 0 . 0 8 6 3 4 8 2 az 0 . 5 5 2 6 2 8 4 ay + 0 . 8 2 8 9 4 2 6 ax // E l e c t r i c Flux D e n s i t y i n p i c o . C/ s q u a r e . m e t r e D = // 35.416 ax x1 y1 1 7 . 7 0 8 ay x1 2 + 4 4 . 2 7 a z // Volume Charge d e n s i t y from d i v e r g e n c e o f D i n pC/ c u b i c . m e t r e i s rV= // 106.248

20

Chapter 5 Current and Conductors


Scilab code Exa 5.1 Program to nd the resistance, current and current density
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// C a p t i o n : Program t o f i n d t h e r e s i s t a n c e , c u r r e n t and c u r r e n t d e n s i t y // Example5 . 1 // p a g e 123 clc ; clear ; D = 0.0508; // d i a m e t e r o f c o n d u c t o r i n i n c h e s D = 0.0508*0.0254; // d i a m e t e r i n m e t r e s r = D /2; // r a d i u s i n m e t r e s A = %pi * r ^2; // a r e a o f t h e c o n d u c t o r i n s q u a r e m e t r e L = 1609; // l e n g t h o f t h e c o p p e r w i r e i n m e t r e sigma = 5.80 e07 ; // c o n d u c t i v i t y i n s i e m e n s / m e t r e R = L /( sigma * A ) ; // r e s i s t a n c e i n ohms I = 10; // c u r r e n t i n a m p e r e s J = I / A ; // c u r r e n t d e n s i t y i n amps / s q u a r e . m e t r e disp (R , R r e s i s t a n c e i n ohms o f g i v e n c o p p e r w i r e R = ) disp (J , C u r r e n t d e n s i t y i n A/ s q u a r e . m e t r e J = ) // R e s u l t // R r e s i s t a n c e i n ohms o f g i v e n c o p p e r w i r e R = // 21.215013 // C u r r e n t d e n s i t y i n A/ s q u a r e . m e t r e J = 21

21

//

7647425.6

Scilab code Exa 5.2 Program to nd potential at point P, Electric Field Intensity E, Flux density D
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

// C a p t i o n : Program t o f i n d p o t e n t i a l a t p o i n t P , E l e c t r i c f F i e l d I n t e n s i t y E , Flux d e n s i t y D // Example5 . 2 // p a g e 126 clc ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; V = 100*( x ^2 - y ^2) ; disp (V , P o t e n t i a l i n V o l t s V = ) Ex = diff (V , x ) ; Ey = diff (V , y ) ; Ez = diff (V , z ) ; E = -( Ex * ax + Ey * ay + Ez * az ) ; disp (E , E l e c t r i c F i e l d I n t e n s i t y i n V/m E = ) E = limit (E ,x ,2) ; E = limit (E ,y , -1) ; V = limit (V ,x ,2) ; V = limit (V ,y , -1) ; disp (V , P o t e n t i a l a t p o i n t P i n V o l t s Vp = ) disp (E , E l e c t r i c F i e l d I n t e n s i t y a t p o i n t P i n V/m Ep = ) D = 8.854 e -12* E ; disp ( D *1 e09 , E l e c t r i c FLux D e n s i t y a t p o i n t P i n nC/ s q u a r e . m e t r e Dp = ) // R e s u l t // P o t e n t i a l i n V o l t s V = 1 0 0 ( x2y 2 ) // E l e c t r i c F i e l d I n t e n s i t y i n V/m E = 2 00 ay y 200 ax x // P o t e n t i a l a t p o i n t P i n V o l t s Vp = 300 22

// E l e c t r i c F i e l d I n t e n s i t y a t p o i n t P i n V/m Ep = 200 ay 400 ax 31 // E l e c t r i c FLux D e n s i t y a t p o i n t P i n nC/ s q u a r e . m e t r e Dp = 0 . 0 0 8 8 5 4 ( 2 0 0 ay 400 ax ) 32 // which i s e q u i v a l e n t t o Dp = 3.5416 ax 1.7708 ay


30

Scilab code Exa 5.3 Program to determine the equation of the streamline passing through any point
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// C a p t i o n : Program t o d e t e r m i n e t h e e q u a t i o n o f t h e s t r e a m l i n e p a s s i n g t h r o u g h any p o i n t P // Example5 . 3 // p a g e 128 clc ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; C1 = integ (1/ y , y ) + integ (1/ x , x ) ; disp ( C1 , C1 = ) C2 = exp ( C1 ) ; disp ( C2 , The Stream l i n e E q u a t i o n C2 = ) C2 = limit ( C2 ,x ,2) ; C2 = limit ( C2 ,y , -1) ; disp ( C2 , The v a l u e o f c o n s t a n t i n t h e s t r e a m l i n e e q u a t i o n p a s s i n g t h r o u g h t h e p o i n t P i s C2= ) // R e s u l t //C1 = l o g ( y )+l o g ( x ) // The Stream l i n e E q u a t i o n C2 = x y // The v a l u e o f c o n s t a n t i n t h e s t r e a m l i n e e q u a t i o n p a s s i n g t h r o u g h t h e p o i n t P i s C2 = 2

23

Chapter 6 Dielectrics and Capacitance


Scilab code Exa 6.1 Program to calculate D, E and Polarization P for Teon slab
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// C a p t i o n : Program t o c a l c u l a t e D, E and P o l a r i z a t i o n P for Teflon slab // Example6 . 1 // p a g e 142 clc ; ax = sym ( ax ) ; e0 = sym ( e 0 ) ; E0 = sym ( E0 ) ; Ein = sym ( Ein ) ; er = 2.1; // r e l a t i v e p e r m i t t i v i t y o f t e f l o n chi = er -1; // e l e c t r i c s u s c e p t i b i l i t y Eout = E0 * ax ; Dout = float ( e0 * Eout ) ; Din = float ( er * e0 * Ein ) ; Pin = float ( chi * e0 * Ein ) ; disp ( Dout , Dout i n c / s q u a r e . m e t r e = ) disp ( Din , Din i n c / s q u a r e . m e t r e = ) disp ( Pin , P o l a r i z a t i o n i n c o u l o m b s p e r s q u a r e m e t r e Pin = ) // R e s u l t // Dout i n c / s q u a r e . m e t r e = ax e 0 E0 // Din i n c / s q u a r e . m e t r e = 2 . 1 e 0 Ein 24

21

// P o l a r i z a t i o n i n c o u l o m b s p e r s q u a r e m e t r e Pin = 1 . 1 e 0 Ein Scilab code Exa 6.2 Program to calculate E and Polarization P for Teon slab

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// C a p t i o n : Program t o c a l c u l a t e E and P o l a r i z a t i o n P for Teflon slab // Example6 . 2 // p a g e 146 clc ; ax = sym ( ax ) ; e0 = sym ( e 0 ) ; E0 = sym ( E0 ) ; er = 2.1; // r e l a t i v e p e r m i t t i v i t y o f t e f l o n chi = er -1; // e l e c t r i c s u s c e p t i b i l i t y Eout = E0 * ax ; Ein = float ( Eout / er ) ; Din = float ( e0 * Eout ) ; Pin = float ( Din - e0 * Ein ) ; disp ( Ein , Ein i n V/m = ) disp ( Pin , P o l a r i z a t i o n i n c o u l o m b s p e r s q u a r e m e t r e Pin = ) // R e s u l t // Ein i n V/m = 0 . 4 7 6 1 9 0 4 7 6 1 9 0 4 8 ax E0 // P o l a r i z a t i o n i n c o u l o m b s p e r s q u a r e m e t r e Pin = 0 . 5 2 3 8 0 9 5 2 3 8 0 9 5 2 ax e 0 E0 Scilab code Exa 6.3 Program to calculate the capacitance of a parallel plate capacitor

1 2 3 4 5 6

// C a p t i o n : Program t o c a l c u l a t e t h e c a p a c i t a n c e o f a parallel plate capacitor // Example6 . 3 // p a g e 151 clc ; S = 10; // a r e a i n s q u a r e i n c h S = 10*(0.0254) ^2; // a r e a i n s q u a r e m e t r e 25

7 d = 0.01; // d i s t a n c e b e t w e e n t h e p l a t e s i n i n c h 8 d = 0.01*0.0254; // d i s t a n c e b e t w e e n t h e p l a t e s i n 9 10 11 12 13 14 15

metre e0 = 8.854 e -12; // f r e e s p a c e p e r m i t t i v i t y i n F/m er = 6; // r e l a t i v e p e r m i t t i v i t y o f mica e = e0 * er ; C = parallel_capacitor (e ,S , d ) ; disp ( C *1 e09 , C a p a c i t a n c e o f a p a r a l l e l p l a t e capacitor in pico farads C =) // R e s u l t // C a p a c i t a n c e o f a p a r a l l e l p l a t e c a p a c i t o r i n p i c o farads C = 1.3493496 Refer to the following for parallelcapacitor ARC 14

26

Chapter 7 Poissons and Laplaces Equation


Scilab code Exa 7.1 Derivation of capacitance of a parallel plate capacitor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// C a p t i o n : D e r i v a t i o n o f c a p a c i t a n c e o f a p a r a l l e l plate capacitor // Example7 . 1 // p a g e 177 clc ; x = sym ( x ) ; d = sym ( d ) ; Vo = sym ( Vo ) ; e = sym ( e ) ; ax = sym ( ax ) ; A = sym ( A ) ; B = sym ( B ) ; S = sym ( S ) ; V = integ (A , x ) + B ; V = limit (V ,A , Vo / d ) ; V = limit (V ,B ,0) ; disp (V , P o t e n t i a l i n V o l t s V = ) E = - diff (V , x ) * ax ; disp (E , E l e c t r i c F i e l d i n V/m E = ) D = e*E; DN = D / ax ; 27

21 22 23 24 25 26 27 28 29 30 31

disp (D , E l e c t r i c Flux D e n s i t y i n C/ s q u a r e m e t r e D = ) Q = - DN * S ; disp (Q , Charge i n Coulombs Q = ) C = Q / Vo ; disp (C , C a p a c i t a n c e o f p a r a l l e l p l a t e c a p a c i t o r C = ) // R e s u l t // P o t e n t i a l i n V o l t s V = Vo x / d // E l e c t r i c F i e l d i n V/m E = ax Vo/d // E l e c t r i c Flux D e n s i t y i n C/ s q u a r e m e t r e D = ax e Vo/d // Charge i n Coulombs Q = e VoS /d // C a p a c i t a n c e o f p a r a l l e l p l a t e c a p a c i t o r C = e S /d Scilab code Exa 7.2 Capacitance of a Cylindrical Capacitor

// C a p t i o n : C a p a c i t a n c e o f a C y l i n d r i c a l C a p a c i t o r // Example7 . 2 // p a g e 179 clc ; A = sym ( A ) ; B = sym ( B ) ; r = sym ( r ) ; ar = sym ( a r ) ; ruo = sym ( r u o ) ; a = sym ( a ) ; b = sym ( b ) ; L = sym ( L ) ; Vo = sym ( Vo ) ; V = integ ( A /r , r ) + B ; disp (V , P o t e n t i a l V = ) V = limit (V ,A , Vo / log ( a / b ) ) ; V = limit (V ,B , - Vo * log ( b ) / log ( a / b ) ) ; disp (V , P o t e n t i a l V by s u b s t i t u t e t h e v a l u e s o f constant A & B = ) 19 V = Vo * log ( b / r ) / log ( b / a ) ; 20 E = - diff (V , r ) * ar ;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

28

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

disp (E , E = ) ; E = limit (E ,r , a ) ; disp (E , E a t r =a i s = ) D = e*E; DN = D / ar ; disp ( DN , DN = ) S = float (2* %pi * a * L ) ; // a r e a o f c y l i n d e r Q = DN * S disp (Q , Q = ) C = Q / Vo ; disp (C , C a p a c i t a n c e o f a c y l i n d r i c a l C a p a c i t o r C = ) // R e s u l t // P o t e n t i a l V = B+l o g ( r ) A // P o t e n t i a l V by s u b s t i t u t e t h e v a l u e s o f c o n s t a n t A & B =( l o g ( r )l o g ( b ) ) Vo/ l o g ( a / b ) // E = a r Vo / ( l o g ( b / a ) r ) // E a t r =a i s = a r Vo / ( a l o g ( b / a ) ) // DN = e Vo / ( a l o g ( b / a ) ) // Q = 6 . 2 8 3 1 8 5 3 0 6 0 2 3 8 0 5 e VoL/ l o g ( b/ a ) // C a p a c i t a n c e o f a c y l i n d r i c a l C a p a c i t o r C = 6 . 2 8 3 1 8 5 3 0 6 0 2 3 8 0 5 e L/ l o g ( b/ a ) Scilab code Exa 7.3 Program to determine the electric eld of a two innite radial planes with an interior angle alpha

2 3 4 5 6 7 8 9 10 11

// C a p t i o n : Program t o D e t e r m i n e t h e e l e c t r i c f i e l d o f a two i n f i n i t e r a d i a l p l a n e s w i t h an i n t e r i o r angle alpha // Example 7 . 3 // p a g e 180 clc ; phi = sym ( p h i ) ; A = sym ( A ) ; B = sym ( B ) ; Vo = sym ( Vo ) ; alpha = sym ( a l p h a ) ; aphi = sym ( a p h i ) ; r = sym ( r ) ; 29

12 V = integ (A , phi ) + B ; 13 disp (V , V = ) ; 14 V = limit (V ,B ,0) ; 15 V = limit (V ,A , Vo / alpha ) ; 16 disp (V , P o t e n t i a l V a f t e r 17 18 19 20 21 22

a p p l y i n g boundary

conditions =) E = -(1/ r ) * diff (V , phi ) * aphi ; disp (E , E = ) // R e s u l t // V = B+p h i A // P o t e n t i a l V a f t e r a p p l y i n g boundary c o n d i t i o n s = p h i Vo/ a l p h a // E = a p h i Vo / ( a l p h a r ) Scilab code Exa 7.4 Derivation of capacitance of a spherical capacitor

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// C a p t i o n : D e r i v a t i o n o f c a p a c i t a n c e o f a s p h e r i c a l capacitor // Example7 . 4 // p a g e 181 clc ; a = sym ( a ) ; b = sym ( b ) ; Vo = sym ( Vo ) ; r = sym ( r ) ; e = sym ( e ) ; V = Vo *((1/ r ) -(1/ b ) ) /((1/ a ) -(1/ b ) ) ; disp (V , V = ) E = - diff (V , r ) * ar ; disp (E , E = ) D = e*E; DN = D / ar ; disp ( DN , DN = ) S = float (4* %pi * r ^2) ; // a r e a o f s p h e r e Q = DN * S ; disp (Q , Q = ) C = Q / Vo ; disp (C , C a p a c i t a n c e o f a s p h e r i c a l c a p a c i t o r = ) 30

22 23 24 25 26 27

// R e s u l t //V = ( 1 / r 1/b ) Vo / ( 1 / a 1/b ) //E = a r Vo / ( ( 1 / a 1/b ) r 2 ) //DN = e Vo / ( ( 1 / a 1/b ) r 2 ) //Q = 1 2 . 5 6 6 3 7 0 6 0 4 6 9 6 4 3 e Vo / ( 1 / a 1/b ) // C a p a c i t a n c e o f a s p h e r i c a l c a p a c i t o r = 1 2 . 5 6 6 3 7 0 6 0 4 6 9 6 4 3 e / ( 1 / a 1/b ) Scilab code Exa 7.5 Potential in spherical coordinates as a function of teta V(teta)

1 2 3 4 5 6 7 8 9 10 11 12

// C a p t i o n : P o t e n t i a l i n s p h e r i c a l c o o r d i n a t e s a s a f u n c t i o n o f t e t a V( t e t a ) // Example7 . 5 // p a g e 182 clc ; teta = sym ( t e t a ) ; A = sym ( A ) ; B = sym ( B ) ; V = integ ( A / float ( sin ( teta ) ) , teta ) + B ; disp (V , V = ) // R e s u l t //V = B+( l o g ( c o s ( t e t a ) 1)/2 l o g ( c o s ( t e t a ) +1) / 2 ) A // E q u i v a l e n t t o V = B+l o g ( t a n ( t e t a / 2 ) ) A

31

Chapter 8 The Steady Magnetic Field


Scilab code Exa 8.1 Program to nd the magnetic eld intensity of a current carrying lament
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

// C a p t i o n : Program t o f i n d t h e m a g n e t i c f i e l d intensity of a current carrying filament // Example8 . 1 // p a g e 217 clc ; I = 8; // c u r r e n t i n amps alpha1x = -90/57.3; // p h a s e a n g l e a l o n g w i t h xa x i s x = 0.4; y = 0.3; z =0; alpha2x = atan ( x / y ) ; aphi = sym ( a p h i ) ; az = sym ( a z ) ; rx = y ; // d i s t a n c e i n m e t r e s i n c y n l i n d r i c a l c o o r d i a n t e system H2x = float (( I /(4* %pi * rx ) ) *( sin ( alpha2x ) - sin ( alpha1x ) ) ) * - az ; disp ( H2x , H2x = ) alpha1y = - atan ( y / x ) ; alpha2y = 90/57.3; ry = 0.4; H2y = float (( I /(4* %pi * ry ) ) *( sin ( alpha2y ) - sin ( alpha1y 32

20 21 22 23 24 25 26

) ) ) * - az ; disp ( H2y , H2y = ) H2 = H2x + H2y ; disp ( H2 , H2 = ) // R e s u l t // H2x = 3 . 8 1 9 7 1 8 6 1 7 0 7 9 2 8 9 a z // H2y = 2.546479080730701 az //H2 = 6.36619769780999 az Scilab code Exa 8.2 Program to nd the curlH of a square path of side d

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

// C a p t i o n : Program t o f i n d t h e c u r l H o f a s q u a r e path o f s i d e d // Example8 . 2 // p a g e 230 clc ; ax = sym ( ax ) ; az = sym ( a z ) ; ay = sym ( ay ) ; z = sym ( z ) ; y = sym ( y ) ; d = sym ( d ) ; H = 0.2* z ^2* ax ; Hx = float ( H / ax ) ; HdL = float (0.4* z * d ^2) ; // c u r l H e v a l u a t e d from t h e d e f i n i t i o n o f c u r l curlH = ( HdL /( d ^2) ) * ay ; // c u r l H e v a l u a t e d from t h e d e t e r m i n a n t del_cross_H = - ay *( - diff ( Hx , z ) ) + az *( - diff ( Hx , y ) ) ; disp ( curlH , c u r l H = ) disp ( del_cross_H , d e l c r o s s H = ) // R e s u l t // c u r l H = 0 . 4 ay z // d e l c r o s s H = 0 . 4 ay z Scilab code Exa 8.3 Program to verify Stokes theorem 33

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

// C a p t i o n : Program t o v e r i f y S t o k e s t h e o r e m // Example8 . 3 // p a g e 233 clc ; teta = sym ( t e t a ) ; phi = sym ( p h i ) ; ar = sym ( a r ) ; aphi = sym ( a p h i ) ; az = sym ( a z ) ; r = sym ( r ) ; curlH = float (36* cos ( teta ) * cos ( phi ) * r ^2* sin ( teta ) ) ; curlH_S = integ ( curlH , teta ) ; curlH_S = float ( limit ( curlH_S ,r ,4) ) ; curlH_S = float ( limit ( curlH_S , teta ,0.1* %pi ) ) - float ( limit ( curlH_S , teta ,0) ) ; curlH_S = integ ( curlH_S , phi ) ; curlH_S = float ( limit ( curlH_S , phi ,0.3* %pi ) ) - float ( limit ( curlH_S , phi ,0) ) ; disp ( curlH_S , S u r f a c e I n t e g r a l o f c u r l H i n Amps = ) Hr = 6* r * sin ( phi ) ; Hphi = 18* r * sin ( teta ) * cos ( phi ) ; HdL = float ( limit ( Hphi * r * sin ( teta ) ,r ,4) ) ; HdL = float ( limit ( HdL , teta ,0.1* %pi ) ) ; HdL = float ( integ ( HdL , phi ) ) HdL = float ( limit ( HdL , phi ,0.3* %pi ) ) ; disp ( HdL , C l o s e d L i n e I n t e g r a l o f H i n Amps = ) // R e s u l t // S u r f a c e I n t e g r a l o f c u r l H i n Amps = 22.24922359441324 // C l o s e d L i n e I n t e g r a l o f H i n Amps = 22.24922359441324

34

Chapter 9 Magnetic Forces, Materials and Inductance


Scilab code Exa 9.1 Program to nd magnetic eld and force produced in a square loop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

// C a p t i o n : Program t o f i n d m a g n e t i c f i e l d and f o r c e produced in a square loop // Example9 . 1 // p a g e 263 clc ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; I = 15; // f i l a m e n t c u r r e n t i n amps I1 = 2e -03; // c u r r e n t i n s q u a r e l o o p u0 = 4* %pi *1 e -07; // f r e e s p a c e p e r m e a b i l i t y i n H/m H = float ( I /(2* %pi * x ) ) * az ; disp (H , M a g n e t i c F i e l d I n t e n s i t y i n A/m H = ) B = float ( u0 * H ) ; disp (B , M a g n e t i c Flux D e n s i t y i n T e s l a B = ) Bz = B / az ; // B c r o s s d L = ay d i f f ( Bz , x ) ; 35

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

F1 = float ( - I1 * integ ( ay * Bz , x ) ) ; F1 = float ( limit ( F1 ,x ,3) - limit ( F1 ,x ,1) ) ; F2 = float ( - I1 * integ ( ax * - Bz , y ) ) ; F2 = float ( limit ( F2 ,x ,3) ) ; F2 = float ( limit ( F2 ,y ,2) - limit ( F2 ,y ,0) ) ; F3 = float ( - I1 * integ ( ay * Bz , x ) ) ; F3 = float ( limit ( F3 ,x ,1) - limit ( F3 ,x ,3) ) ; F4 = float ( - I1 * integ ( ax * - Bz , y ) ) ; F4 = float ( limit ( F4 ,x ,1) ) ; F4 = float ( limit ( F4 ,y ,0) - limit ( F4 ,y ,2) ) ; F = float (( F1 + F2 + F3 + F4 ) *1 e09 ) ; disp (F , T o t a l F o r c e a c t i n g on a s q u a r e l o o p i n nN F = ) // R e s u l t // M a g n e t i c F i e l d I n t e n s i t y i n A/m H = 2.387324146817574 az /x // M a g n e t i c Flux D e n s i t y i n T e s l a B = 3 . 0 0 0 0 0 0 0 0 0 3 3 4 0 7 7 1 E6 a z / x // T o t a l F o r c e a c t i n g on a s q u a r e l o o p i n nN F = 8 . 0 0 0 0 0 0 0 0 0 8 9 0 8 7 3 ax Scilab code Exa 9.2 Program to determine the dierential force between two dierential current elements

1 2 3 4 5 6 7 8 9 10 11 12

// C a p t i o n : Program t o d e t e r m i n e t h e d i f f e r e n t i a l f o r c e b e t w e e n two d i f f e r e n t i a l c u r r e n t e l e m e n t s // Example9 . 2 // p a g e 265 clc ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; // p o s i t i o n o f f i l a m e n t i n c a r t e s i a n c o o r d i n a t e system P1 = [5 ,2 ,1]; P2 = [1 ,8 ,5]; // d i s t a n c e b e t w e e n f i l a m e n t 1 and f i l a m e n t 2 R12 = norm ( P2 - P1 ) ; 36

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

disp ( R12 , R12 = ) I1dL1 = [0 , -3 ,0]; // c u r r e n t c a r r y i n g f i r s t f i l a m e n t 1 I2dL2 = [0 ,0 , -4]; // c u r r e n t c a r r y i n g s e c o n d f i l a m e n t 2 u0 = 4* %pi *1 e -07; // f r e e s p a c e p e r m e a b i l i t y i n H/m aR12 = UnitVector ( P2 - P1 ) ; // u n i t v e c t o r disp ( aR12 , aR12 = ) C1 = cross_product ( I1dL1 , aR12 ) ; C2 = cross_product ( I2dL2 , C1 ) ; dF2 = ( u0 /(4* %pi * R12 ^2) ) * C2 ; dF2_y = float ( dF2 (2) *1 e09 ) ; disp ( dF2_y * ay , t h e d i f f e r e n t i a l f o r c e b e t w e e n two d i f f e r e n t i a l c u r r e n t e l e m e n t s i n nN = ) // R e s u l t // R12 = 8 . 2 4 6 2 1 1 3 // aR12 = 0 . 4 8 5 0 7 1 3 0.7276069 0.4850713 // t h e d i f f e r e n t i a l f o r c e b e t w e e n two d i f f e r e n t i a l c u r r e n t e l e m e n t s i n nN = 8 . 5 6 0 0 8 0 8 7 8 1 0 5 1 4 2 ay Refer to the following Scilab code for UnitVector ARC 27 Refer to the fol-

lowing for cross product ARC 4

Scilab code Exa 9.3 Program to calculate the total torque acting on a planar rectangular current loop
1 2 3 4 5 6 7 8

// C a p t i o n : Program t o c a l c u l a t e t h e t o t a l t o r q u e a c t i n g on a p l a n a r r e c t a n g u l a r c u r r e n t l o o p // Example9 . 3 // p a g e 271 clc ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; x = 1; // l e n g t h i n m e t r e 37

9 y = 2; // w i d e i n m e t r e 10 S = [0 ,0 , x * y ]; // a r e a o f 11 12 13 14 15 16 17

current loop in square metre I = 4e -03; // c u r r e n t i n Amps B = [0 , -0.6 ,0.8]; T = I * cross_product (S , B ) ; Tx = float ( T (1) ) ; disp ( Tx * ax *1 e03 , T o t a l Torque a c t i n g on t h e r e c t a n g u l a r c u r r e n t l o o p i n m i l l i N/m= ) // R e s u l t // T o t a l Torque a c t i n g on t h e r e c t a n g u l a r c u r r e n t l o o p i n m i l l i N/m = 4 . 8 ax

Refer to the following for cross product ARC 4

Scilab code Exa 9.4 Program to nd the torque and force acting on each side of planar loop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// C a p t i o n : Program t o f i n d t h e t o r q u e and f o r c e a c t i n g on e a c h s i d e o f p l a n a r l o o p // Example9 . 4 // p a g e 271 clc ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; I = 4e -03; // c u r r e n t i n Amps B = [0 , -0.6 ,0.8]; // M a g e n t i c F i e l d a c t i n g on c u r r e n t loop in Tesla L1 = [1 ,0 ,0]; // l e n g t h a l o n g xa x i s L2 = [0 ,2 ,0]; // l e n g t h a l o n g ya x i s F1 = I * cross_product ( L1 , B ) ; F3 = - F1 ; F2 = I * cross_product ( L2 , B ) ; F4 = - F2 ; R1 = [0 , -1 ,0]; // d i s t a n c e from c e n t e r o f l o o p f o r side1 38

17 R2 = [0.5 ,0 ,0]; // d i s t a n c e from c e n t e r

of loop for

side2
18 R3 = [0 ,1 ,0]; // d i s t a n c e from c e n t e r

of loop for of loop for

side3
19 R4 = [ -0.5 ,0 ,0]; // d i s t a n c e from c e n t e r 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

side4 T1 = cross_product ( R1 , F1 ) ; T2 = cross_product ( R2 , F2 ) ; T3 = cross_product ( R3 , F3 ) ; T4 = cross_product ( R4 , F4 ) ; T = T1 + T2 + T3 + T4 ; Tx = float ( T (1) *1 e03 ) ; disp ( F1 , F1 = ) disp ( F2 , F2 = ) disp ( F3 , F3 = ) disp ( F4 , F4 = ) disp ( T1 , T1 = ) disp ( T2 , T2 = ) disp ( T3 , T3 = ) disp ( T4 , T4 = ) disp ( Tx * ax , T o t a l t o r q u e a c t i n g on t h e r e c t a n g u l a r p l a n a r l o o p i n m i l l i N/m T = ) // R e s u l t // F1 = // 0. // 0 . 0 0 3 2 // 0 . 0 0 2 4 // F2 = // 0.0064 // 0. // 0. // F3 = // 0. // 0.0032 // 0.0024 // F4 = // 0.0064 // 0. 39

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

// // // // // // // // // // // // // // // // // //

0. T1 = 0.0024 0. 0. T2 = 0. 0. 0. T3 = 0.0024 0. 0. T4 = 0. 0. 0. T o t a l t o r q u e a c t i n g on t h e r e c t a n g u l a r p l a n a r l o o p i n m i l l i N/m T = 4 . 8 ax

Refer to the following for cross product ARC 4

Scilab code Exa 9.5 Program to nd Magnetic Susceptibility, H , Magnetization M


1 2 3 4 5 6 7 8 9 10 11

// C a p t i o n : Program t o f i n d M a g n e t i c S u s c e p t i b i l i t y , H, M a g e n t i z a t i o n M // Example9 . 5 // p a g e 279 clc ; ur = 50; // r e l a t i v e p e r m e a b i l i t y o f f e r r i t e m a t e r i a l u0 = 4* %pi *1 e -07; // f r e e s p a c e p e r m e a b i l i t y i n H/m chim = ur -1; // m a g n e t i c s u s c e p t i b i l i t y B = 0.05; // m a g n e t i c f l u x d e n s i t y i n t e s l a u = u0 * ur ; H = B / u ; // m a g n e t i c f i e l d i n t e n s i t y i n A/m M = chim * ceil ( H ) ; // m a g n e t i z a t i o n i n A/m 40

12 13 14 15 16 17 18

disp ( chim , chim = ) disp (H , H = ) disp (M , M = ) // R e u s l t // chim = 4 9 . //H = 795.77472 //M = 39004. Scilab code Exa 9.6 Program to nd the boundary conditions on magnetic eld

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

// C a p t i o n : Program t o f i n d t h e boundary c o n d i t i o n s on m a g n e t i c f i e l d // Example9 . 6 // p a g e 283 clc ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; u1 = 4e -06; // r e l a t i v e p e r m e a b i l i t y i n medium1 u2 = 7e -06; // r e l a t i v e p e r m e a b i l i t y i n medium2 k = [80 ,0 ,0]; // i n A/m B1 = [2 e -03 , -3 e -03 ,1 e -03]; // f i e l d i n r e g i o n 1 aN12 = [0 ,0 , -1]; //To f i n d Normal Components o f M a g n e t i c F i e l d Bz = dot ( B1 , aN12 ) ; BN1 = [0 ,0 , - Bz ]; BN1 = float ( BN1 ) ; BN2 = float ( BN1 ) ; //To Find t h e T a n g e n t i a l Components o f M a g n e t i c Field Bt1 = float ( B1 - BN1 ) ; Ht1 = float ( Bt1 / u1 ) ; v = cross_product ( aN12 , k ) ; Ht2 = float ( Ht1 -v ) ; Bt2 = float ( u2 * Ht2 ) ; disp ( BN1 (1) * ax + BN1 (2) * ay + BN1 (3) * az , BN1 = ) disp ( BN2 (1) * ax + BN2 (2) * ay + BN2 (3) * az , BN2 = ) 41

26 disp ( Bt1 (1) * ax + Bt1 (2) * ay + Bt1 (3) * az , Bt1 = ) ; 27 disp ( Ht1 (1) * ax + Ht1 (2) * ay + Ht1 (3) * az , Ht1 = ) ; 28 disp ( Ht2 (1) * ax + Ht2 (2) * ay + Ht2 (3) * az , Ht2 = ) ; 29 disp ( Bt2 (1) * ax + Bt2 (2) * ay + Bt2 (3) * az , Bt2 = ) ; 30 // T o t a l M a g n e t i c F i e l d R e g i o n 2 31 B2 = ( BN2 + Bt2 ) *1 e03 ; 32 B2 = B2 (1) * ax + B2 (2) * ay + B2 (3) * az ; 33 disp ( B2 , T o t a l M a g n e t i c F i e l d R e g i o n 2 i n m i l l i 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

Tesla

B2 = ) // R e s u l t // BN1 = // 0 . 0 0 1 a z //BN2 = // 0 . 0 0 1 a z // Bt1 = // 0 . 0 0 2 ax 0 . 0 0 3 ay // Ht1 = // 5 0 0 . 0 ax 7 5 0 . 0 ay // Ht2 = // 5 0 0 . 0 ax 6 7 0 . 0 ay // Bt2 = // 0 . 0 0 3 5 ax 0 . 0 0 4 6 9 ay // T o t a l M a g n e t i c F i e l d R e g i o n 2 i n m i l l i T e s l a B2 = // 1 . 0 az 4.69 ay +3.5 ax Refer to the following for crossproduct ARC 4 Refer to the following for dot

ARC 6

Scilab code Exa 9.7 Program to nd magnetomotive force Vm and reluctance R // C a p t i o n : Program t o f i n d f i n d m a g n e t o m o t i v e f o r c e Vm and r e l u c t a n c e R 2 // Example9 . 7 3 // p a g e 288
1

42

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

clc ; u0 = 4* %pi *1 e -07 ; // f r e e s p a c e p e r m e a b i l i t y i n H/m ur = 1; // r e l a t i v e p e r m e a b i l i t y u = u0 * ur ; dair = 2e -03; // a i r gap i n t o r o i d dsteel = 0.3* %pi ; S = 6e -04; // a r e a o f c r o s s s e c t i o n i n s q u a r e m e t r e B = 1; // f l u x d e n s i t y 1 t e s l a N = 500; // number o f t u r n s Rair = dair /( u * S ) ; disp ( Rair , R e l u c t a n c e i n A . t /Wb R a i r = ) phi = B * S ; disp ( phi , M a g n e t i c Flux i n weber p h i = ) Vm_air = S * Rair ; disp ( Vm_air , mmf r e q u i r e d f o r t h e a i r gap i n A . t Vm air = ) Hsteel = 200; // m a g n e t i c f i e l d i n t e n s i t y o f s t e e l i n A/m Vm_steel = Hsteel * dsteel ; disp ( Vm_steel , mmf r e q u i r e d f o r t h e s t e e l i n A . t Vm steel = ) disp ( Vm_steel + Vm_air , T o t l a mmf r e q u i r e d f o r t o r o i d i n A . t Vm = ) I = ( Vm_steel + Vm_air ) / N ; disp (I , T o t a l c o i l c u r r e n t i n Amps I = ) // R e s u l t // R e l u c t a n c e i n A . t /Wb R a i r = 2 6 5 2 5 8 2 . 4 // M a g n e t i c Flux i n weber p h i = 0 . 0 0 0 6 //mmf r e q u i r e d f o r t h e a i r gap i n A . t Vm air = 1591.5494 //mmf r e q u i r e d f o r t h e s t e e l i n A . t V m s t e e l = 188.49556 // T o t l a mmf r e q u i r e d f o r t o r o i d i n A . t Vm = 1780.045 // T o t a l c o i l c u r r e n t i n Amps I = 3.56009 Scilab code Exa 9.8 Program to nd total Magnetic Flux Density in Weber 43

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// C a p t i o n : Program t o f i n d t o t a l M a g n e t i c Flux D e n s i t y i n Weber // Example9 . 8 // p a g e 289 clc ; I = 4; // c u r r e n t t h r o u g h t o r o i d i n Amps r = 1e -03; // a i r gap r a d i u s i n m e t r e Hphi = I /(2* %pi * r ) ; u0 = 4* %pi *1 e -07 ; // f r e e s p a c e p e r m e a b i l i t y i n H/m ur = 1; // r e l a t i v e p e r m e a b i l i t y u = u0 * ur ; N = 500; // number o f t u r n s S = 6e -04; // c r o s s s e c t i o n a r e a i n s q u a r e m e t r e Rair = 2.65 e06 ; // r e l u c t a n c e i n a i r A . t /Wb Rsteel = 0.314 e06 ; // r e l u c t a n c e i n s t e e l A . t /Wb R = Rair + Rsteel ; // t o t a l r e l u c t a n c e i n A . t /Wb Vm = I *500; // t o t a l mmf i n A . t phi = Vm / R ; // t o t a l f l u x i n w e b e r s B = phi / S ; // f l u x d e n s i t y i n Wb/ S q u a r e m e t r e disp (B , M a g e n t i c Flux D e n s i t y i n t e s l a B = ) // R e s u l t // M a g e n t i c Flux D e n s i t y i n t e s l a B = 1 . 1 2 4 6 0 6 4 Scilab code Exa 9.9 Program to calculate self inductances and Mutual Inductances between two coaxial solenoids

1 2 3 4 5 6 7 8 9 10 11

// C a p t i o n : Program t o c a l c u l a t e s e l f i n d u c t a n c e s and Mutual I n d u c t a n c e s b e t w e e n two c o a i x a l s o l e n o i d s // Example9 . 9 // p a g e 297 clc ; n1 = sym ( n1 ) ; n2 = sym ( n2 ) ; I1 = sym ( I 1 ) ; I2 = sym ( I 2 ) ; az = sym ( a z ) ; R1 = sym ( R1 ) ; R2 = sym ( R2 ) ; 44

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

u0 = sym ( u0 ) ; H1 = n1 * I1 * az ; disp ( H1 , H1 = ) ; H2 = n2 * I2 * az ; disp ( H2 , H2 = ) ; S1 = float ( %pi * R1 ^2) ; S2 = float ( %pi * R2 ^2) ; Hz = float ( H1 / az ) ; phi12 = float ( u0 * Hz * S1 ) ; disp ( phi12 , p h i 1 2 = ) M12 = n2 * phi12 / I1 ; disp ( M12 , M12 = ) //R1 = 2 e 02; //R2 = 3 e 02; // n1 = 5 0 1 0 0 ; // number o f t u r n s /m // n2 = 8 0 1 0 0 ; // number o f t u r n s /m // u0 = 4 %pi 1 e 07; M12 = float ( limit ( M12 , R1 ,2 e -02) ) ; M12 = float ( limit ( M12 , R2 ,3 e -02) ) ; M12 = float ( limit ( M12 , n1 ,5000) ) ; M12 = float ( limit ( M12 , n2 ,8000) ) ; M12 = float ( limit ( M12 , u0 ,4* %pi *1 e -07) ) ; disp ( M12 *1 e03 , Mutual I n d u c t a n c e i n mH/m M12= ) L1 = u0 * n1 ^2* S1 ; L1 = float ( limit ( L1 , u0 ,4* %pi *1 e -07) ) ; L1 = float ( limit ( L1 , n1 ,5000) ) ; L1 = float ( limit ( L1 , R1 ,2 e -02) ) ; disp ( L1 *1 e3 , S e l f I n d u c t a n c e o f s o l e n o i d 1 i n mH/m L1 = ) L2 = u0 * n2 ^2* S2 ; L2 = float ( limit ( L2 , u0 ,4* %pi *1 e -07) ) ; L2 = float ( limit ( L2 , n2 ,8000) ) ; L2 = float ( limit ( L2 , R2 ,3 e -02) ) ; disp ( L2 *1 e3 , S e l f I n d u c t a n c e o f s o l e n o i d 1 i n mH/m L2 = ) // R e s u l t // H1 = a z n1 I 1 // H2 = a z n2 I 2 45

phi12 = 3 . 1 4 1 5 9 2 6 5 3 0 1 1 9 0 3 n1 u0 I 1 R12 M12 = 3 . 1 4 1 5 9 2 6 5 3 0 1 1 9 0 3 n1 n2 u0 R12 Mutual I n d u c t a n c e i n mH/m M12= 63.16546815077 S e l f I n d u c t a n c e o f s o l e n o i d 1 i n mH/m L1 = 39.47841759423 52 // S e l f I n d u c t a n c e o f s o l e n o i d 1 i n mH/m L2 = 227.39568534276
48 49 50 51

// // // //

46

Chapter 11 Transmission Lines


Scilab code Exa 11.1 Program to determine the total voltage as a function of time and position in a loss less transmission line
1 2 3 4 5 6 7 8 9 10

// C a p t i o n : Program t o d e t e r m i n e t h e t o t a l v o l t a g e a s a function // o f t i m e and p o s i t i o n i n a l o s s l e s s t r a n s m i s s o n line // Example11 . 1 // p a g e 3 4 2 // syms z , t , B , w , Vo ; VST = sym ( 2Vo c o s (B z ) ) ; V_zt = VST * sym ( c o s (w t ) ) ; disp ( V_zt , V( z , t )= ) // R e s u l t //V( z , t )= 2Vo c o s ( t w) c o s ( z B) Scilab code Exa 11.2 Program to nd the characteristic impedance, the phase constant an the phase velocity

// C a p t i o n : Program t o f i n d t h e c h a r a c t e r i s t i c impedance , t h e p h a s e c o n s t a n t an t h e p h a s e velocity 2 // Example11 . 2 3 // p a g e 3 4 4 4 clear ;


1

47

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

clc ; close ; L = 0.25 e -6; // 0 . 2 5 uH/m C = 100 e -12; // 100 pF/m f = 600 e06 ; // f r e q u e n c y f = 100MHz W = 2* %pi * f ; // a n g u l a r f r e q u e n c y Zo = sqrt ( L / C ) ; B = W * sqrt ( L * C ) ; Vp = W / B ; disp ( Zo , C h a r a c t e r i s t i c Impedance i n ohms Zo = ) disp (B , Phase c o n s t a n t i n r a d /m B= ) disp ( Vp , Phase v e l o c i t y i n m/ s Vp= ) // R e s u l t // C h a r a c t e r i s t i c Impedance i n ohms Zo = // 50. // Phase c o n s t a n t i n r a d /m B= // 18.849556 // Phase v e l o c i t y i n m/ s Vp= // 2 . 0 0 0D+08 Scilab code Exa 11.3 Program to nd the magnitude and phase of characteristic impedance Zo

1 2 3 4 5 6 7 8 9 10 11 12 13

// C a p t i o n : Program t o f i n d t h e m a g n i t u d e and p h a s e o f characteristic // i m p e d a n c e Zo // Example11 . 3 // p a g e 3 4 7 Zo = sym ( s q r t ( L/C) (1 s q r t ( 1) R/ ( 2 WL ) ) ) ; teta = sym ( a t a n (R/ ( 2 WL ) ) ) ; disp ( Zo , C h a r a c t e r i s t i c i m p e d a n c e Zo = ) disp ( teta , The p h a s e a n g l e t e t a= ) // R e s u l t // C h a r a c t e r i s t i c i m p e d a n c e Zo = // s q r t ( L/C) (1 %i R/ ( 2 LW) ) // The p h a s e a n g l e t e t a= // a t a n (R/ ( 2 LW) )

48

Scilab code Exa 11.4 Program to nd the output power and attenuation coecient
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

// C a p t i o n : Program t o f i n d t h e o u t p u t power and attenuation c o e f f i c i e n t // Example11 . 4 // p a g e 3 4 9 clear ; clc ; close ; z = 20; // d i s t a n c e i n m e t e r s Pz_P0_dB = -2; // f r a c t i o n o f power d r o p i n dB Pz_P0 = 10^( Pz_P0_dB /10) ; disp ( Pz_P0 , F r a c t i o n o f i n p u t power r e a c h e s o u t p u t P ( z ) /P ( 0 )= ) P0_mid_dB = -1; // f r a c t i o n o f power d r o p a t m i d p o i n t i n dB P0_mid = 10^( P0_mid_dB /10) ; disp ( P0_mid , F r a c t i o n o f t h e i n p u t power r e a c h e s t h e m i d p o i n t P ( 1 0 ) /P ( 0 )= ) alpha = - Pz_P0_dB /(8.69* z ) ; disp ( alpha , a t t e n u a t i o n i n Np/m a l p h a= ) // R e s u l t // F r a c t i o n o f i n p u t power r e a c h e s o u t p u t P( z ) /P ( 0 )= // 0.6309573 // F r a c t i o n o f t h e i n p u t power r e a c h e s t h e m i d p o i n t P ( 1 0 ) /P ( 0 )= // 0.7943282 // a t t e n u a t i o n i n Np/m a l p h a= // 0.0115075 Scilab code Exa 11.5 Program to nd the power dissipated in the lossless transmission line

// C a p t i o n : Program t o f i n d t h e power d i s s i p a t e d i n the l o s s l e s s 2 // t r a n s m i s s i o n l i n e 3 // Example11 . 5


1

49

4 5 6 7 8 9 10 11 12 13

// p a g e 3 5 2 clc ; close ; ZL = 50 - %i *75; // l o a d i m p e d a n c e i n ohms Zo = 50; // c h a r a c t e r i s t i c i m p e d a n c e i n ohms R = reflection_coeff ( ZL , Zo ) ; Pi = 100 e -03; // i n p u t power i n m i l l i w a t t s Pt = (1 - abs ( R ) ^2) * Pi ; // power d i s s i p a t e d by t h e l o a d disp (R , R e f l e c t i o n c o e f f i c i e n t R = ) disp ( Pt *1000 , power d i s s i p a t e d by t h e l o a d i n m i l l i w a t s s Pt= ) 14 // R e s u l t 15 // R e f l e c t i o n c o e f f i c i e n t R = 0.36 0.48 i 16 // power d i s s i p a t e d by t h e l o a d i n m i l l i w a t s s Pt = 64. Refer to the following for reection coe ARC 23

Scilab code Exa 11.6 Program to nd the total loss in lossy lines
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// C a p t i o n : Program t o f i n d t h e t o t a l l o s s i n l o s s y lines // Example11 . 6 // page352 353 clc ; close ; L1 = 0.2*10; // l o s s ( dB ) i n f i r s t l i n e o f l e n g t h =10 m L2 = 0.1*15; // l o s s ( dB ) i n s e c o n d l i n e o f l e n g t h =15m R = 0.3; // r e f l e c t i o n c o e f f i c i e n t Pi = 100 e -03; // i n p u t power i n m i l l i w a t t s Lj = 10* log10 (1/(1 - abs ( R ) ^2) ) ; Lt = L1 + L2 + Lj ; Pout = Pi *(10^( - Lt /10) ) ; disp ( Lt , The t o t a l l o s s o f t h e l i n k i n dB i s Lt= ) disp ( Pout *1000 , The o u t p u t power w i l l be i n m i l l i w a t s s Pout = ) // R e s u l t 50

16 17 18 19

// The t o t a l l o s s o f t h e l i n k i n dB i s Lt= // 3.9095861 // The o u t p u t power w i l l be i n m i l l i w a t s s Pout = // 40.648207 Scilab code Exa 11.7 Program to nd the load impedance of a slotted line

1 2 3 4 5 6 7 8 9 10 11 12 13

// C a p t i o n : Program t o f i n d t h e l o a d i m p e d a n c e o f a slotted line // Example11 . 7 // p a g e 3 5 7 clear ; clc ; close ; S = 5; // s t a n d i n g wave r a t i o T = (1 - S ) /(1+ S ) ; // r e f l e c t i o n c o e f f i c i e n t Zo = 50; // c h a r a c t e r i s t i c i m p e d a n c e ZL = Zo *(1+ T ) /(1 - T ) ; disp ( ZL , Load i m p e d a n c e o f a s l o t t e d l i n e i n ohms ZL =) // R e s u l t // Load i m p e d a n c e o f a s l o t t e d l i n e i n ohms ZL = 1 0 . Scilab code Exa 11.8 Program to nd the input impedance and power delivered to the load

1 2 3 4 5 6 7 8 9 10 11

// C a p t i o n : Program t o f i n d t h e i n p u t i m p e d a n c e and power d e l i v e r e d t o // t h e l o a d // Example11 . 8 // p a g e 3 6 3 clc ; close ; ZR1 = 300; // i n p u t i m p e d a n c e o f f i r s t r e c e i v e r ZR2 = 300; // i n p u t i m p e d a n c e o f s e c o n d r e c e i v e r Zo = ZR1 ; // c h a r a c t e r i s t i c i m p e d a n c e = 300 ohm Zc = - %i *300; // c a p a c i t i v e i m p e d a n c e L = 80 e -02; // l e n g t h = 80 cm 51

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

Lambda = 1; // w a v e l e n g t h = 1m Vth = 60; // v o l t a g e 300 v o l t s Zth = Zo ; ZL1 = parallel ( ZR1 , ZR2 ) ; ZL = parallel ( ZL1 , Zc ) ; // n e t l o a d impedane T = reflection_coeff ( ZL , ZR2 ) ; // r e f l e c t i o n coefficient [R , teta1 ] = polar ( T ) ; // r e f l e c t i o n c o e f f i c i e n t i n p o l a r form teta1 = real ( teta1 ) *57.3; // t e t a v a l u e i n d e g r e e s S = VSWR ( R ) ; // v o l t a g e s t a n d i n g wave r a t i o EL = electrical_length (L , Lambda ) ; EL = EL /57.3; // e l e c t r i c a l l e n g t h i n d e g r e e s Zin = Zo *( ZL * cos ( EL ) + %i * Zo * sin ( EL ) ) /( Zo * cos ( EL ) + %i * ZL * sin ( EL ) ) ; disp ( Zin , I n p u t Impedance i n ohms Z i n = ) Is = Vth /( Zth + Zin ) ; // s o u r c e c u r r e n t i n amps [ Is , teta2 ] = polar ( Is ) ; // s o u r c e c u r r e n t i n p o l a r form Pin = (1/2) *( Is ^2) * real ( Zin ) ; PL = Pin ; // f o r l o s s l e s s l i n e disp ( Pin , Power d e l i v e r e d t o a l o s s l e s s l i n e i n w a t s s PL = ) // R e s u l t // I n p u t Impedance i n ohms Z i n = 755.49551 138.46477 i // Power d e l i v e r e d t o a l o s s l e s s l i n e i n w a t s s PL = 1.2 Refer to the following for electrical length ARC 7

Refer to the following for parallel ARC 15

Refer to the following for reection coe ARC 23

52

Refer to the scilab code for VSWR ??ARC 28)

Scilab code Exa 11.9 Program to nd the input impedance for a line terminated with pure capacitive impedance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

// C a p t i o n : Program t o f i n d t h e i n p u t i m p e d a n c e f o r a l i n e t e r m i n a t e d with pure c a p a c i t i v e impedance // Example11 . 9 // p a g e 3 6 3 clc ; close ; ZL = - %i *300; // l o a d impdance i s p u r e l y c a p a c i t i v e impedance ZR = 300; T = reflection_coeff ( ZL , ZR ) ; // r e f l e c t i o n c o e f f i c i e n t i n r e c t a n d u l a r form [R , teta ] = polar ( T ) ; // r e f l e c t i o n c o e f f i c i e n t i n p o l a r form S = VSWR ( R ) if ( S == %inf ) Zo = ZR ; end Zin = Zo *( ZL * cos ( EL ) + %i * Zo * sin ( EL ) ) /( Zo * cos ( EL ) + %i * ZL * sin ( EL ) ) ; disp (T , R e f l e c t i o n c o e f f i c i e n t i n r e c t a n g u l a r form ) disp (S , V o l t a g e S t a n d i n g Wave R a t i o S= ) disp ( Zin , I n p u t i m p e d a n c e i n ohms Z i n = ) // R e s u l t // R e f l e c t i o n c o e f f i c i e n t i n r e c t a n g u l a r form // i // V o l t a g e S t a n d i n g Wave R a t i o S= // Inf // I n p u t i m p e d a n c e i n ohms Z i n = // 588.78315 i Refer to the scilab code for VSWR ??ARC 28)

53

Refer to the following for reection coe ARC 23

Scilab code Exa 11.10 Program to nd the input impedance for a line terminated with impedance (with inductive reactance)
1

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// C a p t i o n : Program t o f i n d t h e i n p u t i m p e d a n c e f o r a l i n e t e r m i n a t e d with impedance ( with i n d u c t i v e reactance ) // Example11 . 1 0 // p a g e 3 6 9 clc ; close ; ZL = 25+ %i *50; // l o a d impdance i n ohms Zo = 50; // c h a r a c t e r i s t i c i m p e d a n c e i n ohms T = reflection_coeff ( ZL , Zo ) ; // r e f l e c t i o n c o e f f i c i e n t i n r e c t a n d u l a r form [R , teta ] = polar ( T ) ; // r e f l e c t i o n c o e f f i c i e n t i n p o l a r form L = 60 e -02; // l e n g t h 60 cm Lambda = 2; // w a v e l e n g t h = 2m EL = electrical_length (L , Lambda ) ; EL = EL /57.3; // e l e c t r i c a l l e n g t h i n r a d i a n s Zin =(1+ T * exp ( - %i *2* EL ) ) /(1 - T * exp ( - %i *2* EL ) ) ; disp ( Zin , I n p u t i m p e d a n c e i n ohms Z i n = ) // R e s u l t // I n p u t i m p e d a n c e i n ohms Z i n = // 0.2756473 0.4055013 i Refer to the following for electrical length ARC 7 Refer to the following for

reection coe ARC 23

Scilab code Exa 11.11 Program to nd the voltage at the load resistor and the current in the battery 54

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

// C a p t i o n : // Example11 . 1 1 // p a g e 3 8 1 clc ; close ; Rg = 50; // s e r i e s r e s i s t a n c e w i t h b a t t e r y i n ohms Zo = Rg ; // c h a r a c t e r i s t i c i m p e d a n c e RL = 25; // l o a d r e s i s t a n c e Vo = 10; // b a t t e r y v o l t a g e i n v o l t s V1_S = ( Rg /( Zo + Rg ) ) * Vo ; T = reflection_coeff ( RL , Zo ) ; V1_R = T * V1_S ; I1_S = V1_S / Zo ; I1_R = - V1_R / Zo ; IB = Vo /( Zo + RL ) ; VL = Vo *( RL /( Rg + RL ) ) ; disp ( V1_S , V o l t a g e a t s o u r c e i n v o l t s V 1 p l u s = ) disp ( V1_R , V o l t a g e r e t u r n s t o b a t t e r y i n v o l t s V1minus= ) disp ( I1_S , C u r r e n t a t b a t t e r y i n amps I 1 p l u s= ) disp ( I1_R , C u r r e n t a t b a t t e r y i n amps I 1 m i n u s= ) disp ( IB , S t e a d y s t a t e c u r r e n t t h r o u g h b a t t e r y i n amps IB= ) disp ( VL , S t e a d y s t a t e l o a d v o l t a g e i n v o l t s VL= ) // R e s u l t // V o l t a g e a t s o u r c e i n v o l t s V 1 p l u s = // 5. // V o l t a g e r e t u r n s t o b a t t e r y i n v o l t s V1minus= // 1 . 6 6 6 6 6 6 7 // C u r r e n t a t b a t t e r y i n amps I 1 p l u s= // 0.1 // C u r r e n t a t b a t t e r y i n amps I 1 m i n u s= // 0.0333333 // S t e a d y s t a t e c u r r e n t t h r o u g h b a t t e r y i n amps IB= // 0.1333333 // S t e a d y s t a t e l o a d v o l t a g e i n v o l t s VL= // 3.3333333

55

Refer to the following for reection coe ARC 23

Scilab code Exa 11.12 Program to plot the voltage and current through a resistor
1 2 3 4 5 6 7 8 9 10 11 12

13 14 15 16 17 18 19

// C a p t i o n : Program t o p l o t t h e v o l t a g e and c u r r e n t through a r e s i s t o r // Example11 . 1 2 // p a g e 386 clear ; close ; clc ; t1 = 0:0.1:2; t2 = 2:0.1:4; t3 = 4:0.1:6; t4 = 6:0.1:8; VR =[40* ones (1 , length ( t1 ) ) , -20* ones (1 , length ( t2 ) ) ,10* ones (1 , length ( t3 ) ) , -5* ones (1 , length ( t4 ) ) ]; IR =[ -1.2* ones (1 , length ( t1 ) ) ,0.6* ones (1 , length ( t2 ) ) , -0.3* ones (1 , length ( t3 ) ) ,0.15* ones (1 , length ( t4 ) ) ]; subplot (2 ,1 ,1) a = gca () ; a . x_location = o r i g i n ; a . y_location = o r i g i n ; a . data_bounds = [0 , -100;10 ,100]; plot2d ([ t1 , t2 , t3 , t4 ] , VR ,5) xlabel ( t ) ylabel ( VR ) title ( R e s i s t o r V o l t a g e a s a f u n c t i o n o f t i m e ) subplot (2 ,1 ,2) a = gca () ; a . x_location = o r i g i n ; a . y_location = o r i g i n ; 56

20 21 22 23 24 25

Figure 11.1: To be provided


26 a . data_bounds = [0 , -1.4;10 ,1.4]; 27 plot2d ([ t1 , t2 , t3 , t4 ] , IR ,5) 28 xlabel (

29 30

t ) ylabel ( IR ) title ( C u r r e n t t h r o u g h R e s i s t o r a s a f u n c t i o n o f time )

57

Chapter 12 The Uniform Plane Wave


Scilab code Exa 12.1 Program to determine the phasor of forward propagating eld
1 2 3 4 5 6 7 8 9 10 11 12

// C a p t i o n : Program t o d e t e r m i n e t h e p h a s o r o f f o r w a r d propagating f i e l d // Example12 . 1 // p a g e 4 0 0 clc ; close ; Eyzt = sym ( 1 00 exp ( %i 1 0 8 t%i 0 . 5 z +30) ) ; Eysz = sym ( 1 00 exp ( %i 1 0 8 t%i 0 . 5 z +30) exp (%i 108 t ) ); disp ( Eyzt ) disp ( Eysz , Forward P r o p a g a t i n g F i e l d i n p h a s o r form =) // R e s u l t // 100 exp ( 0.5 %i z +100000000 %i t +30) // Forward P r o p a g a t i n g F i e l d i n p h a s o r form =100 exp ( 3 0 0 . 5 %i z ) Scilab code Exa 12.2 Program to determine the instantaneous eld of a plane wave

// C a p t i o n : Program t o d e t e r m i n e t h e i n s t a n t e o u s f i e l d o f a wave 58

2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example12 . 2 // page400 401 clc ; t = sym ( t ) ; z = sym ( z ) ; Ezt1 = sym ( 1 00 c o s ( 0 . 2 1 z +2%pi 1 e 0 7 t ) ) ; Ezt2 = sym ( 20 c o s ( 0 . 2 1 z +30+2%pi 1 e 0 7 t ) ) ; ax = sym ( ax ) ; ay = sym ( ay ) ; Ezt = Ezt1 * ax + Ezt2 * ay ; disp ( Ezt , The r e a l i n s t a n t a n e o u s f i e l d Ezt = ) // R e s u l t // The r e a l i n s t a n t a n e o u s f i e l d Ezt = // 100 ax c o s ( 0 . 2 1 z 2.0E+7%pi t ) +20 ay c o s ( 0 . 2 1 z 2.0E+7%pi t 30) 16 // Scilab code Exa 12.3 Program to nd the Phase constant, Phase velocity, Electric Field Intensity and Intrinsic ratio
1

2 3 4 5 6 7 8 9 10 11 12 13 14 15

// C a p t i o n : Program t o f i n d t h e Phase c o n s t a n t , Phase v e l o c i t y , E l e c t r i c F i e l d I n t e n s i t y and I n t r i n s c i ratio . // Example12 . 3 // p a g e 4 0 8 clc ; syms t ; z = %z ; [ uo , eo ] = muo_epsilon () ; ur = 1; f = 10^6; er1 = 81; er2 =0; etta0 = 377; Ex0 = 0.1; beta1 = phase_constant_dielectric ( uo , eo ,f , er1 , er2 , ur ); disp ( beta1 , p h a s e c o n s t a n t i n r a d /m b e t a= ) 59

16 Lambda = 2* %pi / beta1 ; 17 Vp = phase_velocity (f , beta1 ) ; 18 disp ( Vp , Phase v e l o c i t y i n m/ s e c ) 19 etta = intrinsic_dielectric ( etta0 , er1 , er2 ) 20 disp ( etta , I n t r i n s i c i m p e d a n c e i n ohms = ) 21 Ex = 0.1* cos (2* %pi * f *t - beta1 * z ) 22 disp ( Ex , E l e c t r i c f i e l d i n V/m Ex= ) 23 Hy = Ex / etta ; 24 disp ( Hy , M a g n e t i c F i e l d i n A/m Hy= ) 25 // R e s u l t 26 // p h a s e c o n s t a n t i n r a d /m b e t a= 0.1886241 27 // Phase v e l o c i t y i n m/ s e c = 33310626. 28 // I n t r i n s i c i m p e d a n c e i n ohms = 41.888889 29 // E l e c t r i c f i e l d i n V/m Ex= cos (58342 z

/309303 81681409 t / 1 3 ) /10 30 // e q u i v a l e n t t o Ex = 0 . 1 c o s ( 0 . 1 9 z 6 2 8 3 1 8 5 . 3 t ) 31 // M a g n e t i c F i e l d i n A/m Hy = 9 c o s ( 5 8 3 4 2 z /309303 81681409 t / 1 3 ) / 3 7 7 0 32 // e q u i v a l e n t t o Hy = 0 . 0 0 2 3 8 7 3 c o s ( 0 . 1 9 z 6 2 8 3 1 8 5 . 3 t) Refer to the following for intrinsic dielectric ARC 11

Refer to the following for intrinsi dielectric ARC 11 Refer to the following

for mu epsilon ARC 13

Refer to the following for phase constant dielectric ARC 17

Refer to the following for phase velocity ARC 19

Scilab code Exa 12.4 Program to nd the penetration depth and intrinsic impedance 60

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// C a p t i o n : Program t o f i n d t h e p e n e t r a t i o n d e p t h and i n t r i n s i c impedance // Example12 . 4 // p a g e 4 0 9 clc ; f = 2.5 e09 ; // h i g h m i c r o w a v e f r e q u e n c y = 2 . 5 GHz er1 = 78; // r e l a t i v e p e r m i t t i v i t y er2 = 7; C = 3 e08 ; // f r e e s p a c e v e l o c i t y i n m/ s e c [ uo , eo ] = muo_epsilon () ; // f r e e s p a c e p e r m i t t i v i t y and p e r m e a b i l i t y ur = 1; // r e l a t i v e p e r m e a b i l i t y etta0 = 377; // f r e e s p a c e i n t r i n s i c i m e d a n c e i n ohms alpha = attenuation_constant_dielectric ( uo , eo ,f , er1 , er2 , ur ) ; etta = intrinsic_dielectric ( etta0 , er1 , er2 ) ; disp ( alpha , a t t e n u a t i o n c o n s t a n t i n Np/m a l p h a= ) disp ( etta , I n t r i n s i c c o n s t a n t i n ohms e t t a= ) // R e s u l t // a t t e n u a t i o n c o n s t a n t i n Np/m a l p h a= 20.727602 // I n t r i n s i c c o n s t a n t i n ohms e t t a= 42.558673 + 1.9058543 i Refer to the following for attenuation constant gooddie ARC 1

Refer to the following for intrinsic dielectric ARC 11

Refer to the following for mu epsilon ARC 13

Scilab code Exa 12.5 Program to nd the attenuation constant, propagation constant and intrinsic impedance // C a p t i o n : Program t o f i n d t h e a t t e n u a t i o n c o n s t a n t , p r o p a g a t i o n c o n s t a n t and i n t r i n s i c i m p e d a n c e 2 // Example12 . 5
1

61

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

// p a g e 4 1 2 clc ; f = 2.5 e09 ; // h i g h m i c r o w a v e f r e q u e n c y = 2 . 5 GHz er1 = 78; // r e l a t i v e p e r m i t t i v i t y er2 = 7; C = 3 e08 ; // f r e e s p a c e v e l o c i t y i n m/ s e c [ uo , eo ] = muo_epsilon () ; // f r e e s p a c e p e r m i t t i v i t y and p e r m e a b i l i t y ur = 1; // r e l a t i v e p e r m e a b i l i t y etta0 = 377; // f r e e s p a c e i n t r i n s i c i m e d a n c e i n ohms alpha = attenuation_constant_gooddie ( uo , eo ,f , er1 , er2 , ur ) ; etta = intrinsic_good_dielectric ( etta0 , er1 , er2 ) ; beta1 = phase_constant_gooddie ( uo , eo ,f , er1 , er2 , ur ) ; disp ( alpha , a t t e n u a t i o n c o n s t a n t p e r cm a l p h a= ) disp ( beta1 , p h a s e c o n s t a n t i n r a d /m b e t a 1 = ) disp ( etta , I n t r i n s i c c o n s t a n t i n ohms e t t a= ) // R e s u l t // a t t e n u a t i o n c o n s t a n t p e r cm a l p h a= // 20.748417 // p h a s e c o n s t a n t i n r a d /m b e t a 1 = // 462.3933 // I n t r i n s i c c o n s t a n t i n ohms e t t a= // 42.558673 + 1.9058543 i Refer to the following for attenuation constant gooddie ARC 1

Refer to the following for intrinsic good dielectric ARC 12

Refer to the following for mu epsilon ARC 13 Refer to the following for

phase constant gooddie ARC 18

62

Scilab code Exa 12.6 Program to nd skin depth, loss tangent and phase velocity
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

// C a p t i o n : Program t o f i n d s k i n depth , l o s s t a n g e n t and p h a s e v e l o c i t y // Example12 . 6 // p a g e 4 1 9 clc ; f1 = 1 e06 ; // f r e q u e n c y i n Hz // e r 1 = 8 1 ; ur = 1; [ uo , eo ] = muo_epsilon () ; // f r e e s p a c e p e r m i t t i v i t y and p e r m e a b i l i t y sigma = 4; // c o n d u c t i v i t y o f a c o n d u c t o r i n s /m [ del ] = SkinDepth ( f1 , uo , ur , sigma ) ; pi = 22/7; Lambda = 2* pi * del ; Vp = 2* pi * f1 * del ; disp ( del *100 , s k i n d e p t h i n cm d e l t a = ) disp ( Lambda , Wavelength i n m e t r e Lambda = ) disp ( Vp , Phase v e l o c i t y i n m/ s e c Vp = ) // R e s u l t // s k i n d e p t h i n cm d e l t a = // 25.17737 // Wavelength i n m e t r e Lambda = // 1.5825775 // Phase v e l o c i t y i n m/ s e c Vp = // 1582577.5 Refer to the following for mu epsilon ARC 13 Refer to the following Scilab

code for SkinDepth ARC 24

Scilab code Exa 12.7 Program to nd the electric eld of linearly polarized wave

63

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// clc ; s = sym ( s ) ; B = sym ( B ) ; Eo = sym ( Eo ) ; z = sym ( z ) ; ax = sym ( ax ) ; EsL = Eo *( ax + %i * ay ) * exp ( %i * s ) * exp ( - %i * B * z ) ; EsR = Eo *( ax - %i * ay ) * exp ( - %i * B * z ) ; Est = Eo * exp ( %i * s /2) *(2* cos ( s /2) * ax - %i *2* %i * sin ( s /2) * ay ) * exp ( - %i * B * z ) ; disp ( EsL , L e f t c i r c u l a r l y p o l a r i z e d f i e l d EsL= ) disp ( EsR , R i g h t c i r c u l a r l y p o l a r i z e d f i e l d EsR= ) disp ( Est , T o t a l E l e c e t r i c f i e l d o f a l i n e a r l y p o l a r i z e d wave EsT = ) // R e s u l t // L e f t c i r c u l a r l y p o l a r i z e d f i e l d EsL= // ( %i ay+ax ) Eo exp ( %i s%i z B) // R i g h t c i r c u l a r l y p o l a r i z e d f i e l d EsR= // ( ax%i ay ) Eo%e(%i z B) // T o t a l E l e c e t r i c f i e l d o f a l i n e a r l y p o l a r i z e d wave EsT = // Eo ( 2 ay s i n ( s / 2 ) +2 ax c o s ( s / 2 ) ) exp ( %i s /2%i z B)

64

Chapter 13 Plane Wave Reection and Dispersion


Scilab code Exa 13.1 Program to nd the electric eld of incident, reected and transmitted waves
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// C a p t i o n : Program t o f i n i d t h e e l e c t r i c f i e l d o f i n c i d e n t , r e f l e c t e d and t r a n s m i t t e d waves // Example13 . 1 // p a g e 4 3 9 etta1 = 100; etta2 = 300; // i n t r i n s i c i m p e d a n c e i n ohms T = reflection_coefficient ( etta1 , etta2 ) ; Ex10_i = 100; // i n c i d e n t e l e c t r i c f i e l d i n v /m Ex10_r = T * Ex10_i ; // r e f l e c t e d e l e c t r i c f i e l d i n v /m Hy10_i = Ex10_i / etta1 ; // i n c i d e n t m a g n e t i c f i e l d A/m Hy10_r = - Ex10_r / etta1 ; // r e f l e c t e d m a g n e t i c f i e l d A /m Si = (1/2) * Ex10_i * Hy10_i ; // a v e r a g e i n c i d e n t power d e n s i t y i n W/ s q u a r e m e t r e Sr = -(1/2) * Ex10_r * Hy10_r ; // a v e r a g e r e f l e c t e d power d e n s t i y i n W/ s q u a r e m e t r e tuo = 1+ T ; // t r a n s m i s s i o n c o e f f i c i e n t Ex20_t = tuo * Ex10_i ; // t r a n s m i t t e d e l e c t r i c f i e l d v / m Hy20_t = Ex20_t / etta2 ; // t r a n s m i t t e d m a g n e t i c f i e l d 65

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

A/m St = (1/2) * Ex20_t * Hy20_t ; // a v e r a g e power d e n s i t y transmitted disp (T , r e f l e c t i o n c o e f f i c i e n t t = ) ; disp ( Ex10_i , i n c i d e n t e l e c t r i c f i e l d i n v /m E x 1 0 i = ) disp ( Ex10_r , r e f l e c t e d e l e c t r i c f i e l d i n v /m E x 1 0 r =) disp ( Hy10_i , i n c i d e n t m a g n e t i c f i e l d A/m H y 1 0 i = ) disp ( Hy10_r , r e f l e c t e d m a g n e t i c f i e l d A/m H y 1 0 r= ) disp ( Si , a v e r a g e i n c i d e n t power d e n s i t y i n W/ s q u a r e m e t r e S i= ) disp ( Sr , a v e r a g e r e f l e c t e d power d e n s t i y i n W/ s q u a r e m e t r e S r= ) disp ( St , a v e r a g e power d e n s i t y t r a n s m i t t e d i n W/ s q u a r e m e t r e S t= ) // R e s u l t // r e f l e c t i o n c o e f f i c i e n t t = 0.5 100. // i n c i d e n t e l e c t r i c f i e l d i n v /m E x 1 0 i = // r e f l e c t e d e l e c t r i c f i e l d i n v /m E x 1 0 r = 50. 1. // i n c i d e n t m a g n e t i c f i e l d A/m H y 1 0 i = 0.5 // r e f l e c t e d m a g n e t i c f i e l d A/m H y 1 0 r= // a v e r a g e i n c i d e n t power d e n s i t y i n W/ s q u a r e m e t r e S i= 50. // a v e r a g e r e f l e c t e d power d e n s t i y i n W/ s q u a r e m e t r e S r= 1 2 . 5 // a v e r a g e power d e n s i t y t r a n s m i t t e d i n W/ s q u a r e m e t r e S t= 37.5 Refer to the following for reection coecient ARC 22 Refer to the following

Scilab code for reection coecient ARC 28

Scilab code Exa 13.2 Program to nd the maxima and minima electric eld

66

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

// C a p t i o n : Program t o f i n d t h e maxima and minma electric field // Example13 . 2 // p a g e 4 4 3 clc ; er1 = 4; ur1 = 1; er2 = 9; ur2 = 1; [ uo , eo ] = muo_epsilon () ; // f r e e s p a c e p e r m i t t i v i t y and p e r m e a b i l i t y u1 = uo * ur1 ; // p e r m e a b i l i t y o f medium 1 u2 = uo * ur2 ; // p e r m e a b i l i t y o f medium 2 e1 = eo * er1 ; // p e r m i t t i v i t y o f medium 1 e2 = eo * er2 ; // p e r m i t t i v i t y o f medium 2 etta1 = sqrt ( u1 / e1 ) ; etta2 = sqrt ( u2 / e2 ) ; T = reflection_coefficient ( etta1 , etta2 ) Exs1_i = 100; // i n c i d e n t e l e c t r i c f i e l d i n v /m Exs1_r = -20; // r e f l e c t e d e l e c t r i c f i e l d i n v /m Ex1T_max = (1+ abs ( T ) ) * Exs1_i ; //maximum t r a n s m i t t e d e l e c t r i c f i e l d i n v /m Ex1T_min = (1 - abs ( T ) ) * Exs1_i ; // minimum t r a n s m i t t e d e l e c t r i c f i e l d i n v /m S = VSWR ( T ) ; // v o l t a g e s t a n d i n g wave r a t i o disp ( Ex1T_max , maximum t r a n s m i t t e d e l e c t r i c f i e l d i n v /m = ) disp ( Ex1T_min , minimum t r a n s m i t t e d e l e c t r i c f i e l d i n v /m = ) disp (S , v o l t a g e s t a n d i n g wave r a t i o S= ) // R e s u l t //maximum t r a n s m i t t e d e l e c t r i c f i e l d i n v /m = // 120. // minimum t r a n s m i t t e d e l e c t r i c f i e l d i n v /m = // 80. // v o l t a g e s t a n d i n g wave r a t i o S= // 1.5

67

Refer to the following for mu epsilon ARC 13 Refer to the following for

reection coecient ARC 22

Refer to the scilab code for VSWR ARC 28

Scilab code Exa 13.3 Program to determine the intrinsic impedance of the unknown material
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

// C a p t i o n : Program t o d e t e r m i n e t h e i n t r i n s i c i m p e d a n c e o f t h e unkonwn m a t e r i a l // Eample13 . 3 // p a g e 4 4 1 clc ; maxima_spacing = 1.5; // Lambda /2 i n m e t r e s Lambda = 2* maxima_spacing ; // w a v e l e n g t h i n m e t r e s C = 3 e08 ; // f r e e s p a c e v e l o c i t y i n m/ s e c f = C / Lambda ; // f r e q u e n c y i n Hz S = 5; // v o l t a g e s t a n d i n g wave r a t i o T = (1 - S ) /(1+ S ) ; // r e f l e c t i o n c o e f f i c i e n t etta0 = 377; // i n t r i n s i c i m p e d a n c e i n ohms ettau = etta0 / S ; // i n t r i n s i c i m p e d a n c e o f unkonwn m a t e r i a l i n ohms disp (T , r e f l e c t i o n c o e f f i c i e n t T= ) disp ( ettau , i n t r i n s i c i m p e d a n c e i n ohms = ) // R e s u l t // r e f l e c t i o n c o e f f i c i e n t T = 0.6666667 // i n t r i n s i c i m p e d a n c e i n ohms = 75.4 Scilab code Exa 13.4 Program to determine the required range of glass thickness for Fabry-perot interferometer

// C a p t i o n : Program t o d e t e r m i n e t h e r e q u i r e d r a n g e o f g l a s s t h i c k n e s s f o r Fabryp e r o t i n t e r f e r o m e t e r 68

2 // Example13 . 4 3 // p a g e 4 5 0 4 clear ; 5 clc ; 6 Lambda0 = 600 e -09; // w a v e l e n g t h o f r e d p a r t o f 7 8 9 10 11 12

v i s i b l e s p e c t r u m 600nm n = 1.45; // r e f r a c t i v e i n d e x o f g l a s s p l a t e delta_Lambda = 50 e -09; // o p t i c a l s p e c t r u m o f f u l l w i d t h = 50nm l = Lambda0 ^2/(2* n * delta_Lambda ) ; disp ( l *1 e06 , r e q u i r e d r a n g e o f g l a s s t h i c k n e s s i n m i c r o m e t e r l= ) // R e s u l t // r e q u i r e d r a n g e o f g l a s s t h i c k n e s s i n m i c r o m e t e r l = 2.4827586 Scilab code Exa 13.5 Program to nd the required index for the coating and its thickness

1 2 3 4 5 6 7 8 9 10 11 12 13 14

// C a p t i o n : Program t o f i n d t h e r e q u i r e d i n d e x f o r t h e c o a t i n g and i t s t h i c k n e s s // Example13 . 5 // p a g e 4 5 1 clear ; clc ; etta1 = 377; // i n t r i n s i c i m p e d a n c e o f f r e e s p a c e i n ohms n3 = 1.45; // r e f r a c t i v e i n d e x o f g l a s s etta3 = etta1 / n3 ; // i n t r i n s i c i m p e d a n c e i n g l a s s etta2 = sqrt ( etta1 * etta3 ) ; // i n t r i n s i c i m p e d a n c e i n ohms f o r c o a t i n g n2 = etta1 / etta2 ; // r e f r a c t i v e i n d e x o f r e g i o n 2 Lambda0 = 570 e -09; // f r e e s p a c e w a v e l e n g t h Lambda2 = Lambda0 / n2 ; // w a v e l e n g t h i n r e g i o n 2 l = Lambda2 /4; // minimum t h i c k n e s s o f t h e d i e l e c t r i c layer disp ( l *1 e06 , minimum t h i c k n e s s o f t h e d i e l e c t r i c l a y e r i n um = ) 69

15 16 17

// R e s u l t // minimum t h i c k n e s s o f t h e d i e l e c t r i c l a y e r i n um = // 0.1183398 Scilab code Exa 13.6 Program to nd the phasor expression for the electric eld

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

// C a p t i o n : Program t o f i n d t h e p h a s o r e x p r e s s i o n f o r the e l e c t r i c f i e l d // Example13 . 6 // p a g e 4 5 6 clc ; ax = sym ( ax ) ; ay = sym ( ay ) ; az = sym ( a z ) ; x = sym ( x ) ; y = sym ( y ) ; z = sym ( z ) ; teta = 30; // p h a s e a n g l e i n d e g r e e s teta = 30/57.3; // p h a s e a n g l e i n r a d i a n s Eo = 10; // E l e c t r i c f i e l d i n v /m f = 50 e06 ; // f r e q u e n c y i n Hz er = 9.0; // r e l a t i v e p e r m i t t i v i t y ur = 1; // r e l a t i v e p e r m e a b i l i t y [ uo , eo ] = muo_epsilon () ; k = propagation_constant (f , uo , ur , eo , er ) ; K = k *( cos ( teta ) * ax + sin ( teta ) * ay ) ; r = x * ax + y * ay ; Es = Eo * exp ( - sqrt ( -1) * K * r ) * az ; disp (K , p r o p a g a t i o n c o n s t a n t p e r m e t r e K= ) disp (r , d i s t a n c e i n m e t r e r= ) disp ( Es , P h a s o r e x p r e s s i o n f o r t h e e l e c t r i c f i e l d o f t h e u n i f o r m p l a n e wave Es= ) // R e s u l t //K= 5 6 0 7 ( 1 4 9 6 9 ay /29940+25156 ax / 2 9 0 4 7 ) / 1 7 8 4 // r= ay y+ax x // Es =10 a z %e (5607 %i ( 1 4 9 6 9 ay /29940+25156 ax / 2 9 0 4 7 ) ( ay y+ax x ) / 1 7 8 4 ) 70

Refer to the following for mu epsilon ARC 13 Refer to the following for

propagation constant ARC 21

Scilab code Exa 13.7 Program to nd the fraction of incident power that is reected and transmitted
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// C a p t i o n : Program t o f i n d t h e f r a c t i o n o f i n c i d e n t power t h a t i s r e f l e c t e d and t r a n s m i t t e d // Example13 . 7 // p a g e 4 6 0 clc ; teta1 = 30; // i n c i d e n t a n g l e i n d e g r e e s n2 = 1.45; // r e f r a c t i v e i n d e x o f g l a s s teta2 = snells_law ( teta1 , n2 ) ; etta1 = 377* cos ( teta1 /57.3) ; // i n t r i n s i c i m p e d a n c e i n medium 1 i n ohms etta2 = (377/ n2 ) * cos ( teta2 ) ; // i n t r i n s i c i m p e d a n c e i n medium2 i n ohms Tp = reflection_coefficient ( etta1 , etta2 ) ; // r e f l e c t i o n c o e f f i c i e n t f o r p p o l a r i z a t i o n Reflected_Fraction_p = ( abs ( Tp ) ) ^2; Transmitted_Fraction_p = 1 -( abs ( Tp ) ) ^2; etta1s = 377* sec ( teta1 /57.3) ; // i n t r i n s i c i m p e d a n c e f o r s p o l a r i z a t i o n etta2s = (377/ n2 ) * sec ( teta2 ) ; Ts = reflection_coefficient ( etta1s , etta2s ) ; // r e f l e c t i o n c o e f f i c i e n t f o r s p o l a r i z a t i o n Reflected_Fraction_s = ( abs ( Ts ) ) ^2; Transmitted_Fraction_s = 1 -( abs ( Ts ) ) ^2; disp ( teta2 *57.3 , T r a n s m i s s i o n a n g l e u s i n g s n e l l s law in degrees teta2 =) disp ( Tp , R e f l e c t i o n c o e f f i c i e n t f o r p p o l a r i z a t i o n Tp= ) disp ( Reflected_Fraction_P , F r a c t i o n o f i n c i d e n t 71

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

power t h a t i s r e f l e c t e d f o r p p o l a r i z a t i o n = ) disp ( Transmitted_Fraction_p , F r a c t i o n o f power t r a n s m i t t e d f o r p p o l a r i z a t i o n = ) disp ( Ts , R e f l e c t i o n c o e f f i c i e n t f o r s p o l a r i z a t i o n Tp= ) disp ( Reflected_Fraction_s , F r a c t i o n o f i n c i d e n t power t h a t i s r e f l e c t e d f o r s p o l a r i z a t i o n = ) disp ( Transmitted_Fraction_s , F r a c t i o n o f power t r a n s m i t t e d f o r s p o l a r i z a t i o n = ) // R e s u l t // T r a n s m i s s i o n a n g l e u s i n g s n e l l s law i n d e g r e e s teta2 = // 20.171351 // R e f l e c t i o n c o e f f i c i e n t f o r p p o l a r i z a t i o n Tp= // 0 . 1 4 4 4 9 7 2 // F r a c t i o n o f i n c i d e n t power t h a t i s r e f l e c t e d f o r p o l a r i z a t i o n = // 0.0337359 // F r a c t i o n o f power t r a n s m i t t e d f o r p p o l a r i z a t i o n // 0.9791206 // R e f l e c t i o n c o e f f i c i e n t f o r s p o l a r i z a t i o n Tp= // 0.2222748 // F r a c t i o n o f i n c i d e n t power t h a t i s r e f l e c t e d f o r p o l a r i z a t i o n = // 0.0494061 // F r a c t i o n o f power t r a n s m i t t e d f o r s p o l a r i z a t i o n // 0.9505939 Refer to the following for reection coecient ARC 22

s =

Refer to the following Scilab code for snells law ARC 25

Scilab code Exa 13.8 Program to nd the refractive index of the prism material
1

// C a p t i o n : Program t o f i n d t h e r e f r a c t i v e i n d e x o f the prism m a t e r i a l 72

2 // Example13 . 8 3 // p a g e 4 6 3 4 clear ; 5 clc ; 6 n2 =1.00; // r e f r a c t i v e i n d e x o f a i r 7 teta1 = 45; // i n c i d e n t a n g l e i n d e g r e e s 8 teta1 = 45/57.3; // i n c i d e n t a n g l e i n r a d i a n s 9 n1 = n2 / sin ( teta1 ) ; 10 disp ( n1 , r e f r a c t i v e i n d e x o f p r i s m m a t e r i a l n1= ) 11 // R e s u l t 12 // r e f r a c t i v e i n d e x o f p r i s m m a t e r i a l n1= 13 // 1.4142954

Scilab code Exa 13.9 Program to determine incident and transmitted anlges
1 2 3 4 5 6 7 8 9 10 11 12 13

14 15 16 17

// C a p t i o n : Program t o d e t e r m i n e i n c i d e n t and transmitted anlges // Example13 . 9 // p a g e 4 6 4 clear ; clc ; n1 =1.00; // r e f r a c t i v e i n d e x o f a i r n2 =1.45; // r e f r a c t i v e i n d e x o f g l a s s teta1 = asin ( n2 / sqrt ( n1 ^2+ n2 ^2) ) ; teta2 = asin ( n1 / sqrt ( n1 ^2+ n2 ^2) ) ; Brewster_Condition = teta1 + teta2 ; disp ( teta1 *57.3 , I n c i d e n t a n g l e i n d e g r e e s t e t a 1 = ) disp ( teta2 *57.3 , t r a n s m i t t e d a n g l e i n d e g r e e s t e t a 2= ) disp ( Brewster_Condition *57.3 , sum o f t h e i n c i d e n t a n g l e and t r a n s m i t t e d a n g l e , B r e w s t e r C o n d i t i o n= ) // R e s u l t // I n c i d e n t a n g l e i n d e g r e e s t e t a 1 = 5 5 . 4 1 1 7 9 3 // t r a n s m i t t e d a n g l e i n d e g r e e s t e t a 2 = 3 4 . 5 9 4 8 3 7 // sum o f t h e i n c i d e n t a n g l e and t r a n s m i t t e d a n g l e , B r e w s t e r C o n d i t i o n= 90.00663

73

Scilab code Exa 13.10 Program to determine group velocity and phase velocity of a wave
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

// C a p t i o n : Program t o d e t e r m i n e g r o u p v e l o c i t y and p h a s e v e l o c i t y o f a wave // Example13 . 1 0 // p a g e 4 7 0 clc ; w = sym ( w ) ; wo = sym ( wo ) ; no = sym ( no ) ; c = sym ( c ) ; beta_w = ( no * w ^2) /( wo * c ) ; disp ( beta_w , Phase c o n s t a n t= ) d_beta_w = diff ( beta_w , w ) ; disp ( d_beta_w , D i f f e r e n t i a t i o n o f p h a s e c o n s t a n t w . r . to w = ) Vg = 1/ d_beta_w ; Vg = limit ( Vg ,w , wo ) ; Vp = w / beta_w ; Vp = limit ( Vp ,w , wo ) ; disp ( Vg , Group v e l o c i t y = ) disp ( Vp , Phase v e l o c i t y = ) // R e s u l t // Phase c o n s t a n t= // no w 2 / ( c wo ) // D i f f e r e n t i a t i o n o f p h a s e c o n s t a n t w . r . t o w = // 2 no w/ ( c wo ) // Group v e l o c i t y = // c / ( 2 no ) // Phase v e l o c i t y = // c / no Scilab code Exa 13.11 Program to determine the pulse width at the optical ber output

// C a p t i o n : Program t o d e t e r m i n e t h e p u l s e w i d t h a t the o p t i c a l f i b e r output 74

2 // Example13 . 1 1 3 // p a g e 4 7 4 4 clear ; 5 clc ; 6 T = 10; // w i d t h o f 7 8 9 10 11 12 13 14 15 16 17

l i g h t pulse at the o p t i c a l f i b e r input in pico secs beta2 = 20; // d i s p e r s i o n i n p i c o s e c o n d s s q u a r e p r e kilometre z = 15; // l e n g t h o f o p t i c a l f i b e r i n k i l o m e t r e delta_t = beta2 * z / T ; T1 = sqrt ( T ^2+ delta_t ^2) ; disp ( delta_t , P u l s e s p r e a d i n p i c o s e c o n d s d e l t a t = ) disp ( ceil ( T1 ) , Output p u l s e w i d t h i n p i c o s e c o n d s T1 =) // R e s u l t // P u l s e s p r e a d i n p i c o s e c o n d s d e l t a t = // 30. // Output p u l s e w i d t h i n p i c o s e c o n d s T1 = // 32.

75

Chapter 14 Guided Wave and Radiation


Scilab code Exa 14.1 Program to determine the cuto frequency for the rst waveguide mode(m=1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// C a p t i o n : Program t o d e t e r m i n e t h e c u t o f f f r e q u e n c y f o r t h e f i r s t w a v e g u i d e mode (m=1) // Example14 . 1 // p a g e 499 clear ; clc ; er1 = 2.1; // d i e l e c t r i c c o n s t a n t o f t e f l o n m a t e r i a l er0 = 1; // d i e l e c t r i c c o n s t a n t o f a i r d = 1e -02; // p a r a l l e l p l a t e w a v e g u i d e s e p a r a t i o n i n metre C = 3 e08 ; // f r e e s p a c e v e l o c i t y i n m/ s e c n = sqrt ( er1 / er0 ) ; // r e f r a c t i v e i n d e x fc1 = C /(2* n * d ) ; disp ( fc1 , c u t o f f f r e q u e n c y f o r t h e f i r s t w a v e g u i d e mode i n Hz f c 1 = ) // R e s u l t // c u t o f f f r e q u e n c y f o r t h e f i r s t w a v e g u i d e mode i n Hz f c 1 = // 1 . 0 3 5D+10 Scilab code Exa 14.2 Program to determine the number of modes propagate in waveguide 76

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// C a p t i o n : Program t o d e t e r m i n e t h e number o f modes propagate in waveguide // Example14 . 2 // p a g e 499 clear ; clc ; er1 = 2.1; // d i e l e c t r i c c o n s t a n t o f t e f l o n m a t e r i a l er0 = 1; // d i e l e c t r i c c o n s t a n t o f a i r n = sqrt ( er1 / er0 ) ; // r e f r a c t i v e i n d e x Lambda_cm = 2e -03; // o p e r a t i n g c u t o f f w a v e l e n g t h i n metre d = 1e -02; // p a r a l l e l p l a t e w a v e g u i d e s e p a r a t i o n m = (2* n * d ) / Lambda_cm ; disp ( floor ( m ) , Number o f w a v e g u i d e s modes p r o p a g a t e m =) // R e s u l t // Number o f w a v e g u i d e s modes p r o p a g a t e m = // 14. Scilab code Exa 14.3 Program to determine the group delay and dierence in propagation times

1 2 3 4 5 6 7 8 9 10 11 12

// C a p t i o n : Program t o d e t e r m i n e t h e g r o u p d e l a y and d i f f e r e n c e in propagation times // Example14 . 3 // p a g e 502 clc ; C = 3 e08 ; // f r e e s p a c e v e l o c i t y i n m/ s e c er = 2.1; // d i e l e c t r i c c o n s t a n t o f t e f l o n m a t e r i a l fc1 = 10.3 e09 ; // c u t o f f f r e q u e n c y f o r mode m =1 fc2 = 2* fc1 ; // c u t o f f f r e q u e n c y f o r mode m =2 f = 25 e09 ; // o p e r a t i n g f r e q u e n c y i n Hz Vg1 = group_delay (C , er , fc1 , f ) ; // g r o u p d e l a y f o r mode m = 1 Vg2 = group_delay (C , er , fc2 , f ) ; // g r o u p d e l a y f o r mode m = 2 del_t = group_delay_difference ( Vg1 , Vg2 ) ;

77

disp ( ceil ( del_t *1 e10 ) , g r o u p d e l a y d i f f e r e n c e i n p s / cm d e l t = ) 14 // R e s u l t 15 // g r o u p d e l a y d i f f e r e n c e i n p s /cm d e l t = 16 // 33.


13

Refer to the following for group delay ARC 10

Refer to the following for group delay dierence ARC 9

Scilab code Exa 14.4 Program to determine the operating range of frequency for TE10 mode of air lled rectangular waveguide
1

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// C a p t i o n : Program t o d e t e r m i n e t h e o p e r a t i n g r a n g e o f f r e q u e n c y f o r TE10 mode o f a i r f i l l e d r e c t a n g u l a r waveguide // Example14 . 4 // p a g e 509 clear ; clc ; // d i m e n s i o n s o f a i r f i l l e d r e c t a n g u l a r w a v e g u i d e a = 2e -02; b = 1e -02; // F r e e s p a c e v e l o c i t y i n m/ s e c C = 3 e08 ; // t h e v a l u e o f m f o r TE10 mode m = 1; n = 1; // r e f r a c t i v e i n d e x f o r a i r f i l l e d w a v e g u i d e fc = ( m * C ) /(2* n * a ) ; disp ( fc *1 e -09 , O p e r a t i n g r a n g e o f f r e q u e n c y f o r TE10 mode i n GHz f c= ) // R e s u l t // O p e r a t i n g r a n g e o f f r e q u e n c y f o r TE10 mode i n GHz f c= // 7.5

78

Scilab code Exa 14.5 Program to determine the maximum allowable refractive index of the slab material
1 2 3 4 5 6 7 8 9 10 11 12 13

// C a p t i o n : Program t o d e t e r m i n e t h e maximum allowable r e f r a c t i v e index of the slab material // Example14 . 5 // p a g e 517 clear ; clc ; Lambda = 1.30 e -06; // w a v e l e n g t h r a n g e o v e r which s i n g l e mode o p e r a t i o n d = 5e -06; // s l a b t h i c k n e s s i n m e t r e n2 = 1.45; // r e f r a c t i v e i n d e x o f t h e s l a b m a t e r i a l n1 = sqrt (( Lambda /(2* d ) ) ^2+ n2 ^2) ; disp ( n1 , The maximum a l l o w a b l e r e f r a c t i v e i n d e x o f t h e s l a b m a t e r i a l n1= ) // R e s u l t // The maximum a l l o w a b l e r e f r a c t i v e i n d e x o f t h e s l a b m a t e r i a l n1= // 1.4558159 Scilab code Exa 14.6 Program to nd the V number of a step index ber

1 2 3 4 5 6 7 8 9 10 11 12

// C a p t i o n : Program t o f i n d t h e V number o f a s t e p index f i b e r // Example14 . 6 // p a g e 524 clear ; clc ; Lambda = 1.55 e -06; // o p e r a t i n g w a v e l e n g t h i n m e t r e LambdaC = 1.2 e -06; // c u t o f f w a v e l e n g t h i n m e t r e V = ( LambdaC / Lambda ) *2.405; disp (V , t h e V number o f a s t e p i n d e x f i b e r V= ) // R e s u l t // t h e V number o f a s t e p i n d e x f i b e r V= // 1.8619355

79

2 3 4 5 6 7 8 9 10

Scilab code ARC 1 // C a p t i o n : Program t o c a l c u l a t e t h e 1 a t t e n u a t i o n c o n s t a n t o f good d i e l e c t r i c // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example12 . 4 [ 2 ] . Example12 . 5 function [ beta1 ] = attenuation_constant_gooddie ( uo , eo ,f , er1 , er2 , ur ) W = 2*3.14* f ; e1 = eo * er1 ; e2 = eo * er2 ; u = uo * ur ; beta1 = ( W * e2 /2) * sqrt ( u / e1 ) ; endfunction

2 3 4 5 6

Scilab code ARC 2 1 // C a p t i o n : Program u s e d t o c o n v e r t c a r t e s i a n coordinates into cylindrical coordinates // Not u s e d i n any e x a m p l e s function [ th ,r , z ] = cart2cyl (x ,y , z ) th = atan (y , x ) ; r = sqrt ( abs ( x ) .^2+ abs ( y ) .^2) ; endfunction

2 3 4 5 6 7

Scilab code ARC 1 // C a p t i o n : Program u s e d t o c o n v e r t 3 cartesian coordinates into spherical coordinates // Not u s e d i n any e x a m p l e s e x a m p l e s function [ az , elev , r ] = cart2spher (x ,y , z ) r = sqrt ( abs ( x ) .^2+ abs ( y ) .^2+ abs ( z ) .^2) ; elev = atan (z , sqrt ( abs ( x ) .^2+ abs ( y ) .^2) ) ; az = atan (y , x ) ; endfunction

Scilab code ARC 1 // C a p t i o n : Program u s e d t o f i n d t h e 4 c r o s s p r o d u c t o f two v e c t o r s 2 // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s 80

3 4 5 6 7 8

// [ 1 ] . Example9 . 2 [ 2 ] . Example9 . 3 [ 3 ] . Example9 . 4 Example9 . 6 function [ c ] = cross_product (a , b ) c = [ a (2) * b (3) -a (3) .* b (2) a (3) * b (1) -a (1) * b (3) a (1) * b (2) -a (2) * b (1) ]; endfunction

[4].

2 3 4 5 6 7

Scilab code ARC 1 // C a p t i o n : Program u s e d t o c o n v e r t 5 the c y l i n d r i c a l c o o r d i n a t e s into // c a r t e s i a n c o o r d i n a t e s // Not u s e d i n any e x a m p l e s function [x ,y , z ] = cyl2cart (x ,y , z ) x = r .* cos ( th ) ; y = r .* sin ( th ) ; endfunction

2 3 4 5 6

Scilab code ARC 1 // C a p t i o n : Program t o f i n d t h e d o t 6 p r o d u c t o f two v e c t o r s // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example1 . 2 [ 2 ] . Example9 . 6 function [ C ] = dot (A , B ) C = sum ( A .* B ) ; endfunction

2 3 4 5 6

Scilab code ARC 7 1 // C a p t i o n : Program t o f i n d t h e e l e c t r i c a l l e n g t h // R e f e r t h e f u n c t i o n f o r t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example11 . 8 [ 2 ] . Example11 . 1 0 function [ beta1 ] = electrical_length (L , Lambda ) beta1 = 2* %pi * L *57.3/ Lambda ; endfunction

81

2 3 4 5 6

Scilab code ARC 1 // C a p t i o n : Program u s e d t o c a l c u l a t e 8 the e l e c t r i c f i e l d i n t e n s i t y of a l i n e charge // The f u n c t i o n cna be u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example3 . 1 function [ E ] = Electric_Field_Line_Charge ( rL , e0 , r ) E = rL /(2* %pi * e0 * r ) ; endfunction

2 3 4 5 6

Scilab code ARC 1 // C a p t i o n : Program t o f i n i d t h e 9 group d e l a y d i f f e r e n c e // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example14 . 3 function [ del_t ] = group_delay_difference ( Vg1 , Vg2 ) del_t = ((1/ Vg2 ) -(1/ Vg1 ) ) endfunction

2 3 4 5 6

Scilab code ARC 10 1 // C a p t i o n : Program t o f i n d t h e g r o u p d e l a y // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example14 . 3 function [ Vg ] = group_delay (C , er , fcm , f ) Vg = ( C / sqrt ( er ) ) * sqrt (1 -( fcm / f ) ^2) ; endfunction

2 3 4 5 6

Scilab code ARC 11 // C a p t i o n : Program t o f i n d t h e 1 i n t r i n s i c impedance o f d i e l e c t r i c // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example12 . 3 [ 2 ] . Example12 . 4 function [ etta ] = intrinsic_dielectric ( etta0 , er1 , er2 ) etta = ( etta0 / sqrt ( er1 ) ) *(1/ sqrt (1 - sqrt ( -1) *( er2 / er1 ) ) ) endfunction

82

2 3 4 5 6

Scilab code ARC 12 // C a p t i o n : Program t o f i n d t h e 1 i n t r i n s i c i m e d a n c e o f a good d i e l e c t r i c // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example12 . 5 function [ etta ] = intrinsic_good_dielectric ( etta0 , er1 , er2 ) etta = ( etta0 / sqrt ( er1 ) ) *(1/ sqrt (1 - sqrt ( -1) *( er2 / er1 ) ) ) endfunction

2 3 4 5 6 7 8

Scilab code ARC 13 // C a p t i o n : Program t o f i n d t h e f r e e 1 s p a c e p e r m i t t i v i t y and f r e e s p a c e p e r m e a b i l i t y // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example12 . 3 [ 2 ] . Example12 . 4 [ 3 ] . Example12 . 5 [ 4 ] . Example12 . 6 // [ 5 ] . Example13 . 2 [ 6 ] . Example13 . 6 function [ uo , eo ] = muo_epsilon () uo = 4*3.14*(10^ -7) ; eo = 8.854*(10^ -12) ; endfunction

2 3 4 5 6 7

Scilab code ARC 14 // C a p t i o n : Program u s e d t o f i n d t h e 1 capacitance of a p a r a l l e l plate // C a p a c i t o r // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example6 . 3 function [ C ] = parallel_capacitor (e ,S , d ) C = e*S/d; endfunction

Scilab code ARC 15 // C a p t i o n : Program t o f i n d t h e 1 impedance o f a p a r a l l e l c o n n e c t i o n 2 // R e f e r t h e f u n c t i o n f o r t h e f o l l o w i n g e x a m p l e s 3 // Example11 . 8 83

4 5 6

function [ C ] = parallel (A , B ) C = A * B /( A + B ) endfunction

2 3 4 5 6 7 8

Scilab code ARC 16 // C a p t i o n : Program u s e d t o 1 c a l c u l a t e the phase angle // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example1 . 2 function [ teta ] = Phase_Angle (A , B ) mod_A = sqrt ( A (1) ^2+ A (2) ^2+ A (3) ^2) ; mod_B = sqrt ( B (1) ^2+ B (2) ^2+ B (3) ^2) ; teta = acos ( dot (A , B ) /( mod_A * mod_B ) ) *57.3; endfunction

2 3 4 5 6 7 8 9

Scilab code ARC 17 // C a p t i o n : Program t o f i n d t h e 1 phase constant o f d i e l e c t r i c // [ 1 ] . Example12 . 3 function [ beta1 ] = phase_constant_dielectric ( uo , eo ,f , er1 , er2 , ur ) W = 2* %pi * f ; e1 = eo * er1 ; e2 = eo * er2 ; u = uo * ur ; beta1 = W * sqrt ( u * e1 /2) * sqrt ( sqrt (1+( e2 / e1 ) ^2) +1) ; endfunction

2 3 4 5 6

Scilab code ARC 18 // C a p t i o n : Program t o f i n d t h e 1 p h a s e c o n s t a n t o f a good d i e l e c t r i c // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // Example12 . 5 function [ beta1 ] = phase_constant_gooddie ( uo , eo ,f , er1 , er2 , ur ) W = 2*3.14* f ; e1 = eo * er1 ; 84

7 8 9 10

e2 = eo * er2 ; u = uo * ur ; beta1 = W * sqrt ( u * e1 ) ; endfunction

2 3 4 5 6 7

Scilab code ARC 19 1 // C a p t i o n : Program t o f i n d t h e p h a s e v e l o c i t y // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example12 . 3 function [ Vp ] = phase_velocity (f , beta1 ) W = 2* %pi * f ; Vp = W / beta1 ; endfunction

2 3 4 5 6 7 8 9

Scilab code ARC 21 // C a p t i o n : Program t o f i n d t h e 1 propagation constant // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example13 . 6 function [ k ] = propagation_constant (f , uo , ur , eo , er ) W = 2* %pi * f ; u = uo * ur ; e = eo * er ; k = W * sqrt ( u * e ) ; endfunction

2 3 4 5 6

Scilab code ARC 22 // C a p t i o n : Program t o f i n d t h e 1 reflection coefficient // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example13 . 1 [ 2 ] . Example13 . 2 [ 3 ] . Example13 . 7 function [ T ] = reflection_coefficient ( etta1 , etta2 ) T = ( etta2 - etta1 ) /( etta2 + etta1 ) ; endfunction

85

2 3 4 5 6 7

Scilab code ARC 23 // C a p t i o n : Program t o f i n d t h e 1 reflection coefficient // R e f e r t h e f u n c t i o n f o r t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example11 . 5 [ 2 ] . Example11 . 8 [ 3 ] . Example11 . 9 [ 4 ] . Example11 . 1 0 // [ 5 ] . Example11 . 1 1 function [ T ] = reflection_coeff ( ZL , Zo ) T = ( ZL - Zo ) /( ZL + Zo ) ; endfunction

2 3 4 5 6

Scilab code ARC 24 // C a p t i o n : Program t o c a l c u l a t e t h e 1 s k i n d e p t h o f a good c o n d u c t o r // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example12 . 6 function [ del ] = SkinDepth (f , uo , ur , sigma ) del = sqrt (1/(3.14* f * ur * uo * sigma ) ) ; endfunction

2 3 4 5 6 7

Scilab code ARC 25 // C a p t i o n : Program t o f i n d t h e 1 r e f r a c t e d a n g l e u s i n g s n e l l s law // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example13 . 7 function [ teta2 ] = snells_law ( teta1 , n2 ) teta1 = teta1 /57.3; // t e t a 1 i n r a d i a n s teta2 = asin ( sin ( teta1 ) / n2 ) ; endfunction

Scilab code ARC 26 // C a p t i o n : Program u s e d t o c o n v e r t 1 spherical coordinates into cartesian coordinates 2 // Not u s e d i n any e x a m p l e s 3 function [x ,y , z ] = spher2cart ( az , elev , r ) 4 // s p h e r 2 c a r t T r a n s f o r m s p h e r i c a l t o C a r t e s i a n coordinates .

86

6 7 8 9 10 11

[ x , y , z ] = s p h e r 2 c a r t (TH, PHI , R) t r a n s f o r m s corresponding elements o f data s t o r e d in s p h e r i c a l c o o r d i n a t e s ( a z i m u t h TH, e l e v a t i o n PHI , // r a d i u s R) t o C a r t e s i a n c o o r d i n a t e s X, Y, Z . TH and PHI must be i n r a d i a n s . z = r * sin ( elev ) ; rcoselev = r * cos ( elev ) ; x = rcoselev * cos ( az ) ; y = rcoselev * sin ( az ) ; endfunction

//

2 3 4 5 6

Scilab code ARC 27 1 // C a p t i o n : Program u s e d t o f i n d t h e U n i t v e c t o r // The f u n c t i o n u s e d i n t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example1 . 1 [ 2 ] . Example2 . 1 [ 3 ] . Example2 . 2 [ 4 ] . Example9 . 2 function [ a ] = UnitVector ( A ) a = A / sqrt ( A (1) ^2+ A (2) ^2+ A (3) ^2) ; endfunction

2 3 4 5 6 7 8 9 10 11

Scilab code ARC 28 // C a p t i o n : Program t o f i n d t h e 1 V o l t a g e S t a n d i n g Wave R a t i o (VSWR) // R e f e r t h e f u n c t i o n f o r t h e f o l l o w i n g e x a m p l e s // [ 1 ] . Example 1 1 . 8 [ 2 ] . Example 1 1 . 9 [ 3 ] . Example13 . 2 function [ S ] = VSWR ( T ) // where T i s t h e r e f l e c t i o n c o e f f i c i e n t if ((1 - abs ( T ) ) ==0) S = %inf ; else S = (1+ abs ( T ) ) /(1 - abs ( T ) ) ; end endfunction

87

Vous aimerez peut-être aussi