Class: FunctionApproximation.LUTSolution
Package: FunctionApproximation
Access a solution found during the approximation process
other_solution = solutionfromID(solution,id)
returns the solution associated with the other_solution
= solutionfromID(solution
,id
)FunctionApproximation.LUTSolution
object, solution
,
with the ID specified by id
.
solution
— Solution objectFunctionApproximation.LUTSolution
objectThe solution object containing the solution you want to explore, specified
as a FunctionApproximation.LUTSolution
object.
id
— ID of the solutionID of the solution that you want to explore, specified as a scalar integer.
Data Types: double
other_solution
— FunctionApproximation.LUTSolution
specified by id
FunctionApproximation.LUTSolution
objectFunctionApproximation.LUTSolution
object associated
with the specified ID.
This example shows how to use the solutionfromID
method of the FunctionApproximation.LUTSolution
object to examine other approximation solutions.
Create a FunctionApproximation.Problem
object defining a math function to approximate. Then use the solve
method to get a FunctionApproximation.LUTSolution
object.
problem = FunctionApproximation.Problem('sin')
problem = 1x1 FunctionApproximation.Problem with properties: FunctionToApproximate: @(x)sin(x) NumberOfInputs: 1 InputTypes: "numerictype(0,16,13)" InputLowerBounds: 0 InputUpperBounds: 6.2832 OutputType: "numerictype(1,16,14)" Options: [1x1 FunctionApproximation.Options]
solution = solve(problem)
| ID | Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 0 | 64 | 0 | 2 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.000000e+00 | | 1 | 784 | 1 | 47 | 16 | 16 | EvenSpacing | 7.812500e-03, 5.388912e-03 | | 2 | 768 | 1 | 46 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.534419e-03 | | 3 | 608 | 1 | 36 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.089765e-03 | | 4 | 592 | 1 | 35 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.272461e-03 | | 5 | 416 | 1 | 24 | 16 | 16 | EvenSpacing | 7.812500e-03, 6.201693e-03 | | 6 | 400 | 1 | 23 | 16 | 16 | EvenSpacing | 7.812500e-03, 6.836819e-03 | | 7 | 224 | 0 | 12 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.013411e-02 | | 8 | 304 | 0 | 17 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.887217e-02 | | 9 | 352 | 0 | 20 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.361513e-02 | | 10 | 368 | 0 | 21 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.219313e-02 | | 11 | 384 | 0 | 22 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.121192e-02 | | 12 | 64 | 0 | 2 | 16 | 16 | EvenPow2Spacing | 7.812500e-03, 1.315166e+00 | | 13 | 576 | 1 | 18 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.803448e-03 | | 14 | 512 | 0 | 16 | 16 | 16 | ExplicitValues | 7.812500e-03, 1.190175e-02 | | 15 | 576 | 1 | 18 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.803448e-03 | Best Solution | ID | Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 6 | 400 | 1 | 23 | 16 | 16 | EvenSpacing | 7.812500e-03, 6.836819e-03 |
solution = 1x1 FunctionApproximation.LUTSolution with properties: ID: 6 Feasible: "true"
Display all feasible solutions found during the approximation process.
displayfeasiblesolutions(solution)
| ID | Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 1 | 784 | 1 | 47 | 16 | 16 | EvenSpacing | 7.812500e-03, 5.388912e-03 | | 2 | 768 | 1 | 46 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.534419e-03 | | 3 | 608 | 1 | 36 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.089765e-03 | | 4 | 592 | 1 | 35 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.272461e-03 | | 5 | 416 | 1 | 24 | 16 | 16 | EvenSpacing | 7.812500e-03, 6.201693e-03 | | 6 | 400 | 1 | 23 | 16 | 16 | EvenSpacing | 7.812500e-03, 6.836819e-03 | | 13 | 576 | 1 | 18 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.803448e-03 | | 15 | 576 | 1 | 18 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.803448e-03 | Best Solution | ID | Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 6 | 400 | 1 | 23 | 16 | 16 | EvenSpacing | 7.812500e-03, 6.836819e-03 |
Solution with ID 5 is not listed as a feasible solution in the table. Explore this solution to see why it is not feasible.
solution5 = solutionfromID(solution, 5)
solution5 = 1x1 FunctionApproximation.LUTSolution with properties: ID: 5 Feasible: "true"
Compare the numerical behavior of the solution with ID 5.
compare(solution5)
ans = struct with fields:
Breakpoints: [51473x1 double]
Original: [51473x1 double]
Approximate: [51473x1 double]
You can see from the plot that the solution does not meet the required tolerances.
FunctionApproximation.LUTMemoryUsageCalculator
| FunctionApproximation.LUTSolution
| FunctionApproximation.Options
| FunctionApproximation.Problem
You have a modified version of this example. Do you want to open this example with your edits?