Sei sulla pagina 1di 24

CONTROL DESIGN-

FREQUENCY DOMAIN

LECTURE NOTES

HEIKKI N. KOIVO
2

SUMMARY

The notes cover classical frequency domain control design. The emphasis is on the design of
simple controllers using Bode diagram.

MATLAB and its Control System Toolbox are used extensively. In fact, although design can be
completed by hand calculations, it is neither recommended nor feasible. Careful control design
requires modern tools and use of computers is unavoidable. On the other hand, the tools mentioned
make design fun, requiring both engineering intuition and skills. Required level of mathematics is
quite modest. Some basic understanding of linear systems and control theory is required.
3

1. REPRESENTATION OF TRANSFER FUNCTIONS

1.1 BODE DIAGRAMS

In control design it is important that the reader has a clear understanding of frequency domain
analysis. Because Bode diagram forms central part in the design procedure, drawing Bode diagram
is reviewed. Specia l emphasis is on using appropriate MATLAB commands for it.

Transfer function in frequency domain can be written as

G ( jω ) = G( jω) e jϕ(ω ) (1- 1)

Taking logarithm on both sides of this equation we

ln G ( jω ) = ln G ( jω ) + jϕ (ω ) . (1- 2)

Usually the logarithm applied is Brigg’s logarithm that is logarithm base 10. Multiplying the result by
20, the gain is given in decibels (dB)

Logarithmic gain = 20 log10 G ( jω ) . (1- 3)

The factors of a transfer function can be divided into four classes: constant terms, pure integrators,
first and second order terms. The classification is direct consequence of the roots of polynomials.
Real roots, which are = 0, appear usually in the denominator and are called integrators.
Otherwise real roots result in first order terms either in the numerator or in the denominator.
4

Complex conjugate roots form second order terms. Time delays and distributed parameter syste ms
have to be handled separately.

REMARK: Remember that the order of the numerator polynomial is always smaller or equal than
that of the denominator! Why is this? Note that an ideal differentiator G(s) = s, does not exist in
real world, only in textbooks.

Next we will cover drawing of the Bode diagrams of the basic system classes. Let’s begin by
defining a transfer function model in MATLAB Control System Toolbox.

Example 1.1.
Determine MATLAB representation for transfer functions
3s + 4
a. G1 ( s) = 2
s + 2s + 7
2s 2
b. G2 ( s) = 4
5 s + 6 s 2 + 3 s + 10
10 ( s + 2)
c. G3 ( s) 2
s ( s + 1)( s + 4 )
Convert the representations to zpk or tf forms, depending on the case

SOLUTION.
a. » num=[3 4]; den=[1 2 7]; g1=tf(num,den)
Transfer function:
3s+4
-------------
s^2 + 2 s + 7

Further the zpk form

» sys1=zpk(g1)

Zero/pole/gain:
3 (s+1.333)
--------------
(s^2 + 2s + 7)
b. » num2=[2 0 0]; den2=[5 0 6 3 10]; g2=tf(num2,den2)

Transfer function:
2 s^2
------------------------
5 s^4 + 6 s^2 + 3 s + 10

» sys2=zpk(g2)

Zero/pole/gain:
0.4 s^2
5

---------------------------------------------
(s^2 + 1.291s + 1.201) (s^2 - 1.291s + 1.666)

c. » z=[-2];p=[0 0 -1 -4];
» sys3=zpk(z,p,10)

Zero/pole/gain:
10 (s+2)
---------------
s^2 (s+1) (s+4)

» g3=tf(sys3)

Transfer function:
10 s + 20
-------------------
s^4 + 5 s^3 + 4 s^2

1.1.1. Constant, G(s) = K, K > 0

Set s = j ω , then

Gain in dB
20 log 10 G( jω ) = G( j ω ) dB = 20 log10 K (1- 4)

Phase
ϕ (ω ) = 0 0 . (1- 5)

