BANGLADESH UNIVERSITY OF ENGINEERING AND
TECHNOLOGY
DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING
EEE 212
Numerical Technique Laboratory
Project Report
Section: B2 Group: 05
Time-Varying Vector Fields:
Gradient, Divergent & Curl
Course Instructors:
Dr. Md. Asiful Islam, Assistant Professor
Md. Mostaqul Islam, Part-time Lecturer
Signature of Instructor: ___________________________________________________
Academic Honesty Statement:
IMPORTANT! Please carefully read and sign the Academic Honesty Statement, below. Type the
student ID and name, and put your signature. You will not receive credit for this project experiment
unless this statement is signed in the presence of your lab instructor.
“In signing this statement, We hereby certify that the work on this project is our own and that we have not
copied the work of any other students (past or present), and cited all relevant sources while completing this
project. We understand that if we fail to honor this agreement, We will each receive a score of ZERO for this
project and be subject to failure of this course.”
Signature: ___________Anas_____________ Signature: ________Tonmoy_____________
Full Name: Anas Ahmed Full Name: Mahfuz Alam Tonmoy
Student ID: 2206115 Student ID: 2206116
Signature: ____________Noman____________ Signature: _________Al-Noman______________
Full Name: Md. Shibli Noman Full Name: Md. Abdullah Al- Noman
Student ID: 2206117 Student ID: 2206118
1
2
Table of Contents
1 Abstract................................................................................................................3
2 Introduction........................................................................................................4
3 Design...................................................................................................................4
3.1 Problem Formulation..................................................................................................................................5
3.1.1 What’s the problem ...........................................................................................................................5
3.1.2 Why this is a problem........................................................................................................................5
3.1.3 Our solution........................................................................................................................................... 5
3.2 Methodology....................................................................................................................................................6
3.3 Simulation Model.......................................................................................................................................... 8
4 Implementation..............................................................................................11
4.1 Description.................................................................................................................................................... 11
5 Communication to Project User.................................................................15
5.1 Executive Summary...................................................................................................................................15
5.2 User Manual.................................................................................................................................................. 16
5.3 Google Drive Link.......................................................................................................................................20
6 Outcome.............................................................................................................21
7 References........................................................................................................22
3
1. Abstract:
This project presents the development of a MATLAB-based interactive
application capable of analyzing time-dependent vector fields through the
computation and visualization of fundamental vector calculus operations—
namely divergence, curl, and gradient. The app allows users to input
symbolic expressions or functions for the components of a vector field in
three dimensions with time as an additional variable. It subsequently
computes the respective field operations dynamically and displays animated
vector plots to illustrate their spatial and temporal evolution. The tool is
meant to help students and researchers understand complex vector field
phenomena by visual and analytical description. The application was
developed using MATLAB's App Designer, combining symbolic
mathematics and graphical rendering to offer both educational and practical
utility
4
2. Introduction:
Vector calculus lies at the heart of the investigation of an immense range of
physical phenomena, ranging from electromagnetic fields and fluid flows to
physics and engineering dynamical systems. Divergence, curl, and gradient
are some of the most significant operations that offer a means of dissecting
the spatial structure of vector fields and their physical meaning. If such
fields also vary in time, the case is even more complicated, and a dynamic
visualization is necessary for additional insight.
To address this need, this project introduces an interactive MATLAB App
that allows users to explore time-dependent vector fields through symbolic
computation and animated visualization. The app accepts user-defined
vector field components in three dimensions with time as an additional
parameter, and it computes the divergence, curl, and gradient using
MATLAB’s symbolic math toolbox.
A key feature of the application is its built-in animation control system,
which enables users to play, pause, and observe the temporal evolution of
the vector field and its associated operations. This interactive control allows
for a more intuitive and detailed inspection of how the vector field behaves
and changes over time, enhancing both learning and analytical capabilities.
The application is designed using MATLAB's App Designer, providing a
user-friendly interface with symbolic manipulation, real-time plotting, and
animation. This makes it an excellent teaching and exploratory tool for
students, educators, and researchers looking to better understand the
dynamics of vector fields.
5
3. Design:
3.1 Problem Formulation
3.1.1 What's the Problem?
Understanding how vector fields behave in 3D space and how they change
with time is difficult, especially when studying:
Divergence (how much a field spreads out)
Curl (how much a field rotates)
Gradient (how fast a scalar field changes)
These concepts are often hard to visualize using just equations or 2D
diagrams in textbooks.
3.1.2 Why This Is a Problem?
Students struggle to imagine the dynamic behavior of vector fields. Existing
tools often lack interactive 3D or time-varying visualizations. There's a gap
between mathematical theory and visual understanding in fields like
electromagnetism or fluid dynamics.
3.1.3 Our Solution
We built a MATLAB GUI app that:
Accepts vector field inputs (with time dependence)
Computes gradient, curl, and divergence
Shows how the field evolves in 3D over time.
This helps bridge the gap between theory and visualization.
3.2 Methodology
6
Vector Definition:
We define a time dependent vector field in R3 as-
Mathematical operation:
For each input vector field, the following vector calculus operation are
applied symbolically using Matlab
Symbolic Computation Using MATLAB:
MATLAB’s syms, gradient(), divergence(), curl() functions are used to
Symbolically compute all derivatives. Time t is introduced as a symbolic
Variable to observe its parametric influence
Visualization Techniques:
Using MATLAB’s plotting tools like quiver3, Scatter3
7
•Vector plots show the fields direction and magnitude at sampled points
•Color maps represent divergence and curl magnitude over the field
•Animations show the evolution of te field with changing t
Time Dependence and Partial Derivatives:
•All vector operations are done with time t held constant, treating it as a
•Parameter
•All derivatives are taken with resepct to x,y,z only
•Time is controlled separately to animate or analyze dynamic behavior
3.3 Simulation Model
8
The launchpad
Each clickable button allows quick and easy access to its corresponding subsection
Divergence explorer
First, input the parameters Fx, Fy, and Fz — the three components along the
X, Y, and Z axes. These are expressed using four variables including the
9
time variable t along with x,y,z. Next, set the range for the X, Y, and Z axes,
as well as the time duration. Finally, click the “Plot Divergence” button to
generate the divergence plot. To see it’s functionality overtime press the
play button.
Gradient Analysis
For the gradient, input a scalar parameter using four variables: X, Y, Z, and
T (time). Then set the range about x,y and z axis and finally set the time
range. Then, click the “Plot Gradient” button to generate the output plot of
the gradient function. Finally, press the play button to see the functionality
overtime.
Curl Visualization:
10
For curve visualization, enter the input parameters Fx, Fy, and Fz using four
variables: X, Y, Z, and T (time). Then, set the range for the X, Y, and Z
axes, along with the final time value. Finally, click the “Plot Pearl” button to
view both the input and output of the function. We can press the play button
to see the functionality overtime.
4. Implementation:
11
4.1 Description
To view the functionality of divergence, first click the “Divergence” button.
Plotting Divergence:
12
Input
Output
The graph shows the structure of vector field and its
divergence overtime.
13
Plotting Curl:
Input
Output
The graph displayed the structure of a vector and how it’s
curl behaves as a rotating vector field overtime
14
Plotting Gradient:
Input
Output
The graph displayed the structure of the scalar field and how
it’s gradient behaves as a vector field overtime.
15
5. Communication to project
user:
5.1 Executive Summary
This project presents VectorCalc 3D, a MATLAB application specifically
built to help students and researchers visualize and gain insight into the
behavior of time-dependent vector fields using the calculation and animation
of basic vector calculus operations, i.e., gradient, divergence, and curl.
The main objective of the app is to fill the gap between theory in
mathematics and intuitive visualization, particularly in areas such as
electromagnetism and fluid dynamics where there are complex spatio-
temporal variations. Users can enter symbolic vector or scalar field
expressions that are functions of spatial variables (x, y, z) and time (t), and
the app calculates and visualizes their corresponding field operations with
MATLAB's symbolic math toolbox and 3D plotting functionality.
The easy-to-use interface accommodates real-time animation for interactive
observation of field development in the course of time. With capabilities
such as playback control, adjustable domains, and separate modes for each
operation, the software increases learning and returns practical insights into
dynamic vector field behavior.
The software has been designed with educational utility and ease of use in
mind. It requires only a minimal MATLAB installation, including symbolic
tool support, and can be run on standard Windows or Mac platforms. On
balance, VectorCalc 3D is a powerful computational and pedagogical
vehicle, allowing for enhanced conceptual understanding and serving as the
basis for further exploration of vector field analysis.
16
5.2 User Manual
Introduction:
VectorCalc 3D is a MATLAB-based graphical application designed to help
users visualize and analyze 3D time-dependent vector fields. It symbolically
computes and displays key vector calculus operations gradient,
divergence, and curl and animates how these quantities evolve over
time. The app is ideal for students and educators in fields such as physics,
electromagnetism, and fluid mechanics, offering interactive learning and
real-time simulation capabilities.
System Requirments
To run the application smoothly, the following hardware and software
specifications are recommended:
Hardware
Operating system: Windows 10/11 or MacOs 11+
Processor: Intel Core i3(5th Gen) minimum
Memory(RAM): Minimum 8GB ( 16GB recommended)
Storage: At least 500 MB free space
Display: 1366x768 resolution or higer
Optional: Dedicated GPU for better animation rendering
Software
MATLAB R2021b or later
Symbolic Math Toolbox
App Designer (included in MATLAB)
17
Installation Guide
Follow these steps to install and launch VectorCalc 3D:
Ensure MATLAB is installed with the Symbolic Math Toolbox.
Download the app file VectorCalc3D.mlapp.
Open MATLAB and navigate to the folder containing the app file.
Launch the app via:
o MATLAB App Designer:
>> appdesigner → Open VectorCalc3D.mlapp → Click Run
o Or from Command Window:
>> run('VectorCalc3D.mlapp')
No additional setup is required beyond MATLAB and the required
toolboxes.
User Interface Overview
The main interface of the app is divided into four key components:
Input Panel: Enter the vector or scalar field here using symbolic
expressions (e.g., [x + t, y^2, sin(z)]).
Operation Buttons: Choose between Gradient, Divergence,
and Curl
analysis.
3D Plot Area: Displays vector fields using MATLAB’s quiver3, color
maps, and surface plots.
Time Slider: Lets users animate the field over different time values for
dynamic behavior.
Navigation is intuitive: enter your function, select the operation, and watch
the results update in real time.
18
Key Features
VectorCalc 3D offers three main functionalities that users can access with a
single click:
🔸 Functionality 1: Gradient
Accepts a scalar field input (e.g., x*y + z*t)
Computes gradient vector field using symbolic math
Visualizes it with 3D arrows that update as t changes
🔸 Functionality 2: Divergence
Accepts a vector field input (e.g., [x, y, z + t])
Symbolically computes how much the field spreads
Renders divergence behavior using arrows and color maps
🔸 Functionality 3: Curl
Accepts a vector field
Computes rotational tendency of the field
Shows curl direction and magnitude with dynamic animation
Each feature can be used independently and animated using the time
play/pause button.
Common Tasks
This section outlines basic workflows to get started with the app:
To analyze divergence of a vector field:
1. Enter vector field in input box: [x, y^2, z + t]
2. Click Divergence
3. Adjust the Time Slider to observe changes
19
To visualize gradient of a scalar field:
1. Input scalar function: x^2 + y*z*t
2. Click Gradient
3. View vector directions pointing toward steepest change
To see curl behavior:
1. Enter vector field: [sin(y), x*z, t*z]
2. Click Curl
3. Watch rotation effects update with time
Troubleshooting
Here are common issues and solutions:
Issue Cause Solution
App doesn't start Outdated MATLAB or Use R2021b+ and install
missing toolbox Symbolic Math Toolbox
Blank graph Incorrect expression Use symbolic variables
format like x, y, z, t
Time button has Field doesn’t depend Ensure t appears in your
no effect on t expression
Buttons GUI error or crash Restart MATLAB and reopen
unresponsive app
Symbolic error Wrong input format Avoid undefined variables or
syntax mistakes
20
FAQs:
FAQ 1: Can I use trigonometric or exponential functions in my input?
Answer: Yes, functions like sin(x+t), exp(y), log(z)are fully supported.
FAQ 2: Why do I see zero vectors in the plot?
Answer: The field might be evaluated at a point where all vector
components are zero. Try adjusting the time or the input expression.
FAQ 3: Can this app be used for 2D vector fields?
Answer: The app is optimized for 3D analysis, but you can simulate 2D by
keeping one variable constant (e.g., z = 0).
5.3 Google Drive Link
https://drive.google.com/drive/folders/1bRUB2zxay86uS-
X3sk6MOkDXggZmz-oL?usp=sharing
21
6. Outcome:
The successful completion of this project resulted in a fully functional and
interactive MATLAB App that enables users to compute and visualize key
vector calculus operations—divergence, curl, and gradient—on time-dependent
vector fields. The app allows users to input symbolic expressions for the x, y,
and z components of a vector field, along with time variation, and generates
corresponding symbolic and numerical results.
One of the most impactful outcomes of the project is the integration of a real-
time animation system. Users can play, pause, and step through the time
evolution of the vector field and its derivative fields, gaining an intuitive
understanding of how these quantities change over space and time. This
dynamic interaction significantly enhances conceptual clarity compared to
static plots or manual computations.
Key outcomes of the project include:
• A user-friendly GUI-based MATLAB application built using App Designer.
• Accurate symbolic computation of divergence, curl, and gradient using
MATLAB's symbolic math toolbox.
• 3D vector field visualization with quiver plots for all operations.
• An interactive animation module that lets users explore time-dependent behavior
with control over playback.
• Enhanced understanding of spatio-temporal field dynamics for educational and
research purposes.
Overall, the app serves as a valuable learning tool for students and researchers,
providing both analytical and visual insights into dynamic vector fields. It can
be further extended in the future to include surface/volume integration, user-
defined domains, or even support for partial differential equation (PDE)-based
vector fields
22
7. References:
Matlab Documentations
https://www.mathworks.com/matlabcentral/fileexchange/7921-
3d-vector-field-simulator-gui
https://math.libretexts.org/Bookshelves/Calculus/
Vector_Calculus_%28Corral
%29/04%3A_Line_and_Surface_Integrals/
4.06%3A_Gradient_Divergence_Curl_and_Laplacian?
23