Individualized Matlab Projects in Undergraduate Electromagnetics
Individualized Matlab Projects in Undergraduate Electromagnetics
Individualized Matlab Projects in Undergraduate Electromagnetics
ELECTROMAGNETICS
Page 15.728.1
Abstract
Four projects are described that require students to compose individualized MATLAB programs to
solve a problem in electromagnetics. These projects are: (1) vector electric field from an
arbitrary charge distribution, (2) vector magnetic field from an arbitrary current distribution, (3)
frequency dependent reflection coefficient looking into impedance matching networks, and (4)
beam pattern for an arbitrarily arranged 4 dipole array.
Introduction
MATLAB projects are often assigned in undergraduate electromagnetics courses, in part to satisfy
the ABET criteria on use of modern engineering tools. The best projects will enhance
understanding of the subject matter while providing a significant programming exercise. A
challenge for the instructor is to individualize assignments to make it more likely that students
are doing their own work.
Four projects are presented that require students to write a MATLAB program that calculates the
project’s objective. First, the vector electric field is determined from an arbitrary charge
distribution. Second, the vector magnetic field is determined from an arbitrary current
distribution. For these related projects the discrete sum solution of the electrostatic or
magnetostatic field are individualized by the charge or current distributions and the configuration
of the structure in three dimensions.
In the third project, students are required to find the two fundamental Smith Chart solutions for a
stub matching network and realize this network using microstrip transmission line. Variables
that are modified to individualize the project include load impedance, operating frequency, stub
termination (open or short), and substrate properties. Performance is compared for the two
networks over a range of frequencies. The final project requires the student to determine the
beam pattern for an array of four dipoles. Each dipole in the array has an individualized current
magnitude, phase and orientation that are linked to the student’s ID number. Additionally, an
estimate of the array’s beam solid angle and directivity is required. We will discuss how well
these projects result in individualized work along with our recommendations for future projects.
a. Electrostatics
The vector electric field from an arbitrary static charge distribution can be calculated by the
application of Coulomb’s Law. Utilizing first the conceptually reasonable point charge, then the
somewhat implausible infinite line and surface charges densities, closed form integral solutions
for the vector electric field are obtained. Solutions using Gauss’ Law for the same charge
distributions can simplify the analysis. However, the fundamental aspects of Coulomb’s Law,
Page 15.728.2
expressed as a discrete summation, can provide additional insight for more practical problems in
electrostatics.
As part of the first course in electromagnetics, undergraduate students are tasked with the
computation of the vector electric field in a region from a unique static charge distribution. The
prerequisite for this course includes a course in engineering analysis using MATLAB and they are
familiar with both its computational and graphical rendering capabilities.
A typical charge distribution is shown in Figure 1(a) below in which two rectangular conducting
plates are offset at an angle and are specified to have a uniform charge density + S C/m2 on the
upper plate and − S C/m2 on the lower plate. This plate configuration is introduced as an initial
model of electrostatic deflection plates, as shown in Figure 1(b).
(a) (b)
Figure 1: (a) Configuration of rectangular conduction plates with a uniform charge distribution
(b) actual electrostatic defection plates
The intentionally vague specification of the task is to calculate the vector electric field at an
arbitrary location P(x,y,z) for a specific uniform charge density S. The width X1 and length Z1
of the rectangular plates, the angle and the charge density S are randomly assigned to each
student to avoid direct duplication of the results.
The course learning objective is to effect the translation of a problem to an engineering analysis
to be solved by discrete summation, rather than integration, and to formulate a reasonable
solution. The method utilized is a discussion in the class with groups of students proposing
specifications to modify the task, as it becomes readily apparent that the task is “open-ended”.
The discussion is quite lively, requires research and takes place over several class meetings.
This is a salient object lesson for the students in design and analysis and the points are organized,
agreed upon and added to the task:
For example, what is the restriction on the location P? The region to be analyzed directly affects
the computational time and should be limited. What should be the size of the discrete charge
x y S and how does this affect the computational time and the result? Since such plates are
discovered by the students to be used to deflect a beam of charged particles, usually electrons by
the Lorenz force equation, the salient region is the middle of the plates (x = X1/2), but what
Page 15.728.3
b. Magnetostatics
Next in the typical undergraduate course in electromagnetics is a consideration of the vector
magnetic field due to an arbitrary distribution of current calculated by the Biot-Savart Law.
Utilizing first the somewhat implausible infinite line and ring of current closed form integral
solutions for the vector magnetic field are obtained. Solutions using Ampere’s Circuital Law for
the same current distributions can simplify the analysis. However, the fundamental aspects of
the Biot-Savart Law, expressed as a discrete summation, again provide additional insight for
more practical problems in magnetostatics.
The undergraduate students are now tasked with the computation of the vector magnetic field in
a region from a unique constant current distribution. The usual two circular coils of the
Helmholtz configuration are modified and presented as five rectangular coils as shown in Figure
2(a). The rectangular coils have a width X1, a height Y1, an arbitrary number of turns and
spaced along the Z axis as shown.
(a) (b)
Following the precepts of the course learning objective, the students are familiar with the process
and begin the lively, iterative discussion to modify the task. Such coils are discovered by the
students to be used to provide a uniform magnetic field. It soon becomes apparent to them that
the coils should be spaced symmetrically.
However, should the coils be rectangular or square? What is the optimum distribution of the
Page 15.728.4
relative number of turns in each coil? Over what region and what is the specification for the
uniformity of the vector magnetic field? What should be the size of the discrete current element
I L? As before these points provide a natural division of the task which is then parsed to each
student to further avoid direct duplication of the results.
The results of the calculation of the vector electric and magnetic fields are provided as written
reports from each student with tabulated graphical renderings of the fields using MATLAB. The
written reports provide practice in the formatting of an engineering analysis with summary,
introduction, discussion and conclusion. These reports are to satisfy the additional course
learning objective of the application of technical writing. The results are summarized and
discussed in class to further illustrate the concepts of vector electric and magnetic fields.
The course learning object of the translation of a problem in electrostatics and magnetostatics to
an engineering analysis to be solved by discrete summation is directly assessed by focused
questions on examinations that propose a charge and current distribution and require that the
student provide the MATLAB code for the solution. These questions are graded by the choice of
the limit size x y and L of the discrete summation and the dot and cross product vector
manipulations required.\
An indirect assessment of the course learning objective is obtained by the survey at the end of
the course. Student comments on the survey have favorably noted the proportion (30%) of the
final grade assigned to and the insight provided by the tasks.
A MATLAB project is assigned at the end of a two semester electromagnetics sequence. This
sequence begins with transmission lines1, where students learn such things as how to calculate
input impedance looking into a terminated transmission line and how to use a Smith Chart to
design an impedance matching network using sections of transmission line (a shunt stub
matching network). In the second course, students study applied electromagnetics culminating in
microwave engineering topics including microstrip. Students therefore have covered all the
necessary topics to perform a MATLAB project involving microstrip impedance matching
networks. The project handout follows, with the “Given” information varied for each student:
You are expected to develop your own MATLAB code for this project. Teamwork
is unacceptable.
Note that you can solve for the matching network in terms of wavelength, but to
find the actual lengths you must design 50 Ω microstrip for your given circuit
board material and determine guide wavelength at your design frequency.
This project covers several interesting concepts. Students must find the two fundamentals stub
matching networks using a Smith Chart. The stub lengths from these solutions are in terms of
wavelengths, so to find the physical lengths students must design their microstrip transmission
lines and determine a guide wavelength at the design frequency. Finally, students compare the
reflection coefficient for the two solutions over a frequency range about the design frequency.
The project therefore ties together concepts from both semesters of electromagnetics.
A project grading rubric (Table 1) is provided to the students to guide their effort. This detailed
rubric both simplifies and standardizes the project grading. Student results were verified by a
MATLAB code developed that accepts the “given” information in the order it is displayed in the
project handout. The routine solves for the line lengths (in both wavelengths and in physical
lengths) needed for the two fundamental solutions and then plots the reflection coefficient
magnitudes as a function of frequency. In this way, it was straightforward to assess the
individual projects.
There were 30 students in the class and their MATLAB project scores ranged from a low score of
8% to a high score of 100%, with an average score of 79%. Figure 1 shows the results from one
student’s efforts. This particular student did an excellent job on all aspects of the project (see
appendix for student code). Figure 2 shows a plot from a student who did a very poor job not
only in the basic design but in the coding to generate a plot as well. The goal of the
individualized work was mostly met, though it was apparent that some collaboration did take
place in the code development.
Page 15.728.6
Table 1: Stub Matching Project Grading Rubric
score 0 1 3 5
1. Problem
Solution
a. Neat/organized Sloppy work and Sloppy work or Very neat and
Poorly organized poorly organized Well organized
b. approach Illogical, invalid Logical, valid
approach approach
c. execution three or more errors Two errors One error flawless
2. Program
a. Task definition Task undefined in Task poorly Task somewhat Task well-defined
program heading defined in program defined in program in program heading
heading heading
b. organization Sloppy appearance Sloppy appearance Neat appearance
and or code hard to and
Code hard to follow Code easy to
follow follow
c. comments No comments Program clarified
with comments,
variables clearly
defined
d. code quality Three or more code Two code errors One code error No apparent errors
errors in code
3. Results
a. Performance Program fails to Program runs with Program runs but Program works
run error messages generated faulty perfectly
results
b. Discussion No discussion Poor discussion of Poor discussion of Key points
key points and key points or summarized;
conclusions conclusions conclusions are
drawn
c. |Γ| vs freq. plot Incorrect, sloppy, Correct, neat,
improperly labeled properly labeled Page 15.728.7
Figure 3: One student’s microstrip stub matching network, top-down view and plot.
Page 15.728.8
Figure 4: Poor and incorrect plot for the impedance matching project
The radiation pattern for both dipole antennas and antenna arrays was covered in the second
electromagnetic course of a two course sequence in electromagnetics. There are a large number
of possible projects related to antennas and antenna arrays the students could be assigned. The
true difficulty is in determining a project that is achievable in a reasonable amount of time,
individualized, theoretically and computationally demanding and yet can be graded efficiently.
The project required the students to determine the radiation pattern in two planes for an array of
four dipoles located on the z-axis. Each dipole was separated by a quarter wavelength ( /4) and a
twentieth of a wavelength ( /20) long. The projects were individualized based on the last four
digits of a student’s identification number (ID). This was done in the following manner:
d2 odd :y-axis
Element 3 z = /2 I3 = |d3| 3 = 30*d3 º d3 even :z-axis,
d3 odd :y-axis
Element 4 z = 3 /4 I4 = |d4| 4 = 30*d4 º d4 even :z-axis,
d4 odd :y-axis
All students were asked to develop a MATLAB program that accurately does the following:
1) Plots the normalized power pattern at = 90 degrees for all angles 0 < < 360 degrees in
polar form.
2) Plots the normalized power pattern at = 0 degrees for 0 < < 180 degrees in polar
form.
3) Describes the code and specifically discusses how they developed the formulas used in
MATLAB. Also, a flowchart of the code is required along with sufficient comments in the
MATLAB file to ensure the code can be understood. Students are also asked to include a
printout of their code along with a CD in their project report.
The final projects showed a remarkable amount of diversity with one individual researching the
advanced technique of using Euler angles2 for determining three dimensional surface plots of the
radiation pattern. What became clear from reading the student reports and programs was that
students could basically be separated into four groups: a) Students that understood the antenna
and array theory who were good MATLAB programmers b) Students that understood the antenna
and array theory who were poor MATLAB programmers, c) Students that had little understanding
of antenna and array theory who were good MATLAB programmers and c) Students that had little
understanding of antenna and array theory who were also poor MATLAB programmers.
Grading of the plots for correctness was relatively simple since a code that only required the
entry of the last four digits of the persons ID number had already been created. It was likely that
some collaboration occurred in a small number of cases. However, most of the codes were very
different with several people creating completely vectorized codes. The same basic grading
rubric of Table 1 modified for this project was used. A correct radiation plot from a student is
shown in Figure 5.
Conclusions
Several individualized MATLAB projects have been presented where students use MATLAB to
study fundamental topics in electromagnetics. These projects help satisfy the ABET criteria on
use of modern tools by requiring a significant degree of MATLAB programming that improves
student understanding of the course material.
Typical project reports and code for parts 1a and 1b are available at:
http://www.astro.temple.edu/~silage/archive.htm
0.6
150 30
Normalized Power (Watts) 0.4
0.2
180 0
210 330
240 300
270
θ (degrees)
Bibliography
1. Wentworth, S. M., Applied Electromagnetics: Early Transmission Lines Approach, John Wiley & Sons, 2007
2. T. Milligan, “More applications of Euler rotation angles,” Antennas and Propagation Magazine, IEEE, vol. 41,
1999, pp. 78-83.
Page 15.728.11