Chapter 10. Function M-files

We have already seen that MATLAB has a number of built-in (compiled) functions, such as sin, sqrt, and sum. You can verify that they are built-in by attempting to type them. Try type sin. MATLAB also has some functions in the form of function M-files, such as fzero and why. You can see what’s in them with type (e.g., type why).

MATLAB enables you to create your own function M-files. A function M-file is similar to a script file in that it also has an .m extension. However, it differs from a script file in that it communicates with the MATLAB workspace only through specially designated input and output ...

Get Essential MATLAB for Engineers and Scientists Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.