Main Content

GenerateMATLABCode for Operating Point Configuration

This topic shows how to generate MATLAB®code for operating point configuration using theSteady State ManagerorModel Linearizer. You can generate MATLAB code to programmatically reproduce a result that you obtained interactively.

You can also modify the script to compute multiple operating points with systematic variations in operating point specifications (batch computing). For more information, seeBatch Compute Steady-State Operating Points Reusing Generated MATLAB Code.

GenerateMATLABCode fromSteady State Manager

When computing operating points using theSteady State Manager, you can generate a MATLAB script or a live script for configuring operating point specifications and computing an operating point. To do so:

  1. To create a specification, in theSteady State Manager, on theSteady Statetab, clickTrim Specification.

  2. In the corresponding specification document, configure the operating point state, input, and output specifications. For an example, seeCompute Operating Points from Specifications Using Steady State Manager.

  3. To specify optimization search settings, on theSpecificationtab, clickTrim Options. For more information, seeChange Operating Point Search Optimization Settings.

  4. To generate code that creates an operating point using your specifications and search options, clickTrim, and select a code generation option.

    你可以生成一个the following scripts:

    • Live script — ClickLive Script.

    • MATLAB script — ClickScript.

    The generated script opens in the MATLAB Editor.

GenerateMATLABCode from Model Linearizer

When computing operating points using theModel Linearizer, you can generate a MATLAB script for configuring operating point specifications and computing an operating point. To do so:

  1. In theModel Linearizer, on theLinear Analysistab, in theOperating Pointsdrop-down list, clickTrim Model.

  2. In the Trim the model dialog box, on theSpecificationstab, configure the operating point state, input, and output specifications. For an example, seeCompute Operating Points from Specifications Using Model Linearizer.

  3. In theOptionstab, specify search optimization settings. For more information, seeChange Operating Point Search Optimization Settings.

  4. To generate code that creates an operating point using your specifications and search options, clickGenerate MATLAB Script.

    The generated code opens in the MATLAB Editor.

See Also

Functions

Apps

Related Topics