Scope of Textbook We have endeavored to include all of the necessary fundamental programming syntax and skills for a student to solve most problems they will encounter in STEM. We aimed to not only teach MATLAB syntax in this book, but inform and inspire good programming, documentation, debugging, and program planning and research practices. We believe that this will prepare students well for tackling new MATLAB functionality and building on the programming knowledge they gain from this book. A brief summary of the objectives of each module is given below.
Module 1 introduces how to interact with the MATLAB program including opening and saving m-files and its basic components like the Editor and Command Windows.
Module 2 introduces basic programming fundamentals including the concept of a variable, different data types like numbers and strings, and numeric arrays as used in the context of mathematics and MATLAB. The reader is introduced to program design with user inputs and program outputs and is encouraged to think about the beginning and the end of a program rather than just direct solutions to a problem.
Module 3 introduces how to visualize different types of data in MATLAB, which includes how to plot discrete data pairs directly as well as from discrete data generated from continuous functions. Advanced visualizations in MATLAB are covered including bar graphs and polar and 3D plots. The essential MATLAB plot properties that accompany these plots are demonstrated.
Module 4 introduces how to use MATLAB functions to conduct differentiation and integration, curve fit via interpolation and regression, solve for roots of nonlinear equations, find solutions to simultaneous linear equations, and solve ordinary differential equations.
Module 5 introduces conditions and conditional statements including the relevant Boolean logic.
Module 6 introduces tools for program design and communication including pseudocode and flowcharts. Tips for program design and communication are also provided.
Module 7 introduces user-defined functions where readers are shown how to write their own custom functions. Tips on how to consider the user of a function are also given.
Module 8 introduces loops and provides thorough coverage of the topic. Many different cases are covered including use of matrices and loops together and the obligatory summing, searching and sorting. Other examples include implementing recursive formulas and approximating mathematical functions using infinite series.
Module 9 introduces interacting with external files and directories. Methods for reading from and writing to text and Excel files are given. Applications demonstrating how to interact with data, once it has been read into MATLAB, are also provided.
Appendix A provides a primer on linear algebra which describes fundamental matrix operations used in programming such as addition, multiplication, inverse, and many more. Special types of matrices, such as symmetric, diagonally dominant, identity and several more are also defined.
Appendix B contains a set of mini-projects that thoughtfully provide additional practice to the student. Relevant modules are noted at the beginning of each mini-project for easy reference.
Appendix C demonstrates how to animate 2D and 3D plots and data in MATLAB.
Tips on Using the Book for Instructors
For this edition, the textbook was intentionally rearranged into nine modules with a total of 42 lessons. The textbook will appeal to schools ranging from where programming is introduced to freshmen in a first-year engineering design course to those who have a full-fledged 3-credit hour course dedicated to programming at a higher level. The intention is that the instructor would choose the lessons that are appropriate in each module for their students based on the course level and effort. Our recommendation for courses, such as Numerical Methods with Programming or Engineering Analysis, where programming is instead introduced as one of several topics, would be to safely skip the following lessons: Lessons 3.3, 4.3 to 4.9, 8.6, 9.1 to 9.3.
At the end of most lessons, there is a multiple-choice question quiz and a set of exercises. You should encourage students to finish both problem sets. The course works well by assigning a set of mini-projects deliverable every other week, and these have been included in the end of lesson exercises as well as in Appendix B.
Students Program Submissions We have included instructions on publishing m-files in Lesson 1.7. We have found it very helpful for students to include a published version of their program. This is for three main reasons: 1) it reduces the number of m-files that need to be run while grading, 2) the outputs are immediately shown after the appropriate code, which is helpful to both the grader and the student, and 3) it encourages students to review the output of each submitted problem.