Lookup Table Optimizer
Optimize existing lookup table or approximate function with lookup table
Description
Use the Lookup Table Optimizer app to obtain an optimized (memoryefficient) lookup table.
Using this app, you can:
Approximate an existing Simulink^{®} block, including Subsystem blocks and math function blocks
Approximate a MATLAB^{®} handle
Approximate a curve fit object
You can choose to return the optimized lookup table as a Simulink block or as a MATLAB function.
The optimizer supports any combination of floatingpoint and fixedpoint data types. The original input and output data types can be kept or changed as desired. To minimize memory used, the optimizer selects the data types of breakpoints and table data as well as the number and spacing of breakpoints.
Open the Lookup Table Optimizer App
Simulink toolstrip: On the Apps tab, under Code Generation, click the app icon.
In a Simulink model with a Lookup Table block, select the Lookup Table block. In the Lookup Table tab, select Lookup Table Optimizer.
Examples
Parameters
Source
— Source for memoryefficient LUT
Simulink block or subsystem (default)  MATLAB function handle  curve fit object
Select the source for memoryefficient LUT:
Simulink block or subsystem — Simulink block or subsystem to approximate, or lookup table block to optimize, for example, 1D Lookup Table or nD Lookup Table. If you specify one of the lookup table blocks, the app generates an optimized lookup table.
MATLAB function handle — MATLAB function handle to approximate with a lookup table. Function handles must be on the MATLAB search path, or approximation fails.
Fitted curve — Curve fit
cfit
(Curve Fitting Toolbox) object from the base workspace to approximate. For a list of library models to approximate, see List of Library Models for Curve and Surface Fitting (Curve Fitting Toolbox).
Tip
The process of generating a lookup table approximation is faster for a function handle than for a subsystem. If a subsystem can be represented by a function handle, approximating the function handle is faster.
Output Error Tolerance
— Tolerance of difference between original and approximation
nonnegative scalar
Specify the maximum tolerance of the Absolute
and
Relative
difference between the original output value and
the output value of the approximation.
Allowed Word Lengths
— Word lengths permitted in lookup table approximation
[8 16 32]
(default)  vector of integers
Specify the word lengths, in bits, that can be used in the lookup table approximation based on your intended hardware. For example, if you intend to target an embedded processor, you can restrict the data types in your lookup table to native types. The word lengths must be between 1 and 128.
LUT Specification
— Options for optimized lookup table
Interpolation
 Breakpoint specification
 Saturate to output type
 AUTOSAR Compliant
 Explore Half
 HDL Optimized
 Solution Type
Specify options to use for the optimized lookup table.
Option  Description 

Interpolation  When an input falls between breakpoint values, the lookup table interpolates the output value using neighboring breakpoints.

Breakpoint specification  Spacing of breakpoint data.
For more information on how breakpoint specification can affect performance, see Effects of Spacing on Speed, Error, and Memory Usage. 
Saturate to output type  Whether to automatically saturate the range of the output of the function to approximate to the range of the output data type. 
AUTOSAR Compliant  Whether the generated lookup table is AUTOSAR compliant. When this
option is set to
This option is not supported when the

Explore Half  Whether to allow the optimizer to explore halfprecision data types for table data and breakpoints. 
HDL Optimized  Whether to generate an HDLoptimized approximation. When this
option is set to To generate an HDLoptimized
approximation, the function to approximate must be onedimensional and

Solution Type  How the app outputs the optimized lookup table.
Note The Simulink block and MATLAB function lookup table approximations generated by the Lookup Table Optimizer may not be exactly numerically equivalent. However, both solution forms are guaranteed to meet all constraints specified in the optimization problem. 
Settings
— Optimization options
Max time
 Max memory usage (bytes)
 On curve table values
 Use parallel
Specify additional optimization options.
Option  Description 

Max time  Maximum amount of time for the approximation to run, specified in seconds as a scalar number. The approximation runs until it reaches the time specified, finds an ideal solution, or reaches another stopping criterion. Default: 
Max memory usage (bytes)  The maximum amount of memory the generated lookup table can use, in bytes, specified as a scalar integer. Default:

On curve table values  Whether to constrain table values to the quantized output of the
function being approximated. When you set this option to
Default: 
Use parallel  Whether to run iterations of the optimization in parallel. Running
iterations in parallel requires a Parallel Computing Toolbox™ license. If you do not have a Parallel Computing Toolbox, or if you specify This option is not supported when the
Default:

Limitations
Lookup table objects and breakpoint objects are not supported in a model mask workspace.
Functions and function handles that you approximate must meet these criteria:
The function must be timeinvariant.
The function must operate elementwise, meaning for each input there is one output.
The function must not contain states.
For more information, see Vectorization.