Main Content


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 that specifies how to create an approximation for a MATLAB® function. Use the coder.FixptConfig configuration object addApproximation method to associate this configuration object with a coder.FixptConfig object. Then use the fiaccel function -float2fixed option with coder.FixptConfig to convert floating-point MATLAB code to fixed-point MATLAB 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 fiaccel function.