complex arithemtic
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
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.
argument x | any complex type |
---|---|
result r | same complex type as x |
r=cr2p(xc) |
... convert from cartesian format (real, imaginary) to polar (length, phase) |
r=cp2r(xc) |
convert from polar (length, phase) to cartesian format (real, imaginary) |
- 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
cr2p
Convert Cartesian coordinates to Polar coordinates
Usage:
cr2p(xC)
Return Type:
like xC
complex numbers