simscape.logging.plotxy

Package: simscape.logging

Plot logged simulation data for one node or series against another

Syntax

h = simscape.logging.plotxy(x,y,Name,Value)

Description

h = simscape.logging.plotxy(x,y,Name,Value) plots the simulation series values of object y along the y-axis, with series values of object x along the x-axis. x and y are objects (or homogeneous cell arrays of objects) of class simscape.logging.Series or simscape.logging.Node. If x or y is a node, it must be a simulation variable node (one that has a direct child series). The values of this child series are then plotted along the respective axis.

If x and y are cell arrays, they must be of the same size, or one of them can be a scalar. x and y must have the same time vectors. The remaining arguments are optional and provided as name-value pairs.

h is a cell array of figure handles, one for each y versus x plot generated.

Input Arguments

x

An object of class simscape.logging.Series. Can also be an object of class simscape.logging.Node, in which case it must be a simulation variable node (one that has a direct child series). The values of this series are plotted along the x-axis. Can also be a homogeneous cell array of objects of either of these two classes. x must include a full identifier path to the node or series, starting with the workspace log variable name.

y

An object of class simscape.logging.Series. Can also be an object of class simscape.logging.Node, in which case it must be a simulation variable node (one that has a direct child series). The values of this series are plotted along the y-axis. Can also be a homogeneous cell array of objects of either of these two classes. y must include a full identifier path to the node or series, starting with the workspace log variable name. If x and y are cell arrays, they must be of the same size, or one of them can be a scalar. x and y must have the same time vectors.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'time'

Plot data in the specified time range only. Provide a 1x2 vector [start_time end_time] to specify the time range. [] plots all data.

Default: Plots all data.

'xname'

Adds the x-axis name to the plot. Must be either a scalar or a cell array of the same size as x. Axis names must appear inside single quotes ('').

Default: Variable name.

'yname'

Adds the y-axis name to the plot. Must be either a scalar or a cell array of the same size as y. Axis names must appear inside single quotes ('').

Default: Variable name.

'xunit'

Plot the series values along the x-axis in the specified units. The specified unit must be commensurate with the unit of the series values. Unit name must appear inside single quotes ('').

Default: Default unit of the series values.

'yunit'

Plot the series values along the y-axis in the specified units. The specified unit must be commensurate with the unit of the series values. Unit name must appear inside single quotes ('').

Default: Default unit of the series values.

Output Arguments

h

A cell array of handles to the resulting plot figure windows.

Examples

Plot the motor torque, in default units, against its angular velocity, in rpm, and add axis names:

plotxy(simlog.Rotational_Electromechanical_Converter.R.w, simlog.Motor_Inertia_J.t, ...
   'xunit', 'rpm', 'xname', 'Angular velocity', 'yname', 'Torque')

Was this topic helpful?