The Bode diagram of K=50 is shown in Fig 1.1. Use MATLAB-commands to draw it. Here are
two ways to determine the transfer function of a constant

» num0=[50];den0=[1];g0=tf(num0,den0)
Transfer function: 50
Static gain.
or
» g0=tf(50)
Transfer function: 50
Static gain.
6

Fig. 1.1. Bode diagram of a constant K = 50, above gain in dB and below phase. Note the
logarithmic scale of the frequency.

1.1.2. Integrator, G(s) = 1/s

1
Set s = jω, G( jω ) = . Then the gain

1
G dB = 20 log( ) = −20log ω (dB) (1- 6)
ω
and phase

ϕ (ω ) = −90 0 . (1- 7)

Draw the Bode diagram with the same MATLAB commands as above. First define the
appropriate num(s)/den(s) form.

num1=[1];den1=[1 0];g11=tf(num1,den1)
Transfer function: 1/s
» bode(g11)
7

Bode diagram of the integrator is displays in Fig. 1.2. Because the ω -scale is logarithmic, the gain
has a slope of - 20 dB/decade.

Fig. 1.2. Bode diagram of integrator.

REMARK: If G(s) = K/s, the gain graph intersects the 0 dB level at ω = K and its slope is as
before -20 dB/decade. Figure 1.3. shows the case, when K = 50.
.

Fig 1.3. Bode diagram of transfer function G(s) = 50/s.


8

1.1.3. Differentiator, G(s) = s (not realizable!)

Otherwise exactly as the integrator, but now the slope is


+20 dB/dec and ϕ(ω) = +90o .

Fig.1.4. Bode diagram of transfer function G(s) = s.

1.1.4. Lo w pass filter G(s) = 1/(Ts+1) (first order system)

Set s= jω , then

G dB = −20 log(ω 2 T 2 + 1) ½ (1- 8)

ϕ (ω ) = − tan −1 ω T . (1- 9)

When ω b T = 1 or ω b = 1 the frequency ωb is called the break or corner frequency. For


T
frequencies smaller than one decade below the corner frequency G dB ≈ 0 dB , ω < 0.1ωb , and for
one decade greater G dB ≈ −20log( ωT ) , ω > 10 ωb. Correspondingly the phase at corner
frequency ϕ (ω ) = 450 . For small frequencies ϕ (ω ) ≈ 00 , ω < 0.1 ωb and for large frequencies
ϕ (ω ) ≈ 00 , ω > 10 ωb. In between the angle has a slope of -45 /dec.
0
9

Example 1.2: Draw Bode diagram of


1
G ( s) = (1- 10)
1 + 10 s

» num2=[1];den2=[10 1];g2=tf(num2,den2);bode(g2)

Fig.1.5. Bode diagram of a first order system. Note that the corner frequency is ωb = 0.1 rad/s.
For larger frequencies, ω >> ωb the system also acts as a low pass filter

1.1.5 High pass filter, G(s) = Ts + 1

As above, but now the - sign in the slope changes into + sign.

1.1.6 Second order terms, G (s) = ω 2n /( s2 + 2ςω n s + ω n2 )

Example : Draw Bode diagram of

1 (1- 11)
G( s ) =
s + 2ςs + 1
2

by varying the damping coefficient ζ between 0-1.

SOLUTION:
Use again the same MATLAB commands. Set e.g. ζ = 0, 0.2, 0.4, 0.6, 0.8 and 1.
10

Fig.1.6. Bode diagram of a second order system with ζ = taking values between 0 and 1.

Example. 1.3. Draw Bode diagram of

1
G( s) = . (1- 12)
(0.2 s + 1)( s + 1)( s + 0.1)

SOLUTION: Use again the bode command. The only difficulty is that now the transfer function is
not in the usual numerator polynomial/denominator polynomial or num(s)/den(s) form. To force it
to the correct form calculations in the denominator can be done in several ways. Either by hand or
using MATLAB tf , zpk and * commands.

