I-J Square Root of Negative One
Section: Base Constants
complexvalue that represents the square root of -1. There are two functions that return the same value:
y = i
y = j.
This allows either
j to be used as loop indices. The returned value is a 32-bit complex value.
ExampleThe following examples demonstrate a few calculations with
--> i ans = 0.0000 + 1.0000i --> i^2 ans = -1.0000 + 0.0000i
The same calculations with
--> j ans = 0.0000 + 1.0000i --> j^2 ans = -1.0000 + 0.0000i
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