ECE3FI4 - Theory and Applications in Electromagnetic Page: 1
MATLAB Examples and Exercises (Set 16 solution)
ECE3FI4
Theory and Applications in Electromagnetic
Term II, January April 2007
MATLAB Example and Exercises (Set 16 solution)
Prepared by: Dr. M. H. Bakr and C. He
Exercise: a toroid whose axis is the z axis carries a current of 5.0 A and has 200 turns. The inner radius is
1.5 cm while the outer radius is 2.5 cm. Write a MATLAB program that compute and plots the magnetic
field in the x-y plane in the region 4.0 cm 4.0 cm x and 4.0 cm 4.0 cm y .
5.0 A I =
o
u
t
2
.
5
c
m
R
=
in
1
.5
c
m
R
=
x
y
z
Figure E16.1 See the exercise problem
ECE3FI4 - Theory and Applications in Electromagnetic Page: 2
MATLAB Examples and Exercises (Set 16 solution)
Analytical solution:
The cross section of the toriod is shown in Figure E16.2. Similar to the example problem, we can assign each
point on the winding an angle value. For instance, if a point has a ( is the angle shown in Figure E16.2) of
/3 , and it is on the third turn, then the angle value we assign to this point is ' /3 2 (3 1) 13 /3 = + = .
general, ' 2( 1) k = + , where , 1 number of turns k Z k and 0 2 < . Knowing the value of ' ,
we can find the cylindrical coordinates of a point on the k-th turn :
1 2 1 2
cos cos ' R R R R R = + = + (1)
2( 1)
Number of turns
k
= (2)
2 2
sin sin ' z R R = = (3)
Then we want to divide the winding to many segment along the direction of the current I in order to allow
MATLAB program to calculate the magnetic field. Assume we want to divide the winding to n segments,
then we have to pick up n+1 points on the winding. And for the i-th point, the angle is given by
max min
min
' '
' ' ( 1)
i
i
n
= + , where
min
' 0 = and ( )
max
' 2 Number of turns =
by plugging this equation into (1) (2) and (3), we can find
i
R ,
i
, and
i
z . Also, we can find the rectangular
coordinate
i
x ,
i
y ,and
i
z by using the formula
cos
i i i
x R =
sin
i i
y R =
i i
z z =
Note the i-th segment is a vector given by
1 1 1
( ( (
i i i x i i y i i y
x x y y z z
+ + +
= + + L )a )a )a
and the vector
i
R (pointing from the center of the i-th segment to the observation point) is given by
( )
1 1 1
, , , ,
2 2 2
i i i i i i
i i
x x y y z z
P C x y z
+ + +
= =
R
ECE3FI4 - Theory and Applications in Electromagnetic Page: 3
MATLAB Examples and Exercises (Set 16 solution)
5.0 A I =
O
1
R
2
R
R
M
z
Figure E16.2 Cross section view of the toroid in the example
problem. R and z are cylindrical coordinates of point M. It
can be shown that
1 2
cos R R R = + ,
2
sin z R = . And if M
is on the k-th turn,
2( 1)
Number of turns
k
= .