You are on page 1of 59

KOM 3781

Discrete-Time Control Systems

Veysel Gazi
Lecture 6: Stability Analysis
Outline
• Stability
• Bilinear Transformation
• Routh-Hurwitz Criterion
• Jury Stability Test
• Root Locus
• Nyquist Criterion
• Bode Diagram
• Interpretation of Frequency Response
• Closed-Loop Frequency Response
z-Plane Stability
Consider the LTI system:
R(s) + X(s) X*(s) 1 - e -Ts X (s)
G p (s)
Y(s)
T=0.1 s
-

m
K z zi
G z R z
Y z R z
1 GH z n
z pi

k1 z kn z
Y z YR z
z p1 z pn

1 ki z k
ki pi
z pi

Combining complex pairs of poles:


A(r ) k cos(k + )
Transient Response
A(r ) k cos(k + )
Stability
System stability may be determined from the location of
the roots of the characteristic equation.
The system characteristic equation is given in various ways:
Classic Characteristic Equation:
1 + GH ( z ) = 0
Denominator of pseudo-control function, independent
of R(z)
|zI - A| = 0
Keep in mind that stability is only a boundary condition in control.
Tests for stability:
Do not give relative stability
Do not give system performance.
For relative stability, performance and design we will use:
Root locus
Nyquist plots
Bode plots
z-Plane Stability
R(s) + E(s) E* ZOH Y(s)
D(z) Gp(s)
T
-
H(s)

Y ( z) D ( z )G ( z )
=
R ( z ) 1 + D( z )GH ( z )
-1  G p (s) H (s) 
GH ( z ) = (1 - z )  
 s 
Characteristic equation:
-1  G p (s) H (s) 
1 + D( z )GH ( z ) = 1 + D( z )(1 - z )  =0
 s 
z-Plane Stability

E1(s) E1* +
R(s) + Y(s)
T G1(z) G2(s)
– –

 G1G 2 
 2 + G  ( z)
 R   2  (1 + G2 ) R 
Y ( z) =   ( z) +   ( z)
 2 + G2   G1G2 
1+   2 + G2 
 ( z)
 2 + G2 
The denominator term, independent of the input R( z ),
 G1G2 
is the characteristic equation: 1+   ( z) = 0
 2 + G2 
z-Plane Stability
The characteristic equation may also be found by:
Opening the loop at a sampler:
• Set the input R(s)=0 (stability is independent of the input).
• Open the loop at any sampler (label the sampler output as
Ei*(s) and its input as Eo(s)).
• Solve for the sampler input Eo(s) using Ei*(s) as the source.
• Solve for the open-loop transfer fcn (Gop(z) = Eo(z)/Ei(z)).
• Characteristic equation is 1 + F(z) = 1 – Gop(z) = 0

State space:
x(k+1) = A x(k) + B r(k)
y(k) = C x(k) + D r(k)
Characteristic equation is |zI - A| = 0
Example: opening a sampler

Open Loop:
G1* Ei*
Eo = -G2 E E1 = G1 E - G2 HE E =
*
* * *
1 i 1 1 *
1 + G2 H

-G1*G2*
E =
*
o *
Ei*
1 + G2 H
Close the loop (Eo* = Ei*  Gop ( z ) = 1):
Eo ( z ) = Gop ( z ) Ei ( z )
 G1 ( z )G2 ( z ) 
1 +  Eo ( z ) = 0
 1 + G2 H ( z )  G1 ( z )G2 ( z )
Gop ( z ) = -
1 + G1 ( z )G2 ( z ) + G2 H ( z ) = 0 1 + G2 H ( z )

1 + F ( z ) = 1 - Gop ( z ) = 0 Gop(z) is the open-loop transfer function.


F(z) is the open-loop function.
z-Plane Stability
A discrete-time system is stable if its closed-loop roots
are inside the unit circle.

We will discuss two methods to evaluate root locations of


