You are on page 1of 84
Modern Control Systems Analysis and Design Using MATLAB® Robert H. Bishop ‘The University of Texas at Austin w ADDISON-WESLEY PUBLISHING COMPANY Reading, Massachusetts » Menlo Park, California + New York Don Mills, Ontario + Wokingham, England » Amsterdam * Bonn Sydney + Singapore» Toko + Madrid» San Juan» Milan» Pais Preface Non bo Pouloaiar Richard 2 Gort derlagrent ‘of this text. [also ‘and P, Daniel Burkhart for their ide goes to my wife, Lynda, for asit- Tanuscript and for her continuous support and RAB, Austin, Tezos Contents Preface 1 MATLAB Basics 1 12 13 14 15 Introduction . .. Statements and Variables Matrices Graphics Scripts 2 Mathematical Modeling of Systeme 22 22 23 24 25 Inteoduction Spring-Mase-Damper System ‘Transfer Punctions . Block Diagram Models Design Example . 3. Control System Characteristics 31 32 33 Tntroduction ... - Speed Tachometer System English Channel Boring Machines 4. Control System Performance Ai 42 43, Introduction ‘Time-Domain Specifications Simplification of Linear Systems 5 Control System Stability 5a. Introduction 16 a a5 25 49 9 5 ot 6 61 na a 52 Routh-Hurwita Stability 5.3 Example: Tracked Vehicle Turning Control 6 Root Locus Method 6. Introduction 6.2 Obtaining a Root Locus Plot 6.3. Sensitivity and the Root Locus 7 Frequency Response Methods 7 Introduction 72. Bode Diagram 1.3. Specifications in the Prequency Domain 74 Example: Engraving Machine System 8 Stability in the Frequency Domain 8.1 Introduction 82 Nyquist Plots 83. Nichols Chats 84 Examples © State-Space Methods 9.1 Introdvetion 9.2 Model Relationships 93. Stability of Systems in the Time Domain 9.44 Time Response 10 Control System Design 10.1 Introduction 102 Lead Compensation 103 Lag Compensators 104 Example: Rotor Winder Control System 11 Robust Control Systems 11.1 Introduction 11.2 Robust PID Controlled Systems . Index/Glossary Contents 2 6 a 8 2 88 1 9 2 9% 98 103 108 104 10 ML 1m 1 212 125 129 133, 133 134 136 138 151 151 12 159 Chapter 1 MATLAB Basics 1.1 Introduction MATLAB i 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 Miles, which extend the functionality of the base program. Together the base program plus the Control System ‘Toolboz provide the capability to use MATLAB for control system design and analysis. Inthe remainder ofthis book, whenever we refer to MATLAB, you can interpret that as meaning the base program plus the Control System Toolioz. 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 same. ‘This book concentrates on this computer platform independent in- 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, 8. graphics, and 4. scripts 2 Chapter 1. MATLAB Basics [MATLAB interprets and acts on input inthe form of one oF more Gave objectas Out goal in this chapter isto introduce cach ofthe four objec in prepaation for our ultimate goal of sing MATLAB for contol system design and analysis. ‘The manner in which MATLAB interacts with your computer tem is computer platform dependent. Examples of computer de Pendent functions include installation, che fle stucture, generating hardeopis ofthe graphics, invoking and etng a session, and mem: ory allocation. Questions related to platform dependent issues ae tot addressed here. This is not to imply that they are not impor. tant, but rather that there are better soutees of information sch a3 your Users Guide and your local resident expert. This book is not Intended as vbsttute for your Users Guide Before proceeding, make gure that you can invoke a session and exit MATLAB . You need tobe able to get to the command window and see the command prompt * >> %. ‘To begin a session on & Macintosh you will probably double-click on the MATEAB program icon, On an IBM PC compatible you wll probably type matlab at the DOS prompt. ‘The remainder of this chapter is organized as follows. ‘There are {our sections coreaponding to the four objects listed above. In the frst section we present the basics of statements and varias. Fol lowing that isthe subject of matrices. The third setion presents an introduction o graphics, na the chapter conchides with a discustion ‘on the important topic of sripts and M-fle. 1.2. Statements and Variables ‘Statements have the form shown in Figure 1.1. MATLAB uses the actignment so that equals ("=") implies the assignment of the ex- pression to the variable, The command prompt ie two right arrows, “>>. A typical statement is shown in Figuee 1.2, wherein we are entering a 2 x 2 matrix to which we-attach the variable name ‘A. The statement ie executed after the carringe 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 Figure 1.1 MATLAB Statement Form. ‘The matrix A is automatically displayed after the statement 3s executed following the carriage return, Ifthe statement is followed lay a semicolon (j) the output matrix A is suppressed, as seen in Figure 18, ‘The assignment of the variable A has been catried 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 litte interest. You should use the semicolon whenever you have a need to reduce the amount of output, Output management has the added benefit cf increasing the execution speed of the esloslations, since displaying sereen eatput takes time "The usual mathematical operators can be used in expressions “The common operators are shown in Table 1.1. ‘The order of the avithmetic operations ean be altered by using parentheses, ‘The example in Figure I illstrates that MATLAB can be used in “calculator” mode, When the variable name and *=" are omit ted from an expression, the result is asgned to the generic variable ans, MATLAB has available most of the trigonometric and elemen tary math functions of a common scientific calculator. ‘The Users pAs(T 2546] o> Ae 12 12 Carriage return Figure 1.2 Example Statement: Matrix Inpot. 4 Chapter 1. MATLAB Basics a = »Ac[T 2:4 6) AA [Roseman aie Seon a6 Figure 1.8 Using Semicoloos to Suppress the Output. Guide has & complete lst of available trigonometric and elementary ‘ath functions; the more common ones are surnmarized in Table 1.2. ‘Vasiable names begin with a letter and ate followed by any num- ber of letters and numbers (including underscores). Keep the name length to 19 characters since MATLAB remembers only the frst 19 sharacters Iti a good practice to use variable names that describe the quantity they represent. For example, we might use the variable ‘name vel te 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 it illustrated in Figure 1.5. The variables Mf and m are recognized as different quantities. ‘Table 1.1 Mathematical Operators. + | Addition / Subtraction + | Multiplication 1 | Division Power 1.2, Statements and Variables 5 wIea7eD 1.7971 Figure 1.4 Calculator Mode. (ATLAB ins sevoralproeined vaiables, icading Gf) V(S)and,JTheee ecamples are shown in Figute 1.6. Nan stands rents t00 nd pveprsnts x, The variable t= /=1 sted to TLE Ganple numbers: The vate = VT can be used for ‘Table 1.2 Common Mathematical Functions, sin(X) | Sine of the elements of X fos(X) | Cosine of the elements of X asin(X) | Arcsine ofthe elements of X acot(X) | Arecosine of the elements of X tan(X) | Tangent of the elements of X staa(X) | Arctangent of the elements of X atan2(X,¥) | Four quadrant arctangent of the real elements of X and Y (BAX) | Absolute value of the elements of X Coq@X) | Square root of X imag(X) | Imaginary part of X real(X) | Real part of X Complex conjugate of X [Natural logarithm of the elements of X Logarithm base 10 of the elements of X Exponential ofthe elements of X Chapter 1. MATLAB Basics 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 ea also bbe purposely overwritten in order to free up the variable nance for ‘other use. For instance, one might want to se as an integer and serve J for complex arithmetic. Be safe and leave these predefined variables alone, as there are plenty of alternative names that can be twsed. Predefined variables can be reset to their default values by using clear name (eg, elear pi) . ‘The matrix A and the variable ans, in Figures 13 and 1, are stored in the workspace. Variables in the workspace are automat weeded") 3.0000 + 4.00004, int »0/0 Warning: Divide by zero NaN Figure 1.6 Three Predefined Variables i, Inf, and Nan 1.2. Statements and Varios 1 ao Your variables ar: A Mans om oz 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 @ list 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 ditional information regarding variable dimeasion, type, and mem: jory allocation. Figure .8 gives an example of the whos function. ‘The memory allocation information given by the whos function ‘an be interpreted as follows. Bach element of the 2 x 2 matrix A fawhos Name Size Total Complex. A 2by2 4 No Mo Tby2 2 No ans 1 by1 1 No m1 by3 3 No z Vbyt 2 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 Sear, who Your variables are: Mans om oz leaving 663780 bytes of memory free. Cees Figure 1.9 Removing the Matrix A from the Workspace >= er aig —— Ear ae format long: _ Ti aaa marae] 3.14159265358979 format short e; pi 3.1416¢+00-—{5 digit sealed Ronting pane format long e: pi ET ans= 3.1415926535897936100 Figure 1.10 Outout Format Content ti 1.2. Statements and Variables 9 requires 8 bytes of memory for a total of $2 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 inthe 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 elenr, by itself, removes all items (var: ables and functions) from the workspace; clear variables removes ‘ll variables from the workspace; clear namel nome 2... removes the variables namel, name, 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 $2 bytes. In some casts, clearing a variable may not change the value of the displayed fren 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 fee memory. The point i that your available fee memory may be more than displayed with the who oF whos functions Al computations in MATLAB are performed in double precision, However, the screen output ean be displayed in several formats. The default output format contains four digits past the decimal point for nonintegers) This can be changed by using the format function thown in Figure 1.10. Once a particular format has been speci- fied, it remains in effect until altered by a diferent format input. * WHO 777 Undefined function or variable Symbol in question ==> WHO > who 1277 Undefined function or variable [Symbol in question ==> Who Fieure 1.11 Function Names are Clase 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. ccsarily reflect the number of significant digits of the number. This is problem dependent, and only you ean know the true accuracy of the numbers that you input and that MATLAB displays. Sinco MATLAB is case sensitive, the functions who and WHO fre not the same functions. ‘The fanction who is a built-in fune- tion, s0 typing who lists the variables in the workspace. On the other hand, typing the upperease WHO results in the estor mes sage shown in Figure 1.1. Case sensitivity applies to all functions 1.3 Matrices MATLABis short for matriz laboratory. The Users Guide describes the program as 2 high-performance interactive soltwate package de signed to provide easy access to the LINPACK and EISPACK mma. trix software. Although we will aot dwell on the mattix 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 eoncepts astociated with manipula ing matrices and vectors, ‘The basic computational unit is the matrix. Vectors and sealacs can be viewed as special cases of matrices. A typical matrix expres sion is enclosed in square brackets, (J. The column elements are separated by blanks or commas and the rows are separated by semi colons or carriage returas. Suppose we want to input the matrix A, where 1 4 A=] log(-1) —sin(x/2) costa) arcsin(0.5) arceas(08) exp(0.8) One way to input A is shown in Figuze 1.12. ‘The input style in Figure 1.12 isnot snique Matrices can be input across multiple lines by using a carriage return following the semicolon or in place of the semicolon. ‘This is usefl for entering large matrices. Different combinations of spaces LB. Matrices ETAT ARE = — Ta eterna | fog(-1) sin(pi/2) conc) asin(0.5), ac0s(0.8) exp(0.8)] Ae 1.0000 04.0001 1.4142 0+3.14161 1.0000 0.5000 0.5236 0.6435 2.2255 »Aa(1 2:45] +132 eal mate Ae 12 4s Figure 1.12 Complex and Real Matrix Input with Automatic Di mension and Type Adjustment, sud comms canbe edt separ te cols a diferent om Binations of semicolons and eariage return canbe used to separate the owe, ilustrated in Figure 112 ‘No dimension statements o type statements are necessary when ‘sing tatices; memory is allocated automaticaly. Notie in the txampe in Figure 112 tat the sie ofthe matt is aomatally Aijusted when the input mati is reteined. Also notice thatthe Talc dements can contain tgenomeeic aod elementary math Finetngs, no wel as comes sumbers, “The important basic matrix operations are addition and sub- teaction, multiplication, tbsp, power and the so-called array operations, which ace clement operations. ‘The mathe Iaical operators given in Table 1 apply to mats. We wil not fiscuse mati divin, but be aware that MATEAD basa left- and ptomast dvaion capability "Patrc operations roqie that the matrix dmmnions be com- patil. For matrix addition and subtraction thi means thet the Matrices must have the same dimensions. If A ia an m x’ snateix ry Chapter I. MATLAB Basics sn Bis a picr mati then A&B icpeemitted only itn pand tm =r. Matric multiplication, gven by = B. a peemiied cop ifm = p. Mativvctormuipation isa pei ee eats multpikation. Suppore bis a vector of length n, Muliplenten ofthe vector by the matrx-Ay where Ag ann x setae allowed if m = p. Thus, y= A*b is the nx 1 vector. solution of A+. Examples of thee basic mass vector options nee oe in igure 118 The matrix transpose is formed with the apostrophe (’). We can use the matzix transpose and multiplication operation to create & vector incr product in the following manner. Suppose w aad ‘are m x 1 vectors. Then the inner product (also known ae the doe »As( 3:5 9] Bol4-7; 100}, ee ee ee i ato) 5-4 is 9 »b=[1;5}, aA 16 Figure 1.18 Three Basic Matrix Operat ion, and Transpose Addition, Multiplica- 1 Matic rn woul) ie given by wf «w. The inner product of two vectors wich 'he outer produc of bo vectors can smialy be computed wes v- The outer product of tre mix verona an mx m7 tral of rank 1, Example of inner and outer products ae given In igure 116 "he base matrix operations can be modifed for eiement-by slesient operations by preceding te opealor wit s period. The Ile matrix operations aren an sro opertions The con thovly usd roy operator are gven in Tuble 1. Matrix edition i subtraction are already lament by-lmert operations and do fot require the additional period prevoding the operator. However, tiray alipcatio,aivion, and power 0 requ the precling Ayan shown in Table 13. Suppose A aad B are 2x 2 marces given by an i bua bi on =] 8 [fe | Then, using the array multiplication operator, we have [aus cae] “| Age B anf Sipsin( p72) y=Lexp(-0-S)r13pPCH 2] 4 319388 axty! outer product 3.0327 -65.0000 49.3480 1.9055 -40.8407 31.0063 0.6065 -13.0000 9.2696 igure 1.14 Inner and Outer Products. ‘€ Mu Chapter 1. MATLAB Basics ‘Table 1.3 Mathematical Array Operators. Addition Subtraction Multiplication Division Power The depen of A+B ae the meats of Aso B.A numeseal ‘ven in Piguet. Bore proceeting tothe important topic of aaphica, we ned to Of abating wig con naaton The eg ison sha nF sows to gente oe a Containing the numbers fom piven saree ml value, x, with a specified increment, dx. * ‘te eal products of the corresponding ele- ‘example of two array operations is »A=[1 2:3] 8-(-6;7;10], oAsB ara] Figure 1.15 Array Operations 1k. Matcices Soring ae x= [xpi dxixg ] t in! vale f We can ens Buppowe one ob for 2 = 0,01, data. We c illustrated in x= [00. i aixyl 0.2000 19.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.3000 1.0000 Figure 1.1 3 eae =e 0.1000 010100 Figure 1.16 The Colon Notation, ly generate vectors using the colon notation, and fs we shall s20a see, this is quite useful for developing =-y plots jective is to generate a plot of y = zsin(z) versus 0.2,...41.0. Our fist step is to generate a table of can generate a vector containing the values of 2 at ‘the values of y(z) are desired using the colon notation. This Figure 1.17. Given the desired = vector, the vector sin, Hy fal vale aria 0.0397 ae af? 0.0887 0.1558 0.2397 0.3388, 0.4510 05739 0.7050 0.8415 17 Generating Vectors Using the Colan Notation, M ‘Table 1.3 Mathematical Array Operators. Addition Subtraction Mulcptication Division Power The elements of A. « mets of A'and BLA fiven in Figure 115. int ening othe imprest apc of gph, ened to odue the notion ofsabserping wing colon notation The eg otation, fore in Figure 1.16, allows us to generate a row vector containing the numbers from a given starting value, x, to a inal value, x, with a specified increment, dx. ns vale foal B av the products oft cts of the coresponding ee mere evapo wo anny opens Chapter 1. MATDAB Basics 1. Matrices 2 for 2 illustrated in PawLETAON Sort ms oo 6 0.1000 0.0100 4 0.2000. 0297 0.3000. Oger 000 Oa8s8 AN? 0.5000 0.2397 - “array power 0.6000 0.3388 mee Eman 07000. O.4si0 : 0.8000 0.5739 3 0.9000 0.7050 2 1.0000 0.8415 sing vate navn t t x= [xidx xp ] + wx=[020.1:1]4 yox.*sin(x); Figure 1.16 The Colon Notation, We can easily generate vectots using the colon notation, and 4 ve shall soon see, this is quite useful for developing z-y plots. Buppose our objective is to generate a plot of y = esin(z) versus 0,04, 1y data, We can generate a vector containing the values of 7 at [Which the values of y(2) are desited using the colon notation, ‘Tis 0.2,...,1.0. Our first step is to generate a table of Figure 1.17. Given the desired ¢ veetor, the vector ‘igure 1.15 Array Operations. Figure 1.17 Generating Vectors Using the Colon Notation 16 Chapter 1. MATLAB Basics (=) 8 computed using the multiplication array operation. Creating a plot of y = zsin(z) versus zis a simple step once the table of z-p data is generated 14 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 isan effective graphical capebilty. A complete solution to the control system design and anelyeis will eventually require a detailed look at a multitude of data types in ‘pany formats, The important plot formats include sootlocus pots, Bode plots, Nyquist plots, and time-response plots. The objectcel ‘this section is to acquaint the reader with the basic =-y plotting ca- ability of MATLAB. More advanced graphics topics ace edness a8 the need arises. MATLAB uces a graph dioplay to present plots, Some computer configurations allow both the sommand display end graph display ‘to be viewed simultancously. Oz computer configurations that ate, aly one to be viewed at atime, the command display will dsppeee 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 (eg, the plot function). Switching from the greph display back to the command display x accomplished by presing the Keyboard. The plot in the graph ces eared by Ig Function at the command prompt. ‘The@hg) Hc to sich to he gph dalay be eee ‘There are two basi group of graphics functons, The het oup of funtion, shown in able 1.4, specie the ype of Pek ‘Hee ie sf anilable pot types inluds 2 plo, eamlog an ee pots ne second roup of funtion, shown in Table 13, allows us esctome the plots by adding tite, ats label, and tox tthe pote sal ‘hang the scales and display multiple plots in sebwindovs The standard ey pot ig created using the plot function, ‘The + y data in Figute 1.17 are plotted using the plot function cs vhoe 1 Graphics 1 ‘Table 1.4 Available Plot Formats Plots the vector 2 versus the vector Plots the vector 2 vereus the vector ‘The z-axis is logo; the y axis is linear. Plots the vector z versus the vector ‘The axis is linear; the y axis is gio Plots the vector x versus the vector 41 Creates a plot with log scales on both axes. plot(xy) temilogx(sy) semilogy(xy) loslog(xy) St crayon ‘Table 1.5 Functions for Customized Plot. Pots toxt a the top ofthe pot Labels the saxi with tex Tabels the gaia wit ext text at (p.p2) in sereen coordinates ‘whee (00,00) the lower let and (1.01.0) isthe upper right of the screen, Subdivides the graphics window ras gr ines on the curent pot filet) label text’) ylabeltext) tent(php2ste Pi subplot arid 18 Chapter I. MATLAB Basics petoain roosts eotary) ite Bot of x sina) v8") labels) Figure LA8 A Basic ey Plot of xsin(z) versus 2 line types can also be altered. ‘The available lie 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 Mlustrated in Figure 1.19. ‘The other graphics functions loglog, semilogx, and semilogy ‘ce wrod in» similar fashion to plot. Te obtain an zy plot where the z-axis is linea scale and the y-axis is a logue seale, you would use the semilogy function in place of the plot function. ‘The cus 14, Graphics » Figure 1.19 A Basic x Plot with Multiple Bines ‘Table 1.6 Line Types for Customized Plots & sata | Dues ne Dre ne Pte 2» Chapter 1. MATLAB Basics LA Scripts a tomisng features listed in Table 1.5 ean alo be wt loglog, semilogx, and semilogy functions, Pe staed with he small 20h display canbe wbdivded nto sale ebwindows he fnetin subplotnep)sabdvies the poh dseeg maa 1x grid of ole bwindows, where me? sad eo Tan seas the graph dplaycan bea ivide ns nove feuds ‘The integer p specifies the window, where the windoms are nuntierel lel wright tp to Bottom. This eilacaed a Rees Te 1.5 Scripts Up to this point, all of our interaction with MATLAB has boen at the command prompt, We enter statements and functions at the oininand prompt, and MATLABinterprets our input and takes the sppropriate action, This is the preferable mode of operation when aver your sessions are short and nonrepetitive. However, the real power of MATLAB for control system design and analysis derives from its ability to execute along sequence of commands stored in a file. These files are called Mies since the filename has the form fle: name.m. A script one type of Mie. ‘The Control System Toolbos 4 acollection of Mefles designed specifically for control applications In addition to the pre-existing Mcflesdoivered with MATLAB and the toolboxes, we can develop serpts for our applications Scripts are ordinary ASCII text files and are created by using your own tert editor. Cresting and storing scripts are computer ‘platform dependent topies, which means that you need to seck out the appropriate expert at your location for mote information. ‘A scripts just a sequence of ordinary statements and functions hat you would seat the command prompt level. A serptis invoked, fA the command prompt level by simply typing in the filename (with 1 the m filetype). Scripts can also invoke other scripts. When the seript is invoked, MATLAB executes the statements and func: tions in the file without waiting for input at the command prompt. "The seript operates on variables in the workspace. Suppose we want to plot the function y(@) = sat, where li a variable that we want to vary, Using our favorite text editor, we verite a script, which we will call plotdatacm. 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 wil ase the most recent value of a in the workspace the graphics window is subdivided inte four subwinows, a [Bement agar] ‘After executing the script we can enter another value of ar at the —— OL ‘command prompt and execute the sript again Your seripts should be well documented with comments. A com: ment begins with a %. Ifyou put « header in your seript comprised of several descriptive comments regarding the function of the script, Figure 1.20 Using subplot Pine 120 Using subplot io Cente a 2x2 Partition of the Graph 2 Chapter 1, MATLAB Basics paipha=50;— — >plotdata plotstaim is I-@ SEM to plot the Function y=ain alpha % 6 The value of alpha must exist in the workspace prior 9% to invoking the script. % t=[0:0.01:1]; yesin(alphart); plot(tyy) xlabel("Time [sec}) ylabel(‘y(t) = sin( alpha * t )") anid gure 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 vser. This is illustrated in Figure 1.22 ‘We use plotdata.m to develop an interactive capability with 18 a variable, as shown in Figure 1.23. At the command prompt, ‘we input a value of @ = 10 followed by the scrip filename, which in this case is plotdata. ‘The graph of y(t) = sinat is automatically | ssisswrerroset te tctony-sconien, —_ | ‘The value of alpha must exist in the workspace prior | | mht Figure 1.22 Using the help Function. B 1 Seripts command prompt Y fipha=10; plotdata in apa) 70: jure 1.23 An Interactive Sestioa Using » Seript to Plot the Func- jon y(t) = sinat. - erased, We can now go back to the command prompt, enter a Periuc of a = 50, and run the scrip again to ottan the updated plot. “The graphics capability of MATLAB extends beyond the intro. acy material presented here. We will investigate the issue of apbies further on an as-needed ass 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 Jnl model of complex physical systems. The mathematical moddls, hich follow from the physical laws of the process, are generally ighly coupled nonlinear diferential equations. Fortunately, many physical systems behave linearly around an operating point within Home range of the variables and it is possible to develop linear ap- mations to the physical systems. A Taylor series expansion is erally utilized in the linearization process. The linear approxima- 1 to the physial system is described by a linear, constant coef ent ordinary differential equation. ‘The Laplace transform method ‘one way to compute the solution ofthe diferental equation. The place transform can also be uted to obtain aa input-output de- icription of the linear, time-invariant (LT1) system in the form of [transfer function. The application of the many “classical” and modem” control system design and analysis tools are based on LTT mathematical models. MATLAB can be used with-LTI systems fiven in the form of transfer function descriptions of state-space Sescriptions (ace 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 » MATLAB script, we will develop ‘an interactive analysis capability to analyze the effets of natural % % 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 Tn the subsequent sections, we will discuss transfor fonctions and block diagrams. In particular, we are interested in how MATLAB «can assist us in manipulating polynomials, computing poles and ze- +s of transfer fanctions, computing closed-loop transfer fonctions, block diagram reduction, and computing the response ofa system to ‘a unit step input. The chapter concludes with the electric traction mehot conteol design example found in MCS, pp. 79-81. ‘The functions covered in this chapter are roots, roctst, se- ries, parallel, feedback, cloop, poly, conv, polyval, printays, minreal, pzmiap, and step. 2.2 Spring-Mass-Damper System [Avspring-mass-damper mechanical system is shown in Figure 2. ‘The motion of the sas, denoted bs y(t is described by the dif: ceil equation MGle) + F0) + Kult) = ea) ‘his eystem is described in MCS, pp. 96-41. The saution, 90), of the differential equation describes the displacement ofthe mase at a function of time. The forcing fonction is epresentd by (0). The desvation ofthe sping-maer caper mathematical model is based on the uae of idea! springs and damper, ‘These ideal 08d or the tring and damper are based on lumped, linear, dynamic elements and only approximate the actual elements, The spring-mase damper todd), given in Ba, (21, i 2 tinea, time-invariant approximation to the physical proceat; it valid only in regions where the spring fore isa nea function of the mass dsplacemeat and the damping due to friction isa lnear function of the velocity The mathematical wave, given in Eq (21), might represent an offroad vehicle shock absorber. Our abjetive could be to design ‘a active contro yatem to make the rie smoother when traversing 22, Spring-Mass-Damper System Figure 2.1 Spring Mass-Dasper System. paved roads: ‘The contre design and subsequent analysis would Hhased on the vehicle shock absorber model in Eq. (2.1). Ofcourse, ‘eae test of the control design is the road test. Only then can ‘prove that the contol design docs infact moet the objective of ‘enother ride ona butopy ro, We will oon se how Wo use {ATLAB to eabence our control design and analysis capil ‘Many physical processes are described by mathematical modes lagous to Ba, (21). A typical electrical RUC cireuit is described on analogous mathematical model where the velocity, s(t), and of analogous e voltage, o({), are analogous Variables, This notion of analog ems important i syste modeling, Any experience gained "Qeuigsing and analyzing control systems for mechanical systems Stee by Eq, (2.1) ean be wed in coniroling analogous eletrial, thermal, and fluid systems. : “Phe unforced dynamie response, y(t); of the spring-mase-damper seechasicl system is et sin(wyy— t+ 8), 10) where = coe. "Th tl dnlceent i yO). Then wa ie hnderdampel when ¢ <1 anerdmed when 2) ut W-e 2 (> 1, and critically damped when ¢ = 1 and underdamped cases: Case 1: y(O)=0.15m, wy = VES, C= 58 (fhm, # Case2: y(0)=0.15m, oy =V28, G= ty (B=2g1) ‘The MATLAB commends to generate the plot of the unforced re sponse are shown in Figure2.2. In the MATLABeetup, the variables »y0-0.15; wnasqn2); = = szetal=3/(2*sqr(2); zeta2=1/2*sar(2); st=(0:0.1:10 (ersarY >unforcedcommands nfercodeonmanm % Comte Untorcod Response oan hil a sacostztat ones engi); ae pb t2nacoe(zete2)"ones( Lengthat), [vote et=(O/ser( zeta 2)ieselyoreqn(t-Aiaanahye yivelexp-etal wn") an(eneean zeta oye y2oe2renaaetad n't) ante aeadoayaeey burezrem(-zetaz*wntt) bhebuy 2 ela lot(y9.t92, 8 th), gid - Hiabel( Time {se¢]), ylabel(¢) Displacement [m}) {28(020085,(overarped sata = umes et), text(02,060, wnderdamped zeta2=" puma zeta {274002080 wnderdamped zeta2m'pumzeu(zta2, Chapter 2. Mathematical Modeling of Systems We can use MATLAB to visualize the unforced time response of the mass displacement following an inital displacement of y(0). Consider the ovenlamped Figure 2.2 Script to Analyze the Spring-Mass-Damper. 22. Spring-Mass-Damper System 29 W(O)stny iy and G2 ae input to the workspace at the command level. Then the script unforeedcommands.m is executed to gen- trate the desired plots. This creates an interactive analysis capa ilty t0 analyze the effects of natural frequency and damping om the unforced response of the mass displacement, You can invest te the effecs of the natural frequency and the damping on the Ime response by simply entering new values of wy, Gi, or Gat the ynmand prompt and running the script unforcedcommands. tin. The time-respouse plot is in Figure 2:3. Notice that the int automatically label the plot with the values of the damping sents, This avoids confusion when making many interactive lations. The natura frequency value could also be automati- 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, KC, and friction, f, you can also aralyze the ts 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 Time se] Figure 2.3 Spring Mast-Damper Unforeed Response, 30 Chapter 2. Mathematical Modeling of Systema subject o's vasiely of inputs and initial conditions itis not feasible toattempt to obtain the solution analyscaly. 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 xx input-output deseription of an LTT sys. tem, as described in MCS, pp. 52-69. Tt relates the Laplace (rans form of the output variable to the Laplace transform of the input jable with zero initial conditions. Consider the LTI system de- scribed by the transler fusction G(s}, where Aims + Gunns? + a8 +09 Gls) = Sat Fars thy (3) where m <1, and all common factors have boon canceled. The roots of the numerator polynomial of G(s) are called the zeros ofthe system; the roots of the denominator polynomial are called the poles. Setting the denominator polynomial to sero yields the characteristic equation Shyer bt as bby ‘The transient response of a system is directly related to the «plane locations of the poles and zeros. We can use MATLAB to analyze systems described by trans: fer functions. Since the transfer fanction ise ratio of polynomials, we begin by investigating how MATLAB handles polynomials, re: ‘membering that working with transfer Sexctions means that both & ‘aumerator polynomial and a denominator polynomial must be spe fed ‘Tn MATLAB polynomials are represented by row vectors contai- ing the polynomial coeficents in descending arder. For example, the polynomial Hs) = 2 +3544 is entered as shown in Piguce 24 ea) Notice that even though the 24 ‘Transfer Functions sett 304; — wer 00t510) sa -3.3553e+00 1.77650-01+ 1.0773¢+001 »p-poly(e) + p~ 1.0000 3.0000 10,0000 - 0.00001 4,0000 + 0.00001 igure 2.4 Fntering the Polynomial p(s) = #8 +36? +4 and Cal- lating Its Roots. et ofthe stem is ris nad in th int dition Fina ron vector corning th concent 0) deen to, then tot(p) sana vor ott he oto taba Conair clunn secon ents he te taylan poly) wn sowvesor wat the oy it cclcents nde ver, Wo ence the ots the apt), denn By (wit se rote eon fF Te rooted foneton snopes he ost of iyi but gives amore wc elt when the poral rect rot in Fgwe 2 we ala show bow to rxnre % pant with ie ply fncton Tlipicatn of polnovins complied with th conv ten Supone nent to expend he ply n() we (a) = (Bs? 428-4 1)(6 44). fe associated MATLAB commands using the cony function are hown in Figure 2, Thus, the expanded polynomial, given by n, is nis) 30 $Me? +98 44. 32 Chapter 2. Mathematical Modeling of Systems 23h Transfer Functions 38 M@ PXAMPLE 2.1 ‘Transfer Functions Consider the transfer functions 24 9 4 fase] eat a mo= ete atveepobpalins) I - ilizing a MATLAB script, we can compute the poles and zeros of (2), the characteristic equation of H(s), and divide G(s) by H1(s). ‘ean alo obtain a plot of the pole-zero map of Gia)/H(s) in the plex plane. ‘The pole-zero map of the transfer functionG(s)/H(s) is shown Figure 27, and the associated MATLAB commands are shown in re 28. The pole-2ero map shows clearly the five zero locations, tit appears that there are only two poles. Tis cannot be the since we know that the number of poles mast be greater than ‘equal to the number of zeros. Using the rootst function we can ain 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. 66 Figure 2.5 Using conv and polyval to Multiply and Eval Polynomials (3s? 4.25 + 1)(s-+4) ‘The function polyval is used to evaluate the value of « polynomial atthe given value ofthe variable, ‘The polynomial n(s) has the value (5) = ~06, as shown in Figure 2.5 In the next example we will obtain a plot of the polezeto lo cations in the complex plane. This will be accomplished using the zmap function, shown in Figure 2.6, On the pole-zero map, ze, fos are denoted by an Yo” and poles are denoted by an “x”. If the _Pamap function is invoked without left-hand arguments, the plot is automatically generated. pole locations column vector 2 zero leationg in olan vector “ye , [P.Z=pzmap(num, den) = s és Figure 2.6 The pamap Function, Figure 2.7 Pole-Zero Map for G(s)/H(s) 16 0 11; deng-[1 3.3 1]; »zeroots(numg) +0408 [ermine aE] 0- 0.40821 sew | >»p=roots1 (deng) =—_ | aie P < ama 1 ean 1 ] a ' patel 1h ndaf1 2]; di=[1 24}; d2=[1 -24; Bel 3} srumbaconvint,n2) dethaconviahicon(aeaayy »printsys(numh,denh) rnum/den = SA2 4384 2m I Phe = 5G) mg aah HS) so rah LHS) au S34 352445012 »snum=cons(numg.dent »printsys(num,den) rum/den = 6545 + 18544 +2553 4 75802 445412 sn=conv(deng,numh); ONS +6504 4 14 SAF + TAZ D8 »pzmap(num,den) 4 Pelez6re maps >title(Pole-Zero Map") eur Figure 2.8 Transfer Function Example for G(s) and H(s). 214. Block Diagram Models 35 24 Block Diagram Models Suppore we have developed mathematical models in the form of Itansfer functions forthe plant, represented by Gs), and the con ler, presented by H(3), and possibly many other system cox: oncots such as sensors and actuators. Our objective i to intr- nect these components to form a coatrolaystem. We will utilize [ATLAB functions to eary out the block diagram transformations ck diagra todels are described in MCS, pp. 64-69 “The process to be controlled is shown ia Figure 2.9. A simple ei-loop conte system can be obtained by interconnecting the fant and the controller in series as ustrated in Figure 2.10. We ‘se MATLAB to compute the tanser function from Is) to (9) ilastrated in Example 22. EXAMPLE 2.2 Series Connection the process, represented by the transfer function Gs), be 1 Se = as 3d let the controller, represented by the transfer function G,(s), be ott a can use the series function to cascade tno transfer functions (6) and Ga(3), a8 shown in Figure 2.1. The transfer function G.G(s) is computed using the series func yn as shown in Figure 2.12. The resulting transfer function, G.G(s), Process Ge) > Ye) Us) Figure 2.9 Open-Loop Systern. Chapter 2. Mathematical Modeling of Systems us [Process rT ce Figure 2.10 Open-Loop Control System, Contoier FU) "| as) > ¥i5) mum st OS) = Gen. ~ SOF 00 Block diagrams quite often have transfer functions in parallel. In such cases, the function parallel can be quite wseful. The parallel function is described in Figute 2.13 We can introduce a feedback signal into the contzol system by closing the loop with unity feedback, as shown in Figure 2.14, The signal B,(a) isan error signa; the signal As) is a reference input, In this control system, the controller isin the forward path and the closed-loop transfer function is Po) = G0) = EG.) sveTews ‘veTeM2 M8) hace) | os) ev) (oe Gunma TOE ca AM Dac ae a 4 ft {hum,den}=series(num dent ,num2,den2) enum yen) | Figure 2.11 The series Function, st 24. Block Diagram Model 1 |42foco 2 ‘) Rts) —m} 6e(9) 21 MP os) 2b» Vs) ‘onumg={11; deng=[500 0 Oj; anumbalt 1; denh=tt 2; »[num,den}=series(numg,deng,numh,denh); ~printsys(num,den) rum/den = +t b+ ey 500 843 + 1000 sA2 Figure 2.12 Applicaton of the series Function. re are tro functions we can utilize to aid in the block diagram re on process to compute closed-loop transfer functions fo single- ‘multiloop control systems. These functions are eloop and aback. ‘The eloop function calculates the closed-loop transfer function evsTeM7 G8) SYSTEM? Gxs) Glee aun Ga ye ue Nee eee t 3 [num,den}=parallel(num1,den1,num2,den2) Figure 2.18 The parallel Function. 5 Eas) Poomwate Jus) [Prone 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 delat ‘The feedback function is shown in Figure 216 with the associ ated system configuration, which includes Hs) i the feedback paths For both the eloop and feedback functions, i the input “sign” ie 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 i application of the feedback sanction EXAMPLE 2.3 The cloop Function As Let the process, Gs), and the controler, G(s), be asin Example 2.2 (Gee Fignze 2.12), To apply the eloop function we first use the series function to compute G.G(s), followed by the eloop function ‘o dane the loop. The command sngurasa ig shown in Figure 2.17 ‘The closed-loop transfer function, as shown in Figure 2.47, is 6.648) stl “= GAGS) ~ den ~ 300s 4 10008" +5 3 = mg EE] ‘1 pore esdback 1 ogatve eed ata jee HE mum G19) Mant. Mee atey eer v Peary [num,den]=cloop(num,dent,sign) ¥ Figure 2.15 The eloop Function, ‘Mock Dingrarn: Models 2.18. in thi 39 9-H “aan |}-—* 0) * ‘SYSTEM 2 His) ae om teed HT com can ma = 4 u \ ;suum i deni num2,den2,si Figure 2.18 The feedback Function. i¢ feedback control configuration is shown in Fig: ‘ase, the controller ix located in the foedback path. crvor signal, By(3), i alo utilized in this control system com nother b ration. The closed-loop transfer function is Gis) 7) = TECH) Tom - a Lee Decoy Sts Ploo- aah eve) numg=[1; deng=[500 0 Ol; numen(1 1}; dene=(1 21; > {nuit dent Jseries(rumg den ume, dn), > {nurn,den=cloop(numt dent »printsys(numm den) rum/@en = sel + 500343 + 100082 + 541 Figure 2.17 Application of the cloop Function 40 Chapter 2, Mathemnatical Modeling of Systems Rte) mo 8D ot Gis) fF] v8) #! | Figure 2.18 A Basic Control System with the Comtrolier in the Feedback Loop. ML EXAMPLE 2.4 The feedback Function Agnin, let the proces, G(s}, and the controller, (3), be asin Bx ample 22 (ie, H(s) = G,(3)). To compute the closed-joop transfer fanction with the controller in the feedback loop we use the feed= back function. The command sequence ie shown in Figure 1.9. ‘The losed-loop transfer function G(s) um st VGH) ~ den ~ SOFT TOO eT Tis) = ‘The MATLAB functions series, loop, and feedback can be wed an fals) 10) So Seung dang (6000 of sumo dent 2 {num denl-teedoack(ruma.deng.nurnhdenh-1}) =ptinsysium, der) j 7 rumiden « see 500.53 + 1000 812+ 541 Figure 2.19 Application of the feedback Function. 24, Block Diagram Models a an eid in block diagram maniptlations for multi-loop block di igrams. This i ibustrated in Example 26. EXAMPLE 2.5 Multi-Loop Reduction ‘A multi-loop feedback system is shown in Figure 2.20, This example aime found in MCS, 79.67-68. Our objective is to compute the closed-loop transfer function n= Hey when and S41 ya) =2, Hale) = 1 His) = 25, thle) = 2 Halo) For this exarnple, a fiveep procedure is followed! 4 Step 1: Input the system transfer functions into MATLAB - «+ Step 2 Move If; behind Gy i+ — Figure 2.20 Multi-Loop Feedback Control System, 2 Chapter 2. Mathematical Modeling of Systems © Step 3: Eliminate the G5GeH; foop. «Step 4: Eliminate the loop containing Hs ‘© Step 5: Bliminate the remaining loop and calculate T(s) ‘The five steps are ilustrated in Figure 2.21, and the corresponding block diagram reduction is shown in Figure 2.22, ‘The result of ‘executing the MATLAB commands is gum P44 4609 46245042 “Bea ~ DEF WER + LOGE F BLTO 4 SDR + Tie TTD ‘We must be careful in calling thie the closed-loop transfer function. ‘Recall thatthe transfer function i define tothe input-output la tionship after pole-zezo cancellations. If we compute the poles and eos of T(s}, we fad that the numerator and denominator poly. ongals have (5-+1) as a common factor, ‘This must be canceled before we can claim we have the closed-loop transfer function, To ongt={V} dob=ft 10h, ang2e{1}; da=[1 1}; ong3et1 01]; da3=f1 4 41; ongt=[1 1]; dg4m{1 6}; wohta[1 1]; dh={1 2]; onh2=12); dh2=f1}; onh3={1}; dh3=[1]; evtwconv(oh2,dad}s dT =conv(dh2,ng): d2a]series(ng3,4g3,n94,dg4); 2 }=feedback(n sd3a]-series(ng2,d92,2,82), »(n3,d3]=feedback(n3a,d3a,n1.d1); ind. dA}aserestng gt 03,43); {rum.den}=clooplng.d4,-1); Figure 2.21 Multi-Loop Block Reduction. 34, ‘Wlock Diagram Models (@)stepz wg -ETS-EF 0 fF 19-2] -[ ate (estes aac | «0 fis) —w| aaa: aaa (Step : Figure 2.22 Block Disgram Reduction of Mult-Lanp System (See Example 2.5 in MCS, pp. 67-69) “ Chapter 2. Mathematical Modeling of Systems 45, Design Example 2.5 Design Example fo vommoitactrs __Posstle common factors Taye ae Ga) ‘Becitc traction motors are utilized oo trains and transit vehicles. {Th detailed block diagram model withthe transfer functions of the plier armature controlled motor, and sensor is sbown i igure 2.25. This s Example 2.9 in MCS, ny. 79-1. Our objective compute the closed-loop transfer function anil investigate the Jponse of to a commanded ws. The frst step, as shown in Fig- °2.06, i to compute the clofed-lop transfer function fu. She og characteristic equation is second-order with = 52 and eo 012 Since the damping is low we might expect the response ye highly oscllatory. We can investigate the response (0) to eles input, welt, by wilizing the step function. The step tion, chown ia Figore 2.21, calculates the unit step response of Tinear syste. ‘The step function is jem performance sy ik |{numdenjeminreal(mumg,deng) Figure 2.28 The minreal Eunction sete te sent ntti yf le tm The minveal anion shown in Figure 2, moves comes mage Aten amas Tee om ee in Figure 2.26, "The cheed-loop transfer function is given in Fi Sr ee oe es 1 very important fanefion since contssh featioas aze often given in terms of the States reapome. The state response, gives by z(t, ian oufPut the ctep function and will be discussed in detail in Chapter 9, fa Spare Methods. Incinds = i the Ie-band argument lst, but rot be concerned with ifr the ime being, {the only objective ia to plot the output, y(t, we ca use the sp funtion without left-hand argumenta and oblai the pis Jieally with acs labels. If we n00d y(t) for any reason other ras ploting, we must use the steP function with letband args function we find that the order of the des i ler of the denominator polynomial has ‘been reduced from six to five, implying one pole zero cancellation, J>denga[12 205 1066 2517 3128 2196 712); num den}=minrea(numg.deng); > pprnaynun en) ar ee oy the pt faction to lt yt) We die € a 0 1 pale-reros cancaled Sey Inum/den = | crea eenen toe | ~ a e ex | fia 0.08333 $4 + 0.25 543 + 0.25 sh2 + 0.25 s + 0.1667 ‘SAS + 16.08 $A4 + 72.75 93 + 137 842 + 123.7 8 + 59.33 Figure 2.25 Plectrie Traction Motor Block Diagram. Figure 2.24 Application of the minreal Function, 46 Chapter 2, Mathematical Modeling of Systems onuent=[10}; denta[1 1]; num2={1}; den2=[2 0-5] »num3=[540]; den’: 1} den=f1}, aire alrerle(oumt den. de) ge (ob ol feedback na, da sums don [ne.de}=series(num: | frum den)=cloop(ncde,-1); ree —— printsya(pum,den) rum/den = 3400 2542 42.5 8+ $402 Figure 2.26 Blectric Traction Motor Block Reduction row vector containing the times at which we wish the value of che ‘output variable y(t), The step response ofthe electric traction motor is shown in Fig- ure 2.28, As expected, the wheel velocity response, given by y(t), is “he ‘Wi = output fespone at ¢ 1 tno a wich nit 1it) = sate response a storage seme ae a Le Iy,xAl=step(num.den,t) Figure 2.27 The step Function, 5. Design Example aT ae Wit Time [6] ryotoresponse m ‘% This script computes the step ‘response of the Traction Motor 9% Wheel Velocity % rune[ 5400}; denaf2 2.5 54021; 10.005:31i iuxtl=step(umden.t); plt(ty).ard Habel Time (sec!) abel Wheo velocty’) Figure 2.28 Traction Motor Wheel Velocity Step Response, Chapter 2. Mathematical Modeling of Systems Notes Chapter 3 Control System Characteristics 3.1 Introduction We introduce feedback to 2. decrease the sensitivity ofthe ayster to plant variations, 2. enable adjustment of the system transient response, 3. reject disturbances, and 4, reduce steady-state tracking errors. ‘The advantages of feodback (listed above) come at the cost of in creasing the number of components and system complexity, reduc tion in the closed-loop aystem 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 ‘astrated with two examples. Our objective isto illustrate the use of MATLAB in the control system analysis, In the first example, we introduce feedback control to a speed lachometer system in an effort to reject disturbances. The tachome- ler speed control system example can be found in MCS, pp. 125-198. ‘The reduction in system sensitivity to plant variations, adjust. saont of the transient response, and reduction in stead) ace demonstrated in a second example. This is the English Channel boring machine example found in MCS, pp. 134-197 0 30 Chapter 3. Control System Characteristics 3.2. Speed ‘Tachometer System The open-loop block diagram description of the armature controled de-motor with a load torque disturbance, Ti(s), is shown in Fig: ure 3.L. The values for the various parameter, taken from Example 29 in MOS, yp. 79-81, ate given in Table $1. We have two ia puts to our system, Vj(x) and 7,(3). Relying on the principal of ‘superposition, which applies to our LITT system, we consider each ‘input separately. To investigate the effects of disturbances on she system, we let Vs(s) = 0 and consider only the disturbance 7.(s) Conversely, to investigate the response of the system 0 a reference input, we let Te(s) = 0 and consider only the input Vs(3) ‘The Aosed-loop speed tackemeter conteal system block diagram is shown in Figure 3.2. The values for Ky and Ky aze given ia Table 3. Tout system displays good disturbance rejection, then we expect the disturbance 1,(¢) to have a small effect on the output W(3). Consider the open-loop system shown in Figure 3.1 fret. We can ‘use MATLAB to compute the transfer function from Ty(s) to (3) and evaluate the ouipat response to « unit step disturbance (i-., Ts) = 1/s)- The tine response to a unit step disturbance is shown i Figure 3.3. The script opentach.m, shown in Figure 9.3, i8 used ‘ analyze the open-loop speed tachometer systet. The open-loop transfer function is o(s) _ num _ Tis) * den = Th) | Gs) EME) S yt ——} Figure 8.1 Open-Loop Speed Tachometer Control System where K, is the Back Blectromotive Force Constant os) 12. Speed Tuchoroler Syston 5 ‘fable $.1 Tachometer Control Systero Parameters lke la] s | Re] Ke | Ke 1 | 10 [2]osloa ae ce ou dase value of w(t) sro (remember that Vs) = Os fi erent fale wi wed eg te ope lop, The re-sale ey So veo gure 3s appresiatelyth ae of the peed when on iy cbtan a apport value ofthe ted nate error by looking ot the last vatue in the output vector Voy Which a er ft ocr of waking the lt in Fige 33. The Tiptorinatesendywate vale of 0.0032 rad foc weloo) © wel?) ot verifies that we have infact reached steady-state Fa ln we bg te cls op ase aay computing the coset lop transfer function irom TAs) to w(s), and then generating the time response of u(t) to aunt step disturbance input The output response andthe script elosedtach.m are own in Figure. The closed loop tasafesGunclion from the disturbance ae) \ fs) | 4a} fa} a) 9 oJ Figure 3.2 Closed-Loop Speed Tachometer Contsol System Chapter 8. Control System Characteristics " Oren Sep Rope speed Speed Tachometer Example |the wmnnny sa Goa ent x ad at i InP; 00.5; KO0.1; umt=(1]; dent =[4,; rum2={Ken*kb/Ra]; den2=t1}; (our den=feedback(num! den ,num2,den2); % ae ume-num; —*—| Sean an printsys(qum,den) % [rd de vegeta Se amt trae te | Lyort}-step(num,den); plot(t;yo) sep detubance title(‘Open-loop Disturbance Step Responsa’J ~~ MabelYime [se], label speed, rid | compute response to tee) = SRE EY Figure 8.3 Open-Loop Analysis of the Tachometer System 12. Spoed ‘Tachometer Syston co ot Lon ise Se Rep time [se] lovato 96 Speed Tachometer Example [numa,dena]~parallel(num2,den2,num3,den3) [numb denb}=series(numa,denarum4,den4); [num,den]=feedback(numt ,dent numb, denb); % ; | panos wor a Cari stan ance a fume" ——| as negatve ih the lock agra. printsys(num,den) 6 apie repens to yeaxt]=step(num.den); plot(iye) #9 seubane: title ‘Closetloop Oisturbance Step Response") sHabe((time [sec], ylabel'speed [rad/sec]), grid * ie yellongth(t)) = ‘Beads enor > het vale of aut jo, Figure 3.4 Closed-Loop Analysis of the Tachometer System. uM Chapter 3. Control System Characteristic input is fs) num aa Tis) ~ den ~ 354 515 As before, the steady-state error is just the final value of (), 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 oblaia an approximats Value of the steady-state error by looking at the last value in the output vector yo which we generated in the proces of making the plot in Figure 3.4. The approximate steady-state value of wie oo) & (0.02 0.0018 rad/see. We generally expect that w(00)/a(c0) < 0.02, The ratio of closed- loop to open lop siedy state rp state sped output deta wit slept ‘turbance input, in this example, is va 0x7, We hav achiev «rami inpiovmet in dturbanc eee on. Tt clear thatthe dition of the nope etek rece the ofl ofthe dsturbacs onthe ep ‘Tie deme strates the ditarbance rejection property of ceed lon Ten pier i of lod op faack 3.3 English Channel Boring Machines The Mock diagram description ofthe Fi ; sition of the Baglish Channel boring ma bine i sown in Figure 35. The tense facto othe et due tothe two inputs 1 SF Dey ‘The effect of tie control gain K on the transicat 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 Aecreasing K decreases the overshoot. Although itis not as obvious 00) = Rh) + D(a). A. Hnglish Channel Boring, Machines 55 Di) boring \ machine 6) 9) Be) 4 oe $—fe} = Figure 8.5 Boring Mechine Control System Block Diagram, ered ale from the plots in Figure 36, it is also true that decreasing K de- creases the setting 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 fac, we would prefer to use K = 50. However, there are other considerations that rust he taken into account before we can establish the final design. Before making the final cloice of KX it i important to consider the system response 1 unit step disturbance. This is chown in Fig ure 3:7. We sce that increasing K reduces the steady-state response of eft) to the step disturbance. The steady-state value of c(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 valve theorem as follows: en Ig Be sgriyee sR Wor nt xia cntidtn stance ion we wold pete toe Re We eft expend ey omen fd of ain contests dig: ntl prea arlene de tnt dtu ote, we cng of beter tof vn a ov hr ig) hea sro memett ioe | ~T) OF Oa eee ee tie se} 15,— Sep respomte fc K=50_,____ ee | sae) a ngebtm ‘9% Response to a Unit Step input R(S)=1/s for K=50, 100) % rumg=[1]; deng={1 12 0}; K1=100; K2= num} =Ki*numg; num2=K2*numg % [ lowe Waar nations [ouma,dena}=cloop(aumt eng); ia {numb,derio}=cloop{nisn? eng); Iytatstep(numa dena); [y2xtTesteptra dnb ‘subplat(211).plot(t,y1),tile('Step Response for K=100") xlabel(‘time (Sec]'),ylabel(‘c(t)") ‘subplot(212),plot(t,y2), title("Step Response for K=S0') xlabel(‘time [sec], yfabel('c(t)') Figure 3.6 The Response to a Step Injat with K=100 and 280. 4 English Channel Boring Machines 57 ‘Secutanes Resume fr X=100_ ons; % rnumgn{1J; dengel1 12 0]; K1=100; 2-50: . iene {ened tanta Rina) {[numa,dena]=feedbacKtnumg,deng,1,1); [rumb,denb]-feedback{numg.deng.K2.1 & Faayeoue | ${0:0.05:2.0}; Faiyoame Ty vatiestep(numa dena); (2 F=steptTuMb dnb, Suppo) plt(ty1) ttiecDisturbance Response for K=100) Habel(time (sel abel") Subplt( 212) pote) ; thle Disturbance Response for K-50) slabetime [sey ball? 88 Chapter 3 Control System Characteristics ‘Table 3.2 Response of the Boring Machine Control System for KX 50 and K decision on how to choose K rests with the designee. So you see that while MATLAB can certainly assist you inthe control system design, it cannot replace your decision-making capability and intuition. ‘The final step in the analysis i to look at the system sersitivity to changes inthe plant. The syatem sensitivity i given by (Eq. 3.62, MCS, p. 197) (9) Wet) + 8 We can compute the values of $s) for diferent values of s and generate plot ofthe system seaitivity. For low frequencis, we can approximate the aystem senaitvity by 128 sa) Increasing the gain KC reduces the system senitivty. The system sensitivity plots are shown in Figure 3.8 for KC = 50. The sensitivity approximation is alse shown in Figure 3.8, 1. gl Channel ving Machines wo Pay = 20212 S)- See task i syaomsesivigepssveios sistent 2 SOS 6 4 12) +k ‘% System Sensitivity Plot % 2x 12*5; d2=K; Ston2./d25 4 aa) Figure 3.8 System Sensitivity 1o Plant Variations 0 Chapter 3. Conteol System Characteristics — Notes Chapter 4 Control System Performance 4.1 Introduction Primary concerns in control system design are stability and perfor imsnce. Performance is an issue for stable systems and is the topic of this chapter. In order to design and analyze control systems, ‘we must frst establish adequate performance specifications. Per- {formance specifications can be presented in the time domain or the quency domain. "Tiyne-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 so Investigate time-domain performance specifiations given in terms of teansient response to a given input signal and the resulting stoady- sate tracking errors. The chapter concludes with a discussion of, simplification of linear systems. ‘The MATLAB functions introduen in this chapter are impulse and Isim. Thete functions are used to simulate linear systems 4.2 Time-Domain Specifications “Time 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, a standard fe! gat 6 #2 Chapter 4. Control System Performance Figure 4.1 Step Response of a Second-Order System, jgnal a used, The test signals are of the general form rte) and the corresponding Laplace transform is BO ost 2, and 3 we have the step, ramp, respectively. An impulse function is also used ‘The standard performance measures are ofthe step response and the impulee respon Nev response performance measures are. rise time (T,), peak time (73), and settlin Fin ine | (Tj), and sett Consider the second-order system shown in Figure 42. The and parabolic inputs, as 8 test signal. sually defined in terms we. The most common ercent overshoot (P.O), if time (73), a8 shown in 1.2, Time-Domain Spectiations 6 Res) ~9 — Figure 4.2 Single-Loop Second-Order Fenback System. + cis) closed-loop output is 00) aamaray We have already discused the use ofthe step funtion to com- pate the step reponse ofa sytem. Now we dren athe em Portant ta signal: the impulse. The impue respon isthe tine erative ofthe step response. We compte the imple response fits the impulse faction sbowa in Figure 43 We can obtain a plot similar to Figure (2) in MOS, 9, 198 vith the step fenton, shown in Figure 44 Using the impulse function, we can obtain plot similar to Figure 48 fs MCS, p. 168. The response ofa econd-order eaten for an impale function inpu ie shown in Figure 45. he srg we ot oy = 1, which ie ” J esrew 0 weal] Gis) oe ‘et ‘wa 6) ~ourput response alt “(d= sate respense mt i Se ee oe am To {y,ct]=impulse(num,den,) Figure 4.3 The impulse Function 6 a ster 4. Control System Performance t= 01,02, 04,07,10,20 eee te 12 Time-Domain Specifications ze = 01,025, 05,10 ot os} sion 0s} Se 3 Compe ston espns Tora secundaria * Duplicate Figure 4.5{a} in MCS, p. 162 ont te[0:0.1:12]; sume}; zetal=0.1; dent=[1 2*zetat 1}; 2eta2~0.2; den2=[1 2%zeta2 1}; 2eta3=0.4; den3e[1 2¢zeta3 1]; etad-0.7; dental zeta 1); zeta5=1.0; denSa[ 2¢zetas 1], pee 226-20; cent 2vetag 1), [Semsesaroaeak | ‘Setup denon) “+ potent foreach sien ate] i} See (1 xt}=step(oum.dent t); [y2,xt}estep( am, den2,) y3xt]-step(num.den3,t): vty t]osteptnumedend ty, {ySt}-ste(oum.dens.) ¥63xt]ostep(aum, dene.) Plotityl.ty2tyStvatystye) SEW GTSy Heol) st ce} «See title( zeta ~ 0.1, 0.2, 04, 0.7, 1.0, 2.09) _ Figure 4.4 Reanones of % Compute impulse response for a second-order system 96 Duplicate Figure 4.6 in MCS, p, 163 % %[00.1:10%; mum — etet-0.1;dentett Zzetat_1}; | Beige, eta20.25; dendo[t deta? 1], | Saemeee ee ‘anit rie renee zeta3=0.5; den3=[1 2*zeta3 1}; zeta4e1.0; den4=[1 2*zetad 1}; % Iy1.xt}=impulse(num,dent [y2ixt]=impulse(num,den2, [y3ixt]simpulse(num,den3,t); [y4ixct}simpulse(um,dend,t); % lot(ty1.ty2,ty3,ty4) | ner label! wn't'), ylabel(’9(t)/wn') title(zeta = 0.1, 0.25, 0.5,1.0°), grid =e] Figure 4.5 Response of a Second-Order System to an Impule. 66 Chapter 4, Control System Performance i) Soupan espomiel ae fe) = state response at to 3 ee fy Mztsim(aum,den,u.t) Figure 4.6 The Isim Functioa. ixquivalent to computing the step response versus uxt, This gives us mote general plot valid for any wy > 0. ‘in many eases, you may need to simulate the system response to an arbitrary but known input. In these cases, you eat: use the sim Sunetion. ‘Phe lim function i shaven in Figure 46. An example of the use of fsim is given in Evample 4.1 MI EXAMPLE 4.1 Mobile Robot Steering Contro\ ‘The block diagram for a steoting control system for » mckile robot is shown in Figure 4.7 (sce MCS, pp. 174-176. ticle raion = Rs) s “ “ Figure 4.7 Block Diagram of aStoeriog Contzol System for a Mobile Robot. or 1.2, Time-Domain Speciications % Compute the response af the Mobile Robot Control 96 System to a triangular wave rot _aeg] % rnumng={10 20}; deng=1,10 0" GEE {rumden}=cloop(numg, ten): ‘Pampa ana ta(0:0.1:8.2)'5 eeoee CE Vie (O0.1:2}v2=12-0.12- 2 HIREZO, welvty2v3i i [yaxl-lsim(num,den.ut)s Siabel'vime [sec], ylabeltheta {rad}. ont platity,tw) igure 48 Teantent Response of the Mobile Robot Stering Com trol System to a Ramp Input « Chaptee 4. Caatrl System Performance Sappave the steering contalles, (3), is a= 4% When the input is e samp, the steady-state extor is A une (ay) ‘where Ky = 1K. ‘The effect of the controller constant, Kz, on the steady-state error! is evident from Bq, (4.1). Whenever Ke ie larg, the steady-state ‘error is small, and vice vers. ‘We can simnate the closed-loop system response toa samp input, using the Isim function. ‘The controller gains XK and the system asin K can be represented symbolically in the script so that various values can be selected and simulated, The results are shoven in| Figuee 4.8 for Ky = K = 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 bbe impractical to implement @ high-order controller in a control sys tem, However, it may be possible to develop a lower-order approx. imate controller that closely matches the input-output response of the high-order controler. A procedure for approximating transfer functions is given in MCS, pp. 185-187 We can use MATLAB to compate the approximate model to the actual model, as illustrated in the following example. I PXAMPLE 42 A Simplified Modet Consider the third-order system Hs) 12, Simplification of Linewr Systems C vnweond-order appreinintion (eee MCS, pp. 187-188) is 160 LW) = Bye ssie FT ‘Aeompasison of their respective step responses is given in Figure 42. eprespone & 96 Compre sap response for sje Soa (ise K neteyaemti 611 0m) Greate es 6 umea(1,6]; dend=[1 2.584 V6 ‘t=[0:0.1:8]; TE Hees J=step(numt,dent,t); sya Year aeu: (Lee ata eset 916 yay plot(tyt.ty2), gd - label tie [sec], ylabet’step response’) Figure 4.0 Step Response Comparison for an Approximate Transit unetion Vereus the Actual Transfer Function. 70 Chapter 4. Control System Performance Notes Chapter 5 Control System Stability ’ 1 Introduction w stability of a closed-loop control system is a fundamental issue Jt controls. Generally speaking, an unstable closed-loop contro sys nu is of little practical value. For linear systems, a necessary and lcieat coneition for a feedback syster to be stable is that all the les of the system transfer function have negative real parts. In thet words, the poles must le in the left-haf plane for the aystern be stable, The Routh-Hurwitz stability method provides a struc red mechaninm for determining the number of unstable poles of ¢ closed-loop characteristic equation, This allows us to obtain a ws" of *no” answer to stability without explicitly calculating the es. ‘This chapter begins with a discussion of the Routh-Hurwite stax lity method, We will see how MATLAB cao assist us in the stabil ly analysis by providing an easy and accurate method for comput- Ing the poles of the characteristic equation. For the case where the haracterisic equation isa function of a single parameter, it will be posible to generate a plot displaying the movement of te poles as le parameter varies. The chapter concludes with an example, The function introduced inthis chapter is the function for, which In used to repeat a number of statements a specific numberof times, a 2 Chapter §. 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 cooficients, ‘we can use Routh-Hurwitz to determine the number of roots in t righthalf plane. For example, consider the characteristic equation, SP 42042 =O as) associated with the closed-loop control system shown in Figure 3. ‘The corresponding Routh-Hurwite 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; hencel the closed-loop system is tnstable, Using MATLAB we can verify the Routh-Hurwitz result by directly computing the roots of the characteristic equation, as shown in Figure 5.8, using the roots function. Recall that the roots function computes the roots of af polynomial Whenever the characteristic equation is a function of a single 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 Figuee 5.4 ‘The characteristic equation ie gs) = 8 +8 +4s+K =0. Using a Routh-Huewitz approach we find that we require 0 < K <8 for stability wee MCS, p. 215). We can use MATLAB to verify thie A6) -O— yas) Figure 5.1 Closed-Loop Control System with T(s} (SF +28 +28), Coy R(s) 2% Routh-Hurwite Stability 3 3 2 2 eatin slL2—“~o ae [RSH] igure 5.2 Routh-Hurwitz Arsay for the Closed-Loop Control Sys in with T(s) = C(a)/ Ra) = 1/(o + 9? + 29-4 24) walt graphically. As shown in Figure 5.5, we establish a vector of nlues for K at which we wish to compute the roots of the charsc- istic equation. ‘Then using the roots function we calculate and lot the roots ofthe chazacterstc equation, ax shown in Figure 5.5. can be seen that as K increases, the roots of the characteristic ation move toward the right-half plane asthe gas tends toward ‘= 8, and eventually into the right half plane when K > 8. This x graphical verification of the Routh-Hurwitz result obtained above. ‘the next chapter we will discover a compact method of obtaining plot of the root locations as a function of one parameter using root locus method. snamg-[ih dongalt 1225) >{num,den}- 0. for positive Ii follows that we can restit our search 190 < K 126 and @ > 0. Our approach will be to use MATLAB to find a parameterized « versus K region in which stability is assured. Thea ‘we can Gad set af aK) belouging ta the stable regjon such tha the steady-state erro specification is met. This procedure, show in Figure 58, involves selecting a range of values fr @ and A an computing the rots ofthe characteristic for specifi values of «and XK. For each value of I, we find the fist value of that rests in a Seast one rot ofthe eharacerntc equation in the tght-als plane ‘The proces is repeated until the entre selected range of@ and exhatsted. Then, the pot ofthe (a, ) pits defines the separation wotacatalerm 96 the stablity region for the two track vehicle 56 control problem eo ET % Ant a{0.1:0.01:3.0} K-(209:120] SuOMK: y=0%K; aa EE Tengen) enolngth(ay; [eee aaron a | eter the sable nd unrtable gions forisin forplim : atl. 8, 17, KGet0, Keates [eae ror tam and stele ar " Peeteion > oxen stad end end plot(xy), ri, Mabel('k’), siabel Figure 5.8 Stability Region for a and K for Two-Track Vehicle Figure 5.7 Turning Conteol fae « Two-Track Vehicle ‘Turning Control. i Chapter 5, Control System Stabilt ‘The cegion 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 rt) = At,t > U, thes the steady-state error got WE +2)(645)_ A HoT EFC) + ROTA) F where we have used the fact that 1 T¥G.Gley a(s +3)(04 26 +5) ls) = Ris) Given the steady-state specification, e,, < 0.244, we find that specification is satisfied when 0A, St 4181. 6. Any values of @ and K that lie in the stable region in Figure 5 and satisfy Eq, (5.1) wll lead to an acceptable design. Por exampl K = 10 and a = 046 will satiafy all the design requirements. closed-loop transfer function (with a = 0.6 and K 70s 442 FFESH Te +o T The associated closed-loop poles are + = ~10767, 2s = ~05781, 5 = 0.1726" 3.1995, and 5 = 0.1726 ~ 3.19985. ‘The corresponding unit ramp input response is shown in Figure 5.9 ‘The steady-state error is less than 0.25, as desired, a Example: Tratked Vehicle Turning Control 7 6 This script computes the ramp response 96 for the two-track vehicle turning control 1% problem with a=0.6 and K=70 % to[0:0.01:10}, utes —[ Wein AB RE] umnge=[1 0.6]; dengomlT Ti rnumg=[70]; deng={1 7 10 0]; (a s0eaae [numa ,dena}=series(numge,denge,namg,deng); inum,den]=cloop(numa dena); (yalckimoumyaenit + plot(ty,tu), a xlabel(‘time | a ik {sec]", ylabel'c(t)?) sare 5.9 Ramp Response for a= 0.6 and K = 70 for Two-Track ile Turning Control 80 Chapter 5, Control System Stability Notes Chapter 6 ot Locus Method 1 Introduction he relative stability of a control system i related to the location the roots of the closed-loop characteristic equation. ‘The tran- nt response (i, settling time, overshoot, ete.) ofa linear control nicm jg also related to the location of the poles and 2eros of the sed-loop transfer function. The closed-loop system relative sta- ty and performance can sometimes be adjusted by changing a rameter, such as a control gain. The root lacus method provides Jarapkical representation of the locus of roots of the characteristic tion a8 one parameter is varied. The graphical representation ealled the root locus plot. [An approximate root locus sketch can be obtained by applying ‘orderly procedure outlined in MCS, pp. 241-265. Alternatively, ‘an use MATLAB to obtain an accurate root locus plot. How do not be tempted to rely solely on MATLAB for obtaining 3 Joeas 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 itis essential to ly understand their application. The chapter begins With a discussion on obtaining & root locus lot with MATLAB. This is followed by a discussion of the connec: us between the partial fraction expansion, dominant poles, and 8 w Chapter 6, Root Locus Method f° Obtaining a Root Locus Plot 8 the closed-loop aysem response, Root sositvity i covered in the final section ‘The functions covered in this chapter are rlocus, rlocfind, and| residue. The functions rloevs and elaefind are use to obtain root Jocus plots, and the residue function i utilized for partial fraction expansions of ratioval functions. 6.2 Obtaining a Root Locus Plot Figure 6.2 The rlocus Function. the root locus plot associated with Bq, (6.1) are shown in Figure 6.3 ‘along with the associated root locus plot. Invoking the rlocus func- tion without left-hand arguments rerults in an automatic generation of the o0t locus plot. When invoked with left-hand arguments, the ‘matrix of root locations and the associated Consider the clored-loop control system in Figure 6.1, ‘The closed loop transfer function is —Kist io) MOF B49) Reza) ‘The characteristic equation can be written as sti EHGED ‘The stepe to obtain a root locus plot with MATLAB are as fa WE Ne+H en a 1 Obtain the characteristic equation inthe fotm given in Eq. (6.2) where Fis the parameter of interest, and 2. use the rlocus function to generate the plots. Referring to Figure 6.3, we can see that x K increases, two branches of the root locus break amay from the real axis. This ‘means that for some values of K, the elosed-logp system character istic equation will have two complex roots. Suppose we want to find the value of K corresponding to pair of complex roots. We can tse the rloefind function todo this, but only after a root locus has been obtained with the locus fvaction. Executing the rlocfind function 6.) ‘The form ofthe characteristic equation in Eq (61 ie necessary to seth locus fanctos for gewrting tot nas plots, The peed form ofthe charactrntie eustion necsary for aplication of the flocus function i 7 1H 0, 62) ere isthe parameter of interest tobe vied frm0 << eo The locos fuscia is shown in Figure 62. The tops ta ablaining Uerest and hit the enter key. The value of the parameter KC and the elected point will then be displayed in the command display. The use ofthe rloefind function is illustrated in Figure 6.4 ‘Continuing our thid-order root locus example, we find that when 0.5775, the closed-loop tranefar function has three poles and + Kee Aig) —FO-——»} @0s)= $2 | __s will result in a cross-hait marker appearing on the root locus plot . 31942) | You more the cros-bair matker to the location onthe locus of i { Figure 6.1 Closed-Loop Control System with Unspecified Gain K. Mt Chapter 6. Roos lacus Method \ \ __ 37] retnis | wprll Ts @[1 5 6 Of; rocus(o,q) } / »pall 1: a={1 5 6 0]; (rkl=rlocus(p,a) plot,’ Teac ai ) ctu Figure 6,8 The Root Locus for the Characteristic Ba. (6:1). ‘70 zeros at 2.0505 + 4.32274 potes:5= { -20505~ 432275 } , zeros +=(3) — 5089 \3 Considering the closed-loop pole locations only, we would expect thatthe real pole at s = ~.8989 would be the dominant pole ace MCS, p. 160), To verify this, we ean study the closed-loop system response to a step input, Ris) = i/e. Fora step input we have " MSTI(s+Yo+3) ©) = = Y= EF Ae+a e207 sO Generally, the fst step in computing o@) isto expand Eq, (6.8) ia 4 patil fraction expansion (see MCS, pp. 45-82. The residue 6.2. Obtaining « Root Locus Mot % opal Thal 56 Orocus(p@) | . »roefind(p.a) oid ftw tr Hem fin] ‘Select a point in the graphics window | selected_point = “2.0509 + 4.82281, 205775 Figure 8.4 Using the rlocfind Function, function can be used to expand Eq, (6.3), at shown in Figure 6.5 ‘The residue function ix deveribed in Figure 66 “ve pasta fraction expansion of Eq. (6.3) ie cf) = ZESTSE+ L010; , —13796— 70101, ~0:2400 (9) Ty zon0s +2087 5 20505 — 49228" 5+ 0.8980 Ss ‘Comparing the residues we se that the eveffcient ofthe term cor responding to the pole at 4 = ~.S080 is considerably smaller than the coofcient of the terms corresponding to the complex-conjugate poles at s = ~2.0505 44.27% From thi we expect that the ine fluence ofthe pole at « = 8989 on the output rexponse cit) i» A) 1.3786 + 1.70105 SO Net 13786-17010 “o.2aes 3.0000 Figg) =r. p= =p)’. 2.0505 - 4.3228) -2.0505 + 4.32281 8989 4 [npkleresiaue(num,den) 2 OSD POE edi 0G" pen “| Figure 6.6 The residue Function 2, Obtaining » Root Locus Plot sr riot dominant. The settling time is then predicted by considering be complex-conjugate poles. The poles at # = ~2.0505 + 4.32271 na to a damping of ¢ = 0.4286 and a natural frequency of = 4.7844, ‘Thus, the settling time is predicted to be Te = 1.95 seconds, te tng the step function, as shown in Figure 6.7, we find that 7, & 6 seconds. So our approximation of setling time T, & 1.95 is & 00d good approximation. The percent overshoot is predicted be, P.O. 100 exp-CVF = 29.5%, can be seen in Figure 6.2, the actual overshoot ie very neatly 1%. Cleary, the prediction of overshoot i too low. Tn this example the role of the system zeros on the traxsient sponse is illustrated. ‘The proximaity of the zero at s = —1 vo the leat s = ~0.8989 reduces the impact of the pole on the transient 9K=20.5775;nam=K°[1 4 3]; den=[1 5 64K KI; step(num,den), grid Figure 6.7 Step Response for the Clored-Loop System in Figure 6.1 with K = 20.5775." 8 Chapter 6 oot Locus Method Figure 6.8 Converting «Patial Faction Bxpeasion Back to ‘tional Function, * * Beckie aa sponse, The min contibstrs othe transient exponse ae the Compler conjugate pols a 920M Snes leit en searing te rend fon. You ca ove the pat action expaton bak tothe plgronia easy sven the residues (r), the pole locations (p), and the dircet terme| (sj with the comand shown gue 6 i 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 of parameter variations on the roots of the characteristic equation is {peti measure of sensitivity. The root sensitivity can be defined to any OR] We can utilize Bq, (6) to investigate the sensitivity ofthe roots of the characteristic equation to variations in the parameter k. Tf we change & by a small finite amount Ak, and evaluate the modified root ry A\ry it fellows from Eq. (6:4) that (6) ni St Soe (6.5) ‘The quantity Sj is « complex number. Referring back to the thind- ‘order example in the previous section, if we change Ka factor of 5S, WA. Sensitivity and the Keo Locus 89 we find that the dominant complex-conjugate pole at ¢ = ~2.0505-+ {228% changes by 1.6064. From Ea. (6.5), wien KC changes from K i follows that 0.0025 ~ 0.11688 2.38801 5 = TSR are: ROM — 2.5885 "he sensitivity Sf! can also be written in the form 3360, £268.7872°. The magnitude and direction of S— provides a measure ofthe root reustivity. The seipt used to perform the above sensitivity ealeu- lations ie shown in Figure 6.9. The root sensitivity measure may be useful for comparing the renstivity for various system parameters at different root Iecations. However, the root sensitivity measure may not be that useful when ulized in the design process. Iti primarily an analysis measure. vty m 6 Compute the system sensitviy to a parameter 6 variation % K=20.5775; dene[? 5 6+K K]; 1 % dke1.0289; + wanna % ots(den); Km=Kdk; denme[1 5 6+km km; =roots(denm);, drerl42; [BF] % Sede/(dk/K); ase Figure 6.9 Sensitivity Caleulations for the Root Locus for a 5% Change in K = 20.5775, —— Notes Chapter 7 equency Response Methods 1 Introduction 1 frequency response of a system is the steady-state output re sponse due to a sinusoidal input signal. In the previous chapters have discussed the system response to various other test signals cluding steps, ramps, parabola, and impulses. In this chapter, we ill investigate the response of systems to sinusoidal inputs ‘The frequency response methods are based on considering the sponse of linear systems to sinusoidal input est signals asthe fre ency of the sinusoidal tet signal varies. A linear, time-invariant yystem 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 transfor function describing the sinu- soidal behavior of the system is obtained by replacing + with ju in the system transfer function G(s). Theu, for a fixed i, Gj) is 8 complex number with @ magnitude and phase, ‘The magnitude and phase of Glju) ean be represented graphically as « varies. This type of graphical represeacation is known as @ ode diagram. It is possible to develop control system performance specifications in the frequency domainso that an effective control system design method: ‘logy 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 specifiestions in the time-domain is discussed. The a m Chapter 7. Frequency Response Methods stapler concludes with an illustrative example to gain expeien Aesigning a contol system in the fequeneydomalae ee st nis conred re bade an logipace. "Te bade fan ion i used to generate a Bode digran, and te logenaes heen fenerates a lognimialy spaced vector of eaaeeee the bede function, vee ss lest by 7.2 Bode Diagram Suppose we have the transfer function (eee MCS, p. $27) ___5{1 40.18) OO OF Ose Be BH oy ‘The Bode diagram correspon {0 Bq (71) sstown in Figue 7. The diagram cons ofthe ogre gin tee lot and the pace ) verse w ina second pet The gonad steps fr sechig an apronimate Bode dagramcs gies ns 3p. 308-917. As with the root locus plots it will be tempting to ‘ely excusively on MATLAB to obtain yout Bade degen Tee MATLAB as one tol in you ol kit tha You cans gna Frequency (race) $0 pe er errr pee "7 To apy Frequeney (adice) Figure 7.1 The Bode Plot Associated with Ba. (7.1), 72 Bode Dingenm 93 snalyze control systems. It is essential to develop the eapabi ‘nanually obtain approximate Bode diageatns. There is no substitute luc a clear understanding of the urderlying theory. |A Bode diagram is obtained with the bode function shown in igure 7.2. The Bode diagram is automatically generated if the bode function is savoked without left-hand arguments. Otherwise, ‘oe magnitude and phase characteristics ate placed in the workspace theough the variables mag and phase, A Bode diagram ix obtained with the plot function using mag, phase, and w. The vector w votains the values of the frequency in radians/sec at which the Node diagram will be calculated. If ws not specified, MATLAB will nutomatically choose the frequency values by placing more points in regions where the frequency’ response is changing quickly. Since the Node dizgzam is a log scale, if you choose to specify the frequencies capliitly, itis desirable to generate the vector w using the logepace fonction. ‘The lagapace 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 eo: 1000) Af = Frequent) user-Supplied frequency (optional | = | wey __[mag,phase,w}=bode(nurn,den, w) Figure 7.2 The bode Function m Ohapter 7. Frequency Response Methods 118, Specifications in the Frequency Domain 95 denen % Bode plot script for Figure 7.21 in MCS, p. 324 % points between 10" and 10" — rum=5*[0.1 fra{1 0}; 2-0-5 1); f34[1/2500 6/50 11; denaconv(F1,convi 2,43); 5 % bbode(num,den) Figure 7.4 The Script for the Bode Diagram in Figure 7.1. frequency range as w = 0.1 to 1000 rad/see. This range is user- selectable with the logapace function wpa SRD, eeriaae ° “reaghetentosorum aan, OE i] 3 Specifications in the Frequency Domain semilogx(w,20"log1 o(mag)), 9d ‘xlabei( Frequency [rad'sec),ylabol(20"log(mag) [d8}) jing in mind our goal of designing contro systems that sat- certain performance specifications given in the time-domain, we oust establish a conection between the frequency response and the transient time response of « system. The relationship between spec- cations given in the time domain to those given in the frequency domain depend upon approximation of the system by a second-order tem with the poles being the system dominant roots. ‘This ap- proximation is discussed in MCS, pp. 241-265. Consider the second-order system shown in Figure 7.5. The Ris) “oO [7 Fregueny (raze) Figure 7.3 The logepace Function. Figure 7.5 Single Loop Second-Order Feedback System, Pa Chapter 7. Frequency Response Methods closed-loop transfer function is wy ‘The Bode diggram magnitude characteristics astocisted with the closed-loop transfer function ia Bq, (7:2) are shown in Figure 7.6, ‘The relationship betwoen the resonant frequency, w,, the maximiim of the frequency response, M,,, and the damping ratio ¢, and the natural frequency, 2 i shown in Figure 7.7 (and in Figure 7.10 in MCS, p.516). he information in Figure 7.7 will be quite helpful in designing control systems in the frequency domain while satisfying time-domain specifications. ‘We have sen that we can relate frequency-domain specifications to time domain specifications by using the information contained in poheeeretees—_ a al | deg ao = ge | | taste er rerio il oy 20*tog mag) (4B) ar Pi gt ‘resonant freq | bandwidth: Toa Figure 7.6 Second-Order Closed-Loop System Characteristics. 7 1 Spreitications in the Piryuency Domain 454 1 spent os! 425 $06) a # al is a 2 ‘gaz aa 06 08 %q ration ‘wnat eta=0.15; = arin _ et AO) Se ‘once ese | wrthe i) ete 240,005; REE) Sa Een Th ete caonneteeh ipa [mp(ist}=max(mag); we(=w(l)s end ~ a a ‘subplot(211),plot(z,mp),grid eee esse) yabekew) | Ramet subplot(212),plot(2,wr),grid, ‘dlabbel zeta’), ylabel('we/ wn’) Te ham a Serpe Figure 7.7 The Relationship Between (Mp, i») and (Gs) for Second-Order System. yA. Example: agraving Machine System 9% Chapter 7. Frequency Response Methods the closed-loop Bode diagram. Stability is an important issue that ‘oct oon can be adden inthe frequency domain by considering the open ij loop transer function, ‘Ths topic will be sdresed in the next Shapter. po erate 7.4 Example: Engraving Machine System Consider the bloc igrn model in Figure 7.8. Thi example an | be found in MCS, pp. 382-935, Our objective is to design K so that the closed-loop aystem has an acceptable time response to step command. A functional bloc diagram describing the frequency domain design process is shown in Figure 7.9. First we choose K = 2 and subsequently ners 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 scfipt is excuted land the clored-loop Bode diagram is generated, The values of M_ and w- are determined by inspection from the Bode diagram. ‘Those values are weed in conjunction with Figure 7.7 to determine the corresponding values of (and. Given the damping ratio, ¢, and the natural ‘tequeney, wy, the settling time and percent overshoot ae estimated using the formutas 2oPtogiOmag) B) I satisfied then ei, aed continue analysis 4 ce Roe, PO.% 100ex Tis Ge» PO. exp ony If the time-domain specifications are not satisfied, then we adjust and iterate ‘The values for ¢ and w, corresponding to 2are( = 0.29 and sy = 0.88, This leads to a prediction of PO. = 38% and T, = 16 ete, srem consort er + [__;__ nt) 89 ok | eee |e oo? Figure 7.0 Frequency Design Functional Block Diagsom for the Figure 7.8 Engraving Machine Block Diagram Model. Peers oe Machine 100 Chapter 7. Frequency Response Methods ume[K); dena{1 3 2 walogspace(-1, 1,400); {mag,phase,w}=bode(num,den.w); {mollemaxtmag)imr(); ©] Bote Soe dan »K=2; engravescript! m= 1.8371 osi7t 2 muna | DRE Dy aE Wage TIO TT] > Soe | » ernie sae Neca sei | 230ta=0.29; moa0.86; enravescipt2 15.6740 po 138.5979 eognvesciotan t594/zeta/wn Oo 0=100%exp(-zetatpi/sqrt(I-zetan2)) Pie Figure 7.10 Frequency Design Script for the Engraving Machine 7A. Example: Engraving Machine System 201 seconds, The step response, shawn in Figure 7.1, i a verification hat the performance predictions are quite accurate and the closed- loop system performs adequately. In this example, the second-order system approximation is rea. ronable and leads to an acceptable design. However, the second ‘order approximation may not alwaye lead directly to a good design. Vortunately, with MATLAB we have the possiblity to construct an interactive design faclity that can) assist us in the design process by reducing the manual computational loads while providing easy ‘ceess to a host of classical and modern control tools lun1.02ones(length),1); ee ere [26 setting une bean | 11=0.98*ones(length(t),3); ET.38%ones(length(tht): ——jyen are [yaxlestep(num,den,t); plot(ty.ttlustl, grid xlabel(‘Time [sec], yiabel('c(t)') Figure 7.11 Engraving Machine Step Response for K = 2. 102 ———____. Notes Chapter 7. Frequency Response Metho Chapter 8 Stability in the Frequency Domain 8.1 Introduction Stability of a control system can be determined with frequency. exponse methods, The basis for the frequency-domain stability alysis is the Nyquit stability criterion, Jsues of absolute sta ity ar wel! 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 se MATLAB to aid in cbtaining ou pote. ‘The chapter begine with a discussion of the Nyquist stability criterion and the Nyquist diagram and Nichole chart. We will also revisit the Bode diagram in our diseusions 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 cloed. loop transfer function, T\jw), as well as the loop transfer function GH (ju). We presen an illustrative example that shows how to deal with a time delay in the eystem by utilizing a Padé approximation. ‘The functions covered in this chapter are ayquist, nichols, margin, pade, and nj 103 104 Chapter 8 Stability in the Frequency Domain 8.2 Nyquist Plots he Nyquist stability criterion is based on Cauchy’ theorem, which is concerned with mapping contours in the complex splane, Con Sider the system in Figute 8.1, The closed-loop trancter fonction . G(s) +m and the characteristic equation is 1% F(s) = 140s) Allof the zeroes of F(s) must liein the left-hand s-plane for stability We choose « contour, Tin the s-plane which encloses the entire right-hand s plane, and plot Pp in the F(3)-plane and determine the umber of encirclements ofthe origin. Equivalently, we can plot Ip in the P(s)-lane and determine the number of encirclements of the =1 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 Pp, the number of counterclockwise encir- clements 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 Pp is the Nyquist plot. It is generally more difficult to 1) __[ Pree mt) a Gis) —> vs) | coma H(s) Figure 8.1 Single.Loop Feedback Control System, 2 Nyquist Plots 105, senerate the Nyquist plot manually than the Bode diagram. How: ‘ver, 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 ie used without left-hand argu: iments, the Nyquist plot is automatically generated; otherwise, you tnust 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 fonction you may find that your Nyquist plot looks strange or that some information appears to be missing. Tt may be necessary in these cases to use the axis func- tion to override the automatic sealing and use the nyquist function with left-hand arguments in conjunction with the plot function. In this way you ean focus in on the —1 point region for your stability analysis, as illustrated in Figure a — a oy _ 34 & 4) 4 Qs 00s ts 1 ‘user supplied Kequeney ee (optional Ge) i {re.im,wj=nyquist(num,den, Figure 8.2 The nyquist Function 108 Chapter 8, Stability in the Frequency Domain rum=[0.5]; den=[t 210.5 J; vaxis((-1.0,.1,-0.1,0.1); »[resim}=nyquist(num,den); Figure 8.8 The nyquist Function with Manual Sealing. Up to this point we have been considering absolute stability only. In other words, our concern has been whether a systern 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 gin margin is a measure of how much the system gain ‘ould have to be increased for the GH(jw) locus to pass through the (1,0) point, thus resulting in an unstable aystem, The phase ‘margin is a measute of the additional phase lag reared before the system becomes unstable. Gain and phase margins can be deter: smined from both the Nyquist plot and the Bode di Consider the aystem shown in Figure 84, Relative stability com ny 8 —+} Baas | —> o@ Lo Figure 8.4 A Closed-Loop Control Systes Example for Nyquist and Bode with Relative Stability. 2. Nyquist Plote 107 ‘um=(0.5}; don=[t 210.5]; {mag,phase.w}=bode(num den) margin(mag,phase,w); 10% fie p00 01 Frequency rade) Figure 8.5 The margin Function be determined from the Bode dingrara 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 js shown in Figure 8.5. If the margin function is invoked without lefi-hand arguments, the Bode diagram is automatically generated with the gain and phase margin labeled on the diagram. ‘This = illustrated in Figure 8.6 for the system that ie 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 cas, the number of poles of GH(s) with positive real part is zero and the number of counter- clockwise encrclements of 1 is ero; hence the closed-loop system is stable. We can also determine the gain and pase margina, 25 indicated in Pigure 87 108 Chapter 8. Stability in she Frequency Domain 82. Nyquist Plots 109 num=[O.5] {% Pot Nyquist and compute Gain and Phase dene{1 27 0.5}; % Margins fr GH(s) = 0.5/sh3425h24540.05 % % ap BHT] Ywelogspace(-,1,200);
2.45 for K = 20). We can plot the step responses to quantify the overshoot, as shows ia Figure 8.15. ‘Alternately, we could have used a Nichole chart to aid the design process. This i shown in Figure 8.16. ‘The results of the analysis are sumsmasized 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 444] 10 | 20 Perzent overshoot | 5% | 30% | 50% Settling time [35 |'5 | 6 Peak time 1s | ta | 07 oe 31% |17% 9% 16 Chapter 8. Stability in the Frequency Domain 44. Baamplen ut welogspace(0, 1,200); K=20; _battlestep.m % for the te[0:0.1:10]; K=20; Sema -«—____—_| eon 5 numge=K*[1 2]; denge=[1 1]; forin1:3 + numg=[1]; deng=[1 2 4]; numge=K*[1 2]; denge=[1 1]; [nums,dens]series(numge.denge,numg,deng); numge[1]; denge[1 2 4]: [num den}=cloop(nums,dens); {[nums,dens]=series(numge,dengg,numg,deng); [mag,phase,w]=bode(num,den,w); [num,den]=cloop(nums,dens); nee og pan Sper: Ke end (pod aeptncSon Pa ier wer oeetean aby eal Sed It maces besa Pace ond Haaren a ices: jsoy end z & Teneo z ee ee ee meted Poneyresey2esaa xlabel(‘time [sec]'), ylabel(‘c(t)") Figure 8.14 Remotely Controlled Battlefield Vehicle Closed-Loop. System Bode Diagram Script wre 8.15 Remotely Controlled Battlefield Vehicle Step Re sponse. us Chapter 8 Stability in the Frequency Domain a attanichlam ‘3% Remotely Controlled Battlefield Vehicle % numge=[1 2]; denge=l1 11; [ane ‘numge[1]; deng=[1 2.4]; ETE Se {rum,den}=series(numge,denge,numg.deng); % vsiogspaces-2,2003;, fama u((210,0-24,36)) * | awe 832 ics 5 304 Be [bs = K1=20; K2=10; K3=4.44; {mag} oht w}=nichals(k *num,den.w); [mag2;ph2,w}=nichols{k2*num den.) {mag3 ph3,w/}=ichols(K3*num den,w) lot(pht 20%og O(magl),~ph2,20%og 10(mag2),'~ Paes h3,20*Iog 1 O(mag3),=.)sngrid Figure 8.16 Remotely Controlled Battlefield Vehicle Nichols Chart, 4. Examples 9 asin Masgin = 49.56 Phase Margin = 26.11 barenygstn 9% Remotely Controlled Battlefield Vehicle 9% Nycuist plot for K=10 % hnumge=10[1 2; denge={1 1; urmg=[1]; deng=[1 2 4); [num den} =series(numge,dengc,numg,deng): % [mag,phase,w}=bodelnum,den); [Gm,Pm, Weg, Wep]=margin(mag,phase,¥); % yquist(num den); tite({'Gain Margin = nuen2str(Gm), Phase Margin = num2str(Prm)]) Figure 8,17 Nyquist Chart for the Remotely Controlled Battlefield Vehicle with K= 16 120 Chapter 8. Stability in the Frequency Domain Noter Chapter 9 State-Space Methods 9.1 Introduction In the previous chapters we considered conteol system design and analysis in the frequency domain. We utilized the Laplace trans- {orm to transform the linear, constant coeficient differential equa- ‘tion model into an algebraic expression in terms of the complex: variable ¢. ‘Then we operated on our system in input-output (or transfer function) form Sud $$ iS by ow (Oar tet ge Fae Rls) = Gia) Rls) 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 represen. tation ofthe system model, given by f= Az+ Bu clber ne on ‘The vector 2 is the state of the system, Ais the constant n xn system matrix, B is the constant. n x m input matrix, D is the constant px outpat matrix and HT is a constant px me matrix ‘he number of inputs, m, and the mumber of outputs, p are taken to be one since we are considering only single-input, single output problems. Therefore cand ate not bold vatiables, 1 9.2, Model Relationships 13 2 Chapter 9. StatoSpace Methods Erbe Th 19) U9 = Geni ‘[mag,phato, w]=bode{num,den,w) al A eter finetn mde! Imag,phase,w]=bode(4,8,0,H,w), Figure 9.1 The State Space Representation bode Function ‘The main elements of the state-space representation in Eq. (9-1) ace the state vector ® and the constant matrices (A, B,D.) Since the main computational unit in MATLAB is the matrix, the statespace representation lends itself well to the MATLAB envi ronment, In fact, MATLAB covers 20 many aspects of state-space methods that we will rot be able to discuss them all here- ‘The new functions covered in this chapter are tf2se and ss2tf. Most of the functions covered in the previous chapters also apply here. For example, the the bode function can be utilized with ‘state-space model, as shown in Figure 9.1. The same ides ap- plies to series, parallel, feedback, cloop, printsys, minreal, step, pzmap, impulse, lsim, rlocus, rlocfind, residue, bode, nnygquist, and nichols, 9.2 Model Relationships Given a transfer function we can obtain an equivalent slatespace representation, and vice versa. MATLAB has two functions that convert systems from transfer function to state space and back ‘The function tf¥ss converts transfer-function representation to a state-space representation; the function ss2Uf converts a state-space representation to a transfer function. These functions ace shown in Figure 92 Figure 9.2 Linear System Model Conversion. For instance, conser the third-order system Ole) __28 +8546 on TO = Re) ~ BFR I F6 We can obtain a state-space representation using the tf2ss function ‘as shown in Figure 9.3. The slate space representation of Ea. (9.2) is given by Ba. (9.1) where -8 -16 -6 A=) 1 0 0,8 0 10 and . Dea[28 6), H=0. ‘Notice thatthe printeys function lists the system matrioes a a,b, cy. "The conversion to our notation is as fellows: aA, DOB, cw D, dH. Chapter 9, State-Space Methods 9% Convert G(s) = (2542+88+6)/(s43+88A2+165+6) % toa state-space representation rum=(2 8 6) i den={1 8 16 6]; [ABD H)-tf2ss(num,den); Printsys(A,8,0,H) peonvert x x2 3 x1 -8.00000 -16.00000 -6.00000 x2 1.000000 0 3 0 1.00000 oo be ul x1 1.00000 x 0 3 ° oa x1 2 3 y1 2.00000 8.00000 «,00000 ul yl 0 Figure 9.8 Comursion of Eq. (9.2) to a State-Space Representa tion, 9 Stability of Syston in Ue Tiase Domain 125 9.3. Stability of Systems ix the Time Domain Suppose we have a system in state-space form as in Bq. (91). The ability f the aystem can be evaluated with the characteristic epua- lion associated with the system matrix A, The cheracteristic eque dei(sI— A) <0. (03) ‘the characteristic equation is a polynomial in s. If all of the roots ofthe characteristic equation have negative real parts (ie., Resi) < 0,¥4), then the system is stable. ‘When the aystem mode e given in the state space form we must caleulate the characteristic polynomial associated with the A ma- six, In this regard we bave several options, We can caleulate the sharacteristc equation directly from Bq. (9.3) by manually comput: ing the deterniinant of (sf ~ A). Then we ean compute the roots using the roots functioa 10 check for stability, or alternatively, we an utilize the Routh-Hurwite method to detect any unstable roots. Unfortunately, the manual computations can become lengthy, espe- cialy if the dimension of in large. We would like to avoid this ‘magual computation if possible. As it turas out, MEATICAB can assat in this endeavor, ‘The poly function deseribed in Chapter 2 ean be used to com pute the characteristic equation associated with A. Recall that poly is used to form polynomial from a vector of roots. It can also be used to compute the characteriatic equation of, ae iusteated in Figure 9.4, wherein input matrix, A, is “8 16 -6 a=|1 0 0 o 1 of and the associated characteristic polynomial is F488 416046 If A is an m xn 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-Spaco Methods papoiy(A) ps 1.0000 8.0000 16.0000 6.0000] roots(p) ~$.0861 2.4280 20.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 ( MCS, pp. 462-465) is = Ant Bu (4) were o 10 ° o-1 1], B=|o0 0 0 K Our design specifications are (i) step response with a settling time ‘ess than two seconds, and (i) overshoot fess than 4%. We assume ‘that the state variables are available for feedback so that the control A 93. Stability of Systems in the Time Domain 127 is given by (-Ky, -Ka, Ko) (93) ‘We must select the gains K, I, Ky and Ks to ment the performance specifications. Using the design approximation Tem A <2 and PO. m 1Mdesy CVF 4, we find that (2072 and uy > 28 "This defines a region in the complex plane in which our dominant roots must lie to have any chance of meeting the design speciica- tions. Substituting Eq. (95) into Bq, (9) yields 0 o4 0 ot 1 KK, -KKy ~(6+KKs) zeae, (96) where A" isthe revised A matrix, The characteristic equation asso- ciated with Eg, (9.6) can be obtained by evaluating det(s— A") = 0. ‘This results in eer nero) KK + BEE Fy 20, (97 If we view KK, as « parameter and let Ky = 1, then we can write B, (87) a8 foiows a Mai Tet Her 8) Wo place the zeros at # = 44 2 in onder to pl the locas to the let in the nplane. Thos out desired mamerator polynomial ie 8486420. Comparing corresponding cefcient leads to Kat Ki Ke 8 wd Ky 0.35 and Ky = 0.05, We can now plot root locus with Ks as the paraneter, an shown in Feu 95, The 1+ WKS 1 0, 128 Chapter 9. State-Space Methods Imag. Asis valid region to meet q | -4N performance specs 4 ‘% Root locus script for the Automatic Test System {% including performance specs regions num=[1 8 20}; den={1 6 § Ol; cg; locustnum,den), hold one % sqrt(1-zetaA2)/zeta)*x, zeta*wn}ic=sqrt(wnh2-xc.A2);, 664!) Figure 9.5 Root Locus for the Automatic Test System, 120 24, Tine Response = onl + - 4 — A — tame [5] Figure 9.6 Step Response for the Automatic Test System. characteristic equation, Bq, (0.1), #486420 s+ Hl ¥ 5) “The selected gain, KK = 12, lies in the performance region, 88 shown in Figure 9.5. ‘The rloefind function is used to determine the value of K’Ky at the eelocted point. The final gains are 1+ KK K = 240.00 Ky = 1.00 Ky = 035 Ky = 005 “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 aystem in Eq, (91) is given by the solution to the vector differential equation 2(9 oop Ade(0)+ [ela nutri. 08) 130 Chapter 9, State-Space Methods ‘The matrix exponential function in Bq, (0.8) i the state transition matrix, (¢), where Ot) = exp( Ad. ‘We can use the function expm to compute the transition matrix for a given delta time, a8 illustrated in Figure 9.7. The expm() func tion computes the matrix exponential wheress the exp(A) function returns efor each of the elements 4, € A. "The time reponse of the system in Eq, (91) can be obtained by using the Isim function ‘The Isim function can acept a input songero initial conditions a2 wel a an pat function. ‘This i i lustrated in Figure 98 for the RLC network (sce MCS, Chapter 9) described ly the state-space representation an[? 2] ef]. p=Ls a) ane 6. ‘The intial conditions are 2,(0) = #2(0) = 1 and the input u(t) = 0. we ean compare the results obtained by the Isim function aad by multiplying the initial condition state vector by the state transition imatex, we find exactly the identical results. At # = 0.2 the state ‘transition matrix is given in Figure 9.7. The state at ¢ = 02 is predicted by the state transition methods to be a) _ [oer 0.2968 ] (21 0.6708 Jag, Lonsse 05219} 2, ), = 0670s ‘The state at t = 0.2 is also predicted with the Isim function to be (0.2) = 2,(0.2) = 0.6703. =0.2; Phimexpm(Arat) Figure 9.7 Computing the State Transition Matrix for » Given 9.4, Time Response 131 a a ms —] 2 4 oe tyxlisi(A, subplot(211), plot(tix(1)) label('time (sec]'), yiabel(x1") ssubplet(212), plot(tyx(22)) label(time (sect), ylabel(2") Figure 9.8 Computing the Time Response for Nonze Initial Con- ditions and Zero Input as Chapter 9. State-Space Methods Notes Chapter 10 Control System Design 10.1 Introduction eis often possible to achieve stability and meet all the control sy 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, io many cases it ie necessary to add a dynamic compensator into the system. Altering 4 control system fo mect relative stability and performance spec: ications is called compensation. We say that our compensators tre 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 Figuce 10.1. The compensator in Figure 10.1 is « cascade or series smart commence atts ©O—| SEPT des Stim 7 Figure 10,1 A Compensated Control System for Spacecrall Rota tional Motion 138 it Chapter 10. Control System Design compensator since it is placed in the feedforward path, A com. tor placed in the feedback path is known as a feedback com. ‘ensator. Compensators can be placed in other paths (e-£ innet feedback loops) in the control systern as well The main topic ofthis chapter is compensation of fesdback cone ‘rol 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 Bade frequency ‘domain method to design the compensatore. One of the most cont. ‘monly used compensators is the proportional plus derivative plus ‘integral (PID). The PID compensator is covered in Chapter 11 10.2 Lead Compensation Consider the series compensator Kota) stp Gls) = (10.1) ‘The selection f the variables K.,2, and p is based on satisfying the design performance specifications. Whenever ll 1. The maximum value of the phase lead occurs at a frequency dq, where om = VF 1 We ‘The maximum phate angle at uy i6 gay where a-1 sing = SSS. Consider, for example, the lead compensator 10(s +1) Sri” ‘The associated Bode diagram is shown in Figure 10.3. ‘The maxi mum value of the phase lead oceurs at on = VB = VO. ‘The maximum phase lead is Gas sis, ita! n= acs 2t where a = 10. ‘The phasc-lead compensator is » diferentiator type compet sator. ‘This can be seen by considering the case when Ip] >> [th ‘Thea it follows that ke Gls) = Ee ? ‘We can design ead compensator with frequency-domain design techniques utilising Bode diagrams as wel as with rot ls design rethods. The lead compensator increas the phase margin, thus providing additional stability, and increases the eytem bandwidth to provide speeder dynamic response. 136 Chapter 10. Control System Design 10}; bode(num,den) Figure 10.8 Bode Diagram ofthe Lead Compeasator. 20.3 Lag Compensators Again consider the series compensator a Ke+2) G9) = Whenever bel< lel the compensator G(s) isa lag compensator. The pole-zezo di z 1epole-zero diagram ofthe lag compensator is shown in Figure 10. The lag compensator «an also be written as in Eq, (10.2) where a < 1. The maximum value of the phase lag occurs at VB = Vi. 10.3. Lag Compeunntorn aT 1 igure 10.4 Pole-Zero Diagram of the Lag Compensator. Consider, fr exaraple, the lag compensator 0.(¢ +10) a4) =) ‘The astociated Bode dingram is shown in Figure 10.5, ‘We see that the lag compensator is an integration type compen sator by considering |2| >> Ip. Then fey K+, ‘This has the same form as the widely used lag compensator ry G(s) = Ky + ‘This is known as a proportional plus integral (PT) compensator. ‘The lag compensator ie applicable when high steady-state ac- ‘curacy ie required. Although itis 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 leg compensator and properly chosen values of K,p, and 2. ‘The lag compensator de- creases the system bandwidth thus suppressing high requency noise and slews down the transient response. 188 Chapter 10. Control System Design ‘snum=0.1°[1 10]; den=[1 1); bode(num,den) 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. 548-545). The design objective is to achieve high steady-state accuracy to a ramp input, The steady-state error to » unit ramp R)—AG + Gus) |-+| aeneria| Cs) Figure 10.6 Rotor Winder Control Systera, 104, Examples Holee Winder Control Sytem 139 inp, Rs) = fi -4, KY whee AO) Ko= lie Of course, the peeformance specification of overshoot and settling time must be considered as well as steady-state tracking error, Ta all likelihood, a simple gain will not be satisfactory. So we will consider active compensation utilizing lead and lag. compensators tsing both Bode diageams and root locus plots. Our approach is to develop a series of eeripts to aid in the compensator designs Consider first «simple gain controller, Gc(s), where GAs) = K. ‘Thea, 80 K Clearly, the larger we make K’, the smaller the steady-state ertor ew However, we must consider the effects of increasing Kon the transient response, ‘The is shown in Figure 10.7. When K = 500, ur steady-state ertor for aramp is 10% but the overshoot is 70% and ‘the settling time ie around 8 seconds for a step input. We consider this to be wasecmptable performance and turn to compensation. The two important compensator types that we consider are lead and lag ‘compensators First we try & lead compensator K(42) rx)" where [2] < Jp. 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 ertor of ess than 10% to & ramp input. Then we desire Gis)= K=10. 40 Chapter 10. Control System Design ot) ee co time (see) e150 -_ ae (50 100 200 500 |; = —) gaan numg=[1]; denge[1 15 ~ t=[0:0.1:5) et $00 x fori {nums,dens}=series(K(i), [numer uma, deng) toop(nums.dens); «| des Rea sten(oum den); [eter tscvon | Stilley _ ae end cane | % Potts. sta, 8.6C8 Mabel ime fee}, yabel CQ)" Figure 10.7 Transient Response for Simple Gaia Controller. 104. Example: Motor Wiuler Control System ui In addition to the steady-state specifications, suppose alo that we desire to mect certain performance specifications: (@ settling time 7, <3 seconds, and (i) percent overshoot fora step input < 10%. Solving the approximate formulas PO. = 100exp IVE = 10 and 7% for ¢ and wy yields 5912 and wy = 2.2585 ‘The phase margin requirement becomes wf es, fom ® ay = 60 dees 1 steps leading to the inal desiga 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 sind, 4. Compute 10 loge and find the frequency wa on the uncom. pensated Bode diagram where the magnitude curve is equal to =10log 5. In the neighborhood around wy on the uncompensated Bode, draw a line through the O-dB point at us 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 caleulate the led compen: sator pole location as p= 6. Draw the compensated Bode and check the phase margin. Re peat any steps if necessary. 2 Chapter 10. Control Syster Design 7. Raise the gain to account for attenuation (1/4), 8. Verify the final design with simulation using step functions, and repeat any steps if necessary. ‘We utilize three eetipts in the design. The design scripts are shown in Figures 10.8, 10.9, and 10.10. The fret script is for the uncom- pesated Bode, the next is for the compensated Bode, and the final ‘script is forthe step response analysis. The final lead compensator design is 1800(5 + 3.5) [e35) ‘The settling time and overshoot specifications are satisfied, but ‘Ke = 5, resulting in a 20% steady-state error to & ramp input. It is possible to continue the design iteration and refine the compensator somewhat, although it should be clear that the lead compensator hhas added phase margin and proved the transiest response as anticipated. ‘To improve the steady-state errors we can consider the lag com. pensator. The leg, compensator has the form Gas) = K(s-+2) Ch Tee where [pl < fe We will use root locus approach to design the Jag compensator, although it can be done using Bode as wal. The desired root location region of the dominant roots are specified by ¢ = 0.5912 and w, = 2.2555. ‘The step in the design area 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.5912 and uy = 2.2558, 3. Cleulate the loop gain at the desired root location and the system ertor constant, Kany: 104. Example: Rotor Winder Control System M43 Wee ee oT mag (481 8 br io atm K=500; numg=[1]; dengrt1 15 a Oo] San etme ena) asa eases 2.200) (cea [mag,phase,w]=bode(num,den,w); [Gm,Pm,Weg,Wep]=margin(mag,phase,w); alphan(14sin(Pripy/(1-sin(Phi)) 96 M--10*I091 O(aipha)*ones(lenath(w)1)i % mag,phase,w]=bodenum,den,w): Some 20g Crag), ' Habel frequency [rad/sec]’), ylabel("mag 1481") Figure 10.8 Lead Compensator: Uncompensated Bode. 4 Chapter 10. Control System Design 10.4. Ramps Hote Wine at) 5 vt = See | nent 5 50, a numgc=K*[1 3.5]; denge={1 25]s Md compensator: {ramden}-anis(umge dengeromesdarehe fo wrooepacet 1.2200) Uagipeseo| Soden den; [enBiincatcionwon hase ted een title(['Gain margin = 'yjnum2str(Gm), ... "Phase margin = "rum2str(Pr) Figure 10.9 Lead Compensators Compensated Bode. rumg=(1h; denga[1 15 50.0}; numge=K'(1 3.5]; dengo=(T 251; % {nums.dens]=series(eumge,denge,nume,dena); [nur den}=cloop(nums dens); % %[0:0.01:2}5 step(rum,den.t) Figure 10.10 Lead Compensator: Step Response. 146 Chapter 10. Control System Dé 0. 4. Compute a= fe where Ky With a known, determine suitable locations of the compe sator pole and 2er0 eo that the compensated root locus sti pastes through desired location, 6. Verify with simalation and repeat any steps if necessary. ‘The design methodology is shown in Figures 0.11, 10.12, and 10.18 Using the rlocfind funetion, we can compute the gain K’ associni with the roots of our choice on the uncompensated root locus thal Tie in the performance region. We then compute a to ensure tha wwe achieve the desired K,. We place the lag compensator pole an¢ eto in order not to impact the uncompensised coat locus. In Fi ure 10.12, the lag compensator pole and zero are very neat the origi ats =O.) and p = 0.01 "The setting time and overshoot specifications are nearly sath and K, = 10 as desired, }t's possible to continue the design iterati tnd refine the compensator soinewhat, although it should be cle ‘that the lag compensator has improved the steady-state errors to ramp input relative to the lead compensator design. ‘The final ls compensator design is ee) = 60) ‘The resulting performance is surmmarized in ‘able 10.1. ‘Table 10.3 Compensator Design Results — Controller Gain, K | Lead | Lag Step overshoot 0% | 8% | 19% Settling time (see) s fala Steady-state error for ramp | 10% | 20% | 10% K w | 5 | 10 |__| 104, Example: Rotor Winder Control System at rurmge{1) dengett 19 50 0h isl (215.110.1005 : Sirocramgtn epee] % snoS12wer2.2555 t -zetan2)/20a) x5 $el-10:0.1-zetatwnl: y(oqnt-z0tah2) sa caetnunienngtns2e 2) % plot xy" ated Root Locus. Figore 10.11 Lag Compensator: Uncompensated Root 148 Chapter 10. Control System Design 104. Beample: Rotor Winder Control System 49 j dangel? 15 50 0, rnumge=[1'0.1]; dengo{ 0.01}; [num den}series(qumge,denge,numg.deng); axis([-15,1,-10,10); cla; Hlocus(num,den); hold on % ‘zeta~0.5912; wm=2.2555; Xt-10:0. -zetarwn}; y—(sart(1-zetan2)/zeta)*x; Xen[-10:0.1-2etatwn];c=sqr(wnA2-xc.42); Plottxy, ‘ Figure 10.12 Lag Compensator: Compensated Root Locus. f= i 1 % Amplitude 0a ee Time Gee) tetodag2.m K=100; 36 rumg-[1]; dengef? 15 $00}; Jaumge=K*[1 0.1]; denge={1 0.01}; % [nums,dens]=series(numgc,dengc,nume,deng); [num,den]=cloop(nures,dens); % step(num, den) Figure 10.18 Lag Compenator: Step Response. Chapter 10. Control System Design Notes Chapter 11 Robust Control Systems 11.2 Introduction Designing a highly accurate control system in the presence of plant uncertainty i a classical design problem, In the previous chapters, we have generally asvunied that the plant parameters are well known ‘and designed our control system accordingly. In practice, the plant parameters are never precisely knowa and may vary slowly overtime. It is desirable to design a control system that performs adequately cover 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. In this chapter, we begin to investigate robust control systems, In particalar we consider the commonly Used proportional plus deriva- 28) a vp fae} Beets Figure 11.1 Feedback Control System with Reference and Distur bance Inputs and a Prefilter. 151 153 152, Chapter 11. Robust Control Systems 11.2, Robust PID Controlled Systems ‘ive plus integral (PID) controller. Our feedback control system his the form shown in Figure 11.1. Notice that the system has « pre filter G(s}. ‘The role of the preiter in contributing to optimus performance is discussed in MOS, pp. 594-595. ‘and the nominal value of cis ah and check robustness We will design a compensator based on co = 1 by simulation. Our design specifications ore as follows: 11.2 Robust PID Controlled Systems "The PID coniolles has the form. (i) settling time T, $0.5 seconds, and ‘optimum TTAB performance fora step input (see MCS, op 176-185). our design, we will not ile a prefer to mock specifica: lap. ier mt ot Gretshoot) can be obtained by increasing the system gain "The closed loop transfer function is Ke+KetG ay T= 370 ReHUF RT Kost + Kus + Ke Notice that the PID controller is not a rational function (i. the degre of the mumerator polyaomial is greater than the degree of the denominator polyaemil). You wil experience dificalty # yoa stterpt to input the PID controller into MATLAB in the standacd ‘numerator and denominator fashion. Generally speaking the prob leo can be resolved by tilizing the conv fonction rather thaa, the ‘series function in your manipulations. ‘The objective is to chooge the parameters K, Ky, and Ky t eet the performance specifications and have desirable robustne propertis. Unfortunately, tis aot immediately clear how to cho the parameters in the PID controller to obtain certain robustness characteristics. We will show by an illustrative example that it ie possible to choose the parameters iteratively and verify the robust ness by simulation. Using MATLAB helps in thin proces since the cntice design and simlation can be mechanized util d tasily execited again and again. A complete expoition on the sub- Ject of robust control analysis and desiga is beyond the scope of book Gis) = “The associated characteristic equation rete) oo, Kr = Kot? 1k TERS Ky 4K Our settling time requirement T, < £ leads us to choose the roots Gate ant bto the left of the «= Coy = ~8 line in the plane, Sf thown in Figure 1.2, to ensue tht the locus travels into the Tequited performence region. We have chosen ¢ = 16 and b = 70 Terenwure the locus travels past the # = ~8 line. We select a pint tn the root locus in the performance region, and using the rlocfind {aneton, we find the associated gain K and the asociated value of Ml EXAMPLE 11.1 Robust Control of Temperature Consider the feedback control system in Figure 11.1, where 1 60) = Grae wt Chapter 11. Robust Control Syston Imag. Axis TSA mae S BY STT OOO RTa »rlocfind(num,den) % 10001 toad Figure 11.2 Root Locus for the PID Compensated ‘Te Biwre PID Compensated Temperature n. For the point we have chosen we find that Kt us, ‘Then, with K*, a, and b we can solve for the PID coufiients as 1.2, Robust PID Controlled Systems 155 follows: Ky = 0(2+ Ks) Ky = 62+ K3) ‘To meet the overshoot performance requirements fora step input we will utilize a cascade gain K that wil be chosen by iterative methods using the step function, This i illustrated in Figure 11.3. The step response corterponding to K = 5 has an acceptable overshoot of 2%. With the addition of the gain K = 5, the final PID controller Gs) = K Kost Bia Ka, N60 410870 +8200, ‘We did not used the prefiter as is done inthe desiga Example 11.5in MCS, pp. 594-595. Instead we increased che system gain to obtain satisfactory transient response. Now we can consider the question of robustness to change in the plant parameter co. ‘Our investigation into the robustness of our design consists of = step response analysis using the PID controller given in Ea. (112) for range of plant parameter variations ofc € (0.110). Thereslts 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 cy at the command prompt level to make the script more inecactve. ‘The simulation results indicate that the PID design is robust with respect to changes in cp. The diflerences in the step responses for eo € [0.1,10] are barely discernible on the plot. If the reslts 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 o- Dbustness directly into the design process, but their presentation here iy outside the scope of this text. The interactive capability of MATLAB allows us to check our robustness by simlation, although this is clearly not the most desirable approsch to design. 156 Chapter 11, Robust Control Systema | | o $—s ots 0 ais a os Time (sec) temostenm ‘ai Fam nara root leas creer K3eKs-2, K1 =a*(2+K3)-1, K2=b"(2+K3) <=] Inumge=K*[K3 K1 KZ]; denge=[1 0]; gmat dengan 21% anes Songe deny =< —_[ SSRI HTET by conv(denge,deng); —- prdeanrthedey % [oum,den}=cloop(rums,dens); step(num den) Figure 11.8 Step Response for the PID Temperature Controlier, 112. Robust PID Contralled Syatems ist roo | —| [os] , | te a a a Tine) numg=[1}; deng=[1 2%c0 cOA2); numge=5*[116 1187 8260); denge=[1 0}; % numa=conv(numg,numge)s dena=conv(deng,cenge); % [num den}=cloop(numa,dena); % step(num den) Figure 11.4 Robust PID Controller Analysis with Variations in 6. 158 Chapter 11. Robust Control Systems Notes Index/Glossary axis Controls the manual axis sealing on plots; 105 bode Computes « Bode frequency response plot; 92:98, 107, 110, 12 clear Removes variables and functions from memory; 6, 9 lg 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, 182, end Terminates afor function; 6 ‘expm Computes the matrix ex ponential function; 130 feedback Computes the feed- back interconnection of two sys ‘tems; 26, 31-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; 2 impulse Computes the unit im- pulse response of a system; 61, 63, 122 loglog Generates an s-y plot using log-log scales; 17-18, 20 logspace Generates a logsrith: imically spaced frequency vec- tor for frequency response anal- sin; 92-95, sim Computes the time response of a system to an arbitrary in- put and intial conditions; 61, 66, 68, 122, 190, ‘margin Computes the gain mar. ‘in, phase margin, and associ- ated crossover frequencies from frequency response data; 103, 107-110 160 ‘ainreal Transfer function pole- 2er0 cancellations 26, 4, 122 rngrid Draws grid lines on [Nichols chart; 103, 110 nichols Computes a Nichols fe- ‘quency zesponse plot; 103,110, 1m rnyguist 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 « parallel system connection; 26, 36-87, i plot Generates a linear zyplot; 16-19, 45, 9, 105, 110 poly Returns the characters: tic equation when the input is ‘a matrix and retusa polyno- ‘ial 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, vei24 pzmap Plots the pole-zero map. ‘of linear system 26, 32,122 residue Computes the esidues, Index/ Glossary poles, and direct terms ofa partlale fraction expansion; 82, 84-86, 85, 122 locus Computes the root lo- cus of a linear system; 8233, 12 rloefind Finds the gain asso ciated with a given set of roots ona root locus plot; 82-83, 122, 129, 146, 153) roots Computes the roots of a polyaomial; 26, 1, 72-73, 125 roots] Same as the roots func tion, but gives more accurate answers when there ae repeated roots; 26, 31, 33, shg Shows the graph window; 16 series Computes a series sys tem connestion; 26, 35-38, 40, 122, 152 semilogx Generates an zyplot turing emilog scales with the 2 axis logy and the yaxis linear; A118, 20, semilogy Generates an z-yplot using semilog scales with the ‘yaxis logio and the z-axis lin ear; 17-18, 20 ‘se2Uf Converts & state space ays ‘tem representation to a trans. fer function representation; 122- 13 step Computes the unit step response of a system; 26, 45+ 46, 63, 87, 122, 155, Index/ Glossary subplot Subdivides the graph ‘splay into sub-windows; 17, 2 fas Converts a transfer func- tion system representation (08 state-space representation; 22- 13 title Puts a title on the cur sent plot; IT sho Lists the variables in the ‘workspace; 7, 9-10 ‘whos List the variables jn the ‘workspace including thet size and type; 7,9 xlabel Puts an z-axis label on the current plot; 17 ylabel Pats a yaxis abel on the current plot; 17 161

You might also like