» g14a=tf([1],[0.2 1])
Transfer function: 1/0.2 s + 1
» g14b=zpk([],[-1 -0.1],1)
Zero/pole/gain: 1/(s+1) (s+0.1)
» g14ab=g14a*g14b
Zero/pole/gain: 5/(s+5) (s+1) (s+0.1)

Now the final Bode diagram can be drawn.


» bode(g14ab)
11

The result is displayed in Figure 1.7a.

Fig.1.7a. Bode diagram of the example. Observe that at low frequencies gain is 20*log10(5) 14
dB and the phase zero degrees. At high frequencies the phase becomes –270o.

The frequency at which the gain curve crosses the 0 dB line is called the crossover frequency ω c .
Correspondingly the frequency at which the phase crosses -1800 is called phase crossover
frequencyω 'c . The angle PM = ϕ (ω c ) − 180 0 at frequency ω c is defined to phase margin (PM).
In Figure 1.6a ω c ≈ 1 rad / s and PM ≈ 30 . The gain margin (GM) at frequency ω 'c is
0

defined as GM = − G dB .

Figure 1.7b shows the phase and gain margins, when margin command has been used.

Let us now invoke


» margin(g14ab)

The result is displayed in Figure 1.9b.


12

Fig. 1.7b. The computed phase and gain margins and the corresponding frequencies of the
example also shown in the Bode diagram.

The gain crossover frequency ωc = 0.77 rad/s and the phase margin PM ≈ 50.8 0 and the phase
crossover frequency ω 'c ≈ 2.4 rad / s and gain margin GM≈ 16.6 dB. The meaning of these
concepts becomes clearer when we move on to control design. Basically they relate to both
damping coefficient and maximum percent overshoot, which are frequently used in system
specifications. The stability of the minimum phase systems is determined from there. If both phase
and gain margins are positive, the system is stable.

Minimum phase systems have only positive terms in their transfer functions. If your system is
nonminimum phase, the sweep in phase area is larger.
Let us compare the unit step responses of minimum and nonminimum phase systems:

Y ( s) s +1 Y ( s) −s + 1
= G min ( s) = 2 and = Gnon min ( s) = 2 (1- 13)
R ( s) s + s +1 R ( s) s +s+1

Let us now compute the unit step responses of the example. First define the corresponding transfer
functions
» gmin=tf([1 1],[1 1 1]);gnonmin=tf([-1 1],[1 1 1]);
Now compute the step response
» step (gmin)
13

» step(gnonmin)

Fig. 1.8a. Unit step response of a minimum-phase system.

Fig. 1.8b. Unit step response of a nonminimum-phase system. Note the initial dip in the response -
going the wrong way - which is typical to a nonminimum-phase system.

The difference in behavior is apparent from Fig.1.8a-b.The nonminimum-phase system produces


initially a response that is going the wrong way. This is typical for such systems. Examples of
nonminimum-phase systems are e.g. boilers and steam turbines.
14

Here are the Bode diagrams, which are exactly the same, although this is not true.

1.2. Nichols chart

When the gain G dB is drawn as a function of ϕ (ω ) , the diagram is called Nichols diagram. In
Fig.1.8. it is drawn into a Nichols chart. Nichols chart is useful if closed-loop specifications include
resonance peak requirement. Use MATLAB’s nichols command.

» nichols(g14ab)
15

» ngrid

Fig. 1.10. Nichols diagram of the example. Avoimen järjestelmän vahvistus dB:nä
vahvistuksen funktiona.

Fig.1.11. Nichols' chart, which shows the constant curves of the closed-loop system transfer
functionG 1 + G (gain and phase).

Example 1.4. Draw Nichols diagram and chart for the unity negative feedback system with

10
G( s) =
s( s + 1)

SOLUTION: Use MATLAB commands.


16

gn=zpk([],[0 -1],10)
Zero/pole/gain: 10/s (s+1)

nichols(gn)
grid

