compare
Class: FunctionApproximation.LUTSolution
Namespace: FunctionApproximation
Compare numerical results of
FunctionApproximation.LUTSolution
to original function or lookup
table
Syntax
data = compare(solution)
Description
plots the difference between the data contained in the data
= compare(solution
)FunctionApproximation.LUTSolution
object, solution
,
and the original lookup table, function, or Math Function block.
Input Arguments
solution
— Solution to compare original behavior against
FunctionApproximation.LUTSolution
object
The solution to compare original behavior against, specified as a FunctionApproximation.LUTSolution
object.
Output Arguments
data
— Structure containing data comparing original and the solution
structure
Structure containing data comparing the original function or lookup table and the approximation contained in the solution.
Examples
Compare Function Approximation to Original Function
Create a FunctionApproximation.Problem
object defining the function you want to approximate.
problem = FunctionApproximation.Problem('tanh')
problem = 1x1 FunctionApproximation.Problem with properties: FunctionToApproximate: @(x)tanh(x) NumberOfInputs: 1 InputTypes: "numerictype(1,16,12)" InputLowerBounds: -8 InputUpperBounds: 8 OutputType: "numerictype(1,16,15)" Options: [1x1 FunctionApproximation.Options]
Use default values for all other options. Approximate the tanh
function using the solve
method.
solution = solve(problem)
Searching for fixed-point solutions. | ID | Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 0 | 64 | 0 | 2 | 16 | 16 | EvenSpacing | 7.812500e-03, 7.229091e-01 | | 1 | 1248 | 1 | 76 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.368265e-03 | | 2 | 1232 | 1 | 75 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.439035e-03 | | 3 | 944 | 1 | 57 | 16 | 16 | EvenSpacing | 7.812500e-03, 7.780470e-03 | | 4 | 928 | 1 | 56 | 16 | 16 | EvenSpacing | 7.812500e-03, 5.383741e-03 | | 5 | 656 | 0 | 39 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.678519e-02 | | 6 | 640 | 0 | 38 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.660649e-02 | | 7 | 784 | 1 | 47 | 16 | 16 | EvenSpacing | 7.812500e-03, 7.743777e-03 | | 8 | 704 | 1 | 42 | 16 | 16 | EvenSpacing | 7.812500e-03, 7.805676e-03 | | 9 | 672 | 1 | 40 | 16 | 16 | EvenSpacing | 7.812500e-03, 7.809550e-03 | | 10 | 368 | 0 | 21 | 16 | 16 | EvenSpacing | 7.812500e-03, 4.855583e-02 | | 11 | 512 | 0 | 30 | 16 | 16 | EvenSpacing | 7.812500e-03, 2.773526e-02 | | 12 | 592 | 0 | 35 | 16 | 16 | EvenSpacing | 7.812500e-03, 2.088471e-02 | | 13 | 624 | 0 | 37 | 16 | 16 | EvenSpacing | 7.812500e-03, 1.870074e-02 | | 14 | 384 | 1 | 12 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.812317e-03 | | 15 | 384 | 0 | 12 | 16 | 16 | ExplicitValues | 7.812500e-03, 1.196141e-02 | | 16 | 384 | 1 | 12 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.812317e-03 | Best Solution | ID | Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification | Error(Max,Current) | | 14 | 384 | 1 | 12 | 16 | 16 | ExplicitValues | 7.812500e-03, 7.812317e-03 |
solution = 1x1 FunctionApproximation.LUTSolution with properties: ID: 14 Feasible: "true"
Compare the original function and the function approximation.
data = compare(solution)
data = struct with fields:
Breakpoints: [65536x1 double]
Original: [65536x1 double]
Approximate: [65536x1 double]
Version History
Introduced in R2018a
See Also
Apps
Classes
FunctionApproximation.Problem
|FunctionApproximation.Options
|FunctionApproximation.LUTSolution
|FunctionApproximation.LUTMemoryUsageCalculator
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)