Guia Control en Tiempo Discreto Con MATLAB Tutorial
Guia Control en Tiempo Discreto Con MATLAB Tutorial
The Control System Toolbox also supports the design and analysis of discrete-time systems.
Some of the most commonly used discrete-time system commands and algorithms are given
in this section.
Discretizing a continuous transfer function. The C2d function can be used to discretize a
continuous system transfer function. The sampling time must be specified. The default method
of discretization is zero-order hold at the inputs, but other methods such as linear interpolation
or bilinear approximation can be selected. For example, consider the continuous-time system
transfer function
1
G(s) = .
s+4
Assuming the sampling period is 0.1 s we can convert the transfer function to discrete time
using the following commands:
>> G = tf(1, [1,4]);
>> Gz = c2d(G, 0.1)
JWBK063-APP-B JWBK063-Ibrahim December 22, 2005 20:37 Char Count= 0
Transfer function:
0.08242
-----------
z - 0.6703
Transfer function:
0.6697 z + 0.1878
---------------------------
z^2 - 0.5896 z + 0.01832
Sampling time: 1
Poles and zeros. The poles and zeros can be obtained as follows:
>> [z,p,k] = zpkdata(Gz,‘v’)
z =
-0.2804
p =
0.5567
0.0329
k =
0.6697
Thus, G(z) has one zero at −0.2804 and two poles at 0.5567 and 0.0329. The d.c. gain is
0.6697.
The positions of the poles and zeros can be plotted on the complex plane using the command
>> pzmap(num,den)
Also, the positions of the poles and zeros and the unit circle in the z-plane can be plotted using
the command
>> zplane(num,den)
JWBK063-APP-B JWBK063-Ibrahim December 22, 2005 20:37 Char Count= 0
Step Response
2
1.8
1.6
1.4
1.2
0.8
0.6
0.4
0.2
0
0 5 10 15
Time (sec)
Root locus. The root locus diagram with lines of constant damping factor and lines of constant
natural frequency is shown in Figure B.10 and is obtained from
>> zgrid(‘new’);
>> rlocus(num,den)
The gain and the roots at any point on the locus can interactively be found using the command
>> [k,p] = rlocfind(num,den)
JWBK063-APP-B JWBK063-Ibrahim December 22, 2005 20:37 Char Count= 0
Impulse Response
0.7
0.6
0.5
0.4
Amplitude
0.3
0.2
0.1
0
0 5 10 15
Time (sec)
Root Locus
1
0.5π/T
0.6π/T 0.4π/T
0.8 0.7π/T 0.10.3π/T
0.2
0.6 0.3
0.8π/T 0.4 0.2π/T
0.5
0.4 0.6
0.7
0.9 π/T 0.8 0.1π/T
0.2
Imaginary Axis
0.9
π/T
0
π/T
−0.2
0.9 π/T 0.1π/T
−0.4
0.8π/T 0.2π/T
−0.6
0.7π/T 0.3π/T
−0.8
0.6π/T 0.4π/T
0.5π/T
−1
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
Real Axis
301
JWBK063-APP-B JWBK063-Ibrahim December 22, 2005 20:37 Char Count= 0
Bode Diagram
10
5
Magnitude (dB)
−5
−10
−15
0
− 45
Phase (deg)
−90
−135
−180
10−2 10−1 100 101
Frequency (rad/sec)
Bode diagram. The Bode diagram of a discrete time system can be obtained (assuming a
sampling time of 1 s) as
>> dbode(num,den,1);
>> grid
Nyquist diagram. The Nyquist diagram of a discrete time system can be obtained as (assuming
a sampling time of 1 s)
>> dnyquist(num,den,1);
z-Transform. The z-transform of a time function can be found using the MATLAB function
ztrans. Some examples are given below.
The z-transform of f (kT ) = kT is found as
>> syms k T;
>> ztrans(k*T)
ans =
T*z/(z-1)^2
JWBK063-APP-B JWBK063-Ibrahim December 22, 2005 20:37 Char Count= 0
Nyquist Diagram
1.5
0.5
Imaginary Axis
−0.5
−1
−1.5
−1 −0.5 0 0.5 1 1.5 2 2.5
Real Axis
>> syms a k T;
>> f = sin(a*k*T);
>> ztrans(f)
ans =
z*sin(a*T)/(z^2-2*z*cos(a*T)+1)
or
>> pretty(ans)
z sin(a T)
---------------------
2
z - 2 z cos(a T) + 1
Inverse z-transform. The inverse z-transform of a function can be found using the iztrans
function. Some examples are given below.
JWBK063-APP-B JWBK063-Ibrahim December 22, 2005 20:37 Char Count= 0
ans =
T*n
Notice that the default independent variable is n.
Coefficients of partial fraction expansion. MATLAB can be used to determine the coefficients
of the partial fraction expansion. Some examples are given below.
Consider the transfer function
2z 2 − z
G(z) = 2 .
z − 3z + 2
We usually expand the term G(z)/z which gives a form which is usually easy to look up in the
inverse z-transform tables. Thus,
G(z) 2z − 1
= 2 .
z z − 3z + 2
The coefficients of the partial fraction expansion are found as follows:
>> [r,p,k] = residue([2 -1], [1 -3 2])
r =
3
-1
p =
2
1
k =
[]
where r are the residues, p are the poles and k are the direct terms. Thus,
G(z) 3 1
= −
z z−2 z−1
and
3z z
G(z) = −
z−2 z−1
The time function can easily be found using z-transform tables.
Another example is given below where there is one direct term. Consider the transfer function
G(z) 2z 2 + 2z − 1
= 2 .
z z − 3z + 2
The coefficients are found from
>> [r,p,k] = residue([2 2 -1], [1 -3 2])
r =
11
-3
JWBK063-APP-B JWBK063-Ibrahim December 22, 2005 20:37 Char Count= 0
p =
2
1
k =
2
Thus,
G(z) 11 3
= − +2
z z−2 z−1
or
11z 3z
G(z) = − + 2z
z−2 z−1
and the inverse z-transform can be found using z-transform tables.
The following example has a double pole. Consider the transfer function
G(z) z 2 + 4z − 1
= 3 .
z z − 5z 2 + 8z − 4
The coefficients are found from
>> [r,p,k] = residue([0 1 4 -1], [1 -5 8 -4])
r =
-3.0000
11.0000
4.0000
p =
2.0000
2.0000
1.0000
k =
[ ]
There are two poles at z = 2, and this implies that there is a double root. The first residue is
for the first-order term for the double root, and the second residue is for the second-order term
for the double root. Thus,
G(z) −3 11 4
= + +
z z − 2 (z − 2)2 z−1
or
3z 11z 4z
G(z) = − + + .
z − 2 (z − 2) 2 z−1
The MATLAB command residuez can be used to compute the partial fraction expansion when
the transfer function is written in powers of z −1 .