Opening the book…
- 5.1: Name Collisions
- Scripts may change external variables. Functions use local variables; they can’t change external variables.
- 5.2: Defining Functions
- A function's 1st line is it's signature.
- 5.3: Function Documentation
- You should document what the function does.
- 5.4: Naming Functions
- Function names follow the same rules as variable names. Use descriptive function names.
- 5.6: Functions with Multiple Outputs
- How to create and use MATLAB/Octave functions with multiple inputs
- 5.7: Matlab Functions with No Inputs
- Functions can have outputs, even though they have no input arguments.
- 5.8: Matlab Functions with No Outputs
- How to create and use MATLAB/Octave functions with no outputs. An example of drawing a star is given. Exercises of drawing a rectangle and a triangle are given.
- 5.9: Matlab Functions with No Inputs and No Outputs
- Some functions have no inputs and no returned variables, although they may display values, change the screen, or change a plot.
- 5.10: Functions with variable numbers of inputs or outputs
- How functions with variable numbers of inputs and/or outputs work
Most of the material in this chapter comes from Downey, chapter 5 and Lambert, chapter 8.
This page titled 5: User-Defined Functions was last modified on Thu, 28 Jul 2022 16:45:54 GMT and is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Carey Smith.
The book could not be loaded just now.