Function Introduction Exercises

by Albert Ticona Jr.

```doc functions
```

and then go under Functions-- Aphabetical list. If you're not sure, whether a function is defined as a MATLAB function, you can always find out online either www.mathworks.com or just Googling it. Commonly used ones are: sin(x), cos(x), tan(x), acos(x), asin(x), atan(x), exp(x), sind(x) ( returns the sine value for a value expressed in degrees), sqrt(x), etc. As we saw earlier display() is itself a function that displays what ever value that is placed within the parantheses. The syntax for calling any function in MATLAB is: function_name(parameter) The parameter is the input required by the function in order to return a result, which in most cases is just a number or a vector of numbers. Usually if you omit the semi-colon after the function call, the result will be displayed on the MATLAB screen. Examples of Matlab Functions:

```display(sin(pi)); % will display the sine value of pi (pi being in unit radians)
```
```ans =

1.2246e-16

```
```display(acos(1/2)); % will display the arc cosine value of 1/2
```
```ans =

1.0472

```
```display(exp(1)); % will display the value of the natural number e
```
```ans =

2.7183

```