Initial Publication Date: October 3, 2017

Teaching MATLAB in Numerical Analysis for Beginner Users

Mahmud Akelbek, Weber State University

Numerical Analysis (MATH 4610) at Weber State University is a three credit course. Most of the students who took the course are math major students. There are also double major students who majored also in engineering, computer science or physics. Students' background with programming in any computer language were very diverse. There were students who are taking upper level programming classes in computer science, and there were also students who has only basic knowledge in Mathematica.

Considering the diverse background on student's knowledge with programming, I started from the very basic step in MATLAB. I used hybrid approach for teaching MATLAB section of this course.

Students are assigned to read and watch useful MATLAB introduction videos and contents online in advance.

Some of the links I provided to my students are:

Getting started with MATLAB (Mathworks)

Introduction to MATLAB (MIT Open Courseware)

Introduction to MATLAB (Mathworks Video and Webinar)

Students are also provided with weekly handouts about different contents in MATLAB and some practice assignment problems that needs to be submitted as we progress. Every Friday's class assigned as computer lab. During this time, I did a short lecture and review the basic MATLAB contents, then students are asked to do some practice problems together in groups.

Introduction to MATLAB part consists of the following contents:

Basic concepts: In this part, I introduced Matlab desktop environment, entering commands, access online help, recognize the various Matlab windows, different variables, and assignment statements, built-in functions etc.
Vectors and Matrices. In this section we learned creating and manipulating vectors and matrices, array operations and matrix operations. matrix generation, sub-matrix, special matrices, matrix operations, solving linear equations.
Matlab programming and scripts. This section includes simple input and output, and commenting. Scripts are used to create and customize simple plots, and to do file input and output. Students are also asked to write some simple M-functions: for example, write an M-function that calculates the factorial of a given positive integer. calculate the nth fibonacci number etc.
Logical expression. We introduced the use of logical expression "if", "else" and "elseif". The switch statement is also introduced.
Loops. "for....end" loop, "while...end" loop, difference between " break" and "continue" statement.

Once the students learned the basic steps of Matlab and some simple programming techniques, students assigned to do programming or use some of the available programming for different algorithms in Numerical analysis.

The book that we used for Numerical Analysis course has a course website that contains C, Fortran, Java, Maple, Mathematica and Matlab programs for each algorithm. Every program is illustrated with simple problem that is closely correlated to the text. Students can run the program and see the form of the input and output, then the program can be modified for other assignment problems by making minor changes. This greatly helped students with their confidence to tackle given assignment problems. Whenever there is a need to use new built-in functions or new commands, I put up some helpful tips on our course website. The helpful tips include a short introduction about the new built-in functions or new commands, and a couple of simple examples that contain them.

Some common problems that came up doing programming for the assigned problems: whenever students had hard time to understand or doing programming for some of the algorithms, they tried to do the algorithm step by step by hand, which is not very efficient way to do the problem. Another problem is one algorithm is done in couple of different parts.

Once the homework problems were graded, I pointed out some of the common mistakes and shared some of the best student programmings on the course website under permission from students.

This is the first time that I taught this course. There are still are lot of things needs to be improved. I hope, by attending the Teaching Computation in the Science using MATLAB workshop, I will be able to learn new techniques and new teaching pedagogy from other colleagues from different subjects and will apply those knowledge for my future courses.