the z-plane characteristic equation:

• The Routh-Hurwitz criterion: a s-plane method (z-


plane mapped to the w-plane which mimics the s-plane):

• Jury’s Stability Test: a z-plane method


Bilinear Transformation
z-Plane to s-Plane Mapping
The obvious question: What mapping method should we
use? Consider the mapping we used for s-plane to z-plane
mapping.
sT
z e
z = e sT Thus,  sT ,
z-a e -a
Please note that a polynomial method is preferred!

The bilinear transformation is another powerful method.


1 + (T / 2) w 2 z -1
z= or w=
1 - (T / 2) w T z +1

This transformation maps the z-plane to the w-plane.


How is the w-plane related to the s-plane?
z-Plane to w-Plane Mapping
 z - 1 1 ( z - 1)3 1 ( z - 1)5 
ln z = 2  + + + 
 z + 1 3 z + 1 5 z + 1 
If we let z = e
sT
, we find from the 1st term of the expansion:
1 1  z - 1 1 ( z - 1)3 
s = ln z = 2  + + .......
T T  z +1 3 z +1 
 2 z -1  2 e sT - 1  2 e j T - 1 Bilinear
w=  =  T e sT + 1  =
 T z + 1  z =e sT   s = j T e j T
+ 1 Transform
2 e j T /2 - e - jT /2 2 T
= j T /2 - j T /2
= j tan = jw
Te +e T 2
To interpret this, we observe that the imaginary or
frequency axis in the w-plane is related to the imaginary or
frequency axis in the s-plane by:
2 T T
w = tan when  1, w  
T 2 2
Bilinear Transformation
w-plane to z-plane
2 z -1
1) w=
T z +1

z-plane to w-plane
2 T 
w+ 1+  w
2) z=- T = 2 
w-
2 T 
1-  w
T 2 

s-plane frequency, ω, to w-plane frequency, ωw

2 T T T T
3) w = tan , when  1, tan  , w  
T 2 2 2 2
z-Plane to w-Plane Mapping
jw
s-Plane
D C
ws / 2 frequency
2 T
B ws / 4
w = tan w-Plane
∞ A T 2 jωw
0  T
For  1, w  
G -w s / 4 2
C
-w s / 2 C
E F

B j2/T
C
z = e sT D A
F E -2/T 0 σw
Im z 2 z -1 G -j2/T
w= ∞
z-Plane B
T z +1 F

1
C D A z = 1 gives w = 0 F
F E 0 Re z z = -1 gives w = ∞
z = 0 gives w = –2/T
G
Why map to the w-plane?
1) This is a first-order approximation of the mapping from
the z-plane to the s-plane.

2) We can apply the Routh-Hurwitz criterion for stability


analysis.

3) We can do compensator design on the vertical jωw axis


using continuous-time Bode plot design methods.
(lag, lead, lag/lead, PI, PD, PID, etc.)

4) Accurate for small ωw [tan (ωT/2) ≅ ωT/2]


For example, for: ωT/2 < π/10 or ω < 2π/10T

or ω < ωs/10 (error < 4%)

At ω = ωs/10, a ZOH introduces 18º phase lag.


Example
R(s) + X(s) X*(s) 1 - e-Ts X ( s ) K Y(s)
-
T s s ( s + 1)

The characteristic equation is a function of the sampling


interval T. As T increases beyond 0.5, the system goes
unstable.

G( z) = K
( e -T + T - 1) ) z + (1 - (1 + T )e -T )
( z - 1)( z - e -T )
1 + wT / 2
Let z = , which leads to
1 - wT / 2
 1 + wT / 2 
( e + T - 1) )  1 - wT / 2  + (1 - (1 + T )e-T )
-T

G ( w) = K
 1 + wT / 2    1 + wT / 2  -T 
 1 - wT / 2  - 1  1 - wT / 2  - e 
     
