Function M-files
Abstract
The objective of this chapter is to enable you to write your own function M-files. We have already seen that MATLAB has a number of built-in (compiled) functions, e.g., sin, sqrt, sum. You can verify that they are built-in by attempting to type them. Try type sin for example. MATLAB also has some functions in the form of function M-files, e.g., fzero, why. You can see what's in them with type, e.g., type why. Functions are indispensable when it comes to breaking a problem down into manageable logical pieces. Hence, 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, a function M-file differs from a script file ...
Get Essential MATLAB for Engineers and Scientists, 6th 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.