Professional Documents
Culture Documents
EE211 Electromagnetic
Field Theory
LAB REPORT 3
INTRODUCTION
The objective of this lab was to model and calculate the magnetic field generated
by a finite sheet of surface current density using MATLAB. In this laboratory, we write
a MATLAB program to calculate the magnetic field ‘H’ at a given point and plot this
magnetic field in the ‘x’-‘y’ plane in the pre-defined region. The sheet was assumed to
be infinitely thin and have a uniform current density across its surface. The magnetic
field was calculated at various points in space, both on and off the sheet, by summing
up the contributions from small current elements on the sheet. The calculations were
performed numerically using a finite number of subdivisions in both the ‘x’ and ‘y’
directions of the sheet.
The main focus of this lab was to gain an understanding of how to model and
calculate the magnetic field produced by surface currents using MATLAB. The
calculations were based on the, which relates the magnetic field at a point in space to
the current flowing through an element of conductor at that point. By applying this
law to each small element of the sheet, the total magnetic field at any point in space
could be determined.
This lab report presents the methodology and results of the calculations
performed, including the visual representation of the magnetic field using quiver plots.
The report also includes a discussion of the accuracy and limitations of the model
used, as well as potential areas for further exploration and improvement.
METHOD/MATERIALS
In this experiment, we aimed to calculate and visualize the Magnetic Field
generated by a current sheet using MATLAB. The code utilized the Biot-Savart law to
determine the magnetic field at various observation points in the vicinity of the
current sheet. The code that was implemented in the stimulation of this MATLAB
report and further step-by-step that simplify the code by explaining the coding
language, also the material, and methods used for the MATLAB simulation of the
Magnetic Field are described below:
❖ Material:
• MATLAB software (Online)
• MATLAB Code:
>> clc; %clear the command window clear; %clear all variables d=0.30; %the width of the sheet in the x direction L=20; %length of
sheet in the y direction J=5; %value of surface current density Js=J*[0 1 0]; %the vector of surface current density Xmin=-0.15;
%coordinate of lowest x value on sheet Xmax=0.15; %coordinate of maximum x value on sheet Ymin=-10; %coordinate of lowest y
value on sheet Ymax=10; %coordinate of maximum y value on sheet NumberOfXDivisions=20; %number of cells in the x direction
NumberOfYDivisions=100; %number of cells in the y direction dx=(Xmax-Xmin)/NumberOfXDivisions; %step in the x direction
dy=(Ymax-Ymin)/NumberOfYDivisions; %step in the y direction ds=dx*dy; %area of one subsection of sheet ZCellCenter=0; %all points
on sheet has a coordinate z=0 NumberOfXPlottingPoints=10; %number of plotting points along the x axis
NumberOfZPlottingPoints=10; %number of plotting points along the z axis PlotXmin=-0.5; %lowest x value on the plot plane
PlotXmax=0.5; %maximum x value on the plot plane PlotZmin=-0.5; %lowest z value on the plot plane PlotZmax=0.5; %maximum z
value on the plot plane PlotStepX= (PlotXmax-PlotXmin)/(NumberOfXPlottingPoints-1);%plotting step in the x direction
PlotStepZ=(PlotZmax-PlotZmin)/(NumberOfZPlottingPoints-1); %plotting step in the z direction
[XData,ZData]=meshgrid(PlotXmin:PlotStepX:PlotXmax, PlotZmin:PlotStepZ:PlotZmax); %build arrays of plot plane PlotY=0; %all points
on observation plane have zero y coordinate Bx=zeros(NumberOfXPlottingPoints,NumberOfZPlottingPoints); %x component of field
Bz=zeros(NumberOfXPlottingPoints, NumberOfZPlottingPoints);%z component of field for m=1:NumberOfXPlottingPoints %repeat for
all plot points in the x direction for n=1:NumberOfZPlottingPoints %repeat for all plot points in the y direction PlotX=XData(m,n); %x
coordinate of current plot point PlotZ=ZData(m,n); %z coordinate of current plot point if ((PlotZ==0)&(PlotX>=Xmin)&(PlotX<=Xmax))
% if the plotting point is on the current sheet Bx(m,n)=0.5*J; % we use the model of infinite current sheet Bz(m,n)=0; continue; end
Rp=[PlotX PlotY PlotZ]; %poistion vector of observation points for i=1:NumberOfXDivisions %repeat for all divisions in the x direction
for j=1:NumberOfYDivisions %repeat for all cells in the y direction XCellCenter=Xmin+(i-1)*dx+0.5*dx; %X center of current subsection
YCellCenter=Ymin+(j-1)*dy+0.5*dy; %Y center current subsection Rc=[XCellCenter YCellCenter ZCellCenter]; %position vector of
center of current subsection R=Rp-Rc; %vector pointing from current subsection to the current observation point norm_R=norm(R);
%get the distance between the current surface element and the observation point R_Hat=R/norm_R; %unit vector in the direction of
R dH=(ds/(4*pi*norm_R*norm_R))*cross(Js,R_Hat); %this is the contribution from current element Bx(m,n)=Bx(m,n)+dH(1,1);
%increment the x component at the current observation point Bz(m,n)=Bz(m,n)+dH(1,3); %increment the z component at the current
observation point end %end of j loop end %end of i loop end %end of n loop end % end of m loop quiver(XData, ZData, Bx, Bz);
xlabel('x(m)');%label x axis ylabel('z(m)');%label y axis %The following routing caculates the magnetic field at point P P=[0 0
0.25];%position of point P Hp=[0 0 0];%the magnetic field at point P for i=1:NumberOfXDivisions %repeat for all divisions in the x
direction for j=1:NumberOfYDivisions %repeat for all cells in the y direction XCellCenter=Xmin+(i-1)*dx+0.5*dx; %X center of current
subsection YCellCenter=Ymin+(j-1)*dy+0.5*dy; %Y center current subsection Rc=[XCellCenter YCellCenter ZCellCenter]; %position
vector of center of current subsection R=P-Rc; %vector pointing from current subsection to the current observation point
norm_R=norm(R); %get the distance between the current surface element and the observation point R_Hat=R/norm_R; %unit vector
in the direction of R dH=(ds/(4*pi*norm_R*norm_R))*cross(Js,R_Hat); %this is the contribution from current element Hp=Hp+dH; end
%end of j loop end %end of i loop
❖ Methods:
First, the necessary parameters were defined. These included the width (d)
and length (L) of the sheet, the surface current density (J), and the coordinates and
divisions of the sheet. Additionally, parameters related to the plotting of the
magnetic field were set, such as the number of plotting points along the x and z
axes.
1. Clearing the command window and removing any existing variables using
the ‘clc’ and ‘clear’ commands, respectively.
4. Initializing the matrices ‘Bx’ and ‘Bz’ as zero matrices. These matrices would
store the x and z components of the magnetic field at each observation
point.
5. Using nested loops, the code calculated the magnetic field components at
each observation point. For points lying on the current sheet, a simplified
model for an infinite current sheet was used to calculate the magnetic field
components (‘Bx’ and ‘Bz’).
6. For points not on the sheet, the code entered another set of nested loops
to calculate the magnetic field contribution from each current element. It
computed the position vector of the observation point and the position
vector of the center of each subsection of the sheet. Subsequently, it
determined the distance between the current element and the observation
point and calculated the unit vector pointing from the current element to
the observation point.
7. Utilizing the Biot-Savart law, the code computed the contribution to the
magnetic field at the observation point due to the current element. This
contribution was added to the respective components of the magnetic field
(‘Bx’ and ‘Bz’) at the observation point.
8. After the nested loops, the code generated a quiver plot to visualize the
magnetic field. The plot utilized the x and z coordinates of the observation
points and the corresponding components of the magnetic field (‘Bx’ and
‘Bz’).
9. Finally, the code calculated the magnetic field at a specific point (‘P’) by
summing up the contributions from each current element. It employed a
similar set of nested loops as before but used the point ‘P’ as the
observation point. The resulting magnetic field at ‘P’ was stored in the
variable ‘Hp’.
By executing the MATLAB code, we were able to obtain numerical results for
the magnetic field components at various observation points and visually
represent the magnetic field using quiver plots.
RESULTS
The MATLAB code was executed to calculate and visualize the magnetic field
generated by a current sheet. The results obtained provide insights into the
characteristics of the magnetic field.
By running the code, we obtained numerical values for the ‘x’ and ‘z’
components of the magnetic field (‘Bx’ and ‘Bz’) at various observation points
surrounding the current sheet. These components were then used to generate quiver
plots, which visually represented the direction and magnitude of the magnetic field at
each point.
• Field Distribution around the Current Sheet: The magnetic field lines
exhibited a pattern consistent with the expected behavior around a
current-carrying conductor. They formed closed loops surrounding the
current sheet, indicating a circular magnetic field pattern around the
conductor.
Figure 02: when increasing the breadth of the conductor from 0.15 – 0.5.
❖ When increasing the breadth (width) of the conductor in the current sheet,
the magnetic field generated by the sheet will also change. Here's what you
can expect to happen:
Figure 03: when decrease the breadth of the conductor from 0.15 – 0.05.
❖ When decrease the breadth (width) of the conductor in the current sheet, the
magnetic field generated by the sheet will also be affected. Here are the
expected changes:
It is important to note that the accuracy and precision of the results depend on
the chosen parameters and assumptions made in the model, such as the current
distribution and the dimensions of the current sheet. We can clearly observe that the
specific behavior of the magnetic field will depend on the details of the current sheet,
including the current density distribution and the geometry of the conductor. Further
analysis and modeling can provide more precise insights into the effects of changing
the conductor's breadth on the magnetic field characteristics.
DISCUSSION
The results obtained from the MATLAB code provide valuable insights into the
behavior of the magnetic field generated by a current sheet. In this discussion, we will
explore the implications of the results and their significance in relation to the
theoretical concepts of electromagnetism.
2. Influence of Observation Point Position: The results clearly indicate that the
magnetic field strength and direction vary depending on the distance from the
current sheet. As expected, the field strength is strongest near the surface of the
sheet and decreases as the distance from the sheet increases. This behavior aligns
with the inverse square relationship between magnetic field strength and distance
from a current-carrying conductor.
The experiment you conducted, which involved analyzing the magnetic field generated
by a current sheet, is based on several fundamental principles and concepts in
electromagnetism.
❖ Some of the important formulas behind the stimulation and the phenomenon
of this Lab report are:
• A current sheet 𝑲 = 5.0𝒂𝑦 A/m flows in the region −0.15 𝑚 < 𝑥 < 0.15 𝑚.
Calculate 𝑯 at 𝑃(0,0,0.25). Write a MATLAB program to verify your answer and
plot the magnetic field in the 𝑥-𝑦 plane in the region −0.5 𝑚 ≤ 𝑥 ≤ 0.5 𝑚 −0.5 m
≤ x ≤ 0.5 and −0.5 𝑚 ≤ 𝑧 ≤ 0.5 𝑚.
Figure 04: magnetic field from current Figure 05: magnetic field produced
loop by electric current
• Ampere's Law: one of the basic relations between electricity and magnetism,
stating quantitatively the relation of a magnetic field to the electric current or
changing electric field that produces it. Ampere's law states that the magnetic
field around a closed loop is directly proportional to the current passing
through the loop. It provides a mathematical relationship between the
magnetic field and the current distribution in a conductor.
• Superposition principle
(https://en.wikipedia.org/wiki/Superposition_principle): The superposition
principle states that the total magnetic field at a given point due to multiple
current elements is the vector sum of the individual magnetic fields produced
by each element. It allows for the calculation of the magnetic field from a
complex current distribution by breaking it down into simpler elements.
Figure 05: Two waves traveling in opposite directions across the same
medium combine linearly.(
https://en.wikipedia.org/wiki/Superposition_principle)
• Inverse Square Law: The magnetic field strength decreases with distance from
a current-carrying conductor following the inverse square law. According to
this principle, the strength of the magnetic field is inversely proportional to the
square of the distance from the source.
• Laplace equation:
(https://tutorial.math.lamar.edu/classes/de/laplaceseqn.aspx ):
Moreover, the results obtained through the MATLAB code provided valuable
insights into the magnetic field generated by a current sheet. The observed patterns
and variations in the field strength and direction align with theoretical expectations.
These findings contribute to our understanding of electromagnetism and have
implications for practical applications in various fields.
CONCLUSION
In conclusion, this lab successfully demonstrated the use of MATLAB simulations
to study the magnetic field generated by a current sheet. The results obtained deepen
our knowledge of magnetic field characteristics and provide a foundation for further
exploration in the field of electromagnetism. The result we obtained gives us a clear
insight into the theoretical understanding of the current sheet that produces a
magnetic field. It also demonstrates some of the important laws that govern
Electromagnetic Field Theory that were also stated above in the discussion area.
These results can be useful in designing and optimizing electrical systems that
involve two conductors. By adjusting the spacing and size of the conductors, the
voltage and electric field distribution can be controlled to meet specific design
requirements.
REFERENCE
➢ Some of the source were from the Lab sheet 03 provided by Dr. Hikma
SHABANI.
➢ Chapter 9, sections 9.1, 9.2, 9.3 and 9.4, Hayt W. H. and Buck. J, “Engineering
Electromagnetics”, 9th Ed, McGraw Hill, New York, 2018
➢ Online MATLAB: https://matlab.mathworks.com/
➢ Laplace equation: https://tutorial.math.lamar.edu/classes/de/laplaceseqn.aspx
➢ Lorentz force: Lorentz force – Wikipedia
➢ Biot-Savart law, google, webpage “Britannica”,
(https://www.britannica.com/science/Biot-Savart-law)
➢ Superposition princliple, google, Wikipedia
(https://en.wikipedia.org/wiki/Superposition_principle)
➢ Laplace equation:
(https://tutorial.math.lamar.edu/classes/de/laplaceseqn.aspx
ACKNOWLEDGE
I would like to express my sincere gratitude to Dr. Hikma SHABANI for providing
us this Laboratory Report to work on, it really helped us to understand the concept
behind the Electromagnetic Field, which is so vast and immense field in the theoretical
application but the general stand point is that we are slightly at the edge. I also would
like to appreciate some of my colleagues for their bright ideas and discussion that help
me accomplish this report. I also would like to thank my roommate, Tapi Morea (Steel)
he is and always will be my dear brother for life, thank you for keeping me through
these tough times my brother.
Last but not least, I want to thank the Heavenly Father for his love and mercy that
he has for me to live my everyday life, to help me survive through these rough times,
and to always be there for me when nobody else does.