Opening the book…
The Command Window is great for quick calculations, but scripts and functions are how we turn MATLAB commands into reusable programs. In this chapter, we begin writing MATLAB programs that ask for input, perform calculations, and display meaningful output.
By the end of this chapter, you should be able to:
- Explain what an algorithm is and why algorithms are useful before writing MATLAB code.
- Create, save, run, and document MATLAB scripts.
- Use comments and help text to make scripts and functions easier to understand.
- Use input to receive numeric and text information from the user.
- Use disp and fprintf to display output in the Command Window.
- Apply formatting operators such as %d, %f, %.2f, %s, and in fprintf statements.
- Create user-defined functions with input arguments and output arguments.
- Call user-defined functions from the Command Window and from scripts.
- Use common MATLAB math functions in engineering-style calculations.
This page titled 2.1: Learning Objectives was last modified on Tue, 30 Jun 2026 02:11:44 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.
The book could not be loaded just now.