Plot logged simulation series values against time
the simulation series values along the
fh = plot(
y-axis, with time along
fh is a structure of handles to
the resulting figures.
series is a
series must include
a full identifier path to the series, starting with the workspace log variable name.
Plot velocity of port R of a Translational Spring block.
Open the Mass-Spring-Damper with Controller example model:
This example model has data logging enabled for the whole model, with the
Workspace variable name parameter set to
Simulate the model to log the simulation data:
Plot velocity of port R of the Translational
Customize the previous plot using the name-value pair arguments.
This command plots the velocity of port R of the Translational Spring block in mm/s and only within the time range between 2 and 7 seconds.
series— Simulation data to plot
Seriesobject | nonscalar
Seriesobject | cell array of
Simulation data to plot, specified as a
object or a homogeneous cell array of such objects.
include a full identifier path to the series, starting with the workspace log variable
The table describes the resulting plots based on the type of the
Plots the simulation series values along the
Plots each dimension of the series values on a different axis in the same figure window.
Cell array of
Plots all series objects with commensurate units on the same axis (superimposed), and each dimension for a nonscalar series on a different axis in the same figure window.
The input arguments are binned based on
commensurate units. For each bin, all
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
fh = plot(simlog.Translational_Spring.R.v.series,'units','mm/s')plots velocity of port R of the Translational Spring block in
names— Plot legend
Plot legend, specified as the comma-separated pair consisting of
names' and a cell array of character vectors or string
scalars. The number of elements in the cell array must be same as the number of
By default, plots have no legend.
time— Time range for plotting data
Time range for plotting the data, specified as the comma-separated pair consisting
time' and a 1x2 vector,
[, in seconds.
 plots all data.
units— Units for plotting data
Units for plotting the data, specified as the comma-separated pair consisting of
units' and a unit name, or a cell array of unit names. Unit
names must appear inside single quotes (
'') or double quotes
""). Specified units must be commensurate with the units of the
fh— Handles to the resulting plot figure windows
Handles to the resulting plot figure windows, returned as a cell array.