This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

FunctionApproximation.Options class

Package: FunctionApproximation

Specify additional options to use with FunctionApproximation.Problem object

Description

The FunctionApproximation.Options object contains additional options for defining a FunctionApproximation.Problem object.

Construction

options = FunctionApproximation.Options() creates a FunctionApproximation.Options object to use as an input to a FunctionApproximation.Problem object. The output, options, uses default property values.

options = FunctionApproximation.Options(Name,Value) creates a 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 Name1,Value1,...,NameN,ValueN.

Properties

expand all

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.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

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.

Data Types: logical

Spacing of breakpoint data, specified as one of the following values.

Breakpoint SpecificationDescription
ExplicitValuesLookup table breakpoints are specified explicitly. Breakpoints can be closer together for some input ranges and farther apart in others.
EvenSpacingLookup table breakpoints are evenly spaced throughout.
EvenPow2SpacingLookup 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.

Data Types: char

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.

Data Types: logical

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

Interpolation MethodDescription
LinearFits a line between the adjacent breakpoints, and returns the point on that line corresponding to the input.
FlatReturns 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.
NearestReturns 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.
NoneGenerates a Direct Lookup Table (n-D) block, which performs table lookups without any interpolation or extrapolation.

Note

When generating a Direct Lookup Table block, the maximum number of inputs is two.

Data Types: char

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 the MemoryUnits property.

Data Types: double

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.

Data Types: double

Units for MaxMemoryUsage property, specified as 'bits', 'bytes', or one of the other enumerated options.

Data Types: char

Maximum tolerance of the relative difference between the original output value and the output value of the approximation, specified as a non-negative scalar.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

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.

Example: options.SaturateToOutputType = 1;

Data Types: logical

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.

Example: options.WordLengths = [8,16,32];

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects (MATLAB).

Algorithms

When you set BreakpointSpecification to 'ExplicitValues', during the approximation process, the algorithm also attempts to find a solution using 'EvenSpacing' and 'EvenPow2Spacing'. Likewise, when you set BreakpointSpecification to 'EvenSpacing', 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 InputUpperBounds or InputLowerBounds property of the FunctionApproximation.Problem object is equal to the range of the InputTypes, the algorithm does not attempt to find a solution using 'EvenPow2Spacing'.

Introduced in R2018a