Complex Numbers in Matlab and Octave

Matlab and Octave have the following primitives for complex numbers:

octave:1> help j j is a built-in constant - Built-in Variable: I - Built-in Variable: J - Built-in Variable: i - Built-in Variable: j A pure imaginary number, defined as `sqrt (-1)'. The `I' and `J' forms are true constants, and cannot be modified. The `i' and `j' forms are like ordinary variables, and may be used for other purposes. However, unlike other variables, they once again assume their special predefined values if they are cleared *Note Status of Variables::. Additional help for built-in functions, operators, and variables is available in the on-line version of the manual. Use the command `help -i <topic>' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help-octave@bevo.che.wisc.edu mailing list. octave:2> sqrt(-1) ans = 0 + 1i octave:3> help real real is a built-in mapper function - Mapping Function: real (Z) Return the real part of Z. See also: imag and conj. ... octave:4> help imag imag is a built-in mapper function - Mapping Function: imag (Z) Return the imaginary part of Z as a real number. See also: real and conj. ... octave:5> help conj conj is a built-in mapper function - Mapping Function: conj (Z) Return the complex conjugate of Z, defined as `conj (Z)' = X - IY. See also: real and imag. ... octave:6> help abs abs is a built-in mapper function - Mapping Function: abs (Z) Compute the magnitude of Z, defined as |Z| = `sqrt (x^2 + y^2)'. For example, abs (3 + 4i) => 5 ...

octave:7> help angle angle is a built-in mapper function - Mapping Function: angle (Z) See arg. ...Note how helpful the ``See also'' information is in Octave (and similarly in Matlab).

[How to cite this work] [Order a printed hardcopy]

Copyright ©

Center for Computer Research in Music and Acoustics (CCRMA), Stanford University

[Automatic-links disclaimer]