Programmer Guide/Command Reference/EVAL/complex arithmetic: Difference between revisions

From STX Wiki
Jump to navigationJump to search
(Created page with '{{DISPLAYTITLE:complex arithemtic}} Because the current version of the {{STX}} EVAL command do not support a complex data type, a pack…')
 
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:complex arithemtic}}
{{DISPLAYTITLE:complex arithemtic}}
Because the current version of the {{STX}} [[Programmer_Guide/Command_Reference/EVAL|EVAL command]] do not support a complex data type, a package of functions is used to implement arithmetic and special handling for [[Programmer_Guide/Command_Reference/EVAL#complex numbers|complex numbers].
Because the current version of the {{STX}} [[Programmer_Guide/Command_Reference/EVAL|EVAL command]] do not support a complex data type, a package of functions is used to implement arithmetic and special handling for [[Programmer_Guide/Command_Reference/EVAL#complex numbers|complex numbers]].
 
Note:
* A numerical object containing '''N x M''' complex numbers (N>=1, M>=1), consists of 2N rows and M columns, because each complex number uses two cells of a row.
* If a numerical object containing '''N x M''' complex numbers, is converted element-wise to real numbers, the resulting object consists of N rows and M columns.
 
<sub>real</sub>
<sub>imag</sub>
<sub>length</sub>
<sub>phase</sub>
 
{| class="einrahmen"
! usage !! description !! arguments !! data type of ''r''
| '''<code>''r'' = cr2p(''x'')</code>'''
| convert from cartesian (''x''<sub>real</sub>, ''x''<sub>imag</sub>) to polar format (''x''<sub>length</sub>, ''x''<sub>phase</sub>)
| ''x'' ... any complex type
| same type as ''x''
|-
|}
 
:;<var>xc</var>: a complex scalar, vector or matrix in cartesian format (real part, imaginary part)
;Result: same type as ''xc'', but the complex numbers are stored in the polar format (length, phase)
 
;Usage: '''<code>cp2r(<var>xc</var>)</code>''' ... convert from polar to cartesian format
:;<var>xc</var>: a complex scalar, vector or matrix in polar format (length, phase)
;Result: same type as ''xc'', but the complex numbers are stored in the cartesian format (real part, imaginary part)
 
;Usage: '''<code>cr2len(<var>xc</var>)</code>''' ... convert cartesian format to length (amplitude)
:;<var>xc</var>: a complex scalar, vector or matrix in polar format (length, phase)
;Result: same type as ''xc'', but the complex numbers are stored in the cartesian format (real part, imaginary part)
 


;Usage: '''<code>cr2p(<var>xc</var>)</code>'''
:;<var>xc</var>: a [[Programmer_Guide/Command_Reference/EVAL#complex numbers|complex number, vector or matrix] in cartesian format (re, im)
r with same length as ''x'' containing the converted window function
r with same length as ''x'' containing the converted window function



Revision as of 11:19, 7 April 2011

Because the current version of the STx EVAL command do not support a complex data type, a package of functions is used to implement arithmetic and special handling for complex numbers.

Note:

  • A numerical object containing N x M complex numbers (N>=1, M>=1), consists of 2N rows and M columns, because each complex number uses two cells of a row.
  • If a numerical object containing N x M complex numbers, is converted element-wise to real numbers, the resulting object consists of N rows and M columns.

real imag length phase

usage description arguments data type of r r = cr2p(x) convert from cartesian (xreal, ximag) to polar format (xlength, xphase) x ... any complex type same type as x
xc
a complex scalar, vector or matrix in cartesian format (real part, imaginary part)
Result
same type as xc, but the complex numbers are stored in the polar format (length, phase)
Usage
cp2r(xc) ... convert from polar to cartesian format
xc
a complex scalar, vector or matrix in polar format (length, phase)
Result
same type as xc, but the complex numbers are stored in the cartesian format (real part, imaginary part)
Usage
cr2len(xc) ... convert cartesian format to length (amplitude)
xc
a complex scalar, vector or matrix in polar format (length, phase)
Result
same type as xc, but the complex numbers are stored in the cartesian format (real part, imaginary part)


r with same length as x containing the converted window function


See also
window, fft

<function list>


cr2p

Convert Cartesian coordinates to Polar coordinates

Usage:

cr2p(xC)

Return Type:

like xC


complex numbers

Navigation menu

Personal tools