Graphics Reference
In-Depth Information
We can perform the calculation of powers of a number as shown here.
>> 100 ^ 50
Ans =
1.0000e + 100
Unlike a calculator, when working with integers, MATLAB displays the exact result even when you have more
digits than would fit across the screen. MATLAB returns the exact value of 100 ^ 50 when using the vpa function
discussed in detail later in this appendix.
>> vpa ' 99 ^ 50'
Ans =
.60500606713753665044791996801256e100
To combine several operations into the same instruction you must take into account the usual criteria of priority
among them that determine the order of evaluation of the expression. See the following example:
>> 2 * 3 ^ 2 + (5-2) * 3
Ans =
27
Taking into account the priority of operators, the first to be evaluated is that of empowerment. The normal
evaluation order can be altered by grouping expressions in parentheses.
In addition to these arithmetic operators, MATLAB is equipped with a set of basic functions and the user can also
define their own functions. Both the leading embedded MATLAB functions and operators can be applied on symbolic
constants or numbers.
MATLAB can be used for arithmetic operations as if it were a conventional calculator, but with one important
difference: the precision in the calculation. Operations are performed as accurate, by specifying the user the degree
of precision, as you want. This unlimited precision in the calculation is the feature which differs to other numerical
calculation programs. MATLAB utilizes the word length that works for the computer to determine the accuracy, so it
becomes something inherent to the hardware and cannot be modified.
Search WWH ::




Custom Search