Experiment 6
“Continuous-Time System Representation
and Modeling”
I. INTRODUCTION
A continuous-time can be represented in many ways. However, the physics behind thesesystems
would result to an integro-differential equation, which is then transformed instate-space form or
transfer function (assuming zero initial conditions and linearity). Withthis, MATLAB functions
are developed that will help you perform continuous-timesystem representation and modeling
operations.
II. SYSTEMS MODELING
As mentioned in the previous sections, a continuous-time system can be modeled indifferent
ways. From the integro-differential equation developed by using the laws ofphysics, the equation
would transform into either state-space or transfer function. Thestate-space model is commonly
used in multiple-input-multiple-output (MIMO) systems,while the transfer function is commonly
used to represent a linear, time-invariant (LTI)single-input-single-output (SISO) system.
Transfer function
For continuous-time systems, the transfer function is mathematically defined as the ratioof the
Laplace transform of the output to the Laplace transform of the input. Qualitatively,the transfer
function is a rational expression that describes the characteristics of thesystem being modeled.
Generally, the transfer function is obtain by first getting theLaplace transform of the integro-
differential equation obtained from physical laws, thengetting the ratio of the output Laplace
polynomial to the input Laplace polynomial. Pleasetake note that in getting the Laplace
transform of the integro-differential equation, allinitial conditions must be set to zero.
The general form of a transfer function denoted by G(s) is:
N (s ) b s n + bn −1 s n −1 + ...b1 s + b0
G (s ) = = nm
D(s ) a m s + a m −1 s m −1 + ...a1 s + a 0
Where, N(s) and D(s) are the numerator and denominator polynomials, respectively
1
In MATLAB the function sys=tf(num,den) is used to generate a system that isdescribed by its
transfer function, where num and den are the numerators anddenominator vectors, respectively.
As an example, the system with the transfer function:
s 2 + 3s − 1
G(s ) = 3
s +s−2
is generated by the script shown in Listing 1:
>>numg = [1 3 -1]
numg =
1 3 -1
>>deng = [1 0 1 -2]
deng =
1 0 1 -2
>>sysg = tf(numg,deng)
Transfer function:
s^2 + 3 s - 1
-------------
s^3 + s - 2
As seen in Listing 1, the first steps were to generate the numerator and denominatorpolynomials
numg and deng, respectively. The final step is to generate a system sysgthat uses numg and deng
to as the numerator and denominator vectors for the functiontf(num,den).
State-Space Representation
In state-space representation, the integro-differential equation is transformed in to simultaneous
first-order differential equations. These simultaneous first-order differential equations can then
be represented as matrix equations in the form of:
.
x = Ax + Bu
y = Cx + Du
where there matrices A, B, C, and D are matrices that describe the system. The vectors x and u
are the state and input vectors, respectively. The vector y is called the output vector.The first
equation is called the state equation and the second equation is called the outputequation.
To generate a system described by its state-space model, the MATLAB function
sys=ss(A,B,C,D)is used, where A, B, C, and D are the matrices that describes the system. Listing
2
2 shows an example of a script that generates a state-space model of the system described by the
equations:
.
x.1 = 1 2 x1 + 0u
x 2 0 x 2 1
.2
x1
y = 1 0 + u
x2
Let D=1
3
Listing 2
>>A = [1 2;2 0]
A =
1 2
2 0
>>B = [0 1]'
B =
0
1
>>C = [1 0]
C =
1 0
>>D = 1
D =
1
>>sysg=ss(A,B,C,D)
a =
x1 x2
x1 1 2
x2 2 0
b =
u1
x1 0
x2 1
c =
x1 x2
y1 1 0
d =
u1
y1 1
Continuous-time model.
A seen in Listing 2, the first steps were to generate the matrices A, B, C, and D usingthe
techniques discussed in Chapter 1. The last step is to used the functionsys=ss(A,B,C,D)to
generate the state-space model of the system described by thestate and output equations.
4
Zero-Pole-Gain (ZPK) Model
Sometimes it is necessary to create a model given the zeros, poles, and the gain of theLTI
system. The function sys=zpk(z,p,k), is used to create such models, where zisa vector of zeros,
pis a vector of poles, and kis the dc gain of the system. As anexample, consider an LTI system
with the following specs:
Poles = 0, -2, -3, -4
Zeros = -1, -2
Gain = 2
This may have the form:
(s + z1 )(s + z 2 )...(s + z m ) (s + 1)(s + 2)
G( s) = k =2
(s + p1 )(s + p2 ) + ...(s + pn ) s(s + 2)(s + 3)(s + 4)
In MATLAB we write:
Listing 3
>>z = [-1 –2]
z =
-1 -2
>>p = [0 –2 –3 –4]
p =
0 -2 -3 -4
>>k = 2
k =
2
>>sys=zpk(z,p,k)
Zero/pole/gain:
2 (s+1) (s+2)
-------------------
s (s+2) (s+3) (s+4)
>>
5
III. SYSTEM TRANSFORMATION
MATLAB has many useful functions to transform one mathematical model of an LTIsystem to
another model. Such LTI transformations are useful for solving controlengineering problems,
and are listed below.
Converting Transfer Function to State-Space
An LTI system represented by a transfer function can be transformed into a state spacemodel by
using the function [A,B,C,D] = tf2ss(num,den), where num and denare the numerator and
denominator polynomials of the transfer function to be converted.
Converting State-Space to Transfer Function
An LTI system represented by a state space representation can be transformed into atransfer
function model by using the function [num,den]=ss2tf(A,B,C,D).
Converting Transfer Function to Zero-Pole-Gain Model
An LTI system represented by a transfer function can be transformed into a zero-polegainmodel
using the function [z,p,k]=tf2zp(num,den).
Converting Zero-Pole-Gain Model to Transfer Function
An LTI system represented by a zero-pole-gain model can be transformed into atransfer function
model by using the function [num,den]=zp2tf(z,p,k).
Converting Zero-Pole-Gain Model to State-Space
An LTI system represented by a zero-pole-gain model can be transformed into astate space
model using the function [A,B,C,D]=zp2ss(z,p,k).
Converting State-Space to Zero-Pole-Gain Model
An LTI system represented by a state space model can be transformed into a zeropole-gain
model using the function [z,p,k]=ss2zp(A,B,C,D).
It is sometimes difficult to determine the data of a certain system manually, which makes
MATLAB an efficient tool for data extraction.
Extraction of Transfer Function Data
A system sys can have transfer function data such as the numerator polynomial and the
denominator polynomial. Given a system sys, the transfer function numerator and denominator
vectors can be obtained using the function [num,den]=tfdata(sys).
Extraction of State Space Data
A system syscan have state space data such as the system matrix A, input matrix B, output matrix
C, and the feedforward matrix D. Given a system sys, the state space data can be obtained using
the function [A,B,C,D]=ssdata(sys).
6
Extraction of Zero-Pole-Gain Data
A system syscan have zero-pole-gain data such as zeros, poles, and system gain. Given a system
sys, the zero-pole-gain data can be obtained using the function [z,p,k]=zpkdata(sys).
IV. THE ZERO POLE MAP
In the analysis and design of feedback control systems, it is important to determine the location
of the zeros and poles of the system. One way of determining the zeros and poles of the system is
by using the function zpkdata as described earlier. If you are interested in the determining only
the zeros of the system, the zero function can be used. One the other hand, if you are interested in
determining only the poles of the system, the pole function can be used. Listing 4 shows an
example of zero and pole determination using the zeroand polefunctions.
Listing 4
>>% Use the system generated earlier.
>>pvector = pole(sysg)
pvector =
-1.56155281280883
2.56155281280883
>>zvector = zero(sysg)
zvector =
2
-1
The visual representation of the poles and zeros of the system in the s-plane is generated
by using the function pzmapas follows:
Listing 5
>>pzmap(sysg)
The visual representation of the pole-zero map is shown in Fig. 1.
7
Figure 1: Pole zero map of sysg
V. LTI MODELS
The command ltimodelsis used as a help file on the description of different LTI models used in
MATLAB . It gives a general information on the various types of LTI models supported in the
Control System Toolbox. There is another command, ltiprops, that is able to give details on the
generic properties of LTI models.
8
EXERCISES
A system is described by the differential equation:
d3 d2
2 3 y(t ) − 2 y(t ) + 3 y(t ) + 2 y(t ) = x(t )
d
dt dt dt
1) Determine the transfer function model of this system and generate it in MATLAB.
2)Determine the roots of the denominator polynomial.
3) Generate the state-space model of the system using any model transformation
technique.
4) Determine the eigenvalues of the state matrix A.
5) Compare the results in No. 2 and No. 4. What can you say about it?
6)Determine the poles and zeros of the system.
7)Plot the pole-zero map of the system.
8) Generate the zero-pole-gain model of the system using any model transformation
technique.
9) Plot the response for 0 t 10 seconds. Use the step command.
10) Elaborate the differences of continuous-time system and discrete-time systems and give real
world examples.