Bilinear Transformation
Next form 1 + G (w) = 0, getting
 T 2

 -T
 -T -T
 
 2(1 + e ) + K  2(1 - e - T (1 + e )    +
2
w 
 4 
w T (1 - e -T ) - KT 1 - e -T (1 + T )   + KT (1 - e -T ) = 0

-b  b 2 - 4ac -b 4ac - b 2
or aw + bw + c = 0
2
w1,2 = =  j
2a 2a 2a

We can determine stability for a specific gain, say K = 4.25,


by increasing T and examining the “-b/2a” term to test for
stability.
T K - b / 2a This result shows that instability
0.1 4.25 - 0.395 results when T is greater than 0.5145.
0.2 4.25 - 0.294
0.5 4.25 - 0.013
We can also set the sampling period
(say T = 0.1) and examine stability for
0.5145 4.25 0
values of K.
The Routh-Hurwitz Criterion
• Find the characteristic equation (discrete).

• Use the bilinear transformation to map the


function from the z-plane to the w-plane.

• Construct the Routh array.

• Examine the entries to determine stability.


The Routh-Hurwitz Criterion
The Routh-Hurwitz criterion identifies the number of RHP
poles from the number of sign changes in the leftmost
column of the Routh array.
F ( w) = bn wn + bn -1wn -1 + bn - 2 wn - 2 + + b1w + b0

Form the array: wn : bn bn - 2 bn - 4


wn : a1 a2 a3 wn -1 : bn -1 bn -3 bn -5
wn -1 : b1 b2 b3 wn - 2 : c1 c2 c3
wn - 2 : c1 c2 c3 : d1 d2 d3

1 a1 ai +1 w1 :
ci = - j1
b1 b1 bi +1
w0 : k1
Routh Array % MATLAB®

For an example open-loop function:


Fw=[1 9 8 12 21 30]
roots(Fw)

F ( w) = w5 + 9 w4 + 8w3 + 12 w2 + 21w + 30 ans =


-8.1687
Forming the array: wn : a1 a2 a3 0.6302 + 1.2968i
0.6302 - 1.2968i

w : n
1 8 21 wn -1 : b1 b2 b3 -1.0458 + 0.8204i
-1.0458 - 0.8204i

w n -1
: 9 12 30 wn -2 : c1 c2 c3
wn - 2 : 1 a1 ai +1
6.667 17.667 0 ci = -
wn -3 : -11.85 30 0 1 60 b1 b1 bi +1
- (1*12 - 9*8) = = 6.667
wn - 4 : 9 9
1 159 53
n -5 - (1*30 - 9* 21) = = = 17.667
w : 9 9 3
1 79
- (9*17.667 - 6.667 *12) = - = -11.85
6.667 6.667

• The appearance of the minus sign in the first column


indicates RHP root(s), and thus instability.
• Number of sign changes in the 1st column is equal to the
number of RHP poles.
Routh Array % MATLAB®
Fw=[1 10 38 67 52 12]
Another example: roots(Fw)

F ( w) = w5 + 10 w4 + 38w3 + 67 w2 + 52 w + 12 ans =
-3.0000
-2.6180
wn : 1 a1 ai +1 -2.0000
1 38 52 ci = - -2.0000
b1 b1 bi +1
wn -1 : 10 67 12 -0.3820

wn - 2 : 31.3 50.8 0
wn -3 : 50.8 12 0 1
- (1* 67 -10 * 38) =
313
= 31.3
wn - 4 : 43.4 0 0 10 10

wn -5 : 12 0 0
• The process continues to a single number in the bottom
two rows. No minus signs appear so the system is stable.
• The number of RHP poles is equal to the number of sign
changes in the first column.
• No sign changes -> No RHP poles –>The system is stable.
Example
R(s) + X(s) X*(s) 1 - e-Ts X ( s ) K Y(s)
-
T s s ( s + 1)
(Again)
Ts
1 e 1
G s , K 1, T 0.1
s s s 1
T
z 1 e T 1 z2 1 e T
Te T
z 0.00484 z 0.00468
G z 2
z z 1 z e T z 1 z 0.905

Find the bilinear transform:


>> T=0.1; numz=[0.00484 0.00468]; denz=[1 -1.905 0.905];
Gz=tf(numz,denz,T);
Gw=d2c(Gz,'tustin')

Gw =
-4.199e-05 s^2 - 0.04913 s + 0.9995
-----------------------------------
s^2 + 0.9974 s + 4.429e-15
Example
0.00004199 w2 0.04913 w 0.9995
G ( w)
w2 0.9974 w 4.429(10) 15

The characteristic equation for any value of K


1 KG w 1 0.000042 K w2 0.997 0.0491K w K 0

The Routh array


w2 1 0.000042 K K K < 23,800
w1 0.997 0.0491K K < 20.3
K K 0
w0

• If K satisfies 0 < K < 20.3, then no sign changes in the


first column and the system is stable.
• K must be in the range 0 < K < 20.3 for stability.
Jury’s Stability Test
• Can be applied directly to z-domain functions.
• It is not necessary to perform the z-plane to w-plane
transformation.
• The array is larger and the computations are more
complex than in the Routh-Hurwitz test.
• First, determine the characteristic equation:
Q ( z ) = 1 + D ( z )GH ( z )
= an z n + an -1 z n -1 + + a1 z + a0 = 0 for an  0
• For the system to be stable, all of the roots of this
polynomial must lie within the unit circle.
• From the characteristic equation, match terms to the
polynomial and form the Jury’s Array.
Jury’s Array
Q( z ) = an z n + an -1 z n -1 + + a1 z + a0 = 0 for an  0

Row z0 z1 z2  z n -k  z n -1 zn
1 a0 a1 a2  an - k  an -1 an
2 an an -1 an -2  ak  a1 a0
3 b0 b1 b2  bn -k  bn -1 0
4 bn -1 bn -2 bn -3  bk -1  b0 0
5 c0 c1 c2 c3  cn -2 0 0
6 cn -2 cn -3 cn -4 cn -5  c0 0 0
      0 0 0
2n - 5 l0 l1 l2 l3 0 0 0 0
2n - 4 l3 l2 l1 l0 0 0 0 0
2n - 3 m0 m1 m2 0 0 0 0 0
Jury’s Array
Q( z ) = an z n + an -1 z n -1 + + a1 z + a0 = 0 for an  0
The elements of the array are calculated as:
a0 an - k b0 bn - k -1 c0 cn - k - 2
bk = ck = dk =
an ak bn -1 bk cn - 2 ck
l0 l3 l0 l2 l0 l1
m0 = m1 = m2 =
l3 l0 l3 l1 l3 l2

The Jury criterion Q(1) > 0 order of the


states that necessary polynomial
( -1)
n
Q(-1) > 0
and sufficient
conditions for stability and the following (n - 1) constraints
(i.e., that all roots lie a0 < an b0 > bn-1 c0 > cn-2 m0 > m2
inside the unit circle) first last
are: row row
Jury Example % MATLAB®
Qz=[17 29 27 7]
Q ( z ) = 17 z 3 + 29 z 2 + 27 z + 7 = 0 abs(roots(Qz))
a0  a3  7  17  OK ans =
1.0415
Q (1) = 80  0  OK 1.0415
0.3796

(-1)3 Q( -1) = (-1)(-8) = 8  0  OK

The array becomes a0 an -0 7 17


b0 = =
an a0 17 7
1 7 27 29 17
7 29 7 27
2 17 29 27 7 b1 = b2 =
17 27 17 29
3 -240 -304 -256 0

Note, the roots are:


m0  m2 - 0.380 , - 0.663  j 0.803 .
?  Fails
-240  -256
The magnitude of the
We thus conclude that the system complex roots is 1.045.
is unstable.
Example
Step input R(s) + E(s) E* 1-e-Ts . K . Y(s)
R(s) = 1/s T=1sec s s(s+1)
-

The open-loop transfer function is given by:


 z -1   K  (0.368 z + 0.264) K
G( z) =    s 2 ( s + 1)  = z 2 - 1.368 z + 0.368
 z   
The unity feedback closed-loop characteristic equation
(with open-loop gain K) is given by:
(0.368 z + 0.264) K
1 + G( z) = 1 + 2 =0
z - 1.368 z + 0.368
or
z 2 + (0.368 K - 1.368) z + (0.368 + 0.264 K ) = 0
Example
The Jury array is:
z0 z1 z2
0.368 + 0.264 K 0.368 K – 1.368 1

Applying the constraints:


a) Q(1) > 0,
[z2 +(0.368K − 1.368)z + (0.368 + 0.264)K)] |z = 1
1 +(0.368K − 1.368) + (0.368 + 0.264 K) = 0.632K > 0 => K > 0

