Specify additional options to use with
FunctionApproximation.Options object contains additional
options for defining a
options = FunctionApproximation.Options()
FunctionApproximation.Options object to use as an input to
FunctionApproximation.Problem object. The output,
options, uses default property values.
options = FunctionApproximation.Options(
FunctionApproximation.Options object with property values
specified by one or more
Name,Value pair arguments.
Name must appear inside single quotes (
You can specify several name-value pair arguments in any order as
AbsTol— Absolute tolerance of difference between original and approximate
Maximum tolerance of the absolute value of the difference between the original output value and the output value of the approximation, specified as a non-negative scalar.
AllowUpdateDiagram— Whether to allow updating of the model diagram during the approximation process
Whether to allow updating of the model diagram during the approximation
process, specified as a logical. This property is only relevant for
FunctionApproximation.Problem objects that specify a
Lookup Table block, or a Math Function
block as the item to approximate.
AUTOSARCompliant— Whether the generated lookup table block is an AUTOSAR block
Whether the generated lookup table is AUTOSAR compliant. When this property is set to 1 (true), the generated lookup table is a Curve or Map block from the AUTOSAR Blockset. When this property is set to 1, the data type of the table data must equal the output data type of the block.
BreakpointSpecification— Spacing of breakpoint data
Spacing of breakpoint data, specified as one of the following values.
|Lookup table breakpoints are specified explicitly. Breakpoints can be closer together for some input ranges and farther apart in others.|
|Lookup table breakpoints are evenly spaced throughout.|
|Lookup table breakpoints use power-of-two spacing. This breakpoint specification boasts the fastest execution speed because a bit shift can replace the position search.|
For more information on how breakpoint specification can affect performance, see Effects of Spacing on Speed, Error, and Memory Usage.
Display— Whether to display details of each iteration of the optimization
Whether to display details of each iteration of the optimization,
specified as a logical. A value of
1 results in
information in the command window at each iteration of the approximation
process. A value of
0 does not display information until
the approximation is complete.
Interpolation— Method when an input falls between breakpoint values
When an input falls between breakpoint values, the lookup table interpolates the output value using neighboring breakpoints.
|Fits a line between the adjacent breakpoints, and returns the point on that line corresponding to the input.|
|Returns the output value corresponding to the breakpoint value that is immediately less than the input value. If no breakpoint value exists below the input value, it returns the breakpoint value nearest the input value.|
|Returns the value corresponding to the breakpoint that is closest to the input. If the input is equidistant from two adjacent breakpoints, the breakpoint with the higher index is chosen.|
Generates a Direct Lookup Table (n-D) block, which performs table lookups without any interpolation or extrapolation.
When generating a Direct Lookup Table block, the maximum number of inputs is two.
MaxMemoryUsage— Maximum amount of memory the generated lookup table can use
The maximum amount of memory the generated lookup table can use, in bits,
specified as a scalar integer. You can change the units of the option using
MaxTime— Maximum amount of time for the approximation to run (in seconds)
Inf(default) | scalar
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 criteria.
MemoryUnits— Units for maximum memory usage
MaxMemoryUsage property, specified as
'bytes', or one of the
other enumerated options.
OnCurveTableValues— Whether to constrain table values to the quantized output of the function being approximated
Whether to constrain table values to the quantized output of the function
being approximated. By setting this property to
allowing off-curve table values, you may be able to reduce the memory of the
lookup table while maintaining the same error tolerances, or maintain the
same memory while reducing the error tolerances.
RelTol— Relative tolerance of difference between original and approximate
Maximum tolerance of the relative difference between the original output value and the output value of the approximation, specified as a non-negative scalar.
SaturateToOutputType— Saturate output of function to approximate to range of output type
Logical value specifying whether to automatically saturate the range of the output of the function to approximate to the range of the output data type.
UseParallel— Whether to run iterations in parallel
Whether to run iterations of the optimization in parallel, specified as a
logical. Running the iterations in parallel requires a Parallel
Computing Toolbox™ license. If you do not have a Parallel
Computing Toolbox license, or if you specify
iterations run in serial.
options.UseParallel = true;
WordLengths— Word lengths permitted in the lookup table approximate
Specify the word lengths, in bits, that can be used in the lookup table approximate 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, 8, 16, and 32. The word lengths must be between 1 and 128.
options.WordLengths = [8,16,32];
Value. To learn how value classes affect copy operations, see Copying Objects (MATLAB).
When you set
'ExplicitValues', during the approximation process, the algorithm
also attempts to find a solution using
'EvenPow2Spacing'. Likewise, when you set
the algorithm also attempts to find a solution using
'EvenPow2Spacing'. If you set the property to
'EvenPow2Spacing', the algorithm only attempts to find a solution
using this spacing.
In cases where the
BreakpointSpecification property is set to
'EvenSpacing', but the
InputLowerBounds property of the
FunctionApproximation.Problem object is equal to the range of the
InputTypes, the algorithm does not attempt to find a solution