| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Model-Based Calibration |
| Contents | Index |
| Learn more about Model-Based Calibration |
| On this page… |
|---|
You can export all models created in the Model Browser using the menu item File > Export Models.
The Export Model dialog box appears.

Choose the export format from the Export to drop-down menu:
Workspace — to the MATLAB workspace. See Evaluating Models in the Workspace.
File — to an EXM file for CAGE. The EXM file format is specifically designed for loading into the CAGE part of MBC Toolbox, for example, to create calibrations.
Simulink — to a Simulink model (an MDL file)
CAGE — export directly to CAGE (only if CAGE is open). If you export to CAGE you will see the Export to CAGE dialog box after you click OK to export.

In the dialog box you can see a list of the models to export. For each model you can edit the name, replace a suitable existing CAGE model or skip the selected model.
Tradeoff — You can export to Tradeoff File only when you are exporting from the test plan node. This is only possible when the current test plan has at least one two-stage model available for export, and when this model has exactly two global input factors. Exporting to Tradeoff File exports all local models in a .mat file that can then be loaded into the Multimodel Tradeoff tool within CAGE.
If a file format is chosen (export to file or to Simulink), the Destination file controls are enabled, and the browse button allows you to locate a destination file using a file browser.
Export As — Defines the name that the model has when loaded, or the name of the workspace variable.
Export global models — When a two-stage model is being exported (from the response node) the constituent response feature models can also be exported. Multiple models are exported to the workspace as a cell array.
Export all local models — When exporting at the local node, the single local model for the current test is exported. Selecting this control exports the local models for all tests (to the workspace as a cell array).
Export datum models— When exporting a two-stage model that has a datum defined, this control allows you to export the datum global model (without exporting all other response feature models).
Export PEV blocks — When exporting to Simulink, you can create a PEV block as part of the Simulink diagram so that the prediction error variance can be evaluated along with the model. This is not available for models where PEV cannot be calculated.
Export constraints — Where design constraints and boundary constraints exist, you can choose to export them.
To File, Workspace or CAGE: exports the boundary constraints with the models. You can also export boundary models to Simulink directly from the Boundary Editor.
To Simulink: exports the design constraints with the models. You can also export design constraints with designs to .mvd file from the Design Editor.
Export Preview — Displays the models that are exported with the current choice of options.
For example:

See What Is Exported? for details on what to expect here.
Export information — Traceability information is exported with the models. You can add/edit/delete further comments using the buttons on the right.
Click OK to export the current selection of models and close the dialog box.
Note Point-by-point models have a separate export tool. From the test plan, select TestPlan > Export Point-by-Point Models. See Exporting Point-by-Point Models to CAGE. |
In the Export Model dialog box you can use the Export Preview button to check the models that have been selected for export. This displays the Models Export List dialog box.
At the test plan node:
You cannot export from the test plan node unless all response models within that test plan have a best model chosen (that is, you used the Select process at response level to assign the best model and calculate the two-stage model). All models within the test plan are exported.
If the datum model check box is selected, the datum model is exported.
If the checkbox for constraints is selected, constraints are also exported (boundary constraints to CAGE, File and workspace; design constraints to Simulink). See Export constraints under Exporting Models
If the check box for global models is selected, all the response features are also exported.
At the response node:
The response model is exported. You cannot export from a response node until it contains a best model (it is empty before that).
If the check box for global models is selected, all the response features are also exported. Note that the datum model is not necessarily a response feature.
There is also a datum model check box. As at the test plan node, this exports the datum model along with the two-stage model (without exporting all other response feature models).
At the local node:
The local model for the current test only is exported.
If the check box for all local models is selected, all the local models are exported for all the tests.
If the node is purely a local model (with a house icon, that is; no two-stage model has yet been calculated), the model is exported under its own name (for example, PS2,3); if a two-stage model has been calculated (that is, the local node has a two-stage house-and-globe icon), the local model is exported under the name of the response node.
At response feature nodes and all child nodes from here:
The current response feature (or other selected subnode) only is exported.
Note When you are exporting to Simulink, linear models support PEV, so the Export PEV blocks check box is active. This is only the case when you are exporting from response features that are linear functions of the local parameters. See Export PEV blocks under Exporting Models. |
If a model is exported to the workspace as MyModel and has four input factors, it can be evaluated at a point as in this example:
Y = MyModel([3.7, 89.55, -0.005, 1]);
If column vectors p1,p2,p3,p4 (of equal length) are created for each input factor, the model can be evaluated to give a column vector output
Y = MyModel([p1,p2,p3,p4]);
Left to right argument order corresponds exactly to top-down input order in the Test Plan view in the Model Browser.
If you export a group of models, the group is exported as a cell array of models. The argument order in the curly braces {1 to n} cell array reference corresponds exactly to top-down model order in the model tree in the Model Browser.
The inputs and outputs for MATLAB model evaluation are in natural engineering units, not coded units.
It is also possible to evaluate the PEV (prediction error variance) for the model using the command
[pev, y] = pev(MyModel, [x1 x2 x3])
You can use one or two arguments, as follows:
[p]=pev(x) gives pev at x
[p,y]=pev(x) gives pev at x and model eval at x
You can use the function ceval to evaluate a boundary constraint exported to the Workspace. For example, if your exported model is M, then ceval(M, X) evaluates the boundary constraint attached to M at the points given by the matrix X (values less than zero are inside the boundary). See Boundary Model Setup.
For example, if you have exported multiple responses from a test plan as a cell array named modeltutorial, entering the following at the command line evaluates the boundary model for the first response {1} at the point where all 4 inputs are zero.
ceval(modeltutorial{1}, [0,0,0,0])
Response models are in top-down order in the model tree, e.g. in this example {1} is the top model in the tree under the test plan node. [0,0,0,0] is the matrix of input values, where left to right argument order corresponds exactly to top-down input order in the Boundary Editor or the Test Plan view in the Model Browser, e.g. spk, load, rpm, and afr.
You can quickly check the number of model inputs as follows:
nfactors( modeltutorial{1} )
You can click a point in the boundary editor (in the 1-D, 2-D and 3-D views) to check the input names and get example input values to evaluate in the workspace, e.g.
ceval (modeltutorial{1}, [25, 0.64, 5000, 14.43] )
ans = 3.0284e-004
Boundary constraint distance of zero means the point is on the boundary, negative values are inside the constraint, and positive values are outside. The range is typically [-1,1] but not always, and roughly linear. Rather like information criteria it is only a comparison that is meaningful (point x has a greater distance than point y) rather than the absolute value.
The confidence interval is given by:
upperbound = y + t*sqrt(pev)
lowerbound = y - t*sqrt(pev)
Where y is the model prediction, and t is the appropriate percentile of the t-statistic, with df = nObs-1 degrees of freedom. This is calculated using the Statistics Toolbox function tinv as follows:
t = tinv(p,v)
p=confidence level e.g. 95%
v= degrees of freedom (n-1)
t = tinv(1-alpha/2, df)
where alpha = 0.05 for 95% confidence intervals.
![]() | Two-Stage Models for Engines | Radial Basis Functions | ![]() |

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