b)(-1)2 Q(-1) > 0


1− 0.368K + 1.368 + 0.368 + 0.264K > 0 => K < .632/.104 = 26.3

c)|a0| < an

0.368 + 0.264K < 1 => K < 0.632/0.264 = 2.39


Example
% MATLAB®
Qz=[1 -0.488 1];
r=roots(Qz)
abs(r)

Then for stability: 0 < K < 2.39


angle(r)

r =
0.2440 + 0.9698i
and marginal stability is at K = 2.39, for which: 0.2440 - 0.9698i

ans =

[z2 +(0.368K−1.368)z + (0.368 + 0.264) K)]| K=2.39


1.0000
1.0000

ans =
= z2 – 0.488 z + 1 1.3243
-1.3243

with roots:

z = 0.244 ± j0.970 = 1 (± 75.9o) = 1 (± 1.32 rad)

= 1  (± ωT), for T = 1 sec => ω = 1.32 rad/sec


Jury’s Method
“Quick” tests for low-order systems:
a0
First-order: 1
a1
Second-order: a2 + a1 + a0  0
a2 - a1 + a0  0
a0 - a2  0
Third-order: a3 + a2 + a1 + a0  0
a3 - a2 + a1 - a0  0
a0  a3
(a0
2
- a32 )  ( a0 a2 - a1a3 )
Root Locus
Determines the location of roots of the characteristic
equation of a closed loop control system as the overall system
gain (often denoted by K) varies. The characteristic equation
may be written in any of the following forms:
1 + KGH ( z ) = 0
Roots of this equation must meet two conditions:

