| Control System Toolbox™ | ![]() |
| On this page… |
|---|
Examples of Creating LTI Models |
You can use Control System Toolbox™ functions to manipulate and analyze linear time-invariant (LTI) models. You can use the functions for both continuous- and discrete-time systems. Systems can be single-input/single-output (SISO) or multiple-input/multiple-output (MIMO). In addition, you can store several LTI models in an array under a single variable name. See Arrays of LTI Models for information on LTI arrays.
You can specify LTI models as:
Transfer functions (TF), for example,
![]()
Zero-pole-gain models (ZPK), for example,
![]()
State-space models (SS), for example,

where A, B, C, and D are matrices of appropriate dimensions, x is the state vector, and u and y are the input and output vectors.
Frequency response data (FRD) models
FRD models consist of sampled measurements of a system's frequency response. For example, you can store experimentally collected frequency response data in an FRD.
The following sections show simple examples of building LTI models. Note that all LTI models, including TF, ZPK, SS, and FRD are also MATLAB® objects. See Definìng Your Own Classes in the MATLAB documentation if you are not familiar with objects and object syntax.
You can create transfer function (TF) models by specifying numerator and denominator coefficients. For example,
num = [1 0];
den = [1 2 1];
sys = tf(num,den)
Transfer function:
s
-------------
s^2 + 2 s + 1
A useful trick is to create the Laplace variable, s. That way, you can specify polynomials using s as the polynomial variable.
s=tf('s');
sys= s/(s^2 + 2*s + 1)
Transfer function:
s
-------------
s^2 + 2 s + 1
This is identical to the previous transfer function.
To create zero-pole-gain (ZPK) models, you must specify each of the three components in vector format. For example,
sys = zpk([0],[-1 -1],[1]) Zero/pole/gain: s ------- (s+1)^2
produces the same transfer function built in the TF example, but the representation is now ZPK.
This example shows a more complicated ZPK model.
sys=zpk([1 0], [-1 -3 -.28],[.776]) Zero/pole/gain: 0.776 s (s-1) -------------------- (s+1) (s+3) (s+0.28)
To create a state-space model, specify the A, B, C, and D matrices.
A= [-1 0; 0 -1];
B= [1 ; 0];
C= eye(2);
D = zeros(2, 1);
sys=ss(A, B, C, D)
a =
x1 x2
x1 -1 0
x2 0 -1
b =
u1
x1 1
x2 0
c =
x1 x2
y1 1 0
y2 0 1
d =
u1
y1 0
y2 0
Continuous-time model.
You can verify that this example has two poles at -1.
sys_poles = eig(sys)
sys_poles =
-1
-1
You can create a frequency response data (FRD) model using measured data from your plant. The function frd requires at a minimum a column of frequency responses and a column of associated frequencies. This example creates FRD data and then builds the FRD model.
freq = logspace(1,2); % Create 50 points of data.
resp = .05*(freq).*exp(i*2*freq); % Create a response at each
%point.
sys = frd(resp,freq);
Type
sys
to see all the data in the FRD model. To check that sys is an FRD model, you can use the size function.
size(sys) FRD model with 1 output(s) and 1 input(s), at 50 frequency point(s).
Since sys is an FRD object, as with any MATLAB object, you can access the data using dot notation.
freq= sys.Frequency; size(freq)
Once you have built LTI models, you can manipulate them using the arithmetic and model interconnection operations described in Operations on LTI Models and analyze them using the model analysis functions, such as bode and step. FRD models can be manipulated and analyzed in much the same way you analyze the other model types, but analysis is restricted to frequency-domain methods.
Using a variety of design techniques, you can design compensators for systems specified with TF, ZPK, SS, and FRD models. These techniques include root locus analysis, pole placement, LQG optimal control, and frequency domain loop-shaping. For FRD models, you can either:
Obtain an identified TF, SS, or ZPK model using system identification techniques.
Use frequency-domain analysis techniques.
FRD models are unique model types available in the Control System Toolbox collection of LTI model types, in that they don't have a parametric representation. In addition to the standard operations you may perform on FRD models, you can also use them to:
Perform frequency-domain analysis on systems with nonlinearities using describing functions.
Validate identified models against experimental frequency response data.
Depending on the type of model you use, the data for your model may consist of a simple numerator/denominator pair for SISO transfer functions, four matrices for state-space models, and multiple sets of zeros and poles for MIMO zero-pole-gain models or frequency and response vectors for FRD models. For convenience, the Control System Toolbox software provides customized data structures (LTI objects) for each type of model. These are called the TF, ZPK, SS, and FRD objects. These four LTI objects encapsulate the model data and enable you to manipulate LTI systems as single entities rather than collections of data vectors or matrices.
An LTI object of the type TF, ZPK, SS, or FRD is created whenever you invoke the corresponding constructor function, tf, zpk, ss, or frd. For example,
P = tf([1 2],[1 1 10])
creates a TF object, P, that stores the numerator and denominator coefficients of the transfer function
![]()
See Creating LTI Models for methods for creating all of the LTI object types.
The LTI object implementation relies on the MATLAB object-oriented programming capabilities. Objects are MATLAB structures with an additional flag indicating their class (TF, ZPK, SS, or FRD for LTI objects) and have predefined fields called object properties. For LTI objects, these properties include the model data, sample time, delay times, input or output names, and input or output groups (see LTI Properties for details). The functions that operate on a particular object are called the object methods. These may include customized versions of simple operations such as addition or multiplication. For example,
P = tf([1 2],[1 1 10]) Q = 2 + P
performs transfer function addition.
![]()
The object-specific versions of such standard operations are called overloaded operations. For more details on objects, methods, and object-oriented programming, see Definìng Your Own Classes in the MATLAB documentation. For details on operations on LTI objects, see Operations on LTI Models
Operations like addition and commands like feedback operate on more than one LTI model at a time. If these LTI models are represented as LTI objects of different types (for example, the first operand is TF and the second operand is SS), it is not obvious what type (for example, TF or SS) the resulting model should be. Such type conflicts are resolved by precedence rules. Specifically, TF, ZPK, SS, and FRD objects are ranked according to the precedence hierarchy.
![]()
Thus ZPK takes precedence over TF, SS takes precedence over both TF and ZPK, and FRD takes precedence over all three. In other words, any operation involving two or more LTI models produces:
An FRD object if at least one operand is an FRD object
An SS object if no operand is an FRD object and at least one operand is an SS object
A ZPK object if no operand is an FRD or SS object and at least one is an ZPK object
A TF object only if all operands are TF objects
Operations on systems of different types work as follows: the resulting type is determined by the precedence rules, and all operands are first converted to this type before performing the operation.
In the frequency domain, an LTI system is represented by the linear input/output map
![]()
This map is characterized by its transfer matrix H, a function of either the Laplace or Z-transform variable. The transfer matrix H maps inputs to outputs, so there are as many columns as inputs and as many rows as outputs.
If you think of LTI systems in terms of (transfer) matrices, certain basic operations on LTI systems are naturally expressed with a matrix-like syntax. For example, the parallel connection of two LTI systems sys1 and sys2 can be expressed as
sys = sys1 + sys2
because parallel connection amounts to adding the transfer matrices. Similarly, subsystems of a given LTI model sys can be extracted using matrix-like subscripting. For instance,
sys(3,1:2)
provides the I/O relation between the first two inputs (column indices) and the third output (row index), which is consistent with