Nichols Charts

80

60

40

20

-20

-40
O pen-Loop Gain (dB)
-60

-80

-100
-170 -160 -150 -140 -130 -120 -110 -100
Open-Loop Phase (deg)

Fig.1.15. Nichols diagram of G( s) = 10 s( s + 1) .

Nichols Charts

80

60

40
0 dB
0.25 dB
0.5 dB
20 1 dB -1 dB
3 dB -3 dB
6 dB
0 -6 dB
-12 dB
-20 -20 dB

-40 -40 dB

-60 Gain (dB)


O pen-Loop -60 dB

-80 -80 dB

-100 -100 dB

-120 -120 dB
-350 -300 -250 -200 -150 -100 -50
Open-Loop Phase (deg)

Fig.1.16. Nichols chart on top of Nichols diagram.


17

1.5 Nyquist diagrams

One more way to represent a transfer function is Nyquist diagram. The transfer function is
plotted on complex plane when ω varies. Let us next consider a few examples discussed
above. Now MATLAB command nyquist can be evoked.

1
a. G( s) =
10 s + 1

1
b. G( s) =
(0 .2 s + 1)(s + 1)( s + 0 .1)

s +1
c. G( s) =
s + s +1
2

− s +1
d. G( s) =
s + s +1
2

SOLUTION:

a. g1=tf([1],[10 1])

Transfer function:
1
--------
10 s + 1

» nyquist(g1)
» grid
Nyquist Diagrams

0.5

0.4

0.3

0.2

0.1

-0.1
Imaginary Axis
-0.2

-0.3

-0.4

-0.5
-1 -0.5 0 0.5 1
Real Axis
18

Fig.1.16. Nyquist diagram of first order system.

b. g2=zpk([],[-5 -1 -0.1],5)
Zero/pole/gain:
5
-------------------
(s+5) (s+1) (s+0.1)
» nyquist(g2); grid
Nyquist Diagrams

Imaginary Axis
-2

-4

-6
0 2 4 6 8 10
Real Axis

Fig. 1.17. Nyquist diagram of a third order system.

c. g3=tf([1 1],[1 1 1])


Transfer function:
s+1
-----------
s^2 + s + 1
» nyquist(g3);grid

Nyquist Diagrams

1
0.8

0.6

0.4

0.2

-0.2
Imaginary
-0.4Axis

-0.6

-0.8
19

Fig. 1.17. Nyquist diagram of c).

d. g4=tf([-1 1],[1 1 1])

Transfer function:
-s + 1
-----------
s^2 + s + 1
» nyquist(g4), grid

Nyquist Diagrams

1.5

0.5

Imaginary
-0.5Axis

-1

-1.5
-1 -0.5 0 0.5 1
Real Axis
20

APPPENDIX. MATLAB commands used in this chapter.

Defining transfer functions in Control System Toolbox.


How to create transfer function representation, tf.
» TF Creation of transfer functions or conversion to transfer function.
You can create SISO or MIMO transfer functions by
SYS = TF(NUM,DEN) Continuous-time model NUM(s)./DEN(s)
SYS = TF(NUM,DEN,T) Discrete-time model NUM(z)./DEN(z) with sampling time T (Set T= -1 if
undetermined)
SYS = TF Default empty transfer function
SYS = TF(M) Static gain matrix
SYS = TF(NUM,DEN,LTISYS) Transfer function with LTI properties inherited from the LTI
model LTISYS.
All the above syntaxes may be followed by Property/Value pairs.
(Type "help ltiprops" for details on assignable properties).
The output SYS is a TF object.
By default, transfer functions are displayed as functions of 's' or 'z'. Alternatively, you can set the
variable name to 'p' (continuous time) and 'z^-1' or 'q' (discrete time) by modifying the 'Variable'
property.
For SISO models, NUM and DEN are row vectors listing the numerator and denominator
coefficients in
* descending powers of s or z by default
* ascending powers of q = z^-1 if 'Variable' is set to 'z^-1' or 'q' (DSP convention).
For MIMO models with NU inputs and NY outputs, NUM and DEN are NY-by-NU cell arrays of
row vectors where NUM{i,j} and DEN{i,j} specify the transfer function from input j to output i.
For example,
tf( {-5 ; [1 -5 6]} , {[1 -1] ; [1 1 0]})
specifies the two-output/one-input system
[ -5 /(s-1) ]
[ (s^2-5s+6)/(s^2+s) ]
SYS = TF(SYS) converts an arbitrary LTI model SYS to transfer function format. The output SYS
is a TF object.
SYS = TF(SYS,'inv') uses a fast algorithm for state-space SYS, but is typically less accurate for
high-order systems.
See also FILT, TFDATA, GET, SET, LTIPROPS, ZPK, SS.

Transfer function in zero -pole -gain form, zpk.


» ZPK Create zero-pole-gain models or convert to zero-pole-gain format.

You can create SISO or MIMO zero-pole-gain (ZPK) models by:


SYS = ZPK(Z,P,K) Continuous-time model
SYS = ZPK(Z,P,K,T) Discrete-time model with sample time T (Set T=-1 if undetermined)
SYS = ZPK Default empty zero-pole-gain model
21

SYS = ZPK(M) Static gain matrix


SYS = ZPK(Z,P,K,LTISYS) ZPK model with LTI properties inherited from the LTI model LTISYS.
All the above syntaxes may be followed by Property/Value pairs
(Type "help ltiprops" for details on assignable properties).
The output SYS is a ZPK object.
For SISO systems, Z and P are the vectors of zeros and poles (set to [] if none) and K is the scalar gain.
For MIMO systems with NU inputs and NY outputs,
• Z and P are NY-by-NU cellarrays where Z{i,j} and P{i,j} are the vectors of zeros and poles of the
• transfer function from input j to output i
• K is the 2-D matrix of gains for each I/O channel.
For example,
zpk( {[];[2 3]} , {1;[0 -1]} , [-5;1] )
specifies the two-output/one-input system
[ -5 /(s-1) ]
[ (s-2)(s-3)/s(s+1) ]

SYS = ZPK(SYS) converts an arbitrary LTI model SYS to zero-pole-gain form. The output SYS is a ZPK
object.
SYS = ZPK(SYS,'inv') uses a fast algorithm for state-space SYS, but is typically less accurate for high-
order systems with low gain at s=0.

See also ZPKDATA, GET, SET, LTIPROPS, TF, SS.

Drawing Bode diagram, tf.


