Documentation

Cordicatan2

脐带-based four quadrant inverse tangent

Syntax

theta = cordicatan2(y,x)
theta = cordicatan2(y,x,niters)

Description

theta = cordicatan2(y,x)computes the four quadrant arctangent ofyxusing a脐带algorithm approximation.

theta = cordicatan2(y,x,niters)performsnitersiterations of the algorithm.

Input Arguments

y、x

y、x是笛卡尔坐标。yxmust be the same size. If they are not the same size, at least one value must be a scalar value. Bothyxmust have the same data type.

niters

nitersis the number of iterations the CORDIC algorithm performs. This is an optional argument. When specified,nitersmust be a positive, integer-valued scalar. If you do not specifyniters或者,如果指定一个太大的值,则该算法使用最大值。对于定点操作,最大迭代次数比单词长度少一个y或者x。For floating-point operation, the maximum value is 52 for double or 23 for single. Increasing the number of iterations can produce more accurate results but also increases the expense of the computation and adds latency.

Output Arguments

theta

thetais the arctangent value, which is in the range [-pi, pi] radians. Ifyxare floating-point numbers, thentheta具有与yx。否则,theta是一个定点数据类型,具有与yx和with a best-precision fraction length for the [-pi, pi] range.

Examples

Floating-point CORDIC arctangent calculation.

theta_cdat2_float = cordicatan2(0.5,-0.5)theta_cdat2_float = 2.3562

Fixed- point CORDIC arctangent calculation.

theta_cdat2_fixpt = cordicatan2(fi(0.5,1,16,15),fi(-0.5,1,16,15)); theta_cdat2_fixpt = 2.3562 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13

More About

collapse all

脐带

脐带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 also increases the expense of the computation and adds latency.

算法

collapse all

信号流程图

脐带Vectoring Kernel

脐带内核的准确性取决于选择初始值的选择X,Y, 和Z。该算法使用以下初始值:

x 0 is initialized to the x 输入值 y 0 is initialized to the y 输入值 z 0 is initialized to 0

fimath Propagation Rules

脐带functions discard any localfimathattached to the input.

The CORDIC functions use their own internalfimath执行计算时:

  • 溢出Wrap

  • RoundingMethod地面

输出没有附件fimath

参考

[1] Volder,JE。“电线三角计算技术。”IRE电子计算机上的交易。卷。EC-8,1959年9月,第330–334页。

[2] Andraka, R. “A survey of CORDIC algorithm for FPGA based computers.” Proceedings of the 1998 ACM/SIGDA sixth international symposium on Field programmable gate arrays. Feb. 22–24, 1998, pp. 191–200.

[3] Walther, J.S. “A Unified Algorithm for Elementary Functions.” Hewlett-Packard Company, Palo Alto. Spring Joint Computer Conference, 1971, pp. 379–386. (from the collection of the Computer History Museum). www.computer.org/csdl/proceedings/afips/1971/5077/00/50770379.pdf

[4] Schelin, Charles W. “Calculator Function Approximation.” The American Mathematical Monthly. Vol. 90, No. 5, May 1983, pp. 317–325.

Extended Capabilities

在R2011b中引入

这个话题有帮助吗?