Besides the math operators that use symbols (+, -, *, /, ^), there are other things Matlab can execute related to mathematics.
As an example, if the ^ symbol is used to take a number to a power, then a related idea is to take the square root of a number. However, there is not a specific symbol for square root the Matlab programming language can interpret.
Instead, the programming language has a built-in function which can be used to perform a square root. Rather than a symbol, the syntax requires a function name and a function input.
For instance, sqrt(9) is the command which can be used to perform the square root operation on the number 9. In this case, the function name is: sqrt. The function input is: 9.
Besides square root, there are many other common functions built in to the Matlab programming language. A table of common math functions is shown below, and many other functions can be found at this link. Several of these functions will be demonstrated on this blog.
In general, functions allow a computer to interpret a very concise command to perform many things beyond the math operator symbols.
Up to this point, we have used our programming language to execute individual commands and display the answer. The next step in programming is to have the computer store the answer in memory so it can be used again. Next, let’s look closer at how the computer is handling the result of an executed command.