CORDIC-based phase angle
theta = cordicangle(c)
theta = cordicangle(c,niters)
Matrix of complex numbers
Phase angle for double-valued input and for fixed-point-valued input.
dblRandomVals = complex(rand(5,4), rand(5,4)); theta_dbl_ref = angle(dblRandomVals); theta_dbl_cdc = cordicangle(dblRandomVals) fxpRandomVals = fi(dblRandomVals); theta_fxp_cdc = cordicangle(fxpRandomVals) theta_dbl_cdc = 1.0422 1.0987 1.2536 0.6122 0.5893 0.8874 0.3580 0.2020 0.5840 0.2113 0.8933 0.6355 0.7212 0.2074 0.9820 0.8110 1.3640 0.3288 1.4434 1.1291 theta_fxp_cdc = 1.0422 1.0989 1.2534 0.6123 0.5894 0.8872 0.3579 0.2019 0.5840 0.2112 0.8931 0.6357 0.7212 0.2075 0.9819 0.8110 1.3640 0.3289 1.4434 1.1289 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13
CORDIC is an acronym for COordinate Rotation DIgital Computer. The Givens rotation-based CORDIC algorithm is one of the most hardware-efficient algorithms available because it requires only iterative shift-add operations (see References). The CORDIC algorithm eliminates the need for explicit multipliers. Using CORDIC, you can calculate various functions such as sine, cosine, arc sine, arc cosine, arc tangent, and vector magnitude. You can also use this algorithm for divide, square root, hyperbolic, and logarithmic functions.
Increasing the number of CORDIC iterations can produce more accurate results, but doing so increases the expense of the computation and adds latency.
Signal Flow Diagrams
The accuracy of the CORDIC kernel depends on the choice of initial values for X, Y, and Z. This algorithm uses the following initial values:
fimath Propagation Rules
CORDIC functions discard any local
to the input.
The CORDIC functions use their own internal
The output has no attached
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Variable-size signals are not supported.
The number of iterations the CORDIC algorithm performs,
niters, must be a constant.