for
.
The next two tables list the commands you can apply to LTI models.
Creating LTI Models
Command | Description |
|---|---|
| drss | Generate random discrete state-space model. |
| dss | Create descriptor state-space model. |
| filt | Create discrete filter with DSP convention. |
| frd | Create an FRD model. |
| frdata | Retrieve FRD model data. |
| get | Query LTI model properties. |
| set | Set LTI model properties. |
| rss | Generate random continuous state-space model. |
| ss | Create a state-space model. |
| ssdata, dssdata | Retrieve state-space data (respectively, descriptor state-space data). |
| tf | Create a transfer function. |
| tfdata | Retrieve transfer function data. |
| zpk | Create a zero-pole-gain model. |
| zpkdata | Retrieve zero-pole-gain data. |
Converting LTI Models
Command | Description |
|---|---|
| c2d | Continuous- to discrete-time conversion. |
| d2c | Discrete- to continuous-time conversion. |
| d2d | Resampling of discrete-time models. |
| upsample | Upsampling of discrete-time models. |
| frd | Conversion to an FRD model. |
| pade | Padé approximation of input delays. |
| ss | Conversion to state space. |
| tf | Conversion to transfer function. |
| zpk | Conversion to zero-pole-gain. |
![]() | LTI Models | Creating LTI Models | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |