Main Content


Class: coder.FixPtConfig
Package: coder

Replace floating-point function with lookup table during fixed-point conversion




addApproximation(approximationObject) specifies a lookup table replacement in a coder.FixPtConfig object. During floating-point to fixed-point conversion, the conversion process generates a lookup table approximation for the function specified in the approximationObject.

Input Arguments

expand all

Function replacement configuration object. Use the coder.FixPtConfig configuration object addApproximation method to associate this configuration object with a coder.FixPtConfig object. Then use the codegen function -float2fixed option with coder.FixPtConfig to convert floating-point MATLAB® code to fixed-point code.


expand all

Create a function replacement configuration object that specifies to replace the log function with an optimized lookup table.

logAppx = coder.approximation('Function','log','OptimizeLUTSize',...

Create a fixed-point configuration object and associate the function replacement configuration object with it.

fixptcfg = coder.config('fixpt');

You can now generate fixed-point code using the codegen function.