Products & Services Solutions Academia Support User Community Company

Learn more about Control System Toolbox   

impulse - Impulse response of LTI model

Syntax

impulse
impulse(sys)
impulse(sys,t)

Description

impulse calculates the unit impulse response of a linear system. The impulse response is the response to a Dirac input for continuous-time systems and to a unit pulse at for discrete-time systems. Zero initial state is assumed in the state-space case. When invoked without left-hand arguments, this function plots the impulse response on the screen.

impulse(sys) plots the impulse response of an arbitrary LTI 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,t) sets the simulation horizon explicitly. You can specify either a final time t = Tfinal (in seconds), or a vector of evenly spaced time samples of the form

t = 0:dt:Tfinal

For discrete systems, the spacing dt should match the sample period. For continuous systems, dt becomes the sample time of the discretized simulation model (see "Algorithm"), so make sure to choose dt small enough to capture transient phenomena.

To plot the impulse responses of several LTI models sys1,..., sysN on a single figure, use

impulse(sys1,sys2,...,sysN) 
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 left-side arguments,

[y,t] = impulse(sys)
[y,t,x] = impulse(sys)     % for state-space models only
y = impulse(sys,t)

return the output response y, the time vector t used for simulation, and the state trajectories x (for state-space models only). 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

and y(:,:,j) gives the response to an impulse disturbance entering the jth input channel. Similarly, the dimensions of x are

Remarks

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.

Example

To plot the impulse response of the second-order state-space model

use the following commands.

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 =
   101     1     2

(the first dimension is the length of t). The impulse response of the first input channel is then accessed by

y(:,:,1)

Algorithm

Continuous-time models are first converted to state space. The impulse response of a single-input state-space model

is equivalent to the following unforced response with initial state .

To simulate this response, the system is discretized using zero-order hold on the inputs. The sampling period 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).

Limitations

The impulse response of a continuous system with nonzero matrix is infinite at . impulse ignores this discontinuity and returns the lower continuity value at .

See Also

ltiview, step, initial, lsim

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS