Note: This page has been translated by MathWorks. Please click here

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

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

Impulse response plot of dynamic system; impulse response data

`impulse(sys)`

impulse(sys,Tfinal)

impulse(sys,t)

impulse(sys1,sys2,...,sysN)

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

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

[y,t] = impulse(sys)

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

y = impulse(sys,t)

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

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

`impulse`

calculates the unit impulse response
of a dynamic system model. For continuous-time dynamic
systems, the impulse response is the response to a Dirac input *δ*(*t*).
For discrete-time systems, the impulse response is the response to
a unit area pulse of length `Ts`

and height `1/Ts`

,
where `Ts`

is the sample time of the system. (This
pulse approaches *δ*(*t*)
as `Ts`

approaches zero.) For state-space models, `impulse`

assumes
initial state values are zero.

`impulse(sys)`

plots the
impulse response of the dynamic system model `sys`

.
This model can be continuous or discrete, and SISO or MIMO. The impulse response
of multi-input systems is the collection of impulse responses for
each input channel. The duration of simulation is determined automatically
to display the transient behavior of the response.

`impulse(sys,Tfinal)`

simulates the impulse
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`

), `impulse`

interprets `Tfinal`

as
the number of sampling periods to simulate.

`impulse(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 `impulse`

command
always applies the impulse at `t=0`

, regardless of `Ti`

.

To plot the impulse responses of several models `sys1`

,..., `sysN`

on
a single figure, use:

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

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

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

As with `bode`

or `plot`

,
you can specify a particular color, linestyle, and/or marker for each
system, for example,

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

See "Plotting and Comparing Multiple Systems" and the `bode`

entry
in this section for more details.

When invoked with output arguments:

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

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

`y = impulse(sys,t)`

`impulse`

returns the output response `y`

and
the time vector `t`

used for simulation (if not supplied
as an argument to impulse). No plot is drawn 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 impulse responses of each input channel are stacked up along
the third dimension of `y`

. The dimensions of `y`

are
then

For state-space models only:

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

(length of *t*) × (number of outputs)
× (number of inputs)

and `y(:,:,j)`

gives the response to an impulse
disturbance entering the `j`

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

are

(length of *t*) × (number of states)
× (number of inputs)

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

returns the
standard deviation `YSD`

of the response `Y`

of
an identified system `SYS`

. `YSD`

is
empty if `SYS`

does not contain parameter covariance
information.

Plot the impulse response of the second-order state-space model

$$\begin{array}{c}\left[\begin{array}{l}{\dot{x}}_{1}\\ {\dot{x}}_{2}\end{array}\right]=\left[\begin{array}{cc}-0.5572& -0.7814\\ 0.7814& 0\end{array}\right]\left[\begin{array}{l}{x}_{1}\\ {x}_{2}\end{array}\right]+\left[\begin{array}{cc}1& -1\\ 0& 2\end{array}\right]\left[\begin{array}{l}{u}_{1}\\ {u}_{2}\end{array}\right]\\ y=\left[\begin{array}{cc}1.9691& 6.4493\end{array}\right]\left[\begin{array}{l}{x}_{1}\\ {x}_{2}\end{array}\right]\end{array}$$

a = [-0.5572 -0.7814;0.7814 0]; b = [1 -1;0 2]; c = [1.9691 6.4493]; sys = ss(a,b,c,0); impulse(sys)

The left plot shows the impulse response of the first input channel, and the right plot shows the impulse response of the second input channel.

You can store the impulse response data in MATLAB^{®} arrays
by

[y,t] = impulse(sys);

Because this system has two inputs, `y`

is
a 3-D array with dimensions

size(y)

ans = 139 1 2

(the first dimension is the length of `t`

).
The impulse response of the first input channel is then accessed by

ch1 = y(:,:,1); size(ch1)

ans = 139 1

Fetch the impulse response and the corresponding 1 std uncertainty of an identified linear system .

load(fullfile(matlabroot, 'toolbox', 'ident', 'iddemos', 'data', 'dcmotordata')); z = iddata(y, u, 0.1, 'Name', 'DC-motor'); set(z, 'InputName', 'Voltage', 'InputUnit', 'V'); set(z, 'OutputName', {'Angular position', 'Angular velocity'}); set(z, 'OutputUnit', {'rad', 'rad/s'}); set(z, 'Tstart', 0, 'TimeUnit', 's'); model = tfest(z,2); [y,t,~,ysd] = impulse(model,2); % Plot 3 std uncertainty subplot(211) plot(t,y(:,1), t,y(:,1)+3*ysd(:,1),'k:', t,y(:,1)-3*ysd(:,1),'k:') subplot(212) plot(t,y(:,2), t,y(:,2)+3*ysd(:,2),'k:', t,y(:,2)-3*ysd(:,2),'k:')

The impulse response of a continuous system with nonzero *D* matrix
is infinite at *t* = *0*. `impulse`

ignores
this discontinuity and returns the lower continuity value *Cb* at *t* = *0*.

Was this topic helpful?