EMP 4301/5301
Computational Methods For Engineers
A presentation of the fundamental numerical techniques used in engineering, including solution of systems of linear and nonlinear equations, interpolation and curve-fitting, solution of ordinary and partial differential equations. In addition to the methods, the course teaches best practices and the philosophy of computation and visualization. With this course, the student will be able to do root-finding, curve fitting, optimization, solve differential equations, and visualize the results.
(PDF) Course Syllabus
Course Materials
Assignments
- (PDF) Homework 1 — Learn MATLAB (due 25 Jan 2023)
- (PDF) Homework 2 — MATLAB & Uncertainty (due 1 Feb 2023)
- (PDF) Homework 3 — Linear Algebra (due 8 Feb 2023)
- (PDF) Homework 4 — Root Finding (due 20 Feb 2023)
- (PDF) Homework 5 — Curve Fitting & Interpolation (due 27 Feb 2023)
- (PDF) Homework 6 — Numerical Integration (due 6 Mar 2023)
- (PDF) Homework 7 — Numerical Differentiation (due 20 Mar 2023)
- (PDF) Homework 8 — 1D Derivative Matrices (due 27 Mar 2023)
- (PDF) Homework 9 — Solving 1D Problems (due 3 Apr 2023)
- Homework 10 — Transmission Line Analysis
Final Project
Presentations will be given during the final exam period, Friday 12 May 2023 at 1:00pm. All documents, media, codes, and other electronic files must be submitted to the course instructor no later than 24 hours prior to your presentation.
Help
Course Topics
Topic 0 — Course Information & Graphics
Topic 1 — Numerical Errors in Computation
Topic 2 — MATLAB
Lectures & Notes
- MATLAB Basics
- Generating Professional Graphics
- Building Geometries into Arrays
- (PDF) (Video) Lecture 2a — Introduction & Grid Setup
- (PDF) (Video) Lecture 2b — Meshgrids
- (Video) MATLAB Session 2.3 — Rectangles & the Centering Algorithm
- (Video) MATLAB Session 2.4 — Bars & Rectangles via Linear Meshgrids
- (Video) MATLAB Session 2.5 — Lines & Fills via Linear Meshgrids
- (Video) MATLAB Session 2.6 — Circles & Ellipses via Radial Meshgrids
- (Video) MATLAB Session 2.7 — Pie Wedges via Azimuthal Meshgrids
- (Video) MATLAB Session 2.8 — Boolean Operations
- (Video) MATLAB Session 2.9 — Coordinate Rotations
Supplemental Information
- (Book) Electromagnetic and Photonic Simulation for the Beginner: Finite-Difference Frequency-Domain in MATLAB — Chapter 1 covers meshgrids, building geometries into arrays, and data visualization.
Old Lectures
Topic 3 — Linear Algebra
Topic 4 — Root Finding
Topic 5 — Curve Fitting & Interpolation
Lectures & Notes
- (PDF) (Video) Lecture 5a — Introduction to Curve Fitting
- (PDF) (Video) Lecture 5b — Linear Regression
- (PDF) (Video) Lecture 5c — Nonlinear Regression
- (PDF) (Video) Lecture 5d — Nonlinear Regression Examples
- (PDF) (Video) Lecture 5e — Polynomial Fitting & Interpolation
MATLAB Sessions
- (Video) MATLAB Session — Making a Line Fitting Problem
- (Video) MATLAB Session — Solving a Line Fitting Problem
- (Video) MATLAB Session — Visualizing a Line Fitting Problem
Implementation of the Algorithms in MATLAB
- ($$$) Implementation of Curve Fitting in MATLAB
This short course shows and explains every single line of code in MATLAB to implement linear regression, nonlinear regression, and polynomial fitting.
Topic 6 — Numerical Integration & Differentiation
Lectures & Notes
- Numerical Integration
- Finite-Difference Approximations
- Numerical Differentiation
MATLAB Sessions
- Numerical Integration
- Numerical Integration — Convergence
- Finite-Differences
- (Video) – MATLAB Session – Deriving finite-difference approximations using Symbolic Toolbox in MATLAB
Supplemental Information
- (Book) Electromagnetic and Photonic Simulation for the Beginner: Finite-Difference Frequency-Domain in MATLAB — Chapter 3 covers finite-difference approximations, deriving finite-difference approximations, boundary conditions, plenty of examples, and more.
Topic 7 — Finite-Difference Method
Lectures & Notes
- One-Dimensional Finite-Difference Method
- Application #1 — Slab Waveguide Analysis
- Two-Dimensional Finite-Difference Method
- Application #2 — Transmission Line Analysis
- Time-Domain Finite-Difference Method
Supplemental Information
- (Book) Electromagnetic and Photonic Simulation for the Beginner: Finite-Difference Frequency-Domain in MATLAB — Chapter 3 covers derivative matrices, incorporating boundary conditions, multiple variables, staggered grids, and has examples of solving differential equations for single and multiple variables.
Implementation of the Algorithms in MATLAB
- Course Related Implementations
- ($$$) Implementation of 1D Finite-Difference Method in MATLAB
This short course shows and explains every single line of code in MATLAB to implement the 1D finite-difference method in MATLAB. The course includes coding fdder1d(), a tester function to verify fdder1d() as well as using it to solve an example problem. - ($$$) Implementation of Simple Finite-Difference Analysis of Transmission Lines in MATLAB
See every line of MATLAB code typed and explained to analyze transmission lines. By the end, you will have developed a fully functional program that that can analyze both balanced and unbalanced transmission lines. The course includes programming TLDER() and develops to different codes to analyze a microstrip transmission line (unbalanced line) and a differential pair (balanced line).
- ($$$) Implementation of 1D Finite-Difference Method in MATLAB
- Other Implementations
- Electromagnetic and Photonic Simulation for the Beginner: Finite-Difference Frequency-Domain in MATLAB
Perfect book to get started in computational electromagnetics. Includes theory, derivations, and all MATLAB codes for simulating waveguides, transmission liens, diffraction gratings, guided-mode resonance filters, frequency selective surfaces, metamaterials, metasurfaces, invisibility cloaks, surface waves and others. - ($$$) One-Dimensional FDTD with MATLAB
Having trouble getting started? This is a complete online course intended for the complete beginner. It covers every detail of FDTD in simple terms and with high quality visualizations. In addition, all of the code is presented and explained to implement the FDTD method in MATLAB. - ($$$) Two-Dimensional FDTD with MATLAB
Having trouble getting started? This is a follow-on to the prerequisite course 1D-FDTD that is intended for the complete beginner. The course covers every detail of FDTD in simple terms and with high quality visualizations. In addition, all of the code is presented and explained to implement the FDTD method in MATLAB. - ($$$) Implementation of Finite-Difference Analysis of Waveguides in MATLAB
See every line of MATLAB code typed and explained to perform rigorous analysis of waveguides. By the end, you will have developed a fully functional program that calculates hybrid modes in waveguides. It will be easy to customize the code to analyze any waveguide. The course includes line-by-line explanation of YEEDER2D() and the finite-difference analysis program for both rigorous analysis and quasi-vectorial analysis. - ($$$) Implementation of 1D FDTD in MATLAB
See every line of MATLAB code typed and explained. By the end, you will have developed a fully functional 1D FDTD simulation that calculates and displays reflectance and transmittance from a device and animates the field interacting with the device. This course only contains the codes and does not explain or derive the FDTD method. - ($$$) Implementation of Basic 2D FDTD with UPML
This course types and explains every line of code in MATLAB to implement a 2D FDTD algorithm that incorporates a UPML. The code is developed in six steps and includes graphical visualization of the fields being simulated. - ($$$) Simulating Periodic Structures Using 2D FDTD in MATLAB
This course builds on the previous course to simulate periodic structures. A diffraction grating is used as the device example and the course describes how to calculate steady-state fields, calculate diffraction efficiencies, and reflectance and transmittance. The course ends by showing how to post-process the data and display the results in a professional plot.
- Electromagnetic and Photonic Simulation for the Beginner: Finite-Difference Frequency-Domain in MATLAB
Topic 8 — Optimization
Lectures & Notes
- Introduction to Optimization and the Merit Function
- Single Variable Optimization
- Multi-Variable Optimization
Animations from Notes
- (Animation) – Steepest Ascent with alpha = 0.5 (too large)
- (Animation) – Steepest Ascent with alpha = 0.1 (good choice)
- (Animation) – Steepest Ascent with alpha = 0.01 (too small)
- (Animation) – Golden-section search
Supplemental Information
Topic 9 — Bonus Material
Fast Fourier Transforms and Cool Applications
- About Fourier Transforms and the FFT
- Applications of the FFT
- (PDF) (Video) Lecture 9d — Calculating Fourier Series Coefficients Using the FFT
- (PDF) (Video) Lecture 9e — Calculating & Displaying Frequency Plots
- (PDF) (Video) Lecture 9f — Numerical Differentiation Using the FFT
- (PDF) (Video) Lecture 9g — Calculating Discrete Convolutions Using the FFT
- (PDF) (Video) Lecture 9h — Generating Low Frequency Noise Using the FFT
- (PDF) (Video) Lecture 9i — Designing Kinoforms Using the FFT
Other Resources
Internet Resources
- numerica-methods.com — Website devoted to various numerical methods.
Open Source Software
Computation
- GNU Octave — Open source alternative to MATLAB.
Desktop Publishing
- LIbreOffice — Open source alternative to Microsoft Office.
Graphics
Course Resources
- Download .zip file with MATLAB codes for this course.
- polyfill.p — This function creates arbitrary polygons on a 2D array given the list of vertices around the perimeter of the polygon.
- polyfill_demo.m — This MATLAB program demonstrates the use of polyfill() to create an arbitrary polygon on a 2D grid.
- klingon.mat — A MATLAB data file containing samples of a signal intercepted from Klingons.
- crazyfunc.p — A crazy function to integrate!
- hw6func.p — A MATLAB function used in Homework #6.
- test_tlder.p — In Homework #10a you are required to write the MATLAB function tlder() which builds derivative matrices across a staggered 2D grid. This MATLAB program test_tlder.p calls your tlder() function hundreds of times with different input arguments to test all of the features.
- stlder.p — This works just like tlder(), but it only generates derivative matrices for small grids. It is provided to help you troubleshoot your tlder() function by providing correct answers.
- weirdfunc.p — A weird function used in a MATLAB session for root finding.
- ash.p — A strange and erratic function cursed by the Egyptian Gods. Beware!
- simbartemp.p — Simulates the temperature across a functionally-graded ceramic bar.
- hw10a_checker.p — This function checks the output of your code for Homework 10a. Install it in your working MATLAB directory. Run your code and then run this.Note: The above items are protected function files and have a “.p” extension. They work just like “.m” files, but they cannot be opened to view the code inside them.