Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Step response plot of dynamic system; step response data

`step(sys) `

step(sys,Tfinal)

step(sys,t)

step(sys1,sys2,...,sysN)

step(sys1,sys2,...,sysN,Tfinal)

step(sys1,sys2,...,sysN,t)

y = step(sys,t)

[y,t] = step(sys)

[y,t] = step(sys,Tfinal)

[y,t,x] = step(sys)

[y,t,x,ysd]
= step(sys)

[y,...] = step(sys,...,options)

`step`

calculates the step
response of a dynamic system. For the state-space case, zero initial
state is assumed. When it is invoked with no output arguments, this
function plots the step response on the screen.

`step(sys) `

plots the step
response of an arbitrary dynamic
system model, `sys`

. This model
can be continuous- or discrete-time, and SISO or MIMO. The step response
of multi-input systems is the collection of step responses for each
input channel. The duration of simulation is determined automatically,
based on the system poles and zeros.

`step(sys,Tfinal)`

simulates the step response
from `t = 0`

to the final time `t = Tfinal`

.
Express `Tfinal`

in the system time units, specified
in the `TimeUnit`

property of `sys`

.
For discrete-time systems with unspecified sample time (```
Ts
= -1
```

), `step`

interprets `Tfinal`

as
the number of sampling periods to simulate.

`step(sys,t)`

uses the user-supplied
time vector `t`

for simulation. Express `t`

in
the system time units, specified in the `TimeUnit`

property
of `sys`

. For discrete-time models, `t`

should
be of the form `Ti:Ts:Tf`

, where `Ts`

is
the sample time. For continuous-time models, `t`

should
be of the form `Ti:dt:Tf`

, where `dt`

becomes
the sample time of a discrete approximation to the continuous system
(see Algorithms). The `step`

command
always applies the step input at `t=0`

, regardless
of `Ti`

.

To plot the step response of several models `sys1`

,..., `sysN`

on
a single figure, use

`step(sys1,sys2,...,sysN)`

`step(sys1,sys2,...,sysN,Tfinal)`

`step(sys1,sys2,...,sysN,t)`

All of the systems plotted on a single plot must have the same number of inputs and outputs. You can, however, plot a mix of continuous- and discrete-time systems on a single plot. This syntax is useful to compare the step responses of multiple systems.

You can also specify a distinctive color, linestyle, marker, or all three for each system. For example,

step(sys1,'y:',sys2,'g--')

plots the step response of `sys1`

with a dotted
yellow line and the step response of `sys2`

with
a green dashed line.

When invoked with output arguments:

`y = step(sys,t)`

`[y,t] = step(sys)`

`[y,t] = step(sys,Tfinal)`

`[y,t,x] = step(sys) `

`step`

returns the output response `y`

,
the time vector `t`

used for simulation (if not supplied
as an input argument), and the state trajectories `x`

(for
state-space models only). No plot generates on the screen. For single-input
systems, `y`

has as many rows as time samples (length
of `t`

), and as many columns as outputs. In the multi-input
case, the step responses of each input channel are stacked up along
the third dimension of `y`

. The dimensions of `y`

are
then

$$(length\text{\hspace{0.17em}}of\text{\hspace{0.17em}}t)\times (number\text{\hspace{0.17em}}of\text{\hspace{0.17em}}outputs)\times (number\text{\hspace{0.17em}}of\text{\hspace{0.17em}}inputs)$$

and `y(:,:,j)`

gives the response to a unit
step command injected in the `j`

th input channel.
Similarly, the dimensions of `x`

are

$$(length\text{\hspace{0.17em}}of\text{\hspace{0.17em}}t)\times (number\text{\hspace{0.17em}}of\text{\hspace{0.17em}}states)\times (number\text{\hspace{0.17em}}of\text{\hspace{0.17em}}inputs)$$

For identified models (see `idlti`

and `idnlmodlel`

) ```
[y,t,x,ysd]
= step(sys)
```

also computes the standard deviation `ysd`

of
the response y (`ysd`

is empty if `sys`

does
not contain parameter covariance information).

`[y,...] = step(sys,...,options)`

specifies
additional options for computing the step response, such as the step
amplitude or input offset. Use `stepDataOptions`

to
create the option set `options`

.

You can change the properties of your plot, for example the units. For information on the ways to change properties of your plots, see Ways to Customize Plots (Control System Toolbox).

Continuous-time models without internal delays are converted
to state space and discretized using zero-order hold on the inputs.
The sample time is chosen automatically based on the system dynamics,
except when a time vector `t = 0:dt:Tf`

is supplied
(`dt`

is then used as sampling period). The resulting
simulation time steps `t`

are equisampled with spacing `dt`

.

For systems with internal delays, Control System
Toolbox™ software
uses variable step solvers. As a result, the time steps `t`

are
not equisampled.

[1] L.F. Shampine and P. Gahinet, "Delay-differential-algebraic equations in control theory," Applied Numerical Mathematics, Vol. 56, Issues 3–4, pp. 574–588.

Linear System Analyzer | `impulse`

| `initial`

| `lsim`

| `stepDataOptions`

Was this topic helpful?