» BODE Bode frequency response of LTI systems.
BODE(SYS) draws the Bode plot of the LTI system SYS (created with either TF, ZPK, or SS). The frequency range and
number of points are chosen automatically.
BODE(SYS,{WMIN,WMAX}) draws the Bode plot for frequencies between WMIN and WMAX (in radian/second).
BODE(SYS,W) uses the user-supplied vector W of frequencies, in radian/second, at which the Bode response is to be
evaluated.
See LOGSPACE to generate logarithmically spaced frequency vectors.
BODE(SYS1,SYS2,...,W) plots the Bode response of multiple LTI systems SYS1,SYS2,... on a single plot. The frequency
vector W is optional. You can also specify a color, line style, and marker for each system, as in bode(sys1,'r',sys2,'y--
',sys3,'gx').
When invoked with left-hand arguments,
[MAG,PHASE,W] = BODE(SYS,...)
returns the frequency vector W and arrays MAG and PHASE of magnitudes and phases (in degrees). No plot is drawn on
the screen. If SYS has NU inputs and NY outputs and LW=length(W), MAG and PHASE are NY-by-NU-by-LW arrays
and the response at the frequency W(k) is given by MAG(:,:,k) and PHASE(:,:,k).
For discrete systems with sample time Ts, BODE uses the transformation Z = exp(j*W*Ts) to map the unit circle to the
real frequency axis. The frequency response is only plotted for frequencies smaller than the Nyquist frequency pi/Ts, and the
default value 1 (second) is assumed when Ts is unspecified.
See also NICHOLS, NYQUIST, SIGMA, FREQRESP, LTIVIEW.

Gain and phase margin

MARGIN Gain margin, phase margin, and crossover frequencies.


22

[Gm,Pm,Wcg,Wcp] = MARGIN(SYS) returns the gain margin Gm, the


phase margin Pm, and associated frequencies Wcg and Wcp, given
the SISO open-loop model SYS (continuous or discrete). The
gain margin Gm is defined as 1/G where G is the gain at the
-180 phase frequency. The gain margin in dB is 20*log10(Gm).
By convention, Gm=1 (0 dB) and Pm=0 when the nominal closed
loop is unstable.

[Gm,Pm,Wcg,Wcp] = MARGIN(MAG,PHASE,W) derives the gain and phase


margins from the Bode magnitude, phase, and frequency vectors
MAG, PHASE, and W produced by BODE. Interpolation is performed
between the frequency points to estimate the values.

When invoked without left hand arguments, MARGIN(SYS) plots


the open-loop Bode plot with the gain and phase margins marked
with a vertical line.

See also BODE, LTIVIEW.

Compute step response with step.

STEP Step response of continuous-time linear systems.


STEP(A,B,C,D,IU) plots the time response of the linear system:
.
x = Ax + Bu
y = Cx + Du
to a step applied to the input IU. The time vector is automatically determined. STEP(A,B,C,D,IU,T) allows the
specification of a regularly spaced time vector T.

[Y,X] = STEP(A,B,C,D,IU,T) or [Y.X,T] = STEP(A,B,C,D,IU) returns the output and state time response in the matrices Y
and X respectively. No plot is drawn on the screen. The matrix Y has many columns as there are outputs, and
LENGTH(T) rows. The matrix X has as many columns as there are states. If the time vector is not specified, then the
automatically determined time vector is returned in T.

[Y,X] = STEP(NUM,DEN,T) or [Y,X,T] = STEP(NUM,DEN) calculates the step response from the transfer function
description G(s) = NUM(s)/DEN(s) where NUM and DEN contain the polynomial coefficients in descending powers of s.

See also: INITIAL, IMPULSE, LSIM and DSTEP.


23

Drawing Nichols diagram, nichols

» help nichols

NICHOLS Nichols frequency response of LTI systems.

NICHOLS(SYS) draws the Nichols chart of the LTI model SYS


(created with either TF, ZPK, or SS). The frequency range and
number of points are chosen automatically. See BODE for details
on the notion of frequency in discrete-time.

NICHOLS(SYS,{WMIN,WMAX}) draws the Nichols chart for frequencies


between WMIN and WMAX (in radian/second).

NICHOLS(SYS,W) uses the user-supplied vector W of frequencies, in


radians/second, at which the Nichols response is to be evaluated.
See LOGSPACE to generate logarithmically spaced frequency vectors.

NICHOLS(SYS1,SYS2,...,W) plots the Nichols chart of multiple LTI


systems SYS1,SYS2,... on a single plot. The frequency vector W
is optional. You can also specify a color, line style, and marker
for each system, as in nichols(sys1,'r',sys2,'y--',sys3,'gx').

When invoked with left-hand arguments,


[MAG,PHASE,W] = NICHOLS(SYS,...)
returns the frequency vector W and matrices MAG and PHASE of
magnitudes and phases (in degrees). No plot is drawn on the
screen. If SYS has NU inputs and NY outputs, and LW=length(W),
MAG and PHASE are NY-by-NU-by-LW arrays and the response at
the frequency W(k) is given by MAG(:,:,k) and PHASE(:,:,k).

See also BODE, NYQUIST, SIGMA, FREQRESP, LTIVIEW.


24

Potrebbero piacerti anche