addApproximation
固定小数点の変換中に浮動小数点の関数をルックアップ テーブルに置換
構文
addApproximation(approximationObject)
説明
addApproximation(
は approximationObject
)coder.FixptConfig
オブジェクト内のルックアップ テーブルの置換を指定します。浮動小数点から固定小数点への変換中に、変換プロセスによって、approximationObject
で指定された関数のルックアップ テーブルの近似が生成されます。
入力引数
approximationObject
— 関数置換の構成オブジェクト
coder.mathfcngenerator.LookupTable
構成オブジェクト
MATLAB® 関数の近似の作成方法を指定する関数置換構成オブジェクト。coder.FixptConfig
構成オブジェクトの addApproximation
メソッドを使用して、この構成オブジェクトを coder.FixptConfig
オブジェクトに関連付けます。そして関数 fiaccel
の -float2fixed
オプションを coder.FixptConfig
と共に使用して、浮動小数点の MATLAB コードを固定小数点の MATLAB コードに変換します。
例
最適化されたルックアップ テーブルによる関数 log の置換
関数 log を最適化されたルックアップ テーブルで置換するように指定した関数置換の構成オブジェクトを作成します。
logAppx = coder.approximation('Function','log','OptimizeLUTSize',... true,'InputRange',[0.1,1000],'InterpolationDegree',1,... 'ErrorThreshold',1e-3,... 'FunctionNamePrefix','log_optim_','OptimizeIterations',25);
固定小数点の構成オブジェクトを作成し、関数置換の構成オブジェクトを関連付けます。
fixptcfg = coder.config('fixpt');
fixptcfg.addApproximation(logAppx);
これにより関数 fiaccel
を使用して固定小数点のコードを生成できます。
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)