Matlab contains a number functions for performing computations, there are give in the tables below:
Function | Description |
---|---|
abs(x) sqrt(x) round(x) fix(x) floor(x) ceil(x) sign(x) rem(x,y) exp(x) log(x) log10(x) |
Computes the absolute value of x. Computes the square root of x. Rounds x to the nearest integer. Rounds (or truncates) x to the nearest integer toward 0. Rounds x to the nearest integer toward –∞. Rounds x to the nearest integer toward ∞. Returns a value of –1 if x is less than 0, a value of 0 if x equals 0, and a value of 1 otherwise. Returns the remainder of x/y. for example, rem(25, 4) is 1, and rem(100, 21) is 16. This function is also called a modulus function. Computes ex, where e is the base for natural logarithms, or approximately 2.718282. Computes ln x, the natural logarithm of x to the base e. Computes log10 x, the common logarithm of x to the base 10. |
Function | Description |
---|---|
exp(x)
log(x)
log10(x)
sqrt(x)
|
Exponential (ex) Natural logarithm Base 10 logarithm Square root |
Table 3: Trigonometric and hyperbolic functions
Function |
Description |
sin(x)
cos(x) tan(x) asin(x) acos(x) atan(x) atan2(y,x) sinh(x) cosh(x) tanh(x) asinh(x) acosh(x) atanh(x) |
Computes the sine of x, where x is in radians.
Computes the cosine of x, where x is in radians. Computes the tangent of x, where x is in radians. Computes the arcsine or inverse sine of x, where x must be between –1 and 1. The function returns an angle in radians between –π/2 and π/2. Computes the arccosine or inverse cosine of x, where x must be between –1 and 1. The function returns an angle in radians between 0 and π. Computes the arctangent or inverse tangent of x. The function returns an angle in radians between –π/2 and π/2. Computes the arctangent or inverse tangent of the value y/x. The function returns an angle in radians that will be between –π and π, depending on the signs of x and y. Computes the hyperbolic sine of x. Computes the hyperbolic cosine of x. Computes the hyperbolic tangent of x. Computes the inverse hyperbolic sine of x. Computes the inverse hyperbolic cosine of x. Computes the inverse hyperbolic tangent of x. |
Table 4: Round-off functions
Function |
Description |
Example |
round(x) |
Round to the nearest integer
. |
>> round(20/6)
ans = 3 |
fix(x) |
Round towards zero
. |
>> fix(13/6)
ans = 2 |
ceil(x) |
Round towards infinity
|
>> ceil(13/5)
ans = 3 |
floor(x) |
Round towards minus infinity
|
>> floor(–10/4)
ans = –3 |
rem(x,y) |
Returns the remainder after x is divided by y
|
>> rem(14,3)
ans = 2 |
sign(x,y) |
Signum function. Returns 1 if x > 0, –1 if x < 0,
and
0 if x = 0.
|
>> sign(7)
ans = 1 |
Table 5: Complex number functions
Function |
Description |
conj(x)
angle(x) real(x) imag(x) abs(x) |
Computes the complex conjugate of the complex number x. Thus,
if
x is equal to a + ib, then conj(x) will be equal to a – ib.
Returns
the phase angles, in radians, for each element of complex array Z.
Computes the real portion of the complex number x.
Computes the imaginary portion of the complex number x. Computes the angle using the value of atan2(imag(x), real(x)); thus, the angle value is between –π and π. |
0 comments:
Post a Comment