Engineering Fundamentals: An Introduction to Engineering, 4th ed.c

(Steven Felgate) #1

15.2 Using MATLAB Built-in Functions 471


On the last command line, note that the three periods ...(an ellipsis) represents a
continuation marker in MATLAB. The ellipsis means there is more to follow on this command
line. Note the use of fprintfand dispcommands. The final result for Example 14.2
(Revisited) is shown in Figure 15.5.

15.2 Using MATLAB Built-in Functions


MATLAB offers a large selection of built-in functions that you can use to analyze data. As we
discussed in the previous chapter, by built-in functions we mean standard functions such as
the sine or cosine of an angle, as well as formulas that calculate the total value, the average value,
or the standard deviation of a set of data points. The MATLAB functions are available in var-
ious categories, including mathematical, trigonometric, statistical, and logical functions. In this
chapter, we will discuss some of the common functions. MATLAB offers a Help menu that you
can use to obtain information on various commands and functions.
The Help button is marked by a question mark ?located to the left of the current folder.
You can also type helpfollowed by a command name to learn how to use the command.
Some examples of commonly used MATLAB functions, along with their proper use and
descriptions, are shown in Table 15.7. Refer to Example 15.2 when studying Table 15.7.

Example 15.2 The following set of values will be used to introduce some of MATLAB’s built-in functions.
Mass [102 115 99 106 103 95 97 102 98 96]. When studying Table 15.7, the results
of the executed functions are shown under the “Result of the Example” column.
More examples of MATLAB’s Functions are shown in Table 15.8.

■Figure 15.5 The commands and result for Example 14.2 (Revisited).


Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).

圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀

Free download pdf