KGH ( z ) = 1, ( )
 KGH ( z ) = (1 + 2k )(180)

A root locus is a plot of the roots of this equation in the z-


plane as K varies. While construction rules for the z-Plane
are identical with those for the s-Plane, the interpretation
is different.
Root Locus
DESIGN METHOD:
1. Derive the open loop transfer function KGH(z) .
2. Factor numerator and denominator, first order and
quadratic factors.
3. Plot roots in z-Plane.
4. Determine the root loci geometrically, analytically, by
computer -- any convenient method.
5. Calibrate in terms of K.

6. Find time response, if needed.


7. Refine, redesign, relocate, etc., to meet specifications.
8. Synthesize or realize any necessary compensation
networks or digital filters.
Root Locus Construction
N(z)
1+ KGH(z) = 0 GH(z) =
D(z)
1. Loci originate on the poles of KGH(z) and terminate on
its zeros.
2. For K > 0, the real axis loci lie to the left of an odd
number of poles and zeros.
3. The loci are symmetrical with respect to the real axis.
4. The number of asymptotes is equal to the number of
poles of KGH(z) , np, minus the number of its zeros, nz.
The angles of the asymptotes are calculated by
(1+ 2k)(180 o )
qA = , k = 0, 1, 2, ... (n p - nz -1)
n p - nz
5. The intersection of the asymptotes on the real axis is
given by: å poles of GH(z) - å zeros of GH(z)
s=
np - nz
Root Locus Construction
6. The breakaway point for the locus between two poles
(or the break-in point for the locus between two
zeros) is found by break-in
dGH ( z )
= 0. Solve for the roots.
dz
N ( z) d ( N ( z )) d ( D ( z ))
GH ( z ) = , D( z ) - N ( z) =0
D( z ) dz dz breakaway

