getErrorValue

Class: FunctionApproximation.LUTSolution
Package: FunctionApproximation

Get the total error of the lookup table approximation

Syntax

memory = getErrorValue(solution)

Description

memory = getErrorValue(solution) returns the total error of the lookup table approximation specified by solution.

Input Arguments

expand all

Solution to get error of, specified as a FunctionApproximation.LUTSolution object.

Output Arguments

expand all

Total error of the lookup table approximation, returned as a struct.

The struct contains two fields. The MaxErrorInSolution field specifies the maximum difference between the original function or block and the lookup table approximation. The ErrorUpperBound field displays the maximum error that was acceptable according to the tolerances specified on the FunctionApproximation.Options object.

Examples

expand all

Create a FunctionApproximation.Problem object defining a math function to approximate. Then, use the solve method to get a FunctionApproximation.LUTSolution object.

Calculate the total error of the FunctionApproximation.LUTSolution object using the getErrorValue method.

problem = FunctionApproximation.Problem('sin')
problem = 

  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: [1×1 FunctionApproximation.Options]
solution = solve(problem)
solution = 

  FunctionApproximation.LUTSolution with properties

          ID: 8
    Feasible: "true"
error = getErrorValue(solution)
error = 

  struct with fields:

    MaxErrorInSolution: 0.0073
       ErrorUpperBound: 0.0078

Introduced in R2019a