メインコンテンツ

cordicangle

CORDIC ベースの位相角

説明

theta = cordicangle(c) は、複素数配列 c の各要素について、区間 [-π,π] の位相角を返します。

theta = cordicangle(c,niters) では、CORDIC アルゴリズムの反復が niters 回実行されます。

すべて折りたたむ

倍精度と固定小数点の入力について、関数 cordicangle を使用して CORDIC ベースの位相角を計算します。

dblRandomVals = complex(rand(5,4),rand(5,4));
theta_dbl_ref = angle(dblRandomVals);
theta_dbl_cdc = cordicangle(dblRandomVals)
theta_dbl_cdc = 5×4

    0.6777    1.4428    1.3512    1.4002
    0.0394    1.2122    0.0328    1.0252
    1.4223    0.6222    0.2816    0.3334
    0.7966    0.6003    0.0948    0.8758
    0.8208    0.1756    0.1208    0.0359

fxpRandomVals = fi(dblRandomVals);
theta_fxp_cdc = cordicangle(fxpRandomVals)
theta_fxp_cdc = 
    0.6777    1.4426    1.3513    1.4001
    0.0393    1.2122    0.0327    1.0254
    1.4224    0.6223    0.2817    0.3333
    0.7964    0.6003    0.0950    0.8757
    0.8208    0.1758    0.1208    0.0359

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 13

入力引数

すべて折りたたむ

入力配列。スカラー、ベクトル、行列または多次元配列として指定します。c の要素が非負の実数の場合、cordicangle0 を返します。c の要素が負の実数の場合、cordicangleπ を返します。

データ型: single | double | fi
複素数のサポート: あり

CORDIC アルゴリズムを実行する反復回数。正の整数値スカラーとして指定します。

反復数を増やすと、結果の精度が高まりますが、計算量も増加しレイテンシも増えます。

niters を指定しない場合や空または非有限として指定した場合は、最大許容値が使用されます。固定小数点の入力では、反復の最大回数は c の語長よりも 1 少なくなります。倍精度の入力では、最大値は 52 です。単精度の入力では、最大値は 23 です。

データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

出力引数

すべて折りたたむ

ラジアン単位の位相角。スカラー、ベクトル、行列、または多次元配列として返されます。

c が浮動小数点の場合、thetac と同じデータ型になります。それ以外の場合、theta は固定小数点データ型となり、語長は c と同じで、小数部の長さは最高精度となります。

アルゴリズム

すべて折りたたむ

参照

[1] Volder, Jack E. “The CORDIC Trigonometric Computing Technique.” IRE Transactions on Electronic Computers. EC-8, no. 3 (Sept. 1959): 330–334.

[2] Andraka, Ray. “A Survey of CORDIC Algorithm for FPGA Based Computers.” In Proceedings of the 1998 ACM/SIGDA Sixth International Symposium on Field Programmable Gate Arrays, 191–200. https://dl.acm.org/doi/10.1145/275107.275139.

[3] Walther, J.S. “A Unified Algorithm for Elementary Functions.” In Proceedings of the May 18-20, 1971 Spring Joint Computer Conference, 379–386. https://dl.acm.org/doi/10.1145/1478786.1478840.

[4] Schelin, Charles W. “Calculator Function Approximation.” The American Mathematical Monthly, no. 5 (May 1983): 317–325. https://doi.org/10.2307/2975781.

拡張機能

すべて展開する

バージョン履歴

R2011b で導入