Main Content

revertToOriginal

Class: FunctionApproximation.LUTSolution
Package: FunctionApproximation

Revert the block that was replaced by the approximation back to its original state

Syntax

revertToOriginal(solution)

Description

revertToOriginal(solution) reverts the block that was replaced by a lookup table approximation back to its original state.

Note

You can only revert a block back to its original state within a single MATLAB® session.

Input Arguments

expand all

The solution approximating the block you want to revert to its original state, specified as a FunctionApproximation.LUTSolution object.

Examples

expand all

This example shows how to approximate a block using a lookup table approximation, replace the original block with the approximation, and then revert the block back to its original state.

Open the model containing the block to approximate. In this example, replace the tan block with a lookup table approximation.

open_system('ex_luto_approx')

Create a FunctionApproximation.Problem object specifying what you want to approximate.

problem = FunctionApproximation.Problem('ex_luto_approx/Trigonometric Function')
problem = 

  1x1 FunctionApproximation.Problem with properties:

    FunctionToApproximate: 'ex_luto_approx/Trigonometric Function'
           NumberOfInputs: 1
               InputTypes: "numerictype('double')"
         InputLowerBounds: -1.5083
         InputUpperBounds: 1.5083
               OutputType: "numerictype('double')"
                  Options: [1x1 FunctionApproximation.Options]

Use default values for all other options. To approximate the block use the solve method.

solution = solve(problem)
|  ID |  Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification |             Error(Max,Current) | 
|   0 |             48 |        0 |          2 |               8 |           16 |             EvenSpacing |     7.812500e-03, 1.146582e+01 |
|   1 |            800 |        0 |         49 |               8 |           16 |             EvenSpacing |     7.812500e-03, 4.497030e-01 |
|   2 |           1584 |        1 |         98 |               8 |           16 |             EvenSpacing |     7.812500e-03, 1.016505e-05 |
|   3 |            640 |        0 |         39 |               8 |           16 |             EvenSpacing |     7.812500e-03, 3.533199e+00 |
|   4 |            416 |        0 |         25 |               8 |           16 |             EvenSpacing |     7.812500e-03, 4.497030e-01 |
|   5 |           1056 |        0 |         65 |               8 |           16 |             EvenSpacing |     7.812500e-03, 4.497030e-01 |
|   6 |             64 |        0 |          2 |              16 |           16 |             EvenSpacing |     7.812500e-03, 1.145654e+01 |
|   7 |            768 |        1 |         46 |              16 |           16 |             EvenSpacing |     7.812500e-03, 2.192364e-04 |
|   8 |            752 |        1 |         45 |              16 |           16 |             EvenSpacing |     7.812500e-03, 1.220687e-04 |
|   9 |            592 |        1 |         35 |              16 |           16 |             EvenSpacing |     7.812500e-03, 2.388241e-04 |
|  10 |            576 |        1 |         34 |              16 |           16 |             EvenSpacing |     7.812500e-03, 6.201875e-05 |
|  11 |            416 |        0 |         24 |              16 |           16 |             EvenSpacing |     7.812500e-03, 8.559014e-01 |
|  12 |            400 |        0 |         23 |              16 |           16 |             EvenSpacing |     7.812500e-03, 1.008229e+00 |
|  13 |            496 |        0 |         29 |              16 |           16 |             EvenSpacing |     7.812500e-03, 2.136958e-01 |
|  14 |            528 |        1 |         31 |              16 |           16 |             EvenSpacing |     7.812500e-03, 1.018354e-04 |
|  15 |            512 |        0 |         30 |              16 |           16 |             EvenSpacing |     7.812500e-03, 1.037605e-01 |
|  16 |            288 |        0 |         16 |              16 |           16 |             EvenSpacing |     7.812500e-03, 2.391904e+00 |
|  17 |            464 |        0 |         27 |              16 |           16 |             EvenSpacing |     7.812500e-03, 4.491186e-01 |
|  18 |             80 |        0 |          2 |               8 |           32 |             EvenSpacing |     7.812500e-03, 1.146600e+01 |
|  19 |             48 |        0 |          2 |               8 |           16 |         EvenPow2Spacing |     7.812500e-03, 1.146582e+01 |
|  20 |             64 |        0 |          2 |              16 |           16 |         EvenPow2Spacing |     7.812500e-03, 1.145654e+01 |
|  21 |             80 |        0 |          2 |               8 |           32 |         EvenPow2Spacing |     7.812500e-03, 1.146600e+01 |
|  22 |             96 |        0 |          2 |              16 |           32 |         EvenPow2Spacing |     7.812500e-03, 1.145661e+01 |
|  23 |            128 |        0 |          2 |              32 |           32 |         EvenPow2Spacing |     7.812500e-03, 1.145660e+01 |
|  24 |             96 |        0 |          2 |              32 |           16 |         EvenPow2Spacing |     7.812500e-03, 1.145654e+01 |
|  25 |            216 |        1 |          9 |               8 |           16 |          ExplicitValues |     7.812500e-03, 9.900552e-04 |
|  26 |            192 |        0 |          8 |               8 |           16 |          ExplicitValues |     7.812500e-03, 1.142949e-02 |
|  27 |            192 |        0 |          8 |               8 |           16 |          ExplicitValues |     7.812500e-03, 1.142949e-02 |
|  28 |            192 |        0 |          8 |               8 |           16 |          ExplicitValues |     7.812500e-03, 1.142949e-02 |
|  29 |            192 |        0 |          8 |               8 |           16 |          ExplicitValues |     7.812500e-03, 1.142949e-02 |
|  30 |            192 |        1 |          8 |               8 |           16 |          ExplicitValues |     7.812500e-03, 1.383244e-03 |
|  31 |            144 |        0 |          2 |               8 |           64 |             EvenSpacing |     7.812500e-03, 1.195947e+01 |
|  32 |            144 |        0 |          2 |               8 |           64 |         EvenPow2Spacing |     7.812500e-03, 1.195947e+01 |

Best Solution
|  ID |  Memory (bits) | Feasible | Table Size | Breakpoints WLs | TableData WL | BreakpointSpecification |             Error(Max,Current) |
|  30 |            192 |        1 |          8 |               8 |           16 |          ExplicitValues |     7.812500e-03, 1.383244e-03 |


solution = 

  1x1 FunctionApproximation.LUTSolution with properties:

          ID: 30
    Feasible: "true"

Generate a Simulink™ subsystem containing the lookup table approximation using the approximate method.

approximate(solution)

Replace the original block with the approximation.

replaceWithApproximate(solution)

You can revert the system back to its original state using the revertToOriginal method.

revertToOriginal(solution)
Introduced in R2018b