7. The unit circle crossings of the root locus may be


determined by the Jury test (the value of K and location
of roots).
Root Locus Example
(z + 0.9700)
( z + 0.9700) N ( z) G(z) =
(z -1)(z - 0.9100)
1+ K = 1 + KG ( z ) = 1 + K =0
( z - 1)( z - 0.9100) D( z )
To find the breakaway points:
D( z ) = ( z - 1)( z - 0.9100) N ( z ) = z + 0.9700
d ( N ( z )) d ( D ( z ))
D( z ) - N ( z) = z 2 + 1.9400 z - 2.7627 = 0.
dz dz
Solving yields z = 0.9471, - 2.9171
Use the Jury test to find that the locus crosses
the unit circle for K = ?.
z 2 + ( K - 1.9100) z + (0.9700 K + 0.9100) = 0
Q(1)  0  K  0; (-1) n Q(-1)  0  K  127.33
a2  a0  1  0.97 K + 0.91, or K  0.0928.
We conclude that the system is stable iff: 0  K  0.0928
Root Locus Example
(z + 0.9700)
G(z) =
(z -1)(z - 0.9100)

K=0.0928

0 x x1
-2.9171 -0.97 0.91

0.9471
Root Locus Example
num=[1 0.970];den=[1 -1.91 0.91];
(z + 0.9700)
Gz=tf(num,den,0.1);rlocus(Gz)
G(z) =
axis([-4 1.5 -2 2]) (z -1)(z - 0.9100)
Root Locus Example

Find the breakaway point.

rlocus(Gz)
axis([.75 1.1 -1.1 1.1])

Breakaway point
(Damping = 1.0)
is 0.954
Root Locus Example
(z + 0.9700)
G(z) =
(z -1)(z - 0.9100)
Suppose we add some compensation, with a digital filter D(z):
z - 0.9100 (z + 0.9700)
D(z) = , D(z)G(z) =
z - 0.4000 (z -1)(z - 0.4000)

K=0.6200

x x
-0.97 0 0.40
0 1

0.6700

While the root locus has a very similar shape, analysis of the
data shows that the system is stable for 0 < K < 0.62. This
greatly reduces the steady-state errors in the system.
Compensated Example
T=0.1;
num=[1 0.970];
den=[1 -1.91 0.91];
Gz=tf(num,den,T);
Dz=tf([1 -0.91],[1 0.4],T);
DzGz=zpk(Dz*Gz)
rlocus(Dz*Gz)
axis([-1.5 1.5 -1.5 1.5])

DzGz =
(z+0.97) (z-0.91)
----------------------
(z-1) (z-0.91) (z+0.4)
Compensated Example
The Nyquist Stability Criterion
Let GH ( z ) be the open-loop function,
Then the characteristic equation for the closed-loop system is
1 + GH ( z ) = 0
Consider GH ( z ) = -1
We can examine the behavior of GH ( z ) in relation to the - 1 point
as we traverse the frequency response contour in the z-Plane.
Let
Zi = number of zeroes of characteristic
equation inside the unit circle
Zo = number of zeroes of characteristic
equation outside the unit circle
Pi = number of poles of the open-loop
function that are inside the unit circle.
Po = number of poles of the open-loop
function that are outside the unit
circle.
The Nyquist Stability Criterion
We can examine the behavior of GH (z) in relation to the -1 point
as we traverse the frequency response contour in the z-Plane.
The number of encirclements of the –1 point is

