0 ratings0% found this document useful (0 votes) 624 views84 pagesAddison Wesley - Modern Control Systems Analysis and Design Using Matlab PDF
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Modern Control Systems Analysis
and Design Using MATLAB®
Robert H. Bishop
The University of Texas at Austin
ADDISON-WESLEY PUBLISHING COMPANY
Reading, Massachusetts * Menlo Park, California * New York
Don Milis, Ontario + Wokingham, England + Amsterdam * Bonn
Sydney + Singapore + Tokyo + Madrid + San Juan + Milan + ParisPreface
Won to Profesor Itehard C. Dorf
mont of this text. I also
id P, Daniel Burkhart for their
titude goes to my wife, Lynda, for assist-
Manuscript and for her continuous support and
RELB.
Austin, Texas
Contents
Preface v
1 MATLAB Basics ba
1.1 Introduction. .......-+ 1
1.2 Statements and Variables... . 2
1.3 Matrices 10
14 Graphics eeu 16
15 Scripts ......- 21
2. Mathematical Modeling of Systems 25
2.1 Introduction. ...-.--++5 25
2.2 Spring-Mass-Damper System . . 26
2.3 Transfer Functions , 30
2.4 Block Diagram Models 35
2.5 Design Example. . . 45,
3 Control System Characteristics
3.1 Introduction... -. +--+
3.2 Speed Tachometer System . . .
33 English Channel Boring Machines
4 Control System Performance 61
4.1, Introduction . . . . 5 61
4.2 Time-Domain Specifications . 61
4.3. Simplification of Linear Systems . 68
3 Control System Stability 71
5.1 Introduction... . 020.000 eee renee 7
viiviii Contents
5.2 Routh-Hurwitz Stability ©... ., Beer
5.3 Example: Tracked Vehicle Turning Control _ 16
6 Root Locus Method 81
6.1 Introduction... ..... 0... 81
62 Obtaining a Root Locus Plot. 82
6.3 Sensitivity and the Root Locus 88
7 Frequency Response Methods 91
71 Introduction... 2... 0... eee or
7.2 Bode Diagram eee 92
7.3 Specifications in the Frequency Domain... . 1... 95
74 Example: Engraving Machine System... ...... 9g
8 Stability in the Frequency Domain 103
8.1 Introduction... .. 0... = 103
82 Nyquist Plots 104
8.3 Nichols Charts 110
84 Examples 11
® State-Space Methods 121
9.1. Introduction... .. . , - 121
9.2 Model Relationships - 122
9.3 Stability of Systems in the Time Domain |__| || | 195
94 Time Response . . 129
10 Control System Design 133
10.1 Introduction . . ee ae 133
10.2 Lead Compensation meet’
10.3 Lag Compensators a oe ++ 136
10.4 Example: Rotor Winder Control System . . . 138
11 Robust Control Systems 151
ILL Introduction... 2.2... 2, eer iol
11.2 Robust PID Controlled Systems 152
Index/Glossary 159
Chapter 1
MATLAB Basics
1.1 Introduction
MATLAB is an interactive program for scientific and engineering
calculations. The MATLAB family of programs includes the base
program plus a variety of toolbozes. The toolboxes are a collection
of special files, called M-files, which extend the functionality of the
base program. Together the base program plus the Control System
Toolbox provide the capability to use MATLAB ‘or control system
design and analysis. In the remainder of this book, whenever we refer
to MATLAB, you can interpret that as meaning the base program
plus the Control System Toolboz.
Most of the statements, functions, and commands are computer
platform independent. Regardless of what particular computer sys-
tem you use, your interaction with MATLAB is basically the sai
This book concentrates on this computer platform independent i
teraction. A typical session will utilize a variety of objects that
allow you to interact with the program. These objects are
1. statements and variables,
2. matrices,
3. graphics, and
4. scripts.2 Chapter 1. MATLAB Basics
MATLAB interprets and acts on input in the form of one or more
of these objects. Our goal in this chapter is to introduce each of the
four objects in preparation for our ultimate goal of using MATLAB
for control system design and analysis.
‘The manner in which MATLAB interacts with your computer
system is computer platform dependent. Examples of computer de-
pendent functions include installation, the file structure, generating
hardcopies of the graphics, invoking and exiting a session, and mem-
ory allocation. Questions related to platform dependent issues are
not addressed here. This is not to imply that they are not impor-
tant, but rather that there are better sources of information such as
your Users Guide and your local resident expert. This book is not
intended as a substitute for your Users Guide.
Before proceeding, make sure that you can invoke a session and
exit MATLAB . You need to be able to get to the command window
and see the command prompt “ >>. To begin a session on a
Macintosh you will probably double-click on the MATLAB program
icon. On an IBM PC compatible you will probably type matlab at
the DOS prompt.
‘The remainder of this chapter is organized as follows. There are
four sections corresponding to the four objects listed above. In the
first section we present the basics of statements and variables, Fol-
lowing that is the subject of matrices. The third section presents an
introduction to graphics, and the chapter concludes with a discussion
on the important topic of scripts and Mfiles,
1.2 Statements and Variables
Statements have the form shown in Figure 1.1. MATLAB uses the
assignment so that equals (“=”) implies the assignment of the ex-
pression to the variable. The command prompt is two right arrows,
“>>”. A typical statement is shown in Figure 1.2, wherein we
are entering a 2 x 2 matrix to which we-attach the variable name
A. The statement is executed after the carriage return (or enter
key) is pressed. The carriage return is not explicitly denoted in the
remaining examples in this and subsequent chapters.
1.2, Statements and Variables 3
command prompt
Wariable=expression
Figure 1.1 MATLAB Statement Form.
‘The matrix A is automatically displayed afte: the statement is
executed following the carriage return. If the statement is followed
by a semicolon (;), the output matrix A is suppressed, as seen in
Figure 1.3. The assignment of the variable A has been carried out
even though the output is suppressed by the semicolon. It is often
the case that your MATLAB sessions will include intermediate cal-
culations for which the output is of little interest. You should use
the semicolon whenever you have a need to reduce the amount of
output. Output management has the added benefit of increasing the
execution speed of the calculations, since displaying screen output,
takes time.
The usual mathematical operators can be used in expressions
‘The common operators are shown in Table 1.1. The order of the
arithmetic operations can be altered by using parentheses.
The example in Figure 1.4 illustrates that MATLAB can be used
in a “calculator” mode, When the variable name and *=" are omit-
ted from an expression, the result is assigned to the generic variable
ans, MATLAB has available most of the trigonometric and elemen-
tary math functions of a common scientific calculator. The Users
>A=[1 2; 4 6]
A=
1
2
carriage return
46 :
Figure 1.2 Example Statement: Matrix Input4 Chapter 1. MATLAB Basics
Figure 1.8 Using Semicolons to Suppress the Output.
Guide has a complete list of available trigonometric and elementary
math functions; the more common ones are summarized in Table 1.2.
Variable names begin with a letter and are followed by any num-
ber of letters and numbers (including underscores). Keep the name
length to 19 characters since MATLAB remembers only the first 19
characters. It is a good practice to use variable names that describe
the quantity they represent. For example, we might use the variable
name vel to represent the quantity aircraft velocity. Generally, we
do not use extremely long variable names even though they may be
legal MATLAB names.
Since MATLAB is case sensitive, the variables M and m are not
the same variables. By case we mean upper and lower case. This is
illustrated in Figure 1.5. The variables M and m are recognized as
different quantities.
‘Table 1.1 Mathematical Operators.
Addition ,
Subtraction
Multiplication
Division
Power
~e +
1.2. Statements and Variables 5
>12.4/6.9
ans =
1.7971
Figure 1.4 Calculator Mode.
MATLAB has several predefined variables, including Gi inf)
(Nan¥i)and(j. JThree examples are shown in Figure 1.6. Nan stands
for Not-a-Nuiber and results from undefined operations. Inf rep-
resents -+co and pi represents x. The variable i = Y—T is used to
represent complex numbers. ‘The variable j = Y/=I can be used for
Table 1.2 Common Mathematical Functions.
sin(X) | Sine of the elements of X
cos(X) | Cosine of the elements of X
asin(X) | Arcsine of the elements of X
acos(X) | Arceosine of the elements of X
tan(X) | Tangent of the elements of X
atan(X) | Arctangent of the elements of X
atan2(X,Y) | Four quadrant arctangent of the real
elements of X and Y
Absolute value of the elements of X
Square root of X
Imaginary part of X
Real part of X
Complex conjugate of X
Natural logarithm of the elements of X
logl0(X) | Logarithm base 10 of the elements of X
(éxp(X) _ | Exponential of the elements of X6 Chapter 1. MATLAB Basics
»M=[1 2];
om=[3 5 7];
Figure 1.5 Variables Are Case Sensitive.
complex arithmetic by those who prefer it over i. These predefined
variables can be inadvertently overwritten. Of course, they can also
be purposely overwritten in order to free up the variable name for
other uses. For instance, one might want to use i as an integer and
reserve j for complex arithmetic. Be safe and leave these predefined
variables alone, as there are plenty of alternative names that can be
used. Predefined variables can be reset to their default values by
using clear name (e.g,, clear pi). .
The matrix A and the variable ans, in Figures 1.3 and 14, are
stored in the workspace. Variables in the workspace are automati-
pz=3444
Zz
3.0000 + 4.0000i
aint
ans =
»0/0
Warning: Divide by zero
ans =
NaN
Figure 1.6 Three Predefined Variables i, Inf, and Nan.
1.2. Statements and Variables 7
>who
Your variables are:
A M ans om z
leaving 675516 bytes of memory free.
Figure 1.7 Using the who Function to Display Variables.
cally saved for later use in your session. The who function gives a
lint of the variables in the workspace, as shown in Figure 1.7.
MATLAB has a host of built-in functions. You can refer to the
Users Guide for a complete list. We will describe each function we
use as the need arises.
The whos function lists the variables in the workspace and gives
Additional information regarding variable dimension, type, and mem-
ory allocation. Figure 1.8 gives an example of the whos function
‘The memory allocation information given by the whos function
can be interpreted as follows. Each clement of the 2 x 2 matrix A
Complex
No
1 by2 No
1by1 No
by 3 No
y 1 Yes
Grand total is (12 * 8) = 96 bytes,
leaving 664912 bytes of memory free.
Figure 1.8 Using the whos Function to Display Variables.Chapter 1. MATLAB Basics
clear A
»who
Your variables are:
M m z
leaving 663780 bytes of memory free.
Figure 1.9 Removing the Matrix A from the Workspace.
pi
ans = F
3.1416 +
»format long; pi
ans = oa
3.14159265358979
»format short e; pi
ans = -
3.1416e+00
»format long e; pi
ans =
3.141592653589793e+00
Figure 1.10 Outout Format Conte.) ™
1.2, Statements and Variables 9
requires 8 bytes of memory for a total of 32 bytes, the 1 x 1 variable
ans requires 8 bytes, and so forth. All the variables in the workspace
are using a total of 96 bytes. The amount of remaining free memory
depends upon the total memory available in the system. Computers
with virtual memory will not display the remaining free memory.
You can remove variables from the workspace with the clear
function. Using the function clear, by itself, removes all items (vari-
ables and functions) from the workspace; clear variables removes
all variables from the workspace; clear namef name 2... removes
the variables namel,; name2, and so forth. The procedure for re-
moving the matrix A from the workspace is shown in Figure 1.9
A simple calculation shows that clearing the matrix A from
memory freed up more than 32 bytes. In some cases, clearing a
variable may not change the value of the displayed free memory at
all. The who function displays the amount of contiguous remaining
free memory. So, depending upon the “location” of the variable in
the workspace, clearing the variable may or may not increase the
displayed amount of remaining free memory. The point is that your
available free memory may be more than displayed with the who or
whos functions.
All computations in MATLAB are performed in double precision.
However, the screen output can be displayed in several formats This can be changed by using the format function
shown in Figure 1.10. Once a particular format has been speci-
fled, it remains in effect until altered by a different format input.
» WHO.
77? Undefined function or variable
‘Symbol in question ==> WHO
> Who
27? Undefined function or variable
Symbol in question ==> Who
Bioure 1.11 Fonction Names are Case Sensitive.10 Chapter 1. MATLAB Basics
Remember that the output format does not affect the MATLAB
computations — all computations are in double precision.
On the other hand, the number of digits displayed does not nec-
essarily reflect the number of significant digits of the number. This
is problem dependent, and only you can know the true accuracy of
the numbers that you input and that MATLAB displays.
Since MATLAB is case sensitive, the functions who and WHO
are not the same functions. The function who is a built-in func-
tion, so typing who lists the variables in the workspace. On the
other hand, typing the uppercase WHO results in the error mes-
sage shown in Figure 1.11. Case sensitivity applies to all functions,
1.3 Matrices
MATLAB is short for matrit laboratory. The Users Guide describes
the program as a high-performance interactive software package de-
signed to provide easy access to the LINPACK and EISPACK ma-
trix software. Although we will not dwell on the matrix routines
underlying our calculations, we will learn how to use the interactive
capability to assist us in our control system design and analysis. We
begin by introducing the basic concepts associated with manipulat-
ing matrices and vectors.
The basic computational unit is the matrix. Vectors and scalars
can be viewed as special cases of matrices. A typical matrix expres-
sion is enclosed in square brackets, [-]. ‘The column elements are
separated by blanks or commas and the rows ate separated by semi-
lons or carriage returns. Suppose we want to input the matrix A,
where
1 aj va
log(-1) —sin(x/2) —_cos(m/3)
aresin(0.5) arccos(0.8) exp(0.8)
A
One way to input A is shown in Figure 1.12. The input style in
Figure 1.12 is not unique.
Matrices can be input across multiple lines by using a carriage
return following the semicolon or in place of the semicolon. This is
useful for entering large matrices. Different combinations of spaces
Matrices u
/
v
vA=[T, -4Y, sqrt(2);) ai] ee
log(-1) sin(pi/2) cos(pi/3} Re
asin(0.5), acos(0.8) exp(0.8)]
A
1.0000, 0- 4.00001 1.4142
0+ 3.14161 1.0000 0.5000
0.5236 0.6435 2.2255,
>A=l1 2:45] + —— od reat math]
A=
12
45
Figure 1.12 Complex and Real Matrix Input with Automatic Di-
mension and Type Adjustment.
and commas can be used to separate the columns, and different com-”
binations of semicolons and carriage returns can be used to separate
the rows, as illustrated in Figure 1.12.
No dimension statements or type statements are necessary when
using matrices; memory is allocated automatically. Notice in the
example in Figure 1.12 that the size of the matrix A is automatically
adjusted when the input matrix is redefined. Also notice that the
matrix elements can contain trigonometric and elementary math
functions, as well as complex numbers.
‘The important basic matrix operations are addition and sub-
traction, multiplication, transpose, powers, and the so-called array
operations, which are element-to-element operations. The mathe-
matical operators given in Table 1.1 apply to matrices. We will not
discuss-matriz division, but be aware that MATLAB has a left- and
right-matrix division capability.
Matrix operations require that the matrix dimensions be com-
patible. For matrix addition and subtraction this means that the
matrices must have the same dimensions. If A is an n x m matrix12 Chapter 1. MATLAB Basics
and Bis ap xr matrix, then A + B is permitted only if n = p and
m =r. Matrix multiplication, given by A * B, is permitted only
. Matrix-vector multiplication is a special case of matrix
multiplication. Suppose b is a vector of length p. Multiplication
of the vector 6 by the matrix A, where A is an nx m matrix, is
allowed if m = p. Thus, y = AB is the nx 1 vector solution of
Examples of three basic matrix-vector operations are given
spose is formed with the apostrophe (’). We can
pose and multiplication operation to create a
vector inner product in the following manner. Suppose w and v
‘are m x 1 vectors. Then the inner product (also known as the dot
»A=[1 3; 5 9]; Be[4 -7; 10 0};
i]
ans =
5-4
15 9
»b=[1;5]; — —
> + _ ea
ans =
16
50
Figure 1.13 Three Basic Matrix Operati iti
erations: Ad ‘iplica-
tion, and Transpose. ares
1. Matrices 13
product) is given by w' + v. The inner product of two vectors is a
wcalar, ‘The outer product of two vectors can similarly be computed
ax w+ v', The outer product of two m x 1 vectors is an m x mi/
matrix of rank 1. Examples of inner and outer products are given
In Figure 1.14.
‘The basic matrix operations can be modified for element-by-
clement operations by preceding the operator with a period. The
modified matrix operations are known as array operations. The com-
monly used array operators are given in Table 1.3. Matrix addition
and subtraction are already element-by-element operations and do
not require the additional period preceding the operator. However,
array multiplication, division, and power do require the preceding
dot, as shown in Table 1.3.
Suppose A and B are 2 x 2 matrices given by
a-[2e]. a-[f 8].
a One ~ | ba ba
"Then, using the array multiplication operator, we have
auby ce |
anba aaabr |”
\
Act B=
\ 2,
»x=[Sipisin(
awty <+—_____
ans =
-27.9384
oxty! <———_f
ans =
3.0327 -65.0000 49.3480
1.9055 -40.8407 31.0063
0.6065 -13.0000 9.8696
Figure 1.14 Inner and Outer Products. \€“4 Chapter 1. MATLAB Basics
‘Table 1.3 Mathematical Array Operators.
+ | Addition
- | Subtraction
+ | Multiplication
Division
Power
The elements of A. * B are the products of the corresponding ele-
ments of A and B. A numerical example of two array operations is
given in Figure 1.15.
___ Before proceeding to the important topic of graphics, we need to
introduce the notion of subscripting using colon notation. The colon
notation, shown in Figure 1.16, allows us to generate a row vector
containing the numbers from a given starting value, xj, to a final
value, x;, with a specified increment, dx. _
»A=[1;2;3];B=[-6;7;10];
»A*B + —_f
Figure 1.15 Array Operations.
1.3. Matricos
starting value final value
+
4
x=[xj: dx: x¢ ]
+
increment
Figure 1.16 The Colon Notation.
We can easily generate vectors using the colon notation, and
as we shall soon see, this is quite useful for developing 2-y plots.
Buppose our objective is to generate a plot of y = xsin(x) versus
1 for + =0,0.1,0.2,...,1.0. Our first step is to generate a table of
y data. We can generate a vector containing the values of x at
hich the values of y(z) are desired using the colon notation. This
fp illustrated in Figure 1.17. Given the desired 2 vector, the vector
la
»x=[0:0.1:1]}4 yex.*sin(x);
»ixy]
ans =
CO) 0
0.1000 0.0100
0.2000 0.0397
0.3000 0.0887
0.4000 0.1558
0.5000 0.2397
0.6000 0.3388
0.7000 0.4510
0.8000 0.5739
0.9000 0.7050
1.0000 0.8415
Figure 1.17 Generating Vectors Using the Colon Notation.14 Chapter 1. MATLAB Basics
‘Table 1.3 Mathematical Array Operators
Addition
Subtraction
Multiplication
Division
Power
ars
The elements of A. « B are the products of the corresponding ele-
ments of A and B. A numerical example of two array operations is
given in Figure 1.15.
Before proceeding to the important topic of graphics, we need to
introduce the notion of subscripting using colon notation. The colon
notation, shown in Figure 1.16, allows us to generate a row vector
containing the numbers from a given starting value, xj, to a final
value, x, with a specified increment, dx.
»A=[1;2;3];B=[-6;7;10];
»A*B
Figure 1.15 Array Operations.
14, Matrices =
starting value final value
1 J
x= [xii dx: xg]
increment
Figure 1.16 The Colon Notation.
easily generate vectors using the colon notation, and
au aa oe eet this is quite useful for developing 2-y plots.
Buppose our objective is to generate a plot of y = esin(z) ans
8 for x = 0,0.1,0.2,...,1.0. Our first step is to generate a table of
y data, We can generate a vector containing the values of z at
hich the values of y(x) are desired using the colon notation. This
illustrated in Figure 1.17. Given the desired x vector, the vector
Figure 1.17 Generating Vectors Using the Colon Notation16 Chapter 1. MATLAB Basics
u(2) is computed using the multiplication array operation. Creating
a plot of y = zsin(z) versus z is a simple step once the table of ey
data is generated,
1.4 Graphics
Graphics play an important role in both the design and analysis of
control systems. An important component of an interactive control
system design and analysis tool is an effective graphical capability.
A complete solution to the control system design and analysis will
eventually require a detailed look at a multitude of data types in
many formats. The important plot formats include root-locus plots,
Bode plots, Nyquist plots, and time-response plots. The objective of
this section is to acquaint the reader with the basic z-y plotting ca-
Pability of MATLAB. More advanced graphics topics are addressed
as the need arises.
MATLAB uses a graph display to present plots. Some computer
configurations allow both the command display and graph display
to be viewed simultaneously. On computer configurations that allow
only one to be viewed at a time, the command display will disappear
when the graph display is up. The graph display is brought up
automatically when a plot is generated using any function which
generates a plot (e.g., the plot function). Switching from the graph
display back to the command display is accomplished by pressing
any the keyboard. The plot in the graph display is cleared
gull junction at the command prompt. TheGhg function is
used to switch to the graph display from the command display.
There are two basic groups of graphics functions. ‘The first group
of functions, shown in Table 1.4, specifies the type of plot. The list
of available plot types includes 2-y plot, semilog and log plots. The
second group of functions, shown in Table 1.5, allows us to customize
the plots by adding titles, axis labels, and text to the plots and to
change the scales and display multiple plots in subwindows,
The standard z-y plot is created using the plot function. The
y data in Figure 1.17 are plotted using the plot function as shown
14, Graphics 17
Table 1.4 Available Plot Formats.
Plots the vector z versus the vector y.
Plots the vector z versus the vector y.
The z-axis is logio; the y axis is linear.
Plots the vector z versus the vector y.
The z-axis is linear; the y axis is logo.
Plots the vector z versus the vector y.
Creates a plot with logio scales on both axes.
plot(x.y)
semilogx(xy)
semilogy(xy)
loglog(x,y)
igure 1.18. ‘The axis scales and line types are automatically
ph ee Ts ac are labeled with the xlabel and ylabel commands;
e title is applied with the title command. A grid can be placed
p the plot by using the grid command. We see that a basic ey
ot is generated with the combination of functions plot, xlabel,
! itle, and grid. ’
akg Tas cab placed on the graph by using the plot fune-
jon with multiple arguments, as shown in Figure 1.19. The default
Table 1.5 Functions for Customized Plots.
Puts ‘text? at the top of the plot.
Labels the 2-axis with ‘text’.
Labels the y-axis with ‘text”,
Puts ‘text? at (p1,p2) in screen coordinates
where (0.0,0.0) is the lower left and > He
(1.0,1.0) is the upper right of the screen.
Subdivides the graphics window.
Draws grid lines on the current plot.
title(‘text’)
H xlabel(‘text”)
ylabel(‘text’)
H text(pl,p2, text? 's¢3)
subplot,
P| grid18 Chapter 1. MATLAB Basics
»x=[0:
»y=x,*sin(x);
»plot(x,y)
»title(Plot of x sin(x) vs x ')
»xlabel('x')
»ylabel('y')
grid
Figure 1.18 A Basic 2-y Plot of zsin(z) versus 2.
line types can also be altered. The available line types are shown
in Table 1.6. The line types will be automatically chosen unless
specified by the user. The use of the text function and changing
the line types is illustrated in Figure 1.19.
The other graphics functions loglog, semilogx, and semilogy
are used in a similar fashion to plot. To obtain an 2-y plot where
the z-axis is a linear scale and the y-axis is a logis scale, you would
use the semilogy function in place of the plot function. ‘The cus-
14, Graphics
yl and y2
19
by x=f0:0.1:175 me
by ytmx.tsing); y2asin(x); _ [eakade fe
> plot(x,y 1,2,"
» text(0.1 031 oan iy
> text(0.1,0.85,'y2 = sin(x) ——'
> xlabel('x'), ylabel('y1 and y2'), grid
Figure 1.19 A Basic z-y Plot with Multiple Lines.
Table 1.6 Line Types for Customized Plots.
aS
- | Solid line
-- | Dashed line
Dotted line
Dashdot line20
Chapter 1. MATLAB Basics
izing features listed in Table 1: ili it
logo, semilog, and semilogy cet een
1e graph display can be subdivided into sma i
The function subplot(mnp) subdivides the ak ae aa
m x n grid of smaller subwindows, where m <2 andn <2. This
means the graph display can be subdivided into two or four windows,
The integer p specifies the window, where the windows are iwimbered
left to right, top to bottom. This is illustrated in Figure 1.20, wh
the graphics window is subdivided into four subwindows. etc
Figure 1.20 Usi iti
x exe ising subplot to Create a 2x2 Partition of the Graph
1.4. Scripts a
1.5 Scripts
Up to this point, all of our interaction with MATLAB has been at
. the command prompt. We enter statements and functions at the
command prompt, and MATLAB interprets our inout and takes the
appropriate action. ‘This is the preferable mode of operation when-
fever your sessions are short and nonrepetitive. However, the real
| power of MATLAB for control system design and analysis derives
from its ability to execute a long sequence of commands stored in a
file, These files are called M-files since the filename has the form file-
name.m. A scriptis one type of M-file. The Control System Toolbox
4p a collection of M-files designed specifically for control applications.
In addition to the pre-existing M-files delivered with MATLAB and
the toolboxes, we can develop seripts for our applications,
Scripts are ordinary ASCII text files and are created by using
your own text editor. Creating and storing scripts are computer
‘platform dependent topics, which means that you need to seek out
ithe appropriate expert at your location for more information.
A script is just a sequence of ordinary statements and functions
yhat you would use at the command prompt level. A script is invoked
{at the command prompt level by simply typing in the filename (with-
Fout the .m file type). Scripts can also invoke other scripts. When
the script is invoked, MATLAB executes the statements and func-
tions in the file without waiting for input at the command prompt
The script operates on variables in the workspace.
Suppose we want to plot the function y(t) = sinat, where a
Js a variable that we want to vary. Using our favorite text editor,
we write a script, which we will call plotdata.m. This is shown
in Figure 1.21. We input a value of a at the command prompt,
and in doing so we place a in the workspace. Then we execute the
script by typing in plotdata at the command prompt. ‘The script
plotdata.m will use the most recent value of a in the workspace.
After executing the script we can enter another value of a at the
command prompt and execute the script again.
Your scripts should be well documented with comments. A com-
ment begins with a %. If you put a header in your script comprised
of several descriptive comments regarding the function of the script,
yeChapter 1. MATLAB Basics
% This is a script to plot the function y=sinalpha’
%
% The value of alpha must exist in
% to invoking the script.
%
the workspace prior
t=[0:0.01:1];
y=sin(alpha*t);
plot(t,y)
xlabel("Time [sec]')
ylabel('y(t) = sin( alpha * t )')
grid
Figure 1.21 A Simple Script to Plot the Function y(t) = sin at.
then using the help function will display the header comments and
describe the script to the user. This is illustrated in Figure 1.22.
We use plotdata.m to develop an interactive capability with &
as a variable, as shown in Figure 1.23. At the command prompt,
we input a value of a = 10 followed by the script filename, which in
this case is plotdata. The graph of y(t) = sinat is automatically
»help plotdata Ht
This is a script to plot the function y=sin(alpha*t),
The value of alpha must exist in the workspace prior
to invoking the script.
Figure 1.22 Using the help Function.
23
Li, Scripts
‘command prompt
palpha=10; plotdata
sin ( alpha * 1)
yo).
‘sin (alpha *t)
y(t)
igure 1.28 An Interactive Session Using a Script to Plot the Func-
jon y(t) = sinat. a
erated. We can now go back to the command prompt, enter a
Value of a = 50, and run the script again to obtain the updated plot.
‘The graphics capability of MATLAB extends beyond the intro-
luctory material presented here. We will investigate the issue of
aphics further on an as-needed basis.24
Notes
Chapter 1. MATLAB Basics
Chapter 2
Mathematical Modeling
of Systems
2.1 Introduction
‘The design and analysis of control systems is based on mathemati-
tal models of complex physical systems. The mathematical models,
which follow from the physical laws of the process, are generally
highly coupled nonlinear differential equations. Fortunately, many
jhysical systems behave Jinearly around an operating point within
‘tome range of the variables and it is possible to develop linear ap-
[proximations to the physical systems. A Taylor series expansion is
erally utilized in the linearization process. The linear approxima-
Jon to the physical system is described by a linear, constant coeffi-
ent ordinary differential equation. The Laplace transform method —
is one way to compute the sohiition of the differential equation. The
japlace transform can also be used to obtain an input-output de-
jscription of the linear, time-invariant (LTT) system in the form of
8 transfer function. The application of the many “classical” and
“modern” control system design and analysis tools are based on
LTI mathematical models. MATLAB can be used with-LTI systems
given in the form of transfer function descriptions or state-space
descriptions (see Chapter 9, State-Space Methods).
We begin this chapter by showing how to use MATLAB to assist,
in the analysis of a typical spring-mass-damper mathematical model
of a mechanical system. Using a MATLAB script, we will develop
an interactive analysis capability to analyze the effects of natural
526 Chapter 2. Mathematical Modeling of Systems
frequency and damping on the unforced response of the mass dis-
placement. This analysis will utilize the fact that we have an ana-
lytic solution that describes the unforced time response of the mass
displacement,
In the subsequent sections, we will discuss transfer functions and
block diagrams. In particular, we are interested in how MATLAB
can assist us in manipulating polynomials, computing poles and ze-
10s of transfer functions, computing closed-loop transfer functions,
block diagram reduction, and computing the response of a system to
a unit step input. The chapter concludes with the electric traction
motor control design example found in MCS, pp. 79-81.
The functions covered in this chapter are roots, roots1, se-
ries, parallel, feedback, cloop, poly, conv, polyval, printsys,
minreal, pamap, and step.
2.2 Spring-Mass-Damper System
A spring-mass-damper mechanical aystem is shown in Figure 2.1.
The motion of the mass, denoted by y(t), is described by the differ.
ential equation
Mij(t) + fe(t) + Ky(t) = r(2). (2.1)
This system is described in MCS, pp. 96-41. The solution, y(t), of
the differential equation describes the displacement, of the mass as
4 fanction of time. The forcing function is represented by r(t), The
derivation of the spring-mass-damper mathematical model is based
on the use of ideal springs and dampers, These ideal models for the
spring and damper are based on lumped, linear, dynamic elements
and only approximate the actual elements. The spring-mass-damper
model, given in Eq. (2.1), is a linear, time-invariant approximation
to the physical process; it is valid only in regions where the spring
force is a linear function of the mass displacement and the damping
due to friction is a linear function of the velocity.
The mathematical model, given in Eq. (2.1), might represent an
off-road vehicle shock absorber. Our objective could be to design
an active control system to make the ride smoother when traversing
2.2. Spring-Mass-Damper System ar
CC)
Forcing
function
Figure 2.1 Spring-Mass-Damper System.
paved roads. The control design and subsequent analysis would
based on the vehicle shock absorber model in Eq. (2.1). Of course,
true test of the control design is the road test. Only then can
prove that the control design does in fact meet the objective of
smoother ride on a bumpy road. We will soon see how to use
[ATLAB to enhance our control design and analysis capability.
Many physical processes are described by mathematical models
nalogous to Eq. (2.1). AA typical electrical RLC circuit is described
y an analogous mathematical model where the velocity, g(t), and
he voltage, v(t), are analogous variables. This notion of analogous
ystems is important in system modeling. Any experience gained
In designing and analyzing control systems for mechanical systems
scribed by Eq. (2-1) can be used in controlling analogous electrical,
thermal, and fluid systems. EVES,
‘The unforced dynamic response, y(t), of the spring-mass-damper
mechanical system is
e-Srt sin(way/ ~ (2 t+ 8),
where @ = cos"!¢. The initial displacement is y(0). ‘The tran-
sient system response is underdamped when ¢ <1, overdamped when
y(0)
WO = 2)28 Chapter 2. Mathematical Modeling of Systems
¢ > 1, and critically damped when ¢ = 1. We
Ay ar = 1. We can use MATLAB
fe sieusine the unforced time response of the mass displacement
following an initial displacement of y(0). Consi
Cede (0). Consider the overdamped
© Case 1: y(0)=0.15m, wn = V28d, G = as (4=2,5=3)
© Case 2: y(0)=0.15m, w, = vist, G= aa (B=2,6=1)
The MATLAB commands to generate the plot of the unforced re-
sponse are shown in Figure 2.2. In the MATLAB setup, the variables
»y0=0.15; wnesqrt(2);_ —<——____—
»zetal=3/(2*sqrt(2)); zeta2=1/(2* 5
>t=[0:0.1:10]; ee
»unforcedcommands
t1=acos(zeta1 )*ones( I,Jength(t)); sa!
t2=acos(zeta2)*ones(1,length(t)); a!
o1=(y0/sqrt(1-zetatA2))ic2=(y0/sqrt(1-Becada2))s
yl=cl *exp(-zetal *wn*t).*sin(wn*sqrt(1-zetal A2)*t+t1);
y2nc2texp(-zetaZ*wntt) Psin(wntscrt(I-2etaZA2)*tvt2);
buse2Mexp(-zeta2wntt}bi-bu;
plot(ty1,"-t,y2,'~',t,bu,'",t,b1,"), grid
a ae oe ylabel(’y(t) Displacement [m]')
ie ['overdi =
eles lamped zetal=',num2str(zetal),...
text(0.2,0.80,[" amped y
t pat 2 eon ‘underdar Zeta2=' num2str(zeta2),..
Figure 2.2 Script to Analyze the Spring Mass-Damper
22. Spring-Mass-Damper System
u(0),Wn, t, Gy and C2 are input to the workspace at the command
level. Then the script unforcedcommands.m is executed to gen-
grate the desired plots. This creates an interactive analysis capa-
bility to analyze the effects of natural frequency and damping on
jhe unforced response of the mass displacement. You can investi-
te the effects of the natural frequency and the damping on the
ime response by simply entering new values of wa, (1, or (2 at the
mmand prompt and running the script unforcedcommands.m
ain. The time-response plot is in Figure 2.3. Notice that the
ript automatically labels the plot with the values of the damping
ficients. This avoids confusion when making many interactive
wlations. The natural frequency value could also be automati-
ly labeled on the plot. Utilizing scripts is an important aspect of
veloping an effective interactive design and analysis capability in
ATLAB . Since you can relate the natural frequency and damping
the spring constant, K, and friction, f, you can also analyze the
fects of K and f on the response.
In the spring-mass-damper problem, the unforced solution to
differential equation, given in Eq. (2.1), was readily available.
general, when simulating closed-loop feedback control systems
0.05
8
(Displacement [rn]
&
ois”
Time [sec]
Figure 2.3 Spring-Mass-Damper Unforced Response.30 Chapter 2. Mathematical Modeling of Systems
subject to a variety of inputs and initial conditions, it is not feasible
to attempt to obtain the solution analytically. In these cases, we can
use MATLAB to compute the solutions numerically and to display
the solution graphically. The simulation capability of MATLAB will
be discussed in detail in subsequent sections and chapters.
2.3. Transfer Functions
The transfer function is an input-output description of an Ll sys-
tem, as described in MCS, pp. 52-68. It relates the Laplace trans-
form of the output variable to the Laplace transform of the input
variable with zero initial conditions. Consider the LTI system de-
scribed by the transfer function G(s), where
X(9)
Rs)
nS + dyna} $ += tars + 0
S$ banis™ tb tas thy!
OAs
(2.3)
where m n=conv(p.q) “*~———| multiply and @._|
ne
314 9 i
»value=polyval(n,-5)
value= ~*——— Evaluate nis) at 9 0-5.
~66
Figure 2.5 Using conv and polyval to Multiply and Evaluate the
Polynomials (35? + 2s + 1)(s +4).
The function polyval is used to evaluate the value of a polynomial
at the given value of the variable. ‘The polynomial n(s) has the value
n(—5) = ~66, as shown in Figure 2.5.
In the next example we will obtain a plot of the pole-zero lo-
cations in the complex plane. This will be accomplished using the
Pzmap function, shown in Figure 2.6. On the pole-zero map, ze-
ros are denoted by an “o” and poles are denoted by an “x”. If the
pzmap function is invoked without left-hand arguments, the plot is
automatically generated.
_ P: pole locations in column vector
zer0 locations in column vector :
a Gg) =num
Oar
4
: IP.Zl-pzmap(num
)
Figure 2.6 The pemap Function.
4. Transfer Functions 33,
@ EXAMPLE 2.1 Transfer Functions
Jonsider the transfer functions
6s? +1
(st 1)(s +2)
Ms) = Sy34 ae FT
1 = Brae Be FH
and
tilizing a MATLAB script, we can compute the poles and zeros of
9), the characteristic equation of H(s), and divide G(s) by H(s)
fe can also obtain a plot of the pole-zero map of G(s)/H(s) in the
plex plane.
The pole-zero map of the transfer functionG(s)/H(s) is shown
Figure 2.7, and the associated MATLAB commands are shown in
ure 2.8. The pole-zero map shows clearly the five zero locations,
t it appears that there are only two poles. This cannot be the
e since we know that the number of poles must be greater than
equal to the number of zeros. Using the roots] function we can
rtain that there are in fact four poles at s = -1. Hence, multiple
‘or multiple zeros at the same location cannot be discerned on
pole-zero map.
Imag Axis
4s
Real Axis,
Figure 2.7 Pole-Zero Map for G(s)/H(s).Chapter 2, Mathematical Modeling of Systems
»numg=[6 0 1]; deng=[1 3 3 1];
»z=roots(numg)
ze
0 + 0.40821
0 - 0.4082
»peroots1 (deng)
<-____
Y
anta[1 1]; n2=[1 2]; dl=[1 24%; d2=[1 -2%i]; a3.
»numh=conv(n1,n2); denh=conv(d1 ,conv(d2,d3));
»printsys(numh,denh)
num/den =
SA243842
sacsesessasasineeitiesias
SAB 43502445412
133;
»num=conv(numg,denh); den=conv(deng,numh);
»printsys(num,den)
num/den =
6 SAS + 18 sA4 + 25 5A3 475 sA2 445412
S95 + 6544+ 14543 + 165A2 49542
»pzmap(num,den) Pole
»title('Pole-Zero Map’)
ae
Figure 2.8 Transfer Function Example for G(s) and H(s).
24, Block Diagram Modolx
2.4 Block Diagram Models
Suppose we have developed mathematical models in the form of
transfer functions for the plant, represented by G(s), and the con-
roller, represented by H(s), and possibly many other system com-
nents such as sensors and actuators. Our objective is to inter-
nect these components to form a control system. We will utilize
[ATLAB functions to carry out the block diagram transformations.
lock diagram models are described in MCS, pp. 54-69.
‘The process to be controlled is shown in Figure 2.9. A simple
yen-loop control system can be obtained by interconnecting the
lant and the controller in series as illustrated in Figure 2.10. We
n use MATLAB to compute the transfer function from R(s) to
(s), as illustrated in Example 2.2.
EXAMPLE 2.2 Series Connection
the process, represented by the transfer function G(s), be
L
500s?"
let the controller, represented by the transfer function G(s), be
+t
s+2°
fe can use the series function to cascade two transfer functions
j,(s) and G(s), as shown in Figure 2.11.
The transfer function G,G(s) is computed using the series func-
as shown in Figure 2.12. ‘The resulting transfer function, G.G(s),
Qs) =
G(s) =
Process
Gs) Ys)
Us) ———>|
Figure 2.9 Open-Loop System.36 Chapter 2. Mathematical Modeling of Systems 24, Block Diagram Models 37
Als) R(s) %s)
»numg=[1]; deng=[500 0 0}
pnumh=[1 1]; denh={1 2];
»[num,den]=series(numg,deng,numh,denh);
»printsys(num,den)
num/den =
stl
Figure 2.10 Open-Loop Control System.
He
G.G(s) = SE stl
500 sA3 + 1000 sA2
den ~ 500° + 10008?"
Block diagrams quite often have transfer functions in parallel, In
such cases, the function parallel can be quite useful. The parallel
function is described in Figure 2.13.
We can introduce a feedback signal into the control system by
closing the loop with unity feedback, as shown in Figure 2.14. The
signal E,(s) is an error signal; the signal A(s) is a reference input.
In this control system, the controller is in the forward path and the
closed-loop transfer function is
Figure 2.12 Application of the series Function.
re are two functions we can utilize to aid in the block diagram re
tion process to compute closed-loop transfer functions for single-
4 multi-loop control systems. These functions are cloop and
dback. |
GeG(s) ‘The cloop function calculates the closed-loop transfer function
7) = EGG
Figure 2.11 The series Function.
Figure 2.13 The parallel Function.i 39
38 Chapter 2. Mathematical Modeling of Systems 4. Block Diagram Models
Ea(s) [Controller] urs) [Process
Rye ae] Ge(s) 4 G(s) yer)
eet
Figure 2.14 A Basic Control System with Unity Feedback.
as shown in Figure 2.15 with the associated system configuration
and assumes unity feedback with negative feedback as the default,
‘The feedback function is shown in Figure 2.16 with the associ
ated system configuration, which includes Hs) in the feedback path.
For both the eloop and feedback functions, if the input “sign” is
omitted, then negative feedback is assumed. In Example 2.3 we
show an application of the eloop function, and in Example 2.4 we
show an application of the feedback function.
@ EXAMPLE 2.3 The cloop Function
Figure 2.16 The feedback Function.
Another basic feedback control configuration is shown in Fig-
2.18. In this case, the controller is located in the feedback path.
error signal, E4(s), is also utilized in this control system con-
ration. The closed-loop transfer function is
Let the process, G(s), and the controller, G(s), be as in Example 2.2
(sce Figure 2.12). To apply the cloop function we first uve the Peja
series function to compute G.G(s), followed by the cloop function 1+ GH(s)
to dose the loop. The command sequence is shown in Figure 2.17.
The closed-loop transfer function, as shown in Figure 2.17, is
> ¥(s)
T(s) = —GeG(S)__ num _ stl
~T+G.G( den ~ 500s + 10005? +541"
»numg~[1]; deng=[500 0 0];
»nume=[1 1]; denc=[1 2];
»{num1 ,den1 ]=series(numg,deng,nume,denc);
»{num,den]=cloop(num1 dent,-1);
»printsys(num,den) ss
num/den = E
‘egative feedback (default)
{num,den]=cloop(numi,dent,sign)
s+1 +——_+
500 s43 + 1000 sA2+ s+1
Figure 2.15 The cloop Function, Figure 2.17 Application of the cloop Function.40 Chapter 2. Mathematical Modeling of Systems
Figure 2.18 A Basic Control System with the Controller in the
Feedback Loop.
WM EXAMPLE 2.4 The feedback Function
Again, let the process, G(s), and the controller, H(s), be as in Ex:
ample 2.2 (.¢., H(s) = G.(s)). To compute the closed-loop transfer
function with the controller in the feedback loop we use the feed.
back function. The command sequence is shown in Figure 2.19,
‘The closed-loop transfer function is
T(s) = —G(s)_ num s+2
“T+ GH{(s) ~ den © 5008? + 10008? +s +1"
The MATLAB functions series, cloop, and feedback can be used
»numh=[1 1]; denh=[1 2};
[num,den}=feedback(numg,deng,numh,denh,-1);
»printsys(num,den)
num/den =
$+2 —_—
eee eer eeeee
500 83 + 1000 s*24 541
Figure 2.19 Application of the feedback Function,
2.4, Block Diagram Models 4
as aids in block diagram manipulations for multi-loop block die
grams. This is illustrated in Example 2.5.
M@ EXAMPLE 2.5 Multi-Loop Reduction
is in Figure 2.20. This example
Iti-loop feedback system is shown in Figure 2
dane found in MCS, pp.67-69. Our objective is to compute the
closed-loop transfer function
= Xb)
Ts) = Re)"
when 1
1
Gis) = a4" Gils) = s4r°
etl stl
P4544" 346"
Gs(s) = Gas) =
and atl
aee
For this example, a five-step procedure is followed:
Ha) = Hp(s) = 2, Hs(s),
Step 1: Input the system transfer functions into MATLAB .
© Step 2: Move Hy behind Gi.
EK
7 to>[om [ew > Y(e)
Hs)
Figure 2.20 Multi-Loop Feedback Control System.42 Chapter 2. Mathematical Modeling of Systems
© Step 3: Eliminate the GsG4F loop.
© Step 4: Eliminate the loop containing Hy.
* Step 5: Eliminate the remaining loop and calculate T(s).
ZThe five steps are illustrated in Figure 2.21, and the corresponding
block diagram reduction is shown in Figure 2.22, ‘The result of
executing the MATLAB commands is
num _ 3° +4ot + 65° + 657+ 5842
den 123" + 20555 + 10669" + 2517s? + 31280? + 21060 FTE
We must be careful in calling this the closed-loop transfer function,
Recall that the transfer function is defined to the input-output rela-
Hionship after pole-zero cancellations. If we compute the poles and
zeros of T(s), we find that the numerator and denominator poly-
nomials have (s +1) as a common factor. This must be canceled
before we can claim we have the closed-loop transfer function. To
ongt=[1]; dg1=[1 10};
ang2=[1]}; dg2=[1 1};
ong3=[1 0 1]; dg3=[1 4 4);
ong4=[1 4=[1 6];
»nhl=[1 1}; dh1=[1 2];
onh2=[2}; dh2=[1];
»nh3=[1]; dh3=[1];
»nt=conv(nh2,dg4); d1=conv(dh2,ng4);
»[n2a,d2a]=series(ng3,dg3,ng4,dg4);
»[n2,d2]-feedback(n2a,d2a,nh1,dh1, +1);
»[n3a,d3a]=series(ng2,dg2,n2,d2);
»[n3,d3]=feedback(n3a,d3a,n1,d1);
»[n4,d4]=series(ng1,dg1,n3,d3);
»[num,den]=cloop(n4,d4,-1);
Figure 2.21 Multi-Loop Block Reduction,
43
24. Block Diagram Models
Ra ts)
(a) Step 2
[=-
z
op - Eh Ge co
fF
(b) Step 3
Ris) cs)
(c) Step 4
a we C(S)
R(s) LO 3Gal t+ 205H2 + DGS
(A) Step 5
’
Figure 2.22 Block Diagram Reduction of Multi-Loop System (See
Example 2.5 in MCS, pp. 67-69).45
4 :
M4 Chapter 2. Mathematical Modeling of ‘Systems 45. Design Example
2.5 Design Example
Ulectric traction motors are utilized on trains and transit vehicles.
‘The detailed block diagram model with the transfer functions of the
Figure 2.23 The minreal Function.
assist us in the pole-zero cancellation we wil it
tion. The minreal function, shown in Fens ae
pole-zero factors of a transfer function, The final step in the block
reduction process is to cancel out the common factors, as shown
in Figure 2.24. The closed-loop transfer function is given in Fig:
lute 2.24 as Ts) = num/den. After the application of the minrecl
function we find that the order of the denominator polynomial hex
been reduced from six to five, implying one pole-nere cancellacio
1 pole-zeros cancelled
0.08333 SA4 + 0.25 sA3 + 0.25 sA2 + 0.25 s + 0.1667
SA5 + 16.08 8A4 + 72.75 sA3 + 137 sA2 4 123.7 s + 59.33
Figure 2.24 Application of the minreal Function,
jower amplifier, armature controlled motor, and sensor, is shown in
gure 2.25. This is Example 2.9 in MCS, pp. 79-81. Our objective
js to compute the closed-loop transfer function and investigate the
pponse of w to a commanded wz. The first step, as shown in Fig-
re 2.26, is to compute the closed-loop transfer function w/w. The
wed-loop characteristic equation is second-order with w, = 52 and
= 0.012. Since the damping is low we might expect the response
Jo be highly oscillatory. We can investigate the response w(t) to
reference input, w(t), by utilizing the step function. The step
nction, shown in Figure 2.27, calculates the unit step response of
linear system.
The step function is a very important function since control
item performance specifications are often given in terms of the
it step response. The state response, given by x(t), is an output
the step function and will be discussed in detail in Chapter 9,
itate-Space Methods. Include « in the left-hand argument list, but
not be concerned with it for the time being.
If the only objective is to plot the output, y(t), we can use the
ep function without left-hand arguments and obtain the plot au-
matically with axis labels. If we need y(t) for any reason other
plotting, we must use the step function with left-hand argu-
ts, followed by the plot function to plot y(t). We define t as a
Figure 2.25 Electric Traction Motor Block Diagram.46 Chapter 2. Mathematical Modeling of Systems
onumt=[10]; dent =[1 1]; num2~[1}; den2=[2 0.5]
»num3=[540]; den3=[1]; num4=[0.1]; den4=[1];
»[nada]=series(num1,den1,num2,den2);
»[nb,db]=feedback(na,da,num4,den4,-1);
»[nc,dc]=series(num3,den3,nb,db);
»[num,den}=cloop(no,de,-1);
»printsys(num,den)
num/den =
5400
—_—__
2842 +2.5s +5402
Figure 2.26 Electric Traction Motor Block Reduction,
Tow vector containing the times at which we wish the value of the
output variable y(t),
‘The step response of the electric traction motor is shown in Fig-
le 2.28. AAs expected, the wheel velocity response, given by y(t), is
highly oscillatory.
Figure 2.27 The step Function.
2.5. Design Example
Wheel velocity
aT
‘motoresponse.m
% This script computes the step
% response of the Traction Motor
% Wheel Velocity
{y.x,t]=step(num,den,t);
plot(ty),grid
xlabel('Time [sec]")
ylabel('Wheel velocity")
Figure 2.28 Traction Motor Wheel Velocity Step Response.48
Chapter 2. Mathematical Modeling of Systems
——__________ Notes
Chapter 3
Control System Characteristics
3.1 Introduction
We introduce feedback to
1. decrease the sensitivity of the system to plant variations,
2. enable adjustment of the system transient response,
3, reject disturbances, and
4, reduce steady-state tracking errors.
‘The advantages of feedback (listed above) come at the cost of in-
creasing the number of components and system complexity, reduc-
tion in the closed-loop system gain, and the introduction of possi-
ble instabilities. However, the advantages of feedback outweigh the
disadvantages to such an extent that feedback control systems are
found everywhere. In this chapter, the advantages of feedback are
illustrated with two examples. Our objective is to illustrate the use
of MATLAB in the control system analysis.
In the first example, we introduce feedback control to a speed
tachometer system in an effort to reject disturbances. The tachome-
ter speed control system example can be found in MCS, pp. 125-128.
The reduction in system sensitivity to plant variations, adjust-
ment of the transient response, and reduction in steady-state error
are demonstrated in a second example. ‘This is the English Channel
boring machine example found in MCS, pp. 134-197.
4950 Chapter 3. Control System Characteristics
3.2 Speed Tachometer System
‘The open-loop block diagram description of the armature controlled
de-motor with a load torque disturbance, T,(s), is shown in Fig-
ure 3.1. The values for the various parameters, taken from Example
2.9 in MCS, pp. 79-81, are given in Table 3.1. We have two in-
puts to our system, V,(s) and Ty(s). Relying on the principal of
superposition, which applies to our LTI system, we consider each
input separately. To investigate the effects of disturbances on the
system, we let V,(s) = 0 and consider only the disturbance 7,(s).
Conversely, to investigate the response of the system to a reference
input, we let Ty(s) = 0 and consider only the input Vq(s)
The closed-loop speed tachometer control system block diagram
is shown in Figure 3.2. The values for K, and K, are given in
Table 3.
Tour system displays good disturbance rejection, then we expect
the disturbance Tu(s) to have a small effect on the output .(s).
Consider the open-loop system shown in Figure 3.1 first. We can
use MATLAB to compute the transfer function from T,(s) to w(s)
and evaluate the output response to a unit step disturbance (i.e.,
T(s) = 1/s). The time response to a unit step disturbance is shown
in Figure 3.3. The script opentach.m, shown in Figure 3.3, is used
to analyze the open-loop speed tachometer system.
‘The open-loop transfer function is
sls) _ nam
Tals) ~ den ~ 26515"
Tals)
Vals) + LY lal) Kn Lim) V- w(s)
Figure 3.1 Open-Loop Speed Tachometer Control System where
K, is the Back Electromotive-Force Constant.
42. Speed Tachometer Syste
51
Table 3.1 Tachometer Control System Parameters.
Ry\ Km | J) f | Ks | Ka| Ke
1 | 10 |2}05/o1] 54) 1
Since our desired value of w(t) is zero (remember that Va(s) = 0),
the steady-state error is just the final value of w(t}, which ve denote
by wo(t) to indicate open-loop. The steady-state error, s hoa on
the plot in Figure 3.3, is approximately the value of the spe a
= T seconds, We can obtain an approximate value ofthe steady-
Alate error by looking at the last value in the output vector vos ti
We generated in the process of making the plot in Figure 3.3. The
approximate steady-state value of w, is
w,(00) FY we(7) = —0.6632 rad/see.
verifies that we have in fact reached steady-state,
Se ai fashion, we begin the closed-loop system analysis by
computing the closed-loop transfer function from Ty) t0 (3), an
then generating the time response of w(t) to aunt step disturbance
input. The output response and the seriptclosedtach.m are shown
in Figure 3.4. The closed-loop transfer function from the disturbance
5)
gus
Rs) + rr] 98)
Plis+f
ea
Figure 3.2 Closed-Loop Speed Tachometer Control System.a Open-Loop Disturbance Stop Response
%Speed Tachometer Example
%
Ra=1; Km=10; J=2; f=0.5; Kb=0.1;
num1=[1]; dent =[J,f}; num2=[Km*Kb/Ra]; den2=[1];
[num,den}=feedback(num1 den! num2,den2);
%
Chaige Sign oF Wanctar trction wie Bhs
nume-num; iveutbanes has pegeten an nea
sgatlve sign in the diagram.
printsys(num,den) ae
%
Compute response to
[yo,xst}=step(numden); plot(tyo) <1 step detubance,
title(‘Open-loop Disturbance Step Response") ——
Habel( time [sec]'), ylabel('speed’), grid
yotlength(t)) —<—{__Steadstate error
Figure 3.3 Open-Loop Analysis of the Tachometer System.
Chapter 3. Control System Characteristics
32. Speed Tachometer System 53
Closed. Loop Disturbance Step Respense
speed [rad/sec]
9 TOOT TOF 0006 OOO COT OIE OUIF OUTS OOS Ot
time [sec]
closedtach.m
% Speed Tachometer Example
%
Raw; Km=10; J=2;
f=0.5; Kb=0.1; Ka=54; Kt=1;
num1=[1 num2=[Ka*Kt]; den2=[1];
num3=[Kb]; den3=[1]; num4=[Km/Ra]; den4=[1];
[numa,dena]=parallel(num2,den2,num3,den3);
[numb,denb]=series(numa,dena,num4,den4);
[num,den]=feedback(num1 ,den1 ,numb,denb);
%
J,
7 age aA OTT
NUM=-NUMT ~« ——| as negative signin the block
printsys(num,den) -
% [Compute response te
[yc,x,t]=step(num,den); plot(t,yc) ~+— ster disturbance.
title(‘Closed-loop Disturbance Step Response’
xlabel('time [sec]'), ylabel('speed [rad/sec}’), grid
%
ye(length(t))
Figure 3.4 Closed-Loop Analysis of the Tachometer System.54 Chapter 3. Control System Characteristics
input is
~ den
2s + 541.5"
As before, the steady-state error is just the final value of w(t), which
we denote by w.(t) to indicate closed-loop. The steady-state error
is shown on the plot in Figure 3.4. We can obtain an approximate
value of the steady-state error by looking at the last value in the
output vector y., which we generated in the process of malking the
plot in Figure 3.4, The approximate steady-state value of w is
We(00) & we(0.02) = -0.0018 rad/sec.
We generally expect that w.(00)/ws(00) < 0.02. ‘The ratio of closed.
loop to open-loop steady-state speed output due to a unit step dis.
turbance input, in this example, is
we(c0)
we(00)
We have achieved a remarkable improvement in disturbance rejec-
tion. It is clear that the addition of the negative feedback loop
reduced the effect of the disturbance on the output. This demon.
strates the disturbance rejection property of closed-loop feedback
systems.
= 0.0027.
3.3 English Channel Boring Machines
‘The block diagram description of the English Channel boring ma-
chines is shown in Figure 3.5. The transfer function of the output
due to the two inputs is
K L
Oe) = ey
(= ayia RO) + app ROU)
The effect of the control gain K’ on the transicut response is shown
in Figure 3.6 along with the script english1.m used to generate the
plots. Comparing the two plots in Figure 3.6, it can be seen that
decreasing K decreases the overshoot. Although it is not ae obvious
1.3. English Channel Boring Machines 55
disturbance
D(s) boring
Figure 3.5 Boring Machine Control System Block Diagram.
from the plots in Figure 3.6, it is also true that decreasing K de-
creases the selling time. This can be verified by taking a closer look
(at the command level) at the data used to generate the plots. This
example demonstrates how the transient response can be altered by
feedback control gain K. Based on our analysis thus far, we would
prefer to use K = 50. However, there are other considerations that
must be taken into account before we can establish the final design.
Before making the final choice of K, it is important to consider
the system response to a unit step disturbance. This is shown in Fig-
ure 3.7. We see that increasing K reduces the steady-state response
of e(t) to the step disturbance. The steady-state value of o(t) is 0.02
and 0.01 for K = 50 and 100, respectively, The steady-state errors,
percent overshoot, and settling times are summarized in Table 3.2.
‘The steady-state values are predicted from the final value theorem
as follows:
Jiged = tgs
s(e+ 12) +K
If our only design consideration is disturbance rejection, we would
prefer to use K = 100.
‘We have just experienced a very common imde-off situation in
control system design. In this particular example, increasing K leads
to better disturbance rejection, while decreasing K leads to better
performance (via less overshoot and quicker settling time). The final56 Chapter 3. Control System Characteristics
15, __Sjep response for K=100_
4 —[orerthcok 7]
‘settling tine |
os|
0
002 04 06 08 i123 ta ie 1
time [sec]
Ls ‘Shep response for K=
time [sec}
english1.m
oe to a Unit Step Input R(s)=1/s for K=50, 100
numge{1]; deng=[1 12 0}; K1=100; K2=50;
num1=K1*numg; num2=K2*numg
%
[numa,dena]=cloop(num1,deng
{numb,denb]=cloop(num2,deng); ~
%
t=[0:0. 5
i -_
(yl x,t]=step(numa,dena,t); [y2,x,t]-step(namb,denb,t);
subplot(211),plot(t.y1), title('Step Response for K=100")
xlabel(‘time [Sec]'),ylabel(‘c(t)")
subplot(212),plot(t,y2), title('Step Response for K=50')
xlabel('time [sec]'),ylabel(‘c(t)")
‘Create a
x and.
loplats with”
is labels,
Figure 3.6 The Response to a Step Input with K=100 and K=50.
4.3, English Channel Boring Machines
Disturbance Response for K=100.
ois;
oof
e
0.005}
02 04 06 08 1 12 14 16 18 2
time [sec]
0.005, Disturbance Response for K=100
(2 04 0605112 a 2
time [sec]
cenglsh2.m
% Response to a Disturbance D(s)=1/s for K=50, 100
%
humge[1]; deng=(1 12 0]; K1=100; K2=50;
% (oedipal
[ruma,dena]=feedbacl{numg,dengk1,1);
[numb,denb}=feedback(numg,deng,
%
t=[0:0.05:2.0]; BE ead ya labels.
[yl xt]=step(numadena,t); [y2.x.t}=step(nurib,denb,t);
subplot(211),plot(ty1) *
title(‘Disturbance Response for K=100')
xlabel‘time [sec]'),ylabel('c(t)")
subplot(212),plot(tiy2)
title('Disturbance Response for K=50')
xlabel(‘time [sec]'),ylabel(‘e(t)")
Figure 3.7 The Response to a Step Disturbance with K=100 and
K=50.Chapter 3. Control System Characteristics
Table 3.2 Response of the Boring Machine Control System for K =
50 and K = 100.
K =50| K = 100
P.O.| 0 10
T | 1a 13
ems | 2% 1%
decision on how to choose K rests with the designer. So you see that
while MATLAB can certainly assist you in the control system design,
it cannot replace your decision-making capability and intuition.
The final step in the analysis is to look at the system sensitivity
‘to changes in the plant. The system sensitivity is given by (Eq. 3.62,
MCS, p. 137)
1
Mel KG(s)
o(s +12)
+1 +k"
We can compute the values of $(s) for different values of s and
generate a plot of the system sensitivity. For low frequencies, we
can approximate the system sensitivity by
12s
Ko
ing the gain K reduces the system sensitivity. ‘The system
sensitivity plots are shown in Figure 3.8 for K = 50. The sensitivity
approximation is also shown in Figure 3.8.
(5) =
ahah
Fuglish Channel Boring Machines
System sensitivity to plant variations
0608
02 04 O65
Se
s(s+12)
| SO ~s eta) 4K
12
‘System sensitivity to plant variations,
pe ike
of -
~
I 3 0 ca
w [rad/sec}
% System Sensitivity Plot
%
K=50; num=[1 12 0};
fen=[1 12
ne .A2 + 12%; d
nx 1245; d2=K; S2=n2./d2;
%
plot(w,abs(S),w,abs(S2))
/=[0.1:0.05:20]; s=w*i; 1
Lay S.A2 +12*84K; S=n/
cg approximate sensitivity. |
Jot(real(S),imag(S)) ce
fitle'System Sensitivity to Plant Variations ')
xlabel(‘Real(S)"), ylabel("Imag(S)), arid a
pause “Sate
xlabel('w [rad/sec]'), ylabel(Abs(S)'), grid
1 s(s) = £66412)
3 (5412) +K
[Setupvecworar |
K];| 8 =# @to evaluate
Figure 3.8 System Sensitivity to Plant Variations.60
Chapter 3. Control System Characteristics
Notes
Chapter 4
Control System Performance
4.1 Introduction
Primary concerns in control system design are stability and perfor-
mance. Performance is an issue for stable systems and is the topic
of this chapter. In order to design and analyze control systems,
We must first establish adequate performance specifications. Per-
formance specifications can be presented in the time domain or the
frequency domain. Time-domain specifications generally take the
rm of settling time, percent overshoot, rise time, and steady-state
ror specifications. Stability and frequency-domain specifications
addressed in the next chapters.
‘This chapter is organized as follows. In the next section we
Investigate time-domain performance specifications given in terms of
transient, response to a given input signal and the resulting steady-
slate tracking errors. ‘The chapter concludes with a discussion of
simplification of linear systems.
The MATLAB functions introduced in this chapter are impulse
‘and Isim, These functions are used to simulate linear systems.
4.2 Time-Domain Specifications
"Lime-domain performance specifications are generally given in terms
of the transient response of a system to a given input signal. Since
the actual input signals are generally unknown, astandard fest input
6162 Chapter 4. Control System Performance
Figure 4.1 Step Response of a Second-Order System.
signal is used. The test signals are of the general form
x(t) =t,
and the corresponding Laplace transform is
When n = 1,2, and 3 we have the
n 22) an step, ramp, and parabolic ir
repectivaly ‘An impulse function is also used as a test eines
fits 1¢ standard performance measures are usually defined in terms
: 1e step response and the impulse response. The most common
Sep opens performance measures are percent overshoot (P.O.),
er tims (B), peak time (T,), and settling time (T,), as shown in
Consider the second-order system shown in Figure 4.2. The
4.2, Time-Domain Spe
_ Gh Cc
| 5(5+an) ia
Figure 4.2 Single-Loop Second-Order Feedback System.
closed-loop output is
oe Rs)
CO) = Sy mas bak
We have already discussed the use of the step function to com-
pute the step response of a system. Now we address another im-
portant test signal: the impulse. The impulse response is the time
derivative of the step response, We compute the impulse response
with the impulse function shown in Figure 4.3.
We can obtain a plot similar to Figure 4.5(a) in MCS, p, 162
with the step function, as shown in Figure 4.4. Using the impulse
function, we can obtain a plot similar to Figure 4.6 in MCS, p.
163. The response of a second-order system for an impulse function
input is shown in Figure 4.5. In the script, we set w, = 1, which is
7] | SYSTEM 7”
T
Figure 4.3 The impulse Function.64 Chapter 4. Control System Performance
zeta = 0.1, 0.2, 0.4,0.7, 1.0,2.0
% Compute step response for a second-ordel
% Duplicate Figure 4.5(a) inMCS, p. 162
%
t=[0:0.1:12]; num=[1];
zetal=0.1; den1=[1 2*zetal 1);
zeta2=0.2; den2=[1 2*zeta2 1]; ~
zeta3=0.4; den3=[1 2*zeta3 1];
zetad~0.7; den4=[1 2*zetad 1];
zetaS=1.0; denS=[1 2*zetaS 1]:
Zeta6-2.0; den6=[1 2+zeta6 1];
(y1.x,t]-step(num,dent ,t); [y2,x,t]=step(num,den2,);
{y3,x,t]~step(num,den3,t); [y4,x,t]=step(num,dendt):
USext-step(rum,den5,t); [y6,x,t]=step(num,den6,t);
plot(ty1,t.y2,t,y3,ty4,t,y5,t,y6)
xabel(' wn*t'), ylabel(‘c(t)') <—
title(‘zeta = 0.1, 0.2, 0.4, 0.7, 1.0, 2.0")
Figure 4.4 Reananca af + Cn
65,
42 Time-Domain Specilic
1
|
0.6}
04}
02|
(tiiwn
o}
02
4
05
a a a
Impulseresponse.m
% Compute impulse response for a second-order system
% Duplicate Figure 4.6 in MCS, p. 163
%
t=[0:0.1:10]; num=[1];
zetal=0.1; denl=[1 2*zetal 1]; “*]
zeta2=0.25; den2=[1 2*zeta2 1];
zeta3=0. n3=[1 2*zeta3 1];
zeta4=1.0; den4=[1 2*zeta4 1];
%
[y1.x,t]-impulse(num,den1 ,t);
[y2,x,t]=impulse(num,den2,t);
[y3,x,t]=impulse(num,den3,t);
[y4.x,t]=impulse(num,den4,t);
%
; der
); der
plot(ty1,ty2,ty3.ty4) | Gee
xlabel(' wn*t’), ylabel('g(t)/wn')
title(‘zeta = 0.1, 0.25, 0.5,1.0"), grid
Figure 4.5 Response of a Second-Order System to an Impulse.66
Chapter 4. Control System Performance
SYSTEM rc)
GS) | capa
Figure 4.6 The Isim Function.
cauivalent to computing the step response versus wnt. This gives us
@ mote general plot valid for any w, > 0.
Ih many eases, you may need to simulate the syatem response to
an arbitrary but known input. In these cases, you can use the Isine
function. The Isim function is shown in Figure 4.6. An example of
the use of Isim is given in Example 4.1.
@ EXAMPLE 4.1 Mobile Robot Steering Control
The block diagram for a steering control system for a mobile robot
is shown in Figure 4.7 (see MCS, pp. 174-176).
Controller Vehicle dynamics
R(s) Cs)
Tee F ee
ie 770 |
Figure 4.7 Block Diagram of a.
‘Steering Control System for a Mobile
Robot.
67
42. Time-Domain Specifications
mobilerobot.m
% Compute the response of the Mobile Robot
% System to a triangular wave input
% |
numg=[10 20]; deng=[1 10 0]?
[num,den]=cloop(numg,deng);
.1:8.2.
[V1 v2iv3];
settee danas eee
t(try, tu), :
tian [sec]’), ylabel(‘theta [rad
Figure 4.8 Transient Response of the Mobile Robot Steering Con-
trol System to a Ramp Input.68 Chapter 4. Control System Performance
Suppose the steering controller, G1(s), is
K
ls) = K+.
When the input is a ramp, the steady-state error is
A
w= (4.1)
where
Ky = WK.
The effect of the controller constant, Kz, on the steady-state error
is evident from Eq, (4.1). Whenever Ky is large, the steady-state
error is small, and vice versa,
We can simulate the closed-loop system response to a ramp input
using the Isim function. The controller gains K, Ky and the system
gain K can be represented symbolically in the script so that various
values can be selected and simulated. The results are shown in
Figure 4.8 for Ky = =1, Ky =2, and r = 1/10,
4.3 Simplification of Linear Systems
In practice, it may be necessary to approximate a higher-order trans-
fer function model with a lower-order model, For example, it may
be impractical to implement a high-order controller in a control sys-
jem. However, it may be possible to develop a lower-order appror.
imate controller that closely matches the input-output response of
the high-order controller. A procedure for approximating transfer
functions is given in MCS, pp. 185-187. We can use MATLAB ta
compare the approximate model to the actual model, as illustrated
in the following example.
M EXAMPLE 4.2 A Simplified Model
Consider the third-order system
6
"0) = sya Ts +o
13. Simplification of Linear Systems 69
‘A necond-order approximation (see MCS, pp. 187-188) is
1.60
1) = Fy 354s +100"
A compatison of their respective step responses is given in Figure 4.9.
% Compare step response for sega
%
num1=[6]; dent=[1 6 11 67)
num2=[1.6]; den2=[1 2.584 1.6
t=[02 is
[y1,x,t]=step(num1 dent ,t);
[y2,x,t]=step(num2,den2,t);
plot(ty1,t.y2), grid zi
xlabel('time [sec]'), ylabel('step response")
Figure 4.9 Step Response Comparison for an Approximate Transfer
Vunction Versus the Actual Transfer Function.70
Chapter 4. Control System Performance
————_______._ Notes
Chapter 5
Control System Stability ’
1 Introduction
he stability of a closed-loop control system is a fundamental issue
Jn controls. Generally speaking, an unstable closed-loop control sys-
Jorn is of little practical value. For linear systems, a necessary and
{ficient condition for a feedback system to be stable is that all the
les of the system transfer function have negative teal parts. In
her words, the poles must lie in the left-half plane for the system
be stable, The Routh-Hurwitz stability method provides a struc-
sed mechanism for determining the number of unstable poles of
«¢ closed-loop characteristic equation. This allows us to obtain a
cs” or “no” answer to stability without explicitly calculating the
es.
‘This chapter begins with a discussion of the Routh-Hurwitz sta-
llity method, We will see how MATLAB can assist us in the stabil-
lly analysis by providing an easy and accurate method for comput-
ling the poles of the characteristic equation. For the case where the
‘characteristic equation is a function of a single parameter, it will be
possible to generate a plot displaying the movement of the poles as
the parameter varies. The chapter concludes with an example.
‘The function introduced in this chapter is the function for, which
In used to repeat a number of statements a specific number of times,
772 Chapter 5. Control System Stability
5.2 Routh-Hurwitz Stability
‘The Routh-Hurwitz criterion is a necessary and sufficient criterion
for stability. Given a characteristic equation with fixed coefficients,
we can use Routh-Hurwitz to determine the number of roots in the
right-half plane. For example, consider the characteristic equation
qs) =? +s? +2s+24=0
associated with the closed-loop control system shown in Figure 5.1.
‘The corresponding Routh-Hurwitz array is shown in Figure 5.2. The
two sign changes in the first column indicate that there are two
roots of the characteristic polynomial in the right-half plane; hence
the closed-loop system is unstable. Using MATLAB we can verify
the Ronth-Hurwitz result. by directly computing the roots of the
characteristic equation, as shown in Figure 5.3, using the root:
function. Recall that the roots function computes the roots of a
polynomial.
Whenever the characteristic equation is a function of a singlel
parameter, the Routh-Hurwitz method can be utilized to determine
the range of values that the parameter may take while maintaining
stability. Consider the closed-loop feedback system in Figure 5.4.
The characteristic equation is
q(s) = 3° +s? 448+ K =0.
Using a Routh-Hurwitz approach we find that we require 0 < K <8
for stability (see MCS, p. 215). We can use MATLAB to verify this
G(s) = ——__1____
(9 Syeda 0B
Figure 5.1 Closed-Loop Control System with T(s) = C(s)/R(s)
1/(s? +s? +.2s +24).
‘2. Routh-Hurwitz Stability 73
nee
at sign change:
gure 5.2 Routh-Hurwitz Array for the Closed-Loop Control Sys-
mn with T(s) = C(s)/R(s) = 1/(s? + 5? +28 +24).
sult graphically. As shown in Figure 5.5, we establish a vector of
malues for K at which we wish to compute the roots of the charac-
ristic equation, Then using the roots function we calculate and
Jot the roots of the characteristic equation, as shown in Figure 5.5.
It can be seen that as K increases, the roots of the characteristic
ation move toward the right-half plane as the gain tends toward
= 8, and eventually into the right-half plane when K > 8. This is
‘graphical verification of the Routh-Hurwitz result obtained above.
the next chapter we will discover a compact method of obtaining
pnumg=[1]; deng=[1 1 2 23];
»[num,den]=cloop(numg,deng);
»roots(den)
ans =
3.0000
1.0000 + 2.6458:
1.0000 - 2.6458:
Figure 5.3 Using the roots Function to Compute the Closed-Loop
Control System Poles of the System Shown in Figure 5.1.4 Chapter 5. Control System Stability
Figure 5.4 Closed-Loop Control System with 7(s) = C' =|
K/(s° +28? +454 K). ees
: f 8 le
3
' peommcsumetioscncoo HX 9696-36303
‘Script computes the roots of the characteristic
% equation (s) = 543 + 2502 +454 K for O0.
% the stability region for the two track vehicle
% control problem
%
a=[0.1:0.01:3.0]; Km[20:1:1 20]; =
X= 0*K; ya"; «ina Hat eon a
nelength(K); m=length(a); | ¥#eters of sppropriate length
for i=1:n
least one root of the characteristic equation in the right-half plane,
The process is repeated until the entire selected range of a and K ig
exhausted. Then, the plot of the (a, K) pairs defines the separation
between the stable and unstable regions,
for j=1:m
Gel, 8, 17, K(D#10, KO*aD: =
ts(q);
net een ae ifmax(Fealp)) > 0, ()=K(0s yl=al
+ E(s) [eva K end
cera : ‘i
nade ait) i ° plot(xy). arid, abel), ylabel‘a')
|
; Figure 5.8 Stability Region for a and K for Two-Track Vehicle
Figure 5.7 Turning Control for a Two-Track Vehicle. ‘Turning Control.8 Chapter 5. Control System Stabilit 63. Example: Tracked Vehicle Turning Control
The region to the left of the plot of a versus K in Figure 5.8 i
the stable region, since that corresponds to K < 126.
If we assume that r(t) = At,t > 0, then the steady-state error i
Pee s(s+1)(s+2)(s+5) A 10A
te 20" s(5 + 1)(s+2)(s+5)+K(sta) 2 aK”
where we have used the fact that
ay
s(s+1)(s +2)(s +5)
1
BO) = Taga = THEE TSF KETO Aol
Given the steady-state specification, e,, < 0.24A, we find that tl
specification is satisfied when
10A
aK < 0-244,
or
ak > 41.67. (6.
Any values of a and K that lie in the stable region in Figure 5
and satisfy Eq. (5.1) will lead to an acceptable design. Por examp!
K = 70 and.a = 0.6 will satisfy all the design requirements. T'
closed-loop transfer function (with a = 0.6 and K = 70) is
% problem with a-0.6 and K=70
% This script computes the ramp response
% for the two-track vehicle turning control
%
t=[0:0.01:10]; u=ty—{_¥ «unit ramp input
70s +42
—— SSS numge=[1 0.6]; denge=[1 1];
s+ 859 + 175? + 80s +42
ile numg=I70]; denge[1 7 10 0};
The associated closed-loop poles are [num,den}=cloop(numa,dena):
[numa,dena]=series(numgc,dengc,numg,deng);
2s = -10767, {y,x]=Isim(num,den,u,t); «tin
6 = 0.5781, plot(ty,tu), grid f
8 —0.1726 + 3.1995%, and xlabel(‘time [sec]'), ylabel('c(t)')
5 = ~0.1726 — 3.1995i, j
The corresponding unit ramp input response is shown in Figure 5.
The steady-state error is less than 0.25, as desired. jicle Turning Control.
re 5.9 Ramp Response for a = 0.6 and K = 70 for ‘Two-TrackChapter 5. Control System Stability’
Notes
Chapter 6
oot Locus Method
.1 Introduction
1c relative stability of a control system is related to the location
the roots of the closed-loop characteristic equation. ‘The tran-
nit response (ie., settling time, overshoot, etc.) of a linear control
tem is also related to the location of the poles and zeros of the
ed-loop transfer function. The closed-loop system relative sta-
lity and performance can sometimes be adjusted by changing a
ameter, such as a control gain. The root locus method provides
raphical representation of the locus of roots of the characteristic
ation as one parameter is varied. The graphical representation
called the root locus plot.
‘An approximate root locus sketch can be obtained by applying
orderly procedure outlined in MCS, pp. 241-253. Alternatively,
can use MATLAB to obtain an accurate root locus plot. How-
r, do not be tempted to rely solely on MATLAB for obtaining
ot locus plots while neglecting the manual steps in developing an
proximate root locus. The fundamental concepts behind the root,
sus method are buried in the manual steps and it is essential to
lly understand their application.
‘The chapter begins with a discussion on obtaining a root locus
Jot with MATLAB. This is followed by a discussion of the connec-
ns between the partial fraction expansion, dominant poles, and
81a2 Chapter 6. Root Locus Method 6.2. Obtaining a Root Locuy Plot 83
the dlosed-loop system response. Root sensitivity is covered in the
final section.
expansions of rational functions,
6.2 Obtaining a Root Locus Plot
Figure 6.2 The rlocus Function.
Consider the closed-loop control system in Figure 6.1. ‘The closed.
loop transfer function is
the root locus plot associated with Eq. (6.1) are shown in Figure 6.3
along with the associated root locus plot. Invoking the rlocus fune-
tion without left-hand arguments results in an automatic generation
of the root locus plot. When invoked with left-hand arguments, the
Flocus function returns a matrix of root locations and the associated
sin vector.
The steps to obtain a root locus plot with MATLAB are as fol-
lows:
1. Obtain the characteristic equation in the form given in Ea. (6.2)
where & is the parameter of interest, and
2. use the rlocus function to generate the plots.
T(s) = (9) ____—K(s +1(s +3)
Ris) s(8+2)(3+3) + K(s+ 1)"
‘The characteristic equation can be written as
sti
14K ary =o
Teh
The form of the characteristic equation in Eq. (6.1) is necessary to
Referring to Figure 6.3, we can see that as K increases, two
branches of the root locus break away from the real axis. ‘This
means that for some values of K, the closed-loop system character
istic equation will have two complex roots. Suppose we want to find
the value of K corresponding to a pair of complex roots. We can use
the rlocfind function to do this, but only after a root locus has been
obtained with the rlocus function. Executing the rlocfind function
Will result in a cross-hair marker appearing on the root-locus plot.
You move the cross-hair marker to the location on the locus of in.
terest and hit the enter key. The value of the parameter K and the
selected point will then be displayed in the command display. The
use of the rlocfind function is illustrated in Figure 64.
Continuing our third-order root locus example, we find that when
K = 20.5775, the closed-loop transfer function has three poles and
, (6.2)
Where k is the parameter of interest to be varied from 0 Ska.
The rlocus function is shown in Figure 6.2. ‘The steps to obtaining
Als) —
Figure 6.1 Closed-Loop Control System with Unspecified Gain K.Oo) Chapter 6, Root Locus Method
Figure 6.3 The Root Locus for the Characteristic Eg. (6:1).
two zeros at
~2.0505 + 4.3297¢
poles:s = | —2.0505 — 4.32275 } , zeros:
—.8989
Considering the closed-loop pole locations only, we would expect
that the real pole at s = ~.8989 would be the dominant pole (see
MCS, p. 166). To verify this, we can study the closed-loop system
Fesponse to a step input, R(s) = 1/s. For a step input we have
Os) = 20.5775(s + 1)(s +3)
s(s + 2)(s +3) + 20.5775(s +1)”
Generally, the first step in computing e(t) is to expand Hq. (6.3) in
@ partial fraction expansion (see MCS, pp. 45-52). The residue
(6.3)
6.2, Obtaining a Root Locus Plot 85
»p=[1 1]; q=[1 5 6 0]; rlocus(p,q)
»rlocfind(p,q) —*——~[ aigeind foiows the Haebe
Select a point in the graphics window
selected_point =
-2.0509 + 4.3228:
ans =
20.5775 «—_{
a
tl
Waled (Rw selected pone]
Figure 6.4 Using the rlocfind Function.
function can be used to expand Eq, (6.3), as shown in Figure 6.5.
‘The residue function is described in Figure 6.6.
The partial fraction expansion of Eq. (6.3) is
=1.3786 + 1.70101
C8) = 55 2.0505 + 4.32081
Comparing the residues we see that the coefficient of the term cor-
responding to the pole at s = -.8989 is considerably smaller than
the coefficient of the terms corresponding to the complex-conjugate
poles at s = —2,0505 + 4.3227%. From this we expect that the in-
fluence of the pole at s = —.8989 on the output response c(t) is
0.24296,2. Obtaining a Root Locus Plot 87
hot dominant. The settling time is then predicted by considering
the complex-conjugate poles. The poles at s = -2.0505 + 4.32271
respond to a damping of ¢ = 0.4286 and a natural frequency of
= 4.7844. Thus, the settling time is predicted to be
K-25:
»lrp,k]=resi
re
1.3786 - 1.70101
0.2429
3.0000
sing the step function, as shown in Figure 6.7, we find that T, =
6 seconds. So our approximation of settling time T, © 1.95 is a
irly good good approximation. The percent overshoot is predicted
be
p=
P.O. = 100 exp-$*/V1-@ = 22.5%,
scan be seen in Figure 6.7, the actual overshoot is very nearly
1%. Clearly, the prediction of overshoot is too low.
In this example the role of the system zeros on the transient
sponse is illustrated. The proximity of the zero at s = —1 to the
le at s = —0.8989 reduces the impact of the pole on the transient,
-2,0505 + 4.3228:
-0.8989
ol
0 0s
a
‘Time (sec)
»K=20.5775;nume=K*[1 4 3]; den=[1 5 6+K K];
»step(num,den), grid
Figure 6.7 Step Response for the Closed-Loop System in Figure
6.1 with K = 20.5775."
Figure 6.6 The residue Function,88 Chapter 6. Root Locus Method
Figure 6.8 Converting a Partial Fraction Expansion Back to a Ra-
tional Function.
response. The main contributors to the transient response are the
complex-conjugate poles at s = —2.0505 + —4.3228i,
One final point regarding the residue function. You can convert,
the partial fraction expansion back to the polynomials num/den,
given the residues (r), the pole locations (p), and the direct terms
(X), with the command shown in Figure 6.8.
6.3 Sensitivity and the Root Locus
‘The roots of the characteristic equation play an important role in
defining the closed-loop system transient response. The effect off
parameter variations on the roots of the characteristic equation is a
useful measure of sensitivity. ‘The root sensitivity can be defined to
be
Ors
a 4
Rk i)
We can utilize Eq. (6.4) to investigate the sensitivity of the roots of
the characteristic equation to variations in the parameter k. If we
change k by a small finite amount Ak, and evaluate the modified
root rj + Ary, it follows from Eq. (6.4) that
ane (65)
i
The quantity Sf is a complex number, Referring back to the third-
order example in the previous section, if we change Ka factor of 5%,
6.4. Sensitivity and the Root Locus 89
we find that the dominant complex-conjugate pole at s = —2.0505+
1.3298i changes by
Ar;
= —0.0025 — 0.168%
when K changes from K = 20.5775 to K = 21.6064. From Eq. (6.5),
it follows that
Sha 0.0494 — 2.3355%.
‘Vhe sensitivity Sf‘ can also be written in the form
Sp! = 2.3360 £268.7872°.
‘The magnitude and direction of Si! provides a measure of the root
sensitivity. The script used to perform the above sensitivity calcu-
lations is shown in Figure 6.9. d
The root sensitivity measure may be useful for comparing the
sensitivity for various system parameters at different root locations.
However, the root sensitivity measure may not be that useful when
tilized in the design process. It is primarily an analysis measure.
pfsensitivity.m
‘% Compute the system sensitivity to a parameter
% variation
%
K=20.5775; den=[1 5 6+K K]; r1=roots(den);
%
dk=1.0289; ~t
%
Km=K+dk; denm=[1 5 6+Km Km]; r2=roots(denm);
dr=r1-r2;
%
‘S=dr/(dk/K); <«———_ sehaitivity forma
7]
Figure 6.9 Sensitivity Calculations for the Root Locus for a 5%
Change in K = 20.5775.Chapter 7
equency Response Methods
-1 Introduction
the frequency response of a system is the steady-state output re-
jonse due to a sinusoidal input signal. In the previous chapters
have discussed the system response to various other test signals
cluding steps, ramps, parabolas, and impulses. In this chapter, we
ill investigate the response of systems to sinusoidal inputs.
‘The frequency response methods are based on considering the
;ponse of linear systems to sinusoidal input test signals as the fre-
juency of the sinusoidal test signal varies. A linear, time-invariant
system has the characteristic that, in the steady-state, the output
response due to a sinusoidal input differs from the input only in
magnitude and phase. The transfer function describing the sim
soidal behavior of the system is obtained by replacing s with jw in
the system transfer function G(s). Then, for a fixed w, G(jw) is a
complex number with a magnitude and phase. The magnitude and
phase of G(jw) can be represented graphically as w varies. This
type of graphical representation is known as a Bode diagram. It is
possible to develop control system performance specifications in the
frequency domain so that an effective control system design method-
ology using the Bode diagram can be used.
The chapter begins with an introduction to the Bode diagram.
Subsequently, the connection between the frequency response and
performance specifications in the time-domain is discussed. ‘The
o192 Chapter 7. Frequency Response Methods
chapter concludes with an illustrative i
2 0 ve example to gain experi
dlesigning a control system in the frequency domain
dion it functions covered are bode and logspace. The bode func-
ion is used to generate a Bode diagram, and the logspace function
generates a logarithmically spaced vect: i
generates lgacitl spaced vector of frequencies utilized by
7.2 Bode Diagram
Suppose we have the transfer function (see MCS, p. $21 )
= 5(1 + 0.18)
30+ 05s) + S$ hat (ray
ie oe diagram corresponding to Eq. (7.1) is shown in Figure 7.1.
iagram consists of the logarithmic gain in dB versus w in one
plot and the phase (1) versus w in a second plot, ‘The manual
steps for sketching an approximate Bode diagram are given in MCS,
pp. 308-317. As with the root locus plots, it be temptin; to
rely exclusively on MATLAB to obtain your Bode diagrams. ‘Treat
MATLAB as one tool in your tool kit that you can use to design and
s
ocr
of
8
3
© -t00}..
150 L
107 ior Tor 10r 0s
ior
Frequency (rad/sec)
10
Figure 7.1 The Bode Plot Associated with Eq. (7.1).
7.2. Bode Diagram 93
analyze control systen to develop the capability to
anually obtain approximate Bode diagrams. There is no substitute
for a clear understanding of the underlying theory.
‘A Bode diagram is obtained with the bode function shown in
Figure 7.2. ‘The Bode diagram is automatically generated if the
hode function is invoked without left-hand arguments. Otherwise,
the magnitude and phase characteristics are placed in the workspace
Unrough the variables mag and phase. A Bode diagram is obtained
with the plot function using mag, phase, and w. ‘The vector w
contains the values of the frequency in radians/sec at which the
Bode diagram will be calculated. If w is not specified, MATLAB will
mitomatically choose the frequency values by placing more points in
rogions where the frequency response is changing quickly. Since the
Bode diagram is a log scale, if you choose to specify the frequencies
explicitly, itis desirable to generate the vector w using the logspace
function. ‘The logspace function is shown in Figure 7.3.
‘The Bode diagram in Figure 7.1 is generated with the commands
shown in Figure 7.4. The bode function automatically selected the
Figure 7.2 The bode Function.* Chapter 7. Frequency Response Methods 7,3. Specifications in the Frequency Domain 95
bodescript.m
‘n points between 10" and 10?
% Bode plot script for Figure 7.21 in MCS, p. 324
| 96
f] num=5*[0.1 1];
fl={1 0}; f2=[0.5 1}; f8=[1/2500 .6/50 1];
denccorv(f conv({2,f3)); = E 3
Bode(num,den)
Figure 7.4 The Script for the Bode Diagram in Figure 7.1.
frequency range as w = 0.1 to 1000 rad/sec. This range is user-
nelectable with the logspace function.
.3 Specifications in the Frequency Domain
Bxeeping in mind our goal of designing control systems that sat-
certain performance specifications given in the time-domain, we
must establish a connection between the frequency response and the
transient time response of a system. The relationship between spec-
ifications given in the time domain to those given in the frequency
domain depend upon approximation of the system by a second-order
system with the poles being the system dominant roots, This ap-
proximation is discussed in MCS, pp. 241-255.
Consider the second-order system shown in Figure 7.5. The
s[mag,phase,w}=bode(num,den,w);
»semilogx(w,20"logt0(mag)), grid
»xlabel(Frequency [rad/sec}), ylabel(20*log(mag) [dBy')
ot 10° 10! 102 10°
Frequency [rad/sec]
Figure 7.3 The logspace Function.
Figure 7.5 Single-Loop Second-Order Feedback System.96 Chapter 7. Frequency Response Methods
closed-loop transfer function is
e cs
Fons FOR
Ts) (72)
‘The Bode diagram magnitude characteristics associated with the
closed-loop transfer function in Eq. (7.2) are shown in Figure 7.6.
The relationship between the resonant frequency, «s,, the meximuny
oF the frequency response, M,,, and the damping ratio, C. and the
yalural frequency, wis shown in Figure 7.17 (and in Figure 7.10 in
MCS, p-810). The information in Figure 7.7 will be quite helpful in
designing control systems in the frequency domain while satisfying
time-domain specifications,
We have seen that we can relate frequency-domain specifications
‘o time-domain specifications by using the information contained in
|__Performance specifications
|___een domain
damping ratio © Mp,
Tisetime > wp
overshoot <> Mp,
10
g 0,
? -10
ae
g 30
OG
Figure 7.6 Second-Order Closed-Loop System Characteristics.
in 7
1. Specifications in the Mequeney Domain 9
welogspace(-1,1,400); «—p——
num=wn2;
for i=1:110
zeta=zeta+0.005; >
den=[1 2*zeta*wn wnA2];
[mag,phase,w]=bode(num,den,w);
2(i)=zeta; [mp(i),!
end :
subplot(211),plot(z,mp),grid
xlabel(‘zeta'), ylabel(‘Mpw')
subplot(212),plot(z,wr),grid
xlabel('zeta’), ylabel('wr/wn")
: )[]emax(mag) stores the index
ofthe minima magn evr.
Figure 7.7 The Relationship Between (M;_,w,) and (¢,w,) for a
Second-Order System.98 Chapter 7. Frequency Response Methods
the closed-loop Bode diagram. Stability is an important issue that
can be addressed in the frequency domain by considering the open-
loop transfer function. This topic will be addressed in the next
chapter.
7.4 Example: Engraving Machine System
Consider the block diagram model in Figure 7.8. This example can
be found in MCS, pp. 932-335. Our objective is to design K so
that the closed-loop system has an acceptable time response to a
step command. A functional block diagram describing the frequency
domain design process is shown in Figure 7.9. First we choose K = 2
and subsequently iterate on K if the performance is unacceptable.
A script, shown in Figure 7.10, is used in the design. The value
of K is defined at, the command level. Then the script is executed
and the closed-loop Bode diagram is generated. The values of My,
and w, are determined by inspection from the Bode diagram. Those
values are used in conjunction with Figure 7.7 to determine the
corresponding values of ¢ and wa.
Given the damping ratio, ¢, and the natural frequency, w,, the-
settling time and percent overshoot are estimated using the formulas *
Gn
4
Tix 7) P.O. 100exp
If the time-domain specifications are not satisfied, then we adjust K
and iterate.
‘The values for ¢ and w, corresponding to K
_ = 0.88. This leads to a prediction of P.O.
are ¢ = 0.29 and
38% and T, = 16
Motor, screw,
and scribe holder
C(s)
Figure 7.8 Engraving Machine Block Diagram Model.
7.4, Example: Engraving Machine System 99
initial gain
K
20*logiOmag) [4B]
nbS85 05
a
If satisfied, then exit
and
continue analysis.
Determine mpo and Gy.
Establish relationship between
‘specs and time domain specs
Figure 7.9 Frequency Design Functional Block Diagram for the
Eneraving Machine.100 Chapter 7. Frequency Response Methods
engravescript 1m
num=[K]; den=[1 3 2 K];~<«!
welogspace(-1,1,400);
[mag,phase,w]=bode(num,den,w);
[mp,!]=max(mag);wr=w(|);
mp.wr
»K=2} engravescript!
15.6740
po=
38.5979
Figure 7.10 Frequency Design Script for the Engraving Machine.
74. Example: Engraving Machine System 101
sconds. The step response, shown in Figure 7.11, is a verification
Lhat the performance predictions are quite accurate and the closed-
loop system performs adequately.
In this example, the second-order system approximation is rea-
wonable and leads to an acceptable design. However, the second-
order approximation may not always lead directly to a good design.
Fortunately, with MATLAB we have the possibility to construct an
interactive design facility that can assist us in the design process
by reducing the manual computational loads while providing easy
access to a host of classical and modern control tools.
on)
Ke2; num=[K]; den=[1 32K];
t=[0:0.01:20];
u=1,02*ones(length(t),1);
=0.98*ones(length(t),1); :
1n1.38*ones(length(t),1);._ ———[ggge
y.xJ=step(num,den,t); C
plot(ty,tustlu,tl), grid
xlabel('Time [sec]'), ylabel(‘c(t)")
Figure 7.11 Engraving Machine Step Response for K = 2.8.1 Introduction
tability of a control system can be determined with frequency-
nse _methods.. The: basis. for the frequency-domain stability
alysis is the Nyquist: stability criterion. Issues of absolute sta-
ility as well as telative stability can be addressed in the frequency
domain. Graphical methods play an important role in the frequency-
domain design and analysis of control systems. We will utilize sev-
eral frequency-domain plots in our stability investigations, and, of
course, we will use MATLAB to aid in obtaining our plots.
‘The chapter begins with a discussion of the Nyquist stability
criterion and the Nyquist diagram and Nichols chart. We will also
revisit the Bode diagram in our discussions on relative stability. Two
examples are given which illustrate the frequency-domain design ap-
proach. We will make use of the frequency response of the closed-
loop transfer function, T(jw), as well as the loop transfer function
GH (ju). We present an illustrative example that shows how to deal
with a time delay in the system by utilizing a Padé approximation.
The functions covered in this chapter are nyquist, nichols,
margin, pade, and ngrid.
103104 Chapter & Stability in the Frequency Domain
8.2 Nyquist Plots
‘The Nyquist stability criterion is based on Cauchy's theorem, which
is concerned with mapping contours in the complex s-plane. Con-
sider the system in Figure 8.1. The closed-loop transfer function
° G(s)
‘
7) = Ty Gay
and the characteristic equation is
F(s) =1+GH(s) =0.
Allof the zeroes of F'(s) must lie in the left-hand s-plane for stability.
We choose a contour, I, in the s-plane which encloses the entire
right-hand s-plane, and plot I’r in the F(s)-plane and determine the
number of encirclements of the origin. Equivalently, we can plot Tp
in the P(s)-plane and determine the number of encirclements of the
=I point, where P(s) = F(s) —1. The Nyquist stability criterion
can be stated as follows:
A feedback control system is stable if and only if, for
the contours I'p, the number of counterclockwise encir-
elements of the (~1,0) point is equal to the number of
poles of P(s) with positive real parts (see MCS, p. 362).
The plot of Ip is the Nyquist plot. It is generally more difficult to
8.2. Nyquist Plots 105
generate the Nyquist plot manually than the Bode diagram. How-
ever, we can use MATLAB to generate the Nyquist plot rather easily.
‘The Nyquist plot is generated with the nyquist function, as
shown in Figure 8.2. When nyquist is used without left-hand argu-
ments, the Nyquist plot is automatically generated; otherwise, you
must use the plot function to generate the plot using the vectors re
and im.
One cautionary remark regarding Nyquist plots: Some time in
the course of using the nyquist function you may find that your
Nyquist plot looks strange or that some information appears to be
missing. It may be necessary in these cases to use the axis func-
tion to override the automatic scaling and use the nyquist function
with left-hand arguments in conjunction with the plot function. In
this way you can focus in on the —1 point region for your stability
analysis, as illustrated in Figure 8.3.
Figure 8.1 Single-Loop Feedback Control System.
Figure 8.2 The nyquist Function,106 Chapter 8. Stability in the Frequency Domain
»num=(0.5]; den=[1 2 10.5 };
»axis([-1.0,.1,-0.1,0.1]);
»[re,im]=nyquist(num,den);
»plot(reim),grid —*—f
Figure 8.3 The nyquist Function with Manual Scaling.
Up to this point we have been considering absolute stability only.
In other words, our concern has been whether a system is stable or,
not. However, relative stability measures of gain and phase margins.
can be determined from both the Nyquist plot and the Bode dia-
gram. The gain margin is a measure of how much the system gain
would have to be increased for the GH (jw) locus to pass through
the (—1,0) point, thus resulting in an unstable system. ‘The phase
margin is a measure of the additional phase lag required before the
system becomes unstable. Gain and phase margins can be deter-
mined from both the Nyquist plot and the Bode diagram.
Consider the system shown in Figure 8.4. Relative stability can |
Figure 84 A Closed-Loop Control System Example for Nyquist
and Bode with Relative Stability.
82. Nyquist Plots 107
100%] Fag. 108
num=(0.5}; den=[1 2 10.5]; —s
[mag,phase,w]=bode(num,den); ‘Frequency (rad/sec)
margin(mag,phase,w);
oT oo
[Pies aia
100 101
Fretcncy atic)
Figure 8.5 The margin Function.
be determined from the Bode diagram using the margin function.
‘The margin function is invoked in conjunction with the bode func-
tion to compute the gain and phase margins. The margin function
is shown in Figure 8.5. If the margin function is invoked without
left-hand arguments, the Bode diagram is automatically generated
with the gain and phase margins labeled on the diagram. This is
illustrated in Figure 8.6 for the system that is shown in Figure 8.4.
The script to generate the Nyquist plot for the system in Fig-
ure 8.4 is shown in Figure 8,7. In this case, the number of poles of
GH(s) with positive real parts is zero and the number of counter-
clockwise encirclements of —1 is zero; hence the closed-loop system
is stable. We can also determine the gain and phase margins, as
indicated in Figure 8.7.108 Chapter 8. Stability in the Frequency Domain 8.2. Nyquist Plots 109
8
1s
Gain Margin = 3.017 Phase Margin = 49.41
num=[0.5];
den=[1 2 10.5 ];
%
% Plot Nyquist and compute Gain and Phase
% Margins for GH(s) = 0.5/sA3+2sA2+5+0.05
%
num=[0.5}; den=[1 2 1 0.5 J; hase ma
% K
[mag,phase,w]=bode(num,dert);
[Gm,Pm,Wcg,Wcp ]=margin(mag,phase,w);
%
w-logspace(-1,1,200); ~«—f5
%
[mag,phase,w]=bode(num,den,w);
%
margin(mag,phase,w);
nyquist(num,den) |
title({'Gain Margin = ‘jnum2str(Gm)
' Phase Margin = ‘,num2str(Pm)]) < 0.215.
Referring to Figure 7.7 (or MOS, p.316) we find that My, < 2.45.4 Chapter 8. Stability in the Frequency Domain
% Liquid Control System Analysis
%
num=K*[0.0743 -0.4460 0.8920]; d1=[1 1]; d2=[30 1];
d3=[1/9 1/3 1]; d4=[ 0.0743 0.4460 0.8920];
den=conv(d1 ,conv(d2,conv(d3,d4)));
%
welogspace(-2,1,400); [ Compote gain ane
{mag,phase,w]=bode(num,den,w); opener
{Gm Pm Weg Mep]amargin(mag, phase.)
bode(num,den) <«——_____|
title(['Gain Margin = ‘num2str(Gm), ...
" Phase Margin = ';num2str(Pm)]) “*—{" ‘abet plot
Figure 8.12 Bode Diagram for the Liquid Level Control System.
44, Example 5
Gels) mf G(s)
ROS) + K(+2) |__aee
desired -D sel speed
speed
Figure 8.13 Battlefield Vehicle Speed Control System.
We must keep in mind that the information in Figure 7.7 is for
wecond-order systems only and can be used here only as a guideline.
We now compute the closed-loop Bode diagram and check the values
of Mp,. Any gain K for which Mp, < 2.45 may be a valid gain for
our design, but we will have to investigate further to include step
responses to check the actual overshoot. The script in Figure 8.14
aids us in this task. In keeping with the spirit of the design steps in
MCS, pp. 992-402, we investigate further the gains K = 20,10, and
4.44 (even though M,, > 2.45 for K = 20). We can plot the step
responses to quantify the overshoot, as shown in Figure 8.15.
Alternately, we could have used a Nichols chart to aid the design
process. This is shown in Figure 8.16.
‘The results of the analysis are summarized in Table 8.1 for K =
20,10, and 4.44. Suppose we choose K = 10 as our design gain.
‘Then we obtain the Nyquist plot and check relative stability. This
is shown in Figure 8.17. The gain margin is GM = 49.56 and the
phase margin is PM = 26.11°.
‘Table 8.1 Actual Response for Selected Gains.
K 4.44] 10 | 20
Percent overshoot | 5% | 30% | 50%
Settling time 35 | 5 | 6
Peak time 14 | 1.0 | 07
Ca 31% | 17% | 9%6 Chapter 8 Stability in the Frequency Domain 4, Examples ut
battlestep.m
t=[0:0.1:10]; K=20;
%
welogspace(0,1,200); K=20; “~
%
forie1:3, <+———_______
numge=K+[1 2]; dengo=[1 1];
numg=[1]; deng=[1 2 4];
[nums,dens]=series(numgc,denge,numg,deng);
[num,den]=cloop(nums,dens);
[mag,phase,w]=bode(num,den,w);
if i==1, magi =mag; phase1=phase; K=10; end
=2, mag2=mag; phase2=phase; K=4.44; end
=3, mag3=mag; phase3=phase; end
for i-1:3 <—_—_______|
numgo=K*[1 2]; dengo=(1 1];
numg=[1]; deng=[1 2 4];
[nums,dens]=series(numgc,dengc,numg,deng);
[num,den]=cloop(nums,dens);
Ly.x]=step(num,den,t);
if in=1, yl=y; K=10; end
, y3=y; end
%
end
loglog(w,mag1,'-',w,mag2,'-',w,mag3,'~"), grid
xlabel('frequency [rad/sec]'), ylabel(’mag')
plot(ty1,'-",ty2,"-',ty3,'-"),grid
xlabel(‘time [sec]'), ylabel(‘c(t)')
Figure 8.14 Remotely Controlled Battlefield Vehicle Closed-Loop
System Bode Diagram Script. Figure 8.15 Remotely Controlled Battlefield Vehicle Step Re-
sponse.us Chapter 8. Stability in the Frequency Domain
battlenichote.m
'% Remotely Controlled Battlefield Vehicle
%
numge=[1 2]; dengc=[1 1]; eS
numg=[1]; deng=[1 24]; “=
{mum,den]-series(numge,denge,numg,deng);
welogspace(-1,2,200);
axis({-210,0,-24,36]) ~*~}
%
K1=20; K2=10; K3=4.44; ——___|
[mag1,ph1 ,w]=nichols(K 1 *num,den,w);
[mag2,ph2,w}=nichols(k2*num,den,w);
[mag3,ph3,w}=nichols(k3*num,den,w);
plot(ph1 ,20*iog1 0(mag
ph3,20*log1 0(mag3),
Figure 8.16 Remotely Controlled Battlefield Vehicle Nichols Chart.
44, Examples
119
Gain Margin = 49.56 Phase Margin = 26.11
Imag. Axis
battlenyquist.n
% Remotely Controlled Battlefield Vehicle
% Nyquist plot for K=10
%
numge=10*[1 2]; dengo=[1 1];
numg=[1]; deng=[1 2 4];
[num,den]=series(numgc,dengc,numg,deng);
[mag,phase,w]-bode(num,den);
[Gm,Pm,Wcg,Wep]=margin(mag,phase,w);
%
nyquist(num,den);
title({'Gain Margin = ',pum2str(Gm), ...
"Phase Margin = ‘,num2str(Pm)])
Figure 8.17 Nyquist Chart for the Remotely Controlled Battlefield
Vehicle with K = 10.120
Chapter 8. Stability in the Frequency Domain
Notes
Chapter 9
State-Space Methods
9.1 Introduction
In the previous chapters we considered control system design and
analysis in the frequency domain. We utilized the Laplace trans-
form to transform the linear, constant coefficient differential equa-
tion model into an algebraic expression in terms of the complex
variable s. ‘Then we operated on our system in input-output (or
transfer function) form
bas +
SF ag +
this + bo
Fast
ols) = ape) = GU) RIs)
In this chapter we begin to look at control system design and
analysis in the time domain. In contrast to the frequency-domain
approach, the time-domain method utilizes a state-space tepresen-
tation of the system model, given by
Az + Bu
De+Hu
(9.1)
ce
The vector & is the state of the system, A is the constant n xn
system matrix, B is the constant n x m input matrix, D is the
constant p xn output matrix and HT is a constant p x m matrix.
‘The number of inputs, m, and the number of outputs, p, are taken
to be one since we are considering only single-input, single-output
problems. Therefore c and u are not bold variables.
121,122 Chapter 9, State-Space Methods
Figure 9.1 The State-Space Representation bode Function.
‘The main elements of the state-space representation in Eq. (9-1)
are the state vector 2 and the constant matrices (A,B, D,H).
Since the main computational unit in MATLAB is the matrix, the
state-space representation lends itself well to the MATLAB envi-
ronment. In fact, MATLAB covers so many aspects of state-space
methods that we will not be able to discuss them all here.
The new functions covered in this chapter are tf2ss and ss2tf.
Most of the functions covered in the previous chapters also apply
here, For example, the the bode function can be utilized with
a state-space model, as shown in Figure 9.1. ‘The same idea ap-
plies to series, parallel, feedback, cloop, printsys, minreal,
step, pzmap, impulse, Isim, rlocus, rlocfind, residue, bode,
nyquist, and nichols.
9.2 Model Relationships
Given a transfer function we can obtain an equivalent state-space
representation, and vice versa, MATLAB has two functions that
convert systems from transfer function to state space and back,
‘The function tf2ss converts a transfer-function representation to a
state-space representation; the function ss2tf converts a state-space
representation to a transfer function. These functions are shown in
Figure 9.2.
123
9.2, Model Relationship
c 7 mum@)
Cis) = Gis) Us) = “ary UO)
Figure 9.2 Linear System Model Conversion.
For instance, consider the third-order system
Ole) __2s? +8846 (02)
Ts) = Rie) = PRP + 1s FO
We can obtain a state-space representation using the tf2ss function
as shown in Figure 9.3. The state-space representation of Eq. (9.2)
is given by Eq. (9.1) where
8 -16 -6 1
A=| 1 0 0], B=|O],
0 1 0 0
pD=([28 6], H=(0)
Notice that the printeys function lists the system matrices as a, b,¢,d.
‘The conversion to our notation is as follows:
and
an A, bo B, cD, do.124 Chapter 9. State-Space Methods
% Convert G(s) = (2sA2+85+6)/(sA3+8542+165+6)
% to a state-space representation
%
num-=[2 8 6]; den=[1 8 16 6];
[A,B,D,H}=tf2ss(num,den);
printsys(A,B,D,H)
»convert
a=
xl x2 x3
xl -8.00000 -16.00000 -6.00000
x2 1.00000 0 0
x3 0 1.00000 0
b=
ul
x1 1.00000
x2 0
x3 0
c=
x1 x2 x3
yl 2.00000 8.00000 6.00000
d=
ul
yl O
Figure 9.3 Conversion of Eq. (9.2) to a State-Space Representa-
tion,
9.3, Stability of Systeme in the Time Domain 125,
9.3 Stability of Systems in the Time Domain
Suppose we have a system in state-space form as in Eq. (9.1). The
stability of the system can be evaluated with the characteristic egua-
tion associated with the system matrix A. The characteristic equa-
tion is
det(sI — A) =0. (93)
"Phe characteristic equation is a polynomial in s. If all of the roots
of the characteristic equation have negative real parts (j.e., Re(si) <
0,¥i), then the system is stable.
‘When the system model is given in the state-space form we must,
calculate the characteristic polynomial associated with the A ma-
trix. In this regard we have several options. We can calculate the
characteristic equation directly from Eq. (9.3) by manually comput-
ing the determinant of (sf — A). ‘Then we can compute the roots
using the roots function to check for stability, or alternatively, we
can utilize the Routh-Hurwitz method to detect any unstable roots.
Unfortunately, the manual computations can become lengthy, espe-
cially if the dimension of A is large. We would like to avoid this
manual computation if possible, As it turns out, MATLAB can
assist in this endeavor.
‘The poly function described in Chapter 2 can be used to com-
pute the characteristic equation associated with A. Recall that poly
is used to form a polynomial from a vector of roots. It can also be
used to compute the characteristic equation of A, as illustrated in
Figure 9.4, wherein input matrix, A, is
8 -16 -6
A=|1 0 0
o 1 0
and the associated characteristic polynomial is
+85? + 163 +6.
If A is an nx n matrix, poly(A) is the characteristic equation
represented by the n-+1 element row vector whose elements are the
coefficients of the characteristic equation.126 Chapter 9. State-Space Methods
[ CoetFicients of characteristic —]
polynomial in descending order
>A=[-8 -16 ~
>p=poly(A)
p-
1.0000 8.0000 16.0000 6.0000)
»roots(p)
ans =
~5.0861
-2.4280 coms
-0.4859
Figure 9.4 Computing the Characteristic Equation of A with the
poly Function.
™@ EXAMPLE 9.1 Automatic Test System
The state-space representation for the automatic test system (see
MCS, pp. 462-465) is
&=Az+ Bu (4)
o 10 0
o-1 1], B=|0
0.0 -5 K
Our design specifications are (i) step response with a settling time
less than two seconds, and (ii) overshoot less than 4%, We assume
that the state variables are available for feedback so that the control
where
9.3, Stability of Systems in the Time Domain 127
is given by
u= (-Ky,-Ka,—Ko) 2. (9.8)
We must select the gains K, K,,K and Ks to meet the performance
specifications. Using the design approximation
TR a <2 and P.O. x 100exp"/VI@ < 4,
On
we find that
(> 0.72 and w, > 28.
‘This defines a region in the complex plane in which our dominant
roots must lie to have any chance of meeting the design specifica-
tions. Substituting Eq, (9.5) into Eq, (9.4) yields
0 1 0
= 1 e=A‘e, (9.6)
-KK, -KK, -(6+KKs)
where A" is the revised A matrix. The characteristic equation asso-
ciated with Eq, (9.6) can be obtained by evaluating det(sI—A") = 0.
‘This results in
Kytka | K
motkK
If we view KK as a parameter and let K, = 1, then we can write
Eq, (9.7) as follows:
4(3-+1)(8-+5) + KKa(s? +
(9.7)
ot + Ragas +
3(5 +1)(s +5)
We place the zeros at s = —4 + 2 in order to pull the locus to
the left in the s-plane. Thus our desired numerator polynomial is
s? +8s-+20. Comparing corresponding coefficients leads to
Kot Ka _ ve
moo 8 and Tatil 20.
Therefore Kz 0.35 and K3 = 0.05. We can now plot a root
locus with KK, as the parameter, as shown in Figure 9.5. The
1+KKs128 Chapter 9. State-Space Methods
Imag. Axis
Valid region to meet
NV performance specs
=28 =0.72
qutolocus m
% Root locus script for the Automatic Test System
% including performance specs regions
num=[1 8 20}; den=[1 6 5 0];
cs: rlocus(num,den); hold on <<}
Figure 9.5 Root Locus for the Automatic Test System.
9.4, Time Respense 129
Figure 9.6 Step Response for the Automatic Test System.
characteristic equation, Eq, (9.7), is
SF +83+20
1+ KK +5) >
‘The selected gain, KKs = 12, lies in the performance region, as
shown in Figure 9.5. The rlocfind function is used to determine
the value of K Kg at the selected point. The final gains are
K = 240.00
Ky, = 1.00
Ky, = 0.35
Ks = 0.05
The controller design results in a settling time of about 1.8 seconds
and an overshoot of 3%, as shown in Figure 9.6.
9.4 Time Response
‘The time response of the system in Eq. (9.1) is given by the solution
to the vector differential equation
a(t) =exp(Adja(0)+ ['explA@-A]Burdr. (98)130 Chapter 9. State-Space Methods
The matrix exponential function in Eq, (9.8) is the state transition
matrix, (0), where
H(t) = exp(At).
We can use the function exxpm to compute the transition matrix for
a given delta time, as illustrated in Figure 9.7. The expm(A) func-
tion computes the matrix exponential whereas the exp(A) function
returns e*% for each of the elements aj; € A.
—t The time response of the system in Eq. (9.1) can be obtained
by using the Isim function. The Isim function can accept as input
nonzero initial conditions as well as an input function. ‘This is il
lustrated in Figure 9.8 for the RLC network (see MCS, Chapter 9)
described by the state-space representation
a-[} 3] 7 a-[§] , D=[1 0] ,and H=0.
The initial conditions are 2,(0) = 22(0) = 1 and the input u(t) = 0.
If we can compare the results obtained by the Isim function and by
multiplying the initial condition state vector by the state transition
matrix, we find exactly the identical results. At 1 = 0.2 the state
transition matrix is given in Figure 9.7. The state at t = 0.2 is
predicted by the state transition methods to be
a — | 0.9671 —0.2968 cay _ f 0.6703
2 Jeg | 01484 0.5219} \ za J, \ 0.6703 J *
The state at 0.2 is also predicted with the Isim function to be
(0.2) = 22(0.2) = 0.6703.
f>A=[0 -2; 1-3]; dt=0.2; Phixexpm(Arat)
Phi =
0.9671 -0.2968 «| sate transi
0.1484 0.5219 esse ‘i
Figure 9.7 Computing the State Transition Matrix for a Given
9.4. Time Response 131
1
os
o.|
xl
os 07 a8 054
A=[0-2;1 -3];
[zare i
Ly x]elsim(A,B,D,H,u,t,x0)
subplot(211), plot(t,x(:,1))
xlabel(‘time [sec]’), ylabel('x1')
subplot(212), plot(t,x(:,2))
xlabel(‘time [sec]'), ylabel('x2")
Figure 9.8 Computing the Time Response for Nonzero Initial Con-
ditions and Zero Input.132
Chapter 9. State-Space Methods
Notes
Chapter 10
Control System Design
10.1 Introduction
It is often possible to achieve stability and meet all the control sys-
tem performance specifications by adjusting one or two parameters.
We introduced many examples in the previous chapters illustrating
design by adjusting a few parameters. However, in many cases it is
necessary to add a dynamic compensator into the system. Altering
a control system to meet relative stability and performance spec-
ifications is called compensation. We say that our compensators
are dynamic in the sense that the compensator is itself a system
described by a transfer function or state-space representation with
internal states. A compensator is shown in the control system in
Figure 10.1. The compensator in Figure 10.1 is a cascade or series
‘Spacecraft
rotational motion
Compensator model
8
desired
Figure 10.1 A Compensated Control System for Spacecraft Rota-
tional Motion.
133134 Chapter 10. Control System Design
compensator since it is placed in the feedforward path. A come
Pensator placed in the feedback path is known as a feedback com,
pensator. Compensators can be placed in other paths (e.g., inner
feedback loops) in the control system as well.
‘The main topic of this chapter is compensation of feedback con-
trol systems. ‘There are many approaches to compensation. We
will consider lead and lag compensators and present a design exam,
ple that uses both the root locus method and the Bode frequency.
domain method to design the compensators. One of the most com,
monly used compensators is the proportional plus derivative plug
integral (PID). The PID compensator is covered in Chapter 11.
10.2 Lead Compensation
Consider the series compensator
G(s) = Aete, (10.1)
“The selection of the variables Kz, and p is based on satisfying the
design performance specifications. Whenever
lel < pl
the compensator in Eq. (10.1) is a lead compensator, The pole-zero
1. The maximum value of the
phase lead occurs at a frequency Wm, where
1
om = VB = ae
The maximum phase angle at Wm is dm, where
zl 1
sin bm = T°
Consider, for example, the lead compensator
10(s +1)
+10"
‘The associated Bode diagram is shown in Figure 10.3. The maxi-
mum value of the phase lead occurs at
on = VB= VO.
‘The maximum phase lead is
rm = arcsin
GAs) =
where a = 10. i: i
The phase-lead compensator is a differentiator type compen-
sator. This can be seen by considering the case when |p| >> |2|.
Then it follows that ue
Glo) #8 FF
We can design lead compensators with frequency-domain design
techniques utilizing Bode diagrams as well as with root locus design
methods. The lead compensator increases the phase margin, thus
providing additional stability, and increases the system bandwidth
to provide speedier dynamic response.136 Chapter 10. Control System Design
bode(num,den)
Figure 10.8 Bode Diagram of the Lead Compensator.
10.3 Lag Compensators
Again consider the series compensator
K(s+2)
G.(s) = £2)
te Se
Whenever
bi <|2l
the compensator G(s) is a lag compensator. The pole-zero diagram
of the lag compensator is shown in Figure 104. The lag compensator
can also be written as in Eq. (10.2) where a < 1. The maximum
value of the phase lag occurs at
un = Vp = V0.
10.3. Lag Compensators 137
Figure 10.4 Pole-Zero Diagram of the Lag Compensator.
Consider, for example, the lag compensator
(e410)
Gels) = FF
‘The associated Bode diagram is shown in Figure 10.5.
We see that the lag compensator is an integration type compen-
sator by considering |2| >> |p|. Then
G(s) ¥ K+ Ke,
‘This has the same form as the widely used lag compensator
Gs) = Ky + AE.
‘This is known as a proportional plus integral (PI) compensator.
‘The lag compensator is applicable when high steady-state ac-
curacy is required. Although it is possible to increase steady-state
accuracy by simply increasing the system gain, this often leads to
unacceptable transient response and sometimes instability. This
problem is overcome with the addition of a lag compensator and
properly chosen values of K,p, and 2. The lag compensator de-
creases the system bandwidth thus suppressing high frequency noise
and slows down the transient response.138 Chapter 10. Control System Design
Pe bas
Figure 10.5 Bode Diagram of the Lag Compensator.
10.4 Example: Rotor Winder Control System
‘The rotor winder control system is shown in Figure 10.6 (see MCS,
pp. 542-545). The design objective is to achieve high steady-state
accuracy to a ramp input. The steady-state error to a unit ramp
Figure 10.6 Rotor Winder Control System.
10.4, Example: Hotor Winder Control System 139
1/s?, is
input, R(s) ’
c= I
where a
fm C268
Kem ty
Of course, the performance specification of overshoot and settling
time must be considered as well as steady-state tracking error. In
all likelihood, a simple gain will not be satisfactory. So we
consider active compensation utilizing lead and lag compensators
using both Bode diagrams and root locus plots. Our approach is to
develop a series of scripts to aid in the compensator designs.
Consider first a simple gain controller, G.(s), where
Gs) = K.
‘Then,
Clearly, the larger we make K, the smaller the steady-state error
éxy. However, we must consider the effects of increasing K on the
transient response. This is shown in Figure 10.7. When K = 500,
our steady-state error for a ramp is 10% but the overshoot is 70% and
the settling time is around 8 seconds for a step input. We consider
this to be unacceptable performance and turn to compensation. The
two important compensator types that we consider are lead and lag
compensators.
First we try a lead compensator
K(s+2)
G(s any
(= Gea)
where |2| < |p|. ‘The lead compensator will give us the capability
to improve the transient response. We will use a frequency domain
approach to design the lead compensator.
‘Suppose we desire a steady-state error of less than 10% to a ramp
input. Then we desire
Ky = 10.140 y
Chapter 19. Control System Design
et)
rotorgain.m
K(50 100 200 500 }; «|
numg=[1]; deng=[1 15 50 0};
oie deng=[ Oo};
%
for i=1:4
[nums,dens]=series(K(i),1,nu
, | numg,der
[num,den}=cloop(nums,dens); _
[y,x]J=step(num,den,t);
Ys(z,i)=y;
end
%
Plot(t, Y¥s(:,1),"',t,Ys(:,2),""1,¥:
xlabel(‘time [sec]'), ylabel(‘c(t)')
~———_f
it, ¥s(:,4),'-")
Figure 10.7 Transient Response for Simple Gain Controller
10.4. Example: Rotor Winder Control System M4
In addition to the stcady-state specifications, suppose also that we
desire to meet certain performance specifications:
(i) settling time T, <3 seconds, and
(ii) percent overshoot for a step input < 10%,
Solving the approximate formulas
e aoe
10 and Te 7-
P.O. % 100 exp"/V1-?
for ¢ and w, yields
¢ 0.5912 and wp, = 2.2555.
The phase margin requirement becomes
Os
Com © Gop = 60 degrees.
‘The steps leading to the final design are as follows:
1. Obtain the uncompensated system Bode diagram with K =
500 and compute the phase margin.
2. Determine the amount of necessary phase lead.
3. Evaluate a where sing, = 224.
4, Compute 10loga and find the frequency wm on the uncom-
pensated Bode diagram where the magnitude curve is equal to
=10loga.
5. In the neighborhood around w,, on the uncompensated Bode,
draw a line through the 0-dB point at w,, with slope equal to
the current slope plus 20 dB/dec. Locate the intersection of
the line with the uncompensated Bode to determine the lead
compensation zero location. Then calculate the lead compen-
sator pole location as p = az.
6. Draw the compensated Bode and check the phase margin. Re-
peat any steps if necessary.M42 Chapter 10. Control System Design
7. Raise the gain to account for attenuation (1/a).
8. Verify the final design with simulation using step functions,
and repeat any steps if necessary.
We utilize three scripts in the design. The design scripts are shown
in Figures 10.8, 10.9, and 10.10. The first script is for the uncom-
pensated Bode, the next is for the compensated Bode, and the final
script is for the step response analysis. The final lead compensator
design is 100¢ 5)
(s +3.
Gels)= 25)
The settling time and overshoot specifications are satisfied, but
K, = 5, resulting in a 20% steady-state error to a ramp input. It is
possible to continue the design iteration and refine the compensator
somewhat, although it should be clear that the lead compensator
has added phase margin and improved the transient response as
anticipated.
‘To improve the steady-state errors we can consider the lag com-
pensator. The lag compensator has the form
K(s+2)
(stp)?
where |p| < |z|. We will use a root locus approach to design the
lag compensator, although it can be done using Bode as well. The
desired root location region of the dominant roots are specified by
G(s) =
$= 0.5912 and w, = 2.2555,
The steps in the design are as follows:
1. Obtain the root locus of the uncompensated system.
2. Locate suitable root locations on the uncompensated system
which lie in the region defined by ( = 0.5012 and w, = 2.2555.
3, Caleulate the loop gain at the desired root location and the
system error constant, Kusncomp
10.4, Example: Rotor Winder Control System 143
mag [dB]
frequency [rad/sec]
rotoriead.m
K=500; numg=[1]; deng=[1 15 50 0};
Inum,den]=series(K,1,numg,deng); resaaee phase
welogspace(-1,2,200); ieee
[mag,phase,w}=bode(num,den,w);
[Gm,Pm,Wcg,Wcp]=margin(mag,phase,w);
%
Phi=(60-Pm)*pi/180; <——f
%
alpha=(1+sin(Phi))/(1-sin(Phi)) | ——«——{
%
M--10*log1 O(alpha)*ones(length(w),1);
%
[mag,phase,w]=bode(num,den,w);
semilogx(w,20*log1 0(mag),W.M), grid :
xlabel( "frequency [rad/sec]'), ylabel(’mag [d8]")
Figure 10.8 Lead Compensator: Uncompensated Bode.144
oft)
rumg={1] deng=[1 15 50
numge=K*[1 3.5]; dengc=[1 25 ]}ne—| '8
[num,den]=series(numgc,denge,numg,deng);
welogspace(-1,2,200);
[mag,phase,w}-bode(num,den,w);
[Gm,Pm,Wcg,Wep ]=margin(mag,phase,w);
%
bode(num,den)
title({"Gain margin = ',num2str(Gm), ..
"Phase margin = ',num2str(Pm)])
Figure 10.9 Lead Compensator: Compensated Bode.
Chapter 10. Control System Design BM 10.4. Example: lotor Winder Coutrol System
K=1800;
%
numge[1]; deng=[1 15 50 0};
numge=K*[1 3.5]; dengc=[1 25];
%
[nums,dens]=series(numge,denge,numg,deng);
[num,den]=cloop(nums,dens);
%
t=[0:0.01:2];
step(num,den,t)
Figure 10.10 Lead Compensator: Step Response.
M5146
5 ur
Chapter 10. Control System Desig 10.4, Example: Rotor Winder Control System
4. Compute a = ee where K,,. 10.
5. With @ known, determine suitable locations of the comps
sator pole and zero so that the compensated root locus sti
passes through desired location.
6. Verify with simulation and repeat any steps if necessary.
The design methodology is shown in Figures 10.11, 10.12, and 10.13;
Using the rlocfind function, we can compute the gain K associat:
with the roots of our choice on the uncompensated root locus that
lie in the performance region. We then compute a to ensure that
we achieve the desired K,. We place the lag compensator pole an
zero in order not to impact the uncompensated root locus. In Fig}
ure 10.12, the lag compensator pole and zero are very neat the origi
at z= —0.1 and p = ~0.01.
The settling time and overshoot specifications are nearly satisfi
and K, = 10 as desired. It is possible to continue the design iterati
and refine the compensator somewhat, although it should be ch
that the lag compensator has improved the steady-state errors to’
Tamp input relative to the lead compensator design, The final k
compensator design is
Imag, Axis
rotorlag.m_
numg=[1]; deng=[1 15 50 0};
axis([-15,1,-10,10]);
clg; rlocus(numg,deng); hold on
100(s + 0.1)
Ode) = ET oa)”
‘The resulting performance is summarized in Table 10.1.
Table 10.1 Compensator Design Results.
%
zeta=0.5912; wn=2.2555;
%
xe[-10:0.1:-zeta*wn); y=-(sqrt(1-zetaA2)/zeta)*xs
-xc.A2);
Controller Gain, K | Lead | Lag xc=[-10:0.1:-zeta*wn];cesqrt(wnA2-xc.42);
%
Step overshoot 70% | 8% | 13% plot(xiys's Xs"? Xie,
Settling time (sec) 8 1] 4
Steady-state error for ramp | 10% | 20% | 10%.
K 10 5 | 10
Figure 10.11 Lag Compensator: Uncompensated Root Locus.148 Chapter 10. Control System Design
rotorlagl.m
rumg=[1}; deng-[1 15 50 0];
numge={1 0.1]; dengo=[1 0.01};
[num,den]=series(numge,denge,numg,deng);
axis([-15,1,-10,10]);
cg; rlocus(num,den); hold on
%
zeta=0.5912; wn=2.2555;
-zeta*wn]; y=-(sqrt(1-zeta42)/zeta)*x;
Figure 10.12 Lag Compensator: Compensated Root Locus.
10.4. Example: Rotor Winder Control System
149
rototlag2.m
K=100;
%
numge[1]; deng-[1 15 50 0};
numge=K*[1 0.1]; denge=[1 0.01};
%
[nums,dens]=series(numgc,dengc,numg,deng);
[num,den]=cloop(nums,dens);
%
step(num,den)
Figure 10.13 Lag Compensator: Step Response.150
Chapter 10. Control System Design
Notes
Chapter 11
Robust Control Systems
11.1 Introduction
Designing a highly accurate control system in the presence of plant
uncertainty is a classical design problem. In the previous chapters,
we have generally assumed that the plant parameters are well known
and designed our control system accordingly. In practice, the plant
parameters are never precisely known and may vary slowly over time.
It is desirable to design a control system that performs adequately
over a range of plant parameters. A control system is robust when
it maintains a satisfactory level of stability and performance over a
range of plant parameters and disturbances.
Tn this chapter, we begin to investigate robust control systems. In
particular we consider the commonly used proportional plus deriva-
Dis)
Figure 11.1 Feedback Control System with Reference and Distur-
bance Inputs and a Prefilter.
151152, Chapter 11. Robust Control $
shee
Live plus integral (PID) controller, Our feedback control system has
the form shown in Figure 11.1. Notice that the system has a pro:
filler G(s). The role of the prefilter in contributing to optimum
performance is discussed in MCS, pp. 594-596.
11.2 Robust PID Controlled Systems
‘The PID controller has the form
Ks? + Kys + Ky
GAs) :
Notice that the PID controller is not a rational function (i.e., the
degree of the numerator polynomial is greater than the degree of
the denominator polynomial). You will experience difficulty if yo
attempt to input the PID controller into MATLAB in the standa
numerator and denominator fashion. Generally speaking, the prol
Jem can be resolved by utilizing the conv function rather than th
series function in your manipulations.
The objective is to choose the parameters Ki,Kz, and Ky
meet the performance specifications and have desirable robustness
properties. Unfortunately, it is not. immediately clear how to choose
the parameters in the PID controller to obtain certain robustness
characteristics. We will show by an illustrative example that it i
possible to choose the parameters iteratively and verify the robust.
ness by simulation. Using MATLAB helps in this process since the
entire design and simulation can be mechanized utilizing scripts an
easily executed again and again. A complete exposition on the sub-
ject of robust control analysis and design is beyond the scope of thi
book.
@ EXAMPLE 11.1 Robust Control of Temperature
Consider the feedback control system in Figure 11.1, where
11.2, Robust PID Controlled Systems 153
and the nominal value of ¢o is
@=1
We will design a compensator based on co = 1 and check robustness
by simulation. Our design specifications are as follows:
(i) settling time T, < 0.5 seconds, and
(a) optimum ITAE performance for a step input (see MCS, pp.
176-185).
In our design, we will not utilize a prefilter to meet specicn
tion (ii) but will instead show that acceptable performance ({.e,, low
overshoot) can be obtained by increasing the system gain.
‘The closed-loop transfer function is
(Kas? + Kis + Ka : (ia)
T8)= SF G+ Kes Ot hst
‘The associated characteristic equation is
2 +as +
iets)
where
Kt = Ke +2,
14h
24K
Ky
2+ Ks
ling time requirement T, < 4 leads us to choose the roots
ey Me fo the left of the ¢ = Cur = 8 line in the s-plane,
as shown in Figure 11.2, to ensure ‘that the locus travels into the
required performance region. We have chosen a= 16 andb=10
ce cheure the locus travels past the s = —8 line. We select a point
tom the root locus in the performance region, and using the rlocfind
function, we find the associated gain K* and the associated value of154 Chapter 11, Robust Control Systers
»tlocfind(num,den)
Figure 11.2 Root
oe ot Locus for the PID Compensated Temperature
q- For the point we have chosen we find that
‘K* =118,
Then, with K*, a, and 6 we can solve for the PID coefficients as
11.2. Robust PID Controlled Systems 155
follows:
Ky = K*-2=116,
Ky = a(2 + Ks) —1 = 1187,
Kz = (2 + K3) = 8260.
To meet the overshoot performance requirements for a step input we
will utilize a cascade gain K that will be chosen by iterative methods
using the step function. This is illustrated in Figure 11.3. The step
response corresponding to K = 5 has an acceptable overshoot of
2%, With the addition of the gain K = 5, the final PID controller
is
Gls) = K Kgs? + Kut Ka _ 1163? + en (112)
We did not used the prefilter as is done in the design Example 11.5 in
MCS, pp. 594-595. Instead we increased the system gain to obtain
satisfactory transient response. Now we can consider the question
of robustness to changes in the plant parameter co.
Our investigation into the robustness of our design consists of a
step response analysis using the PID controller given in Eq. (11.2)
for a range of plant parameter variations of 9 € (0.1, 10]. The results
are displayed in Figure 11.4. The script is written to compute the
step response for a given co. It might be a good idea to place the
input of op at the command prompt level to make the script more
interactive.
The simulation results indicate that the PID design is robust
with respect to changes in cy. The differences in the step responses
fot co € [0.1,10] are barely discernible on the plot. If the results
showed otherwise, it would be possible to iterate on the design until
an acceptable performance was achieved.
‘There exist various control design methods that incorporate ro-
bustness directly into the design process, but their presentation
here is outside the scope of this text. The interactive capability of
MATLAB allows us to check our robustness by simulation, although
this is clearly not the most desirable approach to design.156 Chapter 11. Robust Control Systems
0 0.05 Or O15 02 025 03
‘Time (sec)
Gah Wa Ureorpansated
root locus.
K=5; <——_| Increase syatem gain to redice overshoot.
K3=Ks-2, K1=a*(2+K3)-1, K2=b*(2+K3) = ‘PID gang
numge=K+[K3 K1 K2]; denge=[1 0];
numg=[1]; dengf1 2 1];
1%
nums=conv(numge,numg); caamaretaiios
; ce
denseconv(denge,deng); «| PRPS tne
11.2, Robust PID Controlled Systems 157
3 |
&
E
4b 4 ~ ~
02} + he i. aaa
% 0.05 On 0.15 02 0.25 03
como J; deng=(1 2*cO cONZI
numge=5*[116 1187 8260]; denge=[1 0];
%
numa=conv(numg,numgc); dena=conv(deng,dengc);
%
[num,den}=cloop(numa,dena);
%
step(num,den)
[num,den]=cloop(nums,dens);
step(num,den)
Figure 11.3 Step Response for the PID Temperature Controller.
Figure 11.4 Robust PID Controller Analysis with Variations in co158
Chapter 11. Robust Control Systems
Notes
Index/Glossary
axis Controls the manual axis
sealing on plots; 105
bode Computes a Bode frequency
response plot; 92-93, 107, 110,
122
clear Removes variables and
functions from memory; 6, 9
clg Clears plots from the graph
window; 16
cloop Computes the closed-loop
system with unity feedback; 26,
37-40, 122
conv Multiplies two polynomi-
als via convolution; 26, 31-32,
152
‘end Terminates a for function;
ie
expm Computes the matrix ex-
ponential function; 130
feedback Computes the feed-
back interconnection of two sys-
tems; 26, 37-40, 49, 122
for Repeats a group of state-
ments a specific number of times;
1,75
159
format Controls the output for-
mat; 9
grid Draws grid lines on the
current plot; 17
help Invokes the help facility;
22
impulse Computes the unit im-
pulse response of a system; 61,
63, 122
loglog Generates an z-y plot
using log-log scales; 17-18, 20
logspace Generates a logarith-
mically spaced frequency vec-
tor for frequency response anal-
ysis; 92-95
Isim Computes the time response
of a system to an arbitrary in-
put and initial conditions; 61,
66, 68, 122, 130
margin Computes the gain mar-
gin, phase margin, and associ-
ated crossover frequencies from
frequency response data; 103,
107-110160
minreal Transfer function pole-
zero cancellation; 26, 44, 122
ngrid Draws grid lines on a
Nichols chart; 103, 110
nichols Computes a Nichols fre-
quency response plot; 103, 110,
122
nyquist Computes a Nyquist
frequency response plot; 103,
105-106, 122
pade Computes an n-th order
Padé approximation to a time
delay; 103, 112
parallel Computes a parallel
system connection; 26, 36-37,
122
plot Generates a linear z-y plot;
16-19, 45, 93, 105, 110
poly Returns the characteris-
tic equation when the input is
a matrix and returns a polyno-
mial when the input is a vec-
tor containing the roots of the
polynomial; 26, 31, 125-126
polyval Polynomial evaluation;
26, 32
printsys Prints state-space and
transfer function representations
of linear systems in a readable
form; 26, 34, 39, 40, 44, 46,
122-124
pzmap Plots the pole-zero map
of a linear system; 26, 32, 122
residue Computes the residues,
Index/Glossary
poles, and direct terms of a partials
fraction expansion; 82, 84-86,
88, 122
rlocus Computes the root lo-
cus of a linear system; 82-83,
122
rlocfind Finds the gain asso-
ciated with a given set of roots
on a root locus plot; 82-83, 122,
129, 146, 153
roots Computes the roots of a
polynomial; 26, 31, 72-73, 125
roots1 Same as the roots fune-
tion, but gives more accurate
answers when there are repeated
roots; 26, 31, 33
shg Shows the graph window;
16
series Computes a series sys-
tem connection; 26, 35-38, 40,
122, 152
semilogx Generates an z-y plot
using semilog scales with the 2-
axis logio and the y-axis linear;
17-18, 20
semilogy Generates an 2-y plot
using semilog scales with the
wraxis logio and the z-axis lin-
ear; 17-18, 20
ss2tf Converts a state-space sys-
tem representation to a trans-
fer function representation; 122-
123
step Computes the unit step
response of a system; 26, 45-
46, 63, 87, 122, 155
Index/Glossary
subplot Subdivides the graph
display into sub-windows; 17,
20
tfss Converts a transfer func-
tion system representation toa
state-space representation; 122-
123
title Puts a title on the cur-
rent plot; 17
who Lists the variables in the
workspace; 7, 9-10
whos Lists the variables in the
workspace including their size
and type; 7,9
xlabel Puts an z-axis label on
the current plot; 17
ylabel Puts @ yaxis label on
the current plot; 17
161