|
|
|
| R2012a Documentation → Model-Based Calibration Toolbox | |
Learn more about Model-Based Calibration Toolbox |
|
| Contents | Index |
| On this page… |
|---|
You can use CAGE to produce a table that is the inverse of another table. This involves swapping a table input with a table output, and you can invert 1-D or 2-D tables.

Inverting a table allows you to link a forward strategy to a backward strategy; that is, swapping inputs and outputs. This process is desirable when you have a "forward" strategy, for example predicting torque as a function of speed and load, and you want to reverse this relationship in a "backward strategy" to find out what value of load would give a particular torque at a certain speed.
Normally you fill tables in CAGE by comparing with data or models. Ideally you want to fill using the correct strategy, but that might not be possible to find or measure. If you only have a forward strategy but want a backward one, you can fill using the forward strategy (tables or model) and then invert the table.
For example, to fill a table normally from a model, you need the model response to be the table output, and the model inputs to be a function of the table inputs (or it should be possible to derive the input -- for example, air mass from manifold pressure). If the available model is "inverted"(the model response is a table input and the table output is a model input) and you cannot change the model, you can invert the table in CAGE.

In the diagram of a table shown, the x- and y-axes represent the normalizers (which you want to be spark and load) and the z-axis is the output at each breakpoint (torque). To fill this table correctly from the model is a two-step process. First you need to fill a table that has the same input and output as the model, and then fill a second table by inversion.
For the inversion to be deterministic and accurate, the table to be inverted must be monotonic; that is, always increasing or decreasing. This requirement is explained by the following one-dimensional example. Every point on the y-axis must correspond to a unique point on the x-axis. The same problem applies also to two-dimensional tables: for any given output in the first table there must be a unique input condition; that is, every point on the z-axis should correspond to a unique point in the x-y plane. Some table inversions have multiple values and so do not meet this requirement, just as the square root function can take either positive or negative values. You can use the inversion wizard in CAGE to handle this problem; you can control the inversion process and determine what to do in these cases.
The following example illustrates a table with multiple values. There are two solutions for a single value of torque. CAGE has a table inversion wizard that can help overcome this problem. You can specify whether you want to use the upper or lower values for filling certain parts of the table; this allows you to successfully invert a multiple-valued function. See the inversion instructions for 1-D and 2-D tables in the next sections.

The process of inverting a one-dimensional table is different from the process of inverting a two-dimensional table.
To invert a one-dimensional table,
Ensure that your session contains two tables:
The first table from your forward strategy, filled
The second table from your backward strategy, which you want to fill
Click
or select Table > Fill by Inversion.
The lower pane now acts as a wizard.
In the lower pane, highlight the table that you want to invert. Click Next.
The next page asks what CAGE should do if it encounters multiple values. The options are
Minimum selects the lower of the two if a given number has two possible inverses (like selecting the negative square root of a number).
Maximum selects the uppermost range if a given number has two possible inverses (like selecting the positive square root of a number).
Intermediate selects the middle range if a given number has more than two possible inverses.
Automatic selects the range that produces the least error (see below; the last page of the wizard plots the error metric).
For example, the function y = x2 is impossible to invert over the range -1 to 1. You can specify to invert the range from 0 to 1, sacrificing the inversion in the lower range, or the reverse. To select the range from 0 to 1, highlight Maximum.
The display shows a comparison between the table (green) and the function x = f-1(f(x)).
The last page of the wizard has a comparison plot that shows how successful the inversion has been. If your forward function is y = f(x), and your inverse function is x = g(y), then, combining these, in an ideal world, you should have x = g(f(x)). The plot then displays a red line showing x against x and a green line showing x against g(f(x)). The closeness of these two lines indicates how good the inversion has been: a perfect inverse would show the lines exactly on top of each other.
In the following example, the lines are together and then diverge; this plot can show you which part of your table has not successfully inverted and where you should try a different routine.

Note The automatic inversion routine tries to minimize the total distance between these lines. This can sometimes lead to unexpected results. For example, given the function f(x) = x^2 between -1 and 1, if you select either positive or negative square root as the inverse, this induces a large error in the combined inverse. If you choose g(y) = sqrt(y), then g(f(-1)) = 1, an error of 2. To minimize this, the automatic routine might choose to send everything to zero and accept a medium error over the whole range rather than a large error over half the range. The more knowledge you have of the form of the "forward" table, the more you can make an informed choice about which routine to select. |
Click Finish to accept the inversion or Cancel to ignore the result and return to the original table.
To invert a two-dimensional table,
Ensure that your session contains two tables:
The first table from your forward strategy, filled
The second table from your backward strategy, which you want to fill
Click
or select Table > Fill by Inversion.
The lower pane now acts as a wizard.
In the lower pane, highlight the table that you want to invert and click Next.
Identify the corresponding signals.
The forward table and backward table share a common input. This page of the wizard lists all possible combinations of inputs into the forward and backward tables and asks you to highlight the combination that gives the two common inputs. To illustrate this, if the forward table gives torque in terms of the variables engine speed and load, whereas you want the backward table to give load in terms of RPM and Tq, then the list would read
RPM and engine speed
RPM and load
Tq and engine speed
Tq and load
In this case, you would select the first option.
CAGE asks what to do if it encounters multiple values. The choices are
Maximum selects the uppermost range (like choosing a positive square root of a number).
Minimum selects the lower value if there are two choices (like choosing a negative square root of a number).
Intermediate selects the middle range when there are more than two choices.
Automatic selects the range that produces the least error. CAGE tries to choose values to put in the inverse table that minimize an error metric similar to the error metric for 1-D tables (see Inverting One-Dimensional Tables).
The last page of the wizard has a comparison plot that shows how successful the inversion has been. If the forward function is z = f(x,y), and the inverse function is x = g(y,z), then, combining these, in an ideal world you should have x = g(y,f(x,y)). The plot then displays a plane showing x plotted against x and y, and a colored surface showing g(y,f(x,y)) plotted against x and y. The closeness of these two planes indicates how good the inversion is.
Following is an example. In this case, the forward table is a quadratic (z = y^2); the backward table is inverted using the positive square root of z (maximum range). As you can see, this leads to large errors at negative values of y, but good inversion for positive values of y.

Click Finish to accept the result or Cancel to ignore the result and return to the original table.
![]() | Normalizer View | Importing and Exporting Calibrations | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |