# Using Built-in FunctionsΒΆ

Matlab comes preloaded with many built-in functions that are very easy to use. For a complete list of functions, see Matlab Functions List

• To use a function, type the name of the function in the command window followed by a parentheses. After the parentheses you can list the input arguments, which are seperated by comma’s. After you have entered the input arguments, close the expression with a parenthesis.

• Function inputs can range from one to many, and the some even take vectors or matrices as inputs.

• Matlab also has built-in matrix functions that come in very handy. We will explore some of the more common ones below.

• Our first example involves the use of the cosine function. The cosine function can take a vector or matrix of inputs and produces a vector or matrix of outputs. Remember, a matrix can also be a scalar matrix

• Let’s start by creating an input vector A and matrix B. We would like A to range from $$0$$ to $$2 \pi$$ by $$\frac{\pi}4$$. Let’s make B a (3 x 3) matrix with randomly assigned integers using the magic() function

• We can now use our input vector and matrix to get an output vector and matrix using the cosine function:
• Let’s try the same thing using the exponent function:

• There are many matrices that are used on a regular basis. Four of them are the identity matrix, a matrix full of zeros, a matrix full of ones, and a matrix full of NaN (Not a Number). The first input argument in each of the functions that create these matrices is the number of rows to create, while the second input is the number of columns you would like. We create an assortment of combinations below using these handy functions.