Initial Publication Date: September 16, 2021

# MATLAB as a Tool for Undergraduate Numerical Analysis

Jongmin Shim, Civil, Structural, and Environmental Engineering, University at Buffalo

I have been teaching a numerical method course for undergraduates for the last seven years. The class covers basic MATLAB syntax, numerical root finding, curve-fitting/interpolation, numerical differentiation/integration, and ordinary differential equations. The course is not mandatory, so the typical class size has been quite small, only 10-20 students. Juniors take the majority of the enrollment, and they are quite new to numerical analysis and have little experience in MATLAB (or programming languages).

Before every class, I upload all the PowerPoints slides and MATLAB example codes that I cover in class. After explaining the fundamental concepts in PowerPoint slides, most MATLAB example codes are explained line-by-line. Then, I ask students in the class to revise the example codes to solve slightly modified problems. Since the class size is rather small, I have been able to handle all the specific questions and error messages. During in-person class, I usually take the laptop computer of students who are having a hard time fixing MATLAB error messages, and debug the error messages that are projected to the class screen. Students find this direct interaction very useful for them to be engaged in the class. However, I was not able to do the same procedure during online class since I was not able to take the control of the MATLAB codes of students for debugging. Instead, I had to use extra office hours (typically, right after class) to debug students' codes. In addition, I also find that this approach may not be effective for classes having large enrollments, which may be the case in the future.

As one of the class term projects, I adopt the Direct Stiffness Method for structural analysis, which is a very useful numerical technique in structural engineering. The development of Direct Stiffness Method codes requires a wide range of programming/numerical skills, such as I/O handling, solving the system of linear equations, numerical integration, post-processing in figures, etc. To help students complete the project, I dissect the problem into five subproblems. Then, students can use and combine the codes from the five subproblems to construct a free-standing code for the Direct Stiffness Method. Many students told me that this term project was very useful for them to understand how structural analysis can be numerically implemented. I find that MATLAB is an excellent tool to serve this purpose.