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

(Steven Felgate) #1

472 Chapter 15 MATLAB


TABLE 15.8 More Examples of MATLAB Functions


Function Description of the Function


sqrt(x) Returns the square root of valuex.
factorial(x) Returns the value of factorial ofx.For example, factorial(5) will return:
(5)(4)(3)(2)(1) 120.

Trigonometric Functions
acos(x) This is the inverse cosine function ofx.It is used to determine the value
of an angle when its cosine value is known.
asin(x) This is the inverse sine function ofx.It is used to determine the value of
an angle when its sine value is known.
atan(x) This is the inverse tangent function ofx.It is used to determine the value
of an angle when its tangent value is known.

Exponential and Logarithmic Functions
exp(x) Returns the value ofex.
log(x) Returns the value of the natural logarithm ofx.Note thatxmust be
greater than 0.
log10(x) Returns the value of the common (base 10) logarithm ofx.
log2(x) Returns the value of the base-2 logarithm ofx.

TABLE 15.7 Some MATLAB Functions that You May Use in Engineering Analyses


Function Description of the Function Example Result of the Example


sum It sums the values in a given array. sum(Mass) 1013
mean It calculates the average value of mean(Mass) 101.3
the data in a given array.
max It determines the largest value in max(Mass) 115
the given array.
min It determines the smallest value in min(Mass) 95
the given array.
std It calculates the standard deviation std(Mass) 5.93
for the values in the given array.
sort It sorts the values in the given sort(Mass) 95 96 97 98 99 102
array in ascending order. 102 103 106 115
pi It returns the value of p, pi 3.14151926535897...
3.14151926535897...
tan It returns tangent value of the tan(pi/4) 1
argument. The argument must be
in radians.
cos It returns cosine value of the cos(pi/2) 0
argument. The argument must be
in radians.
sin It returns sine value of the argument. sin(pi/2) 1
The argument must be in radians.

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