Main Content

RespConfig

Options for step or impulse responses

Since R2023a

Description

Use a RespConfig object to specify options for plotting step responses (step, stepplot), impulse responses (impulse, impulseplot), and initial responses (initial and initialplot).

Step responses apply configuration as follows.

  • In the SISO case

    u(t)={U,t<T0+TdU+dU,tT0+Td.

  • In the MIMO case, the step response of the jth input channel is obtained by setting

    u(t)={U,t<T0+TdU+dUj*ej,tT0+Td,

    where ej is the jth basis vector.

Impulse responses apply configuration as follows.

u(t)=U+dU*δ(t(T0+Td))

Here:

  • U is the baseline input value.

  • dU is the input level change relative to U.

  • T0 is the start time.

  • Td is the time at which the change occurs relative to T0.

Creation

Description

respOpt = RespConfig creates a response configuration object with default property values.

example

respOpt = RespConfig(Name=Value) creates a response configuration object and sets its properties using one or more name-value arguments.

example

Properties

expand all

Baseline input signal value, specified as a scalar or vector.

  • For single-input systems, Bias is a scalar value.

  • For multi-input systems, Bias is a vector of length Nu, where Nu is the number of input channels. Each vector value corresponds to the signal value in that input channel. The functions compute the responses one input channel at a time.

  • For state-space models with offsets, set Bias = 'u0' to apply the step or impulse change relative to the model offsets u0, u0(t) of the LTV model, or u0(t,p) of the LPV model. For LTV and LPV models, this is the u0 output of the data function. The total input signal is then u0 + u(t).

Input level change relative to the input signal bias, specified as a scalar or vector.

  • For single-input systems, Amplitude is a scalar value.

  • For multi-input systems, Amplitude is a vector of length Nu, where Nu is the number of input channels. Each vector value corresponds to the level change amplitude in that input channel. The functions compute the responses one input channel at a time.

Input signal delay, specified as a nonnegative scalar value. This value specifies when the change occurs relative to the simulation start time T0.

Initial state values, specified as a vector or initialCondition object.

By default, the simulation starts from the steady-state condition obtained for a constant input level equal to the input bias U. For state-space models without internal delays, the initial state xinit is obtained by solving:

  • Continuous time — 0 = Axinit + BU

  • Discrete time — xinit = Axinit + BU

To start the simulation from a different initial state, use one of the following.

  • For state-space models, InitialState is a vector of length Nx, where Nx is the number of states.

  • For state-space models with offsets, you can also set InitialState to 'x0'. This uses the state offset value x0 for state-space models, x0(T0) for LTV models, or x0(T0,p(T0)) for LPV models. For LTV and LPV models, the state offset value is the x0 output of the data function evaluated at t = T0.

  • For identified LTI models, such as idtf (System Identification Toolbox), idss (System Identification Toolbox), idproc (System Identification Toolbox), idpoly (System Identification Toolbox), and idgrey (System Identification Toolbox) models, you can use an initialCondition (System Identification Toolbox) object to specify the initial state. Using identified models requires System Identification Toolbox™ software.

Initial parameter values for LPV models, specified as a scalar or vector.

This property is required only when you specify Bias = 'u0' or InitialState = [] or 'x0'. Otherwise, this value is ignored.

Object Functions

impulseImpulse response plot of dynamic system; impulse response data
impulseplotPlot impulse response of dynamic system
stepStep response of dynamic system
stepplotPlot step response of dynamic system

Examples

collapse all

Create a transfer function model.

sys = tf([1 5],[1 10 50]);

Create an option set to specify step input bias, amplitude, and delay.

Config = RespConfig(Bias=-2,Amplitude=5,Delay=2);

Calculate the step response using the specified options.

step(sys,Config)

MATLAB figure

Create a state-space model.

A = [-0.8429,-0.2134;-0.5162,-1.2139];
B = [0.7254,0.7147;0,-0.2050];
C = [-0.1241,1.4090;1.4897,1.4172];
D = [0.6715,0.7172;-1.2075,0];
sys = ss(A,B,C,D);

Create a default option set and use the dot notation to specify values.

respOpt = RespConfig;
respOpt.Bias = [-2,3];
respOpt.Amplitude = [2,-0.5];
respOpt.InitialState = [0.1,-0.1];
respOpt.Delay = 5;

Compute the impulse response.

t = 0:0.1:20;
impulse(sys,t,respOpt)

MATLAB figure

This example shows how to apply a step change to a state-space model relative to its model offsets.

Create a random state-space model with offsets.

rng(0)
sys = rss(3,1,1); 
xoff = randn(3,1);
sys.Offsets = struct("x",xoff,"u",2,"y",-1);

Create a response configuration object. For state-space models with offsets, specify "u0" for the Bias argument and "x0" for the InitialState argument.

Config = RespConfig(Bias="u0",InitialState="x0");

Simulate the model.

t = 0:0.01:15;
y = step(sys,t,Config);

Simulate without response configuration.

y2 = step(sys,t);

Compare the responses.

plot(t,y,t,y2,"r--")
legend("With offsets","Without offsets",Location="best")

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent With offsets, Without offsets.

The responses do not match. Therefore, it is important to initialize models with offsets correctly for accurate responses.

Version History

Introduced in R2023a

expand all