MATLAB has a number of built-in functions, such as square root, sine, cosine, exponential, etc, functions. The following table gives a list of some commonly used functions. Later you will also write your own functions.
round(x) |
Rounds to the nearest integer |
floor(x) |
Rounds down to nearest integer |
ceil(x) |
Rounds up to nearest integer |
rem(y,x) |
Remainder after dividing by (eg remainder of 17/3 is 2) |
sign(x) |
Returns -1 if ; returns 0 if ; returns 1 if . |
rand or rand(1) |
Generates a random number between 0 and 1 |
exp(x) |
Exponential function  |
log(x) |
Natural logarithm function, (where ) |
sqrt(x) |
Square root function,  |
abs(x) |
Absolute value function,  |
sin(x) |
sine function  |
cos(x) |
cos function  |
tan(x) |
tan function  |