plot

Class: simscape.logging.Node
Package: simscape.logging

Plot all series associated with node object

Syntax

h = plot(node,Name,Value)

Description

h = plot(node,Name,Value) plots all nonempty series associated with the specified node and its children. You can filter data being plotted by using the name-value pair arguments. h is a structure of handles to the resulting figures. node is an object of class simscape.logging.Node. node must include a full identifier path to the node, starting with the workspace log variable name.

For more information, including the descriptions of name-value pair arguments, see the simscape.logging.plot reference page.

Examples

Consider the following model. The model name is simple_mech2, and data logging is enabled with the default workspace variable name, simlog.

The following is a complete logging tree for the model:

simlog.print
     simple_mech2
     +-Ideal_Force_Source
     | +-C
     | | +-v
     | +-R
     | | +-v
     | +-S
     | +-f
     | +-v
     +-MTR
     | +-V
     | | +-v
     | +-f
     +-MTR1
     | +-V
     | | +-v
     | +-f
     +-Mass
     | +-M
     | | +-v
     | +-f
     +-Simulink_PS_Converter
     +-Translational_Damper
     | +-C
     | | +-v
     | +-R
     | | +-v
     | +-f
     | +-v
     +-Translational_Spring
       +-C
       | +-v
       +-R
       | +-v
       +-f
       +-v
       +-x

Plot velocities of all the blocks in the model:

plot(simlog, 'units', 'm/s', 'depth', 2)
     

This command filters simulation data in two ways. It plots only series that are commensurate with units m/s (that is, velocities), based on the units argument. And because of the depth argument, it plots only those velocity variables that are associated with the block itself. If you refer to the logging tree, only the Ideal Force Source, Translational Damper, and Translational Spring blocks have a velocity (v) variable at the second level. Because of the depth argument, velocities of the block ports (one level down) do not get plotted.

The next command plots all the variables associated with the Translational Spring block, but not with its ports:

plot(simlog.Translational_Spring, 'depth', 1)

Alternatives

Use the simscape.logging.plot function.

Was this topic helpful?