Section: Base Constants
complex value that represents the square root of -1. There are two
functions that return the same value:
y = i
and
y = j.
This allows either i or j to be used as loop indices. The returned value is a 32-bit complex value.
i.
--> i
ans =
0.0000 + 1.0000i
--> i^2
ans =
-1.0000 + 0.0000i
-->
quit
The same calculations with j:
--> j
ans =
0.0000 + 1.0000i
--> j^2
ans =
-1.0000 + 0.0000i
-->
quit
Here is an example of how i can be used as a loop index and then recovered as the square root of -1.
--> accum = 0; for i=1:100; accum = accum + i; end; accum
ans =
5050
--> i
ans =
100
--> clear i
--> i
ans =
0.0000 + 1.0000i
-->
quit