Vectgui: A Matlab-Based Simulation Tool: Ozlem Ozgun and Levent Sevgi
Vectgui: A Matlab-Based Simulation Tool: Ozlem Ozgun and Levent Sevgi
editors Note
This tutorial belongs to a simple MATLAB package that visualizes functions and
operators (e.g., gradient of scalar fields and divergence of vector fields) in the cylindrical
and spherical coordinate systems. These packages can be used in lectures such as vector
algebra, mathematical foundations of electromagnetics, and mathematical methods
in electromagnetics, together with the previous packages we introduced in this
column[1], [2].
References
[1] L. Sevgi and . Uluiik, A tutorial on the Bessel functions and numerical evaluations of Bessel integrals, IEEE Antennas Propagat. Mag., vol. 51, no. 6, pp. 222233, Dec. 2009.
[2] . Uluiik and L. Sevgi, A MATLAB-based visualization package for complex functions, and their mappings and integrals, IEEE Antennas Propagat. Mag., vol. 54, no. 1, pp. 243253, Feb. 2012.
Notation
Transformation
Gradient
df = grad ^ f h
Divergence
d $ F = div ^F h
Curl
d # F = curl ^F h
Basic Concepts
Measurable quantities in the study of
physical phenomena are named either
scalar or vector quantities. A scalar
(e.g., charge and current) is a quantity
that has only magnitude and can be
described by a single numeric value.
A vector (e.g., velocity, electric, and magnetic fields) is a quantity that has both
magnitude and direction. Both scalars
and vectors can be functions of position
and time. A spatial distribution of a quantity is named the field. If the quantity is a
Description
cylGUI
sphGUI
sfieldGUI
vfieldGUI
grad2dGUI
grad3dGUI
curldivGUI
114
june 2015
2 (.) t 1 2 (.)
d = at u1 1
+ a u2
h 2 2u 2
h 1 2u 1
(.)
2
1
,
+ at u3
h 3 2u 3
(1)
2f
2f
df = at u1 1
+ at u2 1
h 2 2u 2
h 1 2u 1
2f
+ at u3 1
,
h 3 2u 3
(a)
(b)
(c)
(d)
Figure 2. The cylGUI window: (a) the r-constant surfaces, (b) the {-constant
surfaces, (c) the z-constant surfaces, and (d) the formed geometry.
(2)
df = at x
2f
2f
2f
.(3)
+ at y
+ at z
2x
2y
2z
1 ; 2 ^ h 2 h 3 Fu1 h
h1 h2 h3
2u 1
2 ^ h 3 h 1 Fu2 h 2 ^ h 1 h 2 Fu3 h
E,
+
+
2u 2
2u 3
(4)
d $ F =
d$F=
(a)
(b)
(c)
(d)
Figure 3. The sphGUI window: (a) the R-constant surfaces, (b) the i-constant
surfaces, (c) the {-constant surfaces, and (d) the formed geometry.
The curl operator applies to a vector
field and returns a vector field. It measures how much the vector field rotates
(curls) around a point of interest. It is
a measure of the strength of a vortex
source. Its magnitude represents the
maximum circulation of a vector field
within an infinitesimal area around
the given point, and its direction is
normal to the area in the sense of the
june 2015
at x at y at z
d # F = 2 2 2 .(7)
2x 2y 2z
Fx Fy Fz
VectGUI Package
VectGUI is a MATLAB-based tool
for visualizing some fundamental
concepts in vector analysis. The main
window of the package is shown in
Figure 1. The package includes seven
subtools, which are summarized in
Table 2. When the user clicks one of
the subtools in the main window, a
new window is opened corresponding
to the clicked subtool. Each subtool in
Table 2 is described below.
The cylGUI tool (Figure 2) is
designed to display geometries in a
cylindrical coordinate system. The
user enters the ranges of each coordinates ^r, {, z h . Once one of the plot
buttons is clicked, the corresponding
variable is sampled by a number of
samples between the lower and upper
limits, and the geometry is dynamically
formed by drawing constant surfaces
at every 0.1 s. For example, as shown
in Figure 2(a), if the button Plot by
varying r is clicked, five r- constant
surfaces are plotted corresponding
to r = 0, r = 0.5, r = 1, r = 1.5, and
r = 2 surfaces at every 0.1 s. Similarly,
the geometry is formed by varying {
and z variables in Figure 2(b) and (c),
respectively. If the number of samples is
increased, the geometry is well formed,
as shown in Figure 2(d).
The sphGUI tool (Figure 3) is
designed to display geometries in a
spherical coordinate system by varying
one of the coordinate variables ^ R, i, { h .
This is similar to the cylGUI tool.
The sfieldGUI tool (Figure 4) is
designed to display the contour and
surface plots of a scalar field in a 2-D
Cartesian system. The function is symbolically entered by the user. The ranges
of the function and the number of points
along the x and y axes are also provided
by the user.
The vfieldGUI tool (Figure 5)
is designed to plot a vector field in a
2-D Cartesian system. The scalar
components of the vector field (i.e., Fx
and Fy ) are entered symbolically by the
june 2015
Conclusions
A MATLAB-based simulation package, VectGUI, has been developed for
vector analysis. The intent is to develop
a better conceptual understanding of
curvilinear coordinate systems, scalar
and vector fields, gradient, curl, and
june 2015
Author Information
Ozlem Ozgun (ozgunozlem@gmail.
com; [email protected]) is
with the Electrical and Electronics
Engineering Department, Hacettepe
University, Beytepe, Ankara, Turkey.
Levent Sevgi ([email protected];
[email protected]) is with the
Electrical and Electronics Engineering
Department, Okan University, Akfirat,
Tuzla, Istanbul, Turkey.
117
References
[1] L. Sevgi and C. Goknar, An intelligent balance between numerical and physical experimentation, IEEE Potentials Mag., vol. 23, no. 4, pp.
4044, Oct./Nov. 2004.
[2] L. B. Felsen and L. Sevgi, Electromagnetic
engineering in the 21st century: Challenges and
perspectives, ELEKTRIK, Turk. J. Electr. Eng.
Comput. Sci., vol. 10, no. 2, pp. 131145, Feb.
2002.
[3] L. Sevgi, A new electromagnetic engineering
program and teaching via virtual tools, Progr.
Electromagn. Res. B (EWS 2006 Special Issue),
vol. 6, pp. 205224, 2008.
[4] L. Sevgi, Teaching electromagnetic modeling and simulation as a graduate-level course,
IEEE Antennas Propagat. Mag., vol. 54, no. 5, pp.
261269, Oct. 2012.
[5] L. Sevgi, Complex Electromagnetic Problems
and Numerical Simulation Approaches. Hoboken,
NJ: IEEE PressJohn Wiley, 2003.
[6] L. Sevgi, Electromagnetic Modeling and Simulation. Hoboken, NJ: IEEE PressJohn Wiley,
2014.
[7] L. Sevgi, Innumeracy: The meaning of the
numbers we use, IEEE Antennas Propagat.
Mag., vol. 49, no. 2, pp. 195190, Apr. 2007.
[8] L. Sevgi, Numerical fourier transforms DFT
and FFT, IEEE Antennas Propagat. Mag., vol.
49, no. 3, pp. 238243, June 2007.
[9] L. Sevgi, Guided waves and transverse fields:
Transverse to what? IEEE Antennas Propagat.
Mag., vol. 50, no. 6, pp. 221225, Dec. 2008.
[10] L. B. Felsen, F. Akleman, and L. Sevgi,
Wave propagation inside a two-dimensional
perfectly conducting parallel plate waveguide:
Hybrid ray-mode techniques and their visualizations, IEEE Antennas Propagat. Mag., vol. 46,
no. 6, pp. 6989, Dec. 2004.
[11] L. Sevgi, Sturm-Liouville equation: The
bridge between eigenvalue and Greens function
problems, ELEKTRIK, Turk. J. Electr. Eng. Comput. Sci., vol. 14, no. 2, pp. 293311, June 2006.
[12] L. Sevgi, Guided waves and eigenvalue
extraction from propagation characteristics,
IEEE Antennas Propagat. Mag., vol. 50, no. 2, pp.
222234, Apr. 2008.
118
We want
to hear
from you!