Plot timeseries
plot(
plots the ts
,specs
)timeseries
data using a line graph and applies the
specified specs
to lines, markers, or both. You can also specify
name-value pairs to define Line Properties.
The plot
function generates titles and axis labels
automatically. These labels are:
Plot Title — 'Time Series Plot:
<name>'
where <name>
is the string assigned to
ts.Name
, or by default,
'unnamed'
X-Axis Label — 'Time
(<units>)'
where <units>
is the value of the
ts.TimeInfo.Units
field, which defaults to
'seconds'
Y-Axis Label — '<name>'
where <name>
is the string assigned to
ts.Name
, or by default,
'unnamed'
You can place new time series data on a time series plot (by setting
hold on
, for example, and issuing another
timeseries/plot
command). When you add data to a plot,
the title and axis labels become blank strings to avoid labeling confusion. You
can add your own labels after plotting using the title
, xlabel
, and ylabel
commands.
Time series events, when defined, are marked in the plot with a circular
marker with red fill. You can also specify markers for all data points using a
linespec
or name/value syntax in addition to any event
markers your data defines. The event markers plot on top of the markers you
define.
The value assigned to ts.DataInfo.Interpolation.Name
controls the type of interpolation the plot
method uses
when plotting and resampling time series data. Invoke the
timeseries
method setinterpmethod
to
change default linear interpolation to zero-order hold interpolation
(staircase). This method creates a new timeseries
object,
with which you can overwrite the original one if you want. For example, to cause
time series ts
to use zero-order hold interpolation, type the
following:
ts = ts.setinterpmethod('zoh');