Main Content

View Model Statistics

This example shows how you can use model statistics to determine the effect of a change on model complexity.

  1. To open an example with a simple mechanical system, enter:

    openExample('simscape/SimpleMechanicalSystemExample')

    Default Simple Mechanical System example model.

  2. To view model statistics, in the model window, on the Debug tab, click Simscape > Statistics Viewer.

    Arrow pointing to the location of the Statistics Viewer tool on the canvas toolstrip.

    The tool opens, but it does not contain any data. The Update Model button displays a caution symbol to indicate the statistics need to be refreshed.

    Empty Statistics Viewer window with update model button highlighted.

  3. Click the Update Model button. The window now displays an overview of the models statistics.

    Updated overview window, which shows a summary

  4. The default page contains a summary of the model statistics. Select Variables to display information about the simulation variables. Note that there are no algebraic variables in this version of the model.

    Variables pane of the Statistics Viewer tool showing 0 in the Algebraic variables row.

  5. To limit the range of motion, add a Translational Hard Stop block to the model diagram, in parallel with the Translational Spring and the Translational Damper blocks.

    Simple Mechanical System example model with a Translational Hard Stop block added in parallel to the spring-damper system.

  6. Return to the Statistics Viewer tool. Note that the Update Model button again shows a caution symbol to remind you to update the statistics after changing the model configuration. Update the model statistics.

    Variables pane of the Statistics Viewer tool showing 5 in the Algebraic variables row.

    Note the increase in algebraic variables. This is a result of adding a nonlinearity with the Translational Hard Stop block. The solver can no longer use a linear optimization to simulate the model.

See Also

Related Examples

More About