In general, the numerator and denominator are


the same degree, say n

Zi = number of zeroes of
characteristic equation So
inside the unit circle
Zo = number of zeroes of
characteristic equation
outside the unit circle
Dropping the subscripts
Pi = number of poles of the
open-loop function that are N = number of encirclement of the –1 point.
inside the unit circle. Z = number of zeroes of characteristic equation outside
Po = number of poles of the the unit circle
open-loop function that are P = number of poles of the open-loop function (or
outside the unit circle. characteristic equation) that are outside the unit circle.
Nyquist Diagrams (Stability)

1
gain margin =
a

phase margin = fm
Nyquist Diagrams (Example)
0.368z + 0.264
Open-loop function: G(z) = T =1
z 2 -1.368z + 0.368
Frequency contour is plotted in G(z) plane. Closed-loop
system is unstable if -1 point in G(z) plane is encircled.
Nyquist Diagrams (dnyquist)

dnyquist: calculates
the frequency
response of discrete-
time LTI systems.
%Example
num=[0 .368 .264];
den=[1 -1.368 .368];
T=1;
dnyquist(num,den,T)
axis([-1.2 0.2 -0.7 0.7])
The Bode Diagram - Discrete System
Example
Bode diagrams can be plotted using the continuous-time
procedures we know by transforming the sampled-time
open-loop transfer functions to the w-plane (which mimics
the frequency behavior of the s-plane if the sampling
period is chosen appropriately).

Consider again the system

Numerator break frequencies: 2.0, 12.14


Denominator break frequencies: 0, 0.924
Example
Gm = 7.58 dB
Pm = 30.4 deg

Straight-
line Bode
diagram
Example G w
0.0381 w 2 w 12.14
w w 0.924

>>Gw = -0.0381*tf([1 -2],[1 0])*tf([1 12.14],[1 0.924]);


margin(Gw), grid % margin generates a labeled Bode diag.

Gm = 7.58 dB
Pm = 30.4 deg
Example
>>Gs=tf([1],[1 1 0]); T=1; Gz=c2d(Gs,T); margin(Gz), grid

Gm = 7.58 dB
Pm = 30.4 deg
Example: Bode diagram, root locus,
Nyquist plot
Compare the gain margins.
10 10
Gp (s) = =
s(s 2 + 4s + 8) s3 + 4s 2 + 8s
>> T=0.1; num=[10]; den=[1 4 8 0];
Gp=tf(num,den); Gz=c2d(Gp,T); Gz=zpk(Gz)
[numz,denz]=tfdata(Gz,'v');
figure(1),margin(Gz) % Bode with margins
figure(2),rlocus(Gz),grid
figure(3),nyquist(numz,denz,T),grid
Gz =
0.0015067 (z+3.373) (z+0.2427)
------------------------------
(z-1) (z^2 - 1.605z + 0.6703)
)
Gz =
0.0015067 (z+3.373) (z+0.2427)
------------------------------
(z-1) (z^2 - 1.605z + 0.6703)
Gz =
0.0015067 (z+3.373) (z+0.2427)
------------------------------
(z-1) (z^2 - 1.605z + 0.6703)
Gz =
0.0015067 (z+3.373) (z+0.2427)
------------------------------
(z-1) (z^2 - 1.605z + 0.6703)

K = 1.0
Gz =
0.0015067 (z+3.373) (z+0.2427)
------------------------------
(z-1) (z^2 - 1.605z + 0.6703)

K = 2.7

>> Gm=2.7; Gmdb=20*log10(Gm)

Gmdb =
8.6273
Gz =
0.0015067 (z+3.373) (z+0.2427)
------------------------------
(z-1) (z^2 - 1.605z + 0.6703)

>> A0=-0.365;
Gmdb=20*log10(-1/A0)

Gmdb =
8.7541

You might also like