Zero to MATLAB



Book Details
Author | Adam L. Lambert |
Publisher | Oregon State University |
Published | 2025 |
Edition | 1 |
Paperback | 151 pages |
Language | English |
License | Creative Commons Attribution-NonCommercial |
Book Description
If one is reading this, they are likely interested in solving science and engineering problems. They are also likely taking a course that requires them to learn MATLAB. They might ask themselves why they should learn to code, reasoning that if they had wanted to major in computers, they would have. The most obvious reason is that there are almost no "pencil-and-paper" problems of significant monetary value, so anyone planning to make a living with their degree will need to be able to perform complex calculations on a computer.
Some may argue that spreadsheet programs, such as MS Excel, are a better choice for engineering calculations. The author disagrees. Firstly, spreadsheet workflows scale poorly when confronted with a large number of repetitive tasks. For instance, an Excel sheet that depends on the GOALSEEK function requires that function to be called for each individual calculation. To solve the same calculation with 100 different input parameters, one would have to update those parameters and call the function - a process requiring multiple menu selections - at every single step. In a scripting language like MATLAB or Python, this process can be automated with a simple loop wrapped around an existing computation, requiring minimal effort. Importing or generating large data sets of input values is also simple. While it is possible to write macros and even script in a spreadsheet program, that process is generally not smooth and does not scale as effectively. Furthermore, by the time one learns how to do it, they could have just used a dedicated scripting language and reaped its additional benefits.
Once an individual learns the basic syntax of a scripting language like MATLAB, a wide range of other options becomes available. They can connect MATLAB to a variety of laboratory equipment using National Instruments hardware, allowing for the automation of data collection and the implementation of process controls. They can even build custom hardware interfaces using Arduino microcontrollers. One can implement machine learning algorithms, create clickable, window-based tools for processing microscope images, and solve large, coupled sets of non-linear differential equations. All of this is well beyond the reach of a spreadsheet program, and each example comes directly from a real engineering project on which the author worked.
This book is available under a Creative Commons Attribution-NonCommercial license (CC BY-NC), which means that you are free to copy, distribute, and modify it, as long as you attribute the source and don't use it for commercial purposes.
If you enjoyed the book and would like to support the author, you can purchase a printed copy (hardcover or paperback) from official retailers.