Use the following model properties to represent time delays in linear systems.
OutputDelay — Time delays at
system inputs or outputs
InternalDelay — Time delays
that are internal to the system
In discrete-time models, these properties are constrained to integer values that
represent delays expressed as integer multiples of the sample time. To approximate
discrete-time models with delays that are a fractional multiple of the sample time, use
This example shows how to create a first order plus dead time model using the
OutputDelay properties of
To create the following first-order transfer function with a 2.1 s time delay:
G = tf(1,[1 10],'InputDelay',2.1)
InputDelay specifies the delay at the input of the
You can use
zpk the same way as with
G = zpk(,-10,1,'InputDelay',2.1)
For SISO transfer functions, a delay at the input is equivalent to a delay at the output. Therefore, the following command creates the same transfer function:
G = tf(1,[1 10],'OutputDelay',2.1)
Use dot notation to examine or change the value of a time delay. For example, change the time delay to 3.2 as follows:
G.OutputDelay = 3.2;
To see the current value, enter:
G.OutputDelay ans = 3.2000
An alternative way to create a model with a time delay is to specify the transfer function with the delay as an expression in s:
Create a transfer function model for the variable s.
s = tf('s');
Specify G(s) as an expression in s.
G = exp(-2.1*s)/(s+10);
This example shows how to create state-space models with delays at the inputs and
outputs, using the
Create a state-space model describing the following one-input, two-output system:
This system has an input delay of 1.5. The first output has an output delay of 0.7, and the second output is not delayed.
In contrast to SISO transfer functions, input delays are not equivalent to output delays for state-space models. Shifting a delay from input to output in a state-space model requires introducing a time shift in the model states. For example, in the model of this example, defining T = t – 1.5 and X(T) = x(T + 1.5) results in the following equivalent system:
All of the time delays are on the outputs, but the new state variable X is time-shifted relative to the original state variable x. Therefore, if your states have physical meaning, or if you have known state initial conditions, consider carefully before shifting time delays between inputs and outputs.
To create this system:
Define the state-space matrices.
A = -2; B = 3; C = [1;-1]; D = 0;
Create the model.
G = ss(A,B,C,D,'InputDelay',1.5,'OutputDelay',[0.7;0])
G is a
delayss to create state-space
models with more general combinations of input, output, and state delays, of the
This example shows how to create a MIMO transfer function with different transport delays for each input-output (I/O) pair.
Create the MIMO transfer function:
Time delays in MIMO systems can be specific to each I/O pair, as in this example.
You cannot use
model I/O-specific transport delays. Instead, use
specify the transport delay across each I/O pair.
To create this MIMO transfer function:
Create a transfer function model for the variable
s = tf('s');
Use the variable
s to specify the transfer functions of
H without the time delays.
H = [2/s (s+1)/(s+10); 10 (s-1)/(s+5)];
ioDelay property of
an array of values corresponding to the transport delay for each I/O
H.IODelay = [0.1 0.3; 0 0.2];
H is a two-input, two-output
Each I/O pair in
H has the time delay specified by the
corresponding entry in
This example shows how to create a discrete-time transfer function with a time delay.
In discrete-time models, a delay of one sampling period corresponds to a factor of in the transfer function. For example, the following transfer function represents a discrete-time SISO system with a delay of 25 sampling periods.
To represent integer delays in discrete-time systems in MATLAB, set the
'InputDelay' property of the model object to an integer value. For example, the following command creates a
tf model representing with a sampling time of 0.1 s.
H = tf(2,[1 -0.95],0.1,'InputDelay',25)
H = 2 z^(-25) * -------- z - 0.95 Sample time: 0.1 seconds Discrete-time transfer function.
If system has a time delay that is not an integer multiple of the sampling time, you can use the
thiran command to approximate the fractional portion of the time delay with an all-pass filter. See Time-Delay Approximation.