
MATLAB has all of the usual mathematical functions found on a scientific calculator including square root, logarithm, and sine.
IMPORTANT: Typing pi returns the number 3.1416. To find the sine of pi, type in sin(pi) and press enter.
IMPORTANT: The arguments in trigonometric functions are in radians. Multiply degrees by pi/180 to get radians. For example, to calculate sin(90), type in sin(90*pi/180).
WARNING: In MATLAB log returns the natural logarithm of the value. To find the ln of 10, type in log(10) and press enter, (ans = 2.3026).
WARNING: MATLAB accepts log10 for common (base 10) logarithm. To find the log of 10, type in log10(10) and press enter, (ans = 1).
Practice the following examples to familiarize yourself with the common mathematical functions. Be sure to read the relevant help and doc pages for functions that are not self explanatory.
- 瀏覽次數:1676