メインコンテンツ

cordicacos

逆余弦の CORDIC ベース近似

説明

theta = cordicacos(x) は、倍精度 CORDIC (DCORDIC) アルゴリズム近似に基づく x の逆余弦を返します。

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

すべて折りたたむ

CORDIC の実装を使用して固定小数点 fi オブジェクトの逆余弦を計算します。

a = fi(-1:.1:1,1,16);
b = cordicacos(a);
plot(a,b);
title('Inverse CORDIC Cosine');

Figure contains an axes object. The axes object with title Inverse CORDIC Cosine contains an object of type line.

関数 cordicacos と関数 acos の出力を比較します。

c = acos(double(a));
error = double(b)-c;
plot(a,error);
title('Error');

Figure contains an axes object. The axes object with title Error contains an object of type line.

CORDIC 実装を使用して fi オブジェクトの逆余弦を求め、CORDIC カーネルで実行すべき反復回数を指定します。さまざまな反復回数で逆余弦の CORDIC 近似をプロットします。

a = fi(-1:.1:1,1,16);
for i = 5:5:20
    b = cordicacos(a,i);
    plot(a,b);
    hold on;
end
legend('5 iterations','10 iterations',...
    '15 iterations','20 iterations')

Figure contains an axes object. The axes object contains 4 objects of type line. These objects represent 5 iterations, 10 iterations, 15 iterations, 20 iterations.

入力引数

すべて折りたたむ

角度の余弦。スカラー、ベクトル、行列、または多次元配列として指定します。x は、範囲 [-1,1] の有限の実数値でなければなりません。

xfi オブジェクトとして指定されている場合、プロパティ 'DataTypeMode'Fixed-point: binary point scaling''Scaled double: binary point scaling''double'、または 'single' と等しくなければなりません。

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

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

niters を指定しない場合、アルゴリズムは既定値を使用します。固定小数点の入力では、niters の既定値は入力配列 x の語長よりも 1 少なくなります。倍精度の入力では、niters の既定値は 54 です。単精度の入力では、既定値は 25 です。

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

出力引数

すべて折りたたむ

ラジアン単位の逆余弦の角度値。スカラー、ベクトル、行列、または多次元配列として返されます。関数 cordicacos は、区間 [0,π] の値を返します。

アルゴリズム

すべて折りたたむ

参照

[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.

拡張機能

すべて展開する

バージョン履歴

R2018b で導入