next up previous
Next: Array operations and manipulations Up: MATLAB summary Previous: MATLAB variables

Special constants


>> pi
ans =
   3.14159265358979
>> eps
ans =
     2.220446049250313e-16
Here the very small number eps is used as the default tolerance by a number of MATLAB routines. Therefore, avoid using it for some different purpose in your own codes.
>> a=1+i      
a =
   1.0000 + 1.0000i
>> b=1-2i
b =
   1.0000 - 2.0000i
>> a*b
ans =
   3.0000 - 1.0000i
>>
Here i (or j) is used as the square root of minus one, and MATLAB computations are all carried out using complex arithmetic, where necessary. Again, it is sensible to avoid using these symbols for other purposes, such as for-loop counters.


Charlie Macaskill
Fri Mar 5 16:05:28 EST 1999

Copyright © University of Sydney 2003