RespConfig
Description
The step
function applies this configuration as follows.
In the SISO case
In the MIMO case, the step response of the jth input channel is obtained by setting
where ej is the jth basis vector.
The impulse
function applies this configuration as follows.
Here:
U is the input signal offset.
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
Properties
InputOffset
— Input signal offset level
0 (default) | scalar | vector | 'u0'
Input signal offset level, specified as a scalar or vector.
For single-input systems,
InputOffset
is a scalar value.For multi-input systems,
InputOffset
is a vector of length Nu, where Nu is the number of input channels. Each vector value corresponds to the signal offset in that input channel. The functions compute the responses one input channel at a time.For state-space models with offsets, set
InputOffset
='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 theu0
output of the data function. The total input signal is then u0 + u(t).
Amplitude
— Input level change
1 (default) | scalar | vector
Input level change relative to the input signal offset, 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.
Delay
— Step or impulse delay
0 (default) | nonnegative scalar
Input signal delay, specified as a nonnegative scalar value. This value specifies when the change occurs relative to the simulation start time T0.
InitialState
— Initial state values
[]
(default) | vector | 'x0'
| initialCondition
object
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 offset 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 thex0
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), andidgrey
(System Identification Toolbox) models, you can use aninitialCondition
(System Identification Toolbox) object to specify the initial state. Using identified models requires System Identification Toolbox™ software.
InitialParameter
— Initial parameter values for LPV models
[]
(default) | scalar | vector
Initial parameter values for LPV models, specified as a scalar or vector.
This property is required only when you specify InputOffset
=
'u0'
or InitialState
= []
or 'x0'
. Otherwise, this value is ignored.
Object Functions
Examples
Configure Options for Step Response
Create a transfer function model.
sys = tf([1 5],[1 10 50]);
Create an option set to specify step input offset, amplitude, and delay.
Config = RespConfig('InputOffset',-2,'Amplitude',5,'Delay',2);
Calculate the step response using the specified options.
step(sys,Config)
Configure Options for Impulse Response
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.InputOffset = [-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)
Simulate State-Space Model Relative to Model Offsets
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,2,1); xoff = randn(3,1); sys.Offsets = struct('x',xoff,'u',2,'y',[1;-1]);
Create a response configuration object. For state-space models with offsets, specify 'u0'
for InputOffset
argument and 'x0'
for InitialState
argument.
Config = RespConfig(InputOffset='u0',InitialState='x0');
Simulate the model.
t = 0:0.01:15; [y,~,x] = step(sys,t,Config);
Simulate without response configuration.
[y2,~,x2] = step(sys,t);
Compare the responses.
plot(t,y,'b',t,y2,'r--') legend("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 R2023aR2023a: Recommended over stepDataOptions
RespConfig
replaces stepDataOptions
for creating a
response configuration for the step command. RespConfig
has better support
for providing initial conditions and input signal offsets for linear time-varying and linear
parameter-varying models.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)