Main Content

solve

Class:FunctionApproximation.Problem
Package:FunctionApproximation

Solve for optimized solution to function approximation problem

Syntax

solution = solve(problem)

Description

solution= solve(problem)solves the optimization problem defined by theFunctionApproximation.Problemobject,problem, and returns the optimized result,solution, as aFunctionApproximation.LUTSolutionobject.

Input Arguments

expand all

Optimization problem specified as aFunctionApproximation.Problemobject defining the function orMath Functionblock to approximate, or theLookup Table一块优化和其他参数nd constraints to use during the optimization process.

Output Arguments

expand all

Approximation solution, returned as aFunctionApproximation.LUTSolutionobject.

Examples

expand all

创建一个FunctionApproximation.Problemobject, specifying a math function to approximate.

problem = FunctionApproximation.Problem('log')
problem = FunctionApproximation.Problem with properties FunctionToApproximate: @(x)log(x) NumberOfInputs: 1 InputTypes: "numerictype(1,16,10)" InputLowerBounds: 0.6250 InputUpperBounds: 15.6250 OutputType: "numerictype(1,16,13)" Options: [1×1 FunctionApproximation.Options]

Use default values for all other options.

Use thesolvemethod to generate an approximation of the function.

solution = solve(problem)
| ID | Memory (bits) | ConstraintMet | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 0 | 64 | 0 | 2 | 16 | 16 | EvenPow2Spacing | 7.812500e-03, 1.178125e+00 | | 1 | 1984 | 1 | 122 | 16 | 16 | EvenPow2Spacing | 7.812500e-03, 4.192649e-03 | | 2 | 1024 | 0 | 62 | 16 | 16 | EvenPow2Spacing | 7.812500e-03, 1.416713e-02 | | 3 | 1968 | 1 | 121 | 16 | 16 | EvenPow2Spacing | 7.812500e-03, 4.192649e-03 | | 4 | 64 | 0 | 2 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.138984e+00 | | 5 | 416 | 1 | 13 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.310789e-03 | Best Solution | ID | Memory (bits) | ConstraintMet | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 5 | 416 | 1 | 13 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.310789e-03 | solution = FunctionApproximation.LUTSolution with properties ID: 5 Feasible: "true"

You can then use theapproximatemethod to generate a subsystem containing the lookup table approximation.

Version History

Introduced in R2018a