SlideShare a Scribd company logo
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
Modern Control Design
With MATLAB and SIMULINK
This page intentionally left blank
Modern Control Design
With MATLAB and SIMULINK




Ashish Tewari
Indian Institute of Technology, Kanpur, India




JOHN WILEY & SONS, LTD
Copyright © 2002 by John Wiley & Sons Ltd
                    Baffins Lane, Chichester,
                    West Sussex, PO19 1UD, England
                    National       01243 779777
                    International (+44) 1243 779777
                    e-mail (for orders and customer service enquiries): cs-books@wiley.co.uk
                    Visit our Home Page on http://www.wiley.co.uk
                                          or http://www.wiley.com
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except
under the terms of the Copyright Designs and Patents Act 1988 or under the terms of a licence issued by
the Copyright Licensing Agency, 90 Tottenham Court Road, London, W1P 9HE, UK, without the permission
in writing of the Publisher, with the exception of any material supplied specifically for the purpose of being
entered and executed on a computer system, for exclusive use by the purchaser of the publication.
Neither the authors nor John Wiley & Sons Ltd accept any responsibility or liability for loss or damage
occasioned to any person or property through using the material, instructions, methods or ideas contained
herein, or acting or refraining from acting as a result of such use. The authors and Publisher expressly disclaim
all implied warranties, including merchantability of fitness for any particular purpose.
Designations used by companies to distinguish their products are often claimed as trademarks. In all instances
where John Wiley & Sons is aware of a claim, the product names appear in initial capital or capital letters.
Readers, however, should contact the appropriate companies for more complete information regarding trade-
marks and registration.
Other Wiley Editorial Offices
John Wiley & Sons, Inc., 605 Third Avenue,
New York, NY 10158-0012, USA
Wiley-VCH Verlag GmbH, Pappelallee 3,
D-69469 Weinheim, Germany
John Wiley, Australia, Ltd, 33 Park Road, Milton,
Queensland 4064, Australia
John Wiley & Sons (Canada) Ltd, 22 Worcester Road,
Rexdale, Ontario, M9W 1L1, Canada
John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01,
Jin Xing Distripark, Singapore 129809




British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library
ISBN 0 471 496790




Typeset in 10/12j pt Times by Laserwords Private Limited, Chennai, India
Printed and bound in Great Britain by Biddies Ltd, Guildford and Kings Lynn
This book is printed on acid-free paper responsibly manufactured from sustainable forestry,
in which at least two trees are planted for each one used for paper production.
To the memory of my father,
Dr. Kamaleshwar Sahai Tewari.
To my wife, Prachi, and daughter, Manya.
This page intentionally left blank
Contents

Preface                                                                                xiii


   Introduction                                                                          1
    1.1 What is Control?                                                                  1
    1.2 Open-Loop and Closed-Loop Control Systems                                         2
    1.3 Other Classifications of Control Systems                                          6
    1.4 On the Road to Control System Analysis and Design                                10
    1.5 MATLAB, SIMULINK, and the Control System Toolbox                                 11
   References                                                                            12



2. Linear Systems and Classical Control                                                 13
    2.1  How Valid is the Assumption of Linearity?                                       13
    2.2  Singularity Functions                                                           22
    2.3  Frequency Response                                                              26
    2.4  Laplace Transform and the Transfer Function                                     36
    2.5  Response to Singularity Functions                                               51
    2.6  Response to Arbitrary Inputs                                                    58
    2.7  Performance                                                                     62
    2.8  Stability                                                                       71
    2.9  Root-Locus Method                                                               73
   2.10  Nyquist Stability Criterion                                                     77
   2.11  Robustness                                                                      81
   2.12  Closed-Loop Compensation Techniques for Single-Input, Single-Output Systems     87
         2.12.1 Proportional-integral-derivative compensation                            88
         2.12.2 Lag, lead, and lead-lag compensation                                     96
   2.13 Multivariable Systems                                                           105
   Exercises                                                                            115
   References                                                                           124


3. State-Space Representation                                                          125
    3.1 The State-Space: Why Do I Need It?                                              125
    3.2 Linear Transformation of State-Space Representations                            140
viii                                          CONTENTS


        3.3 System Characteristics from State-Space Representation                        146
        3.4 Special State-Space Representations: The Canonical Forms                      152
        3.5 Block Building in Linear, Time-Invariant State-Space                          160
       Exercises                                                                          168
       References                                                                         170



4. Solving the State-Equations                                                           171
        4.1 Solution of the Linear Time Invariant State Equations                         171
        4.2 Calculation of the State-Transition Matrix                                    176
        4.3 Understanding the Stability Criteria through the State-Transition Matrix      183
        4.4 Numerical Solution of Linear Time-Invariant State-Equations                   184
        4.5 Numerical Solution of Linear Time-Varying State-Equations                     198
        4.6 Numerical Solution of Nonlinear State-Equations                               204
        4.7 Simulating Control System Response with SIMUUNK                               213
       Exercises                                                                          216
       References                                                                         218



5. Control System Design in State-Space                                                  219
        5.1 Design: Classical vs. Modern                                                 219
        5.2 Controllability                                                              222
        5.3 Pole-Placement Design Using Full-State Feedback                              228
               5.3.1 Pole-placement regulator design (or single-input plants             230
               5.3.2 Pole-placement regulator design for multi-input plants              245
               5.3.3 Pole-placement regulator design for plants with noise               247
               5.3.4 Pole-placement design of tracking systems                           251
        5.4 Observers, Observability, and Compensators                                   256
               5.4.1 Pole-placement design of full-order observers and compensators      258
               5.4.2 Pole-placement design of reduced-order observers and compensators   269
              5.4.3 Noise and robustness issues                                          276
       Exercises                                                                         277
       References                                                                        282



6. Linear Optimal Control                                                                283
        6.1 The Optimal Control Problem                                                  283
               6.1.1 The general optimal control formulation for regulators              284
               6.1.2 Optimal regulator gain matrix and the riccati equation              286
        6.2 Infinite-Time Linear Optimal Regulator Design                                288
        6.3 Optimal Control of Tracking Systems                                          298
        6.4 Output Weighted Linear Optimal Control                                       308
        6.5 Terminal Time Weighting: Solving the Matrix Riccati Equation                 312
       Exercises                                                                         318
       References                                                                        321
CONTENTS                                        ix


7. Kalman Filters                                                                      323
    7.1 Stochastic Systems                                                             323
    7.2 Filtering of Random Signals                                                    329
    7.3 White Noise, and White Noise Filters                                           334
    7.4 The Kalman Filter                                                              339
    7.5 Optimal (Linear, Quadratic, Gaussian) Compensators                             351
    7.6 Robust Multivariable LOG Control: Loop Transfer Recovery                       356
   Exercises                                                                           370
   References                                                                          371



8. Digital Control Systems                                                             373
    8.1  What are Digital Systems?                                                     373
    8.2  A/D Conversion and the z-Transform                                            375
    8.3  Pulse Transfer Functions of Single-Input, Single-Output Systems               379
    8.4  Frequency Response of Single-Input, Single-Output Digital Systems             384
    8.5  Stability of Single-Input, Single-Output Digital Systems                      386
    8.6  Performance of Single-Input, Single-Output Digital Systems                    390
    8.7  Closed-Loop Compensation Techniques for Single-Input, Single-Output Digital
         Systems                                                                       393
    8.8 State-Space Modeling of Multivariable Digital Systems                          396
    8.9 Solution of Linear Digital State-Equations                                     402
   8.10 Design of Multivariable, Digital Control Systems Using Pole-Placement:
         Regulators, Observers, and Compensators                                       406
   8.11 Linear Optimal Control of Digital Systems                                      415
   8.12 Stochastic Digital Systems, Digital Kalman Filters, and Optimal Digital
         Compensators                                                                   424
   Exercises                                                                            432
   References                                                                           436



9. Advanced Topics in Modern Control                                                   437
    9.1 Introduction                                                                   437
    9.2 #00 Robust, Optimal Control                                                    437
    9.3 Structured Singular Value Synthesis for Robust Control                         442
    9.4 Time-Optimal Control with Pre-shaped Inputs                                    446
    9.5 Output-Rate Weighted Linear Optimal Control                                    453
    9.6 Nonlinear Optimal Control                                                      455
   Exercises                                                                           463
   References                                                                          465


Appendix A: Introduction to MATLAB, SIMULINK and the
            Control System Toolbox                                                     467
x                            CONTENTS


Appendix B: Review of Matrices and
            Linear Algebra                                    481

Appendix C: Mass, Stiffness, and Control Influence Matrices of
            the Flexible Spacecraft                            487

Answers to Selected Exercises                                 489

Index                                                         495
Preface

The motivation for writing this book can be ascribed chiefly to the usual struggle of
an average reader to understand and utilize controls concepts, without getting lost in
the mathematics. Many textbooks are available on modern control, which do a fine
job of presenting the control theory. However, an introductory text on modern control
usually stops short of the really useful concepts - such as optimal control and Kalman
filters - while an advanced text which covers these topics assumes too much mathe-
matical background of the reader. Furthermore, the examples and exercises contained
in many control theory textbooks are too simple to represent modern control appli-
cations, because of the computational complexity involved in solving practical prob-
lems. This book aims at introducing the reader to the basic concepts and applications
of modern control theory in an easy to read manner, while covering in detail what
may be normally considered advanced topics, such as multivariable state-space design,
solutions to time-varying and nonlinear state-equations, optimal control, Kalman filters,
robust control, and digital control. An effort is made to explain the underlying princi-
ples behind many controls concepts. The numerical examples and exercises are chosen
to represent practical problems in modern control. Perhaps the greatest distinguishing
feature of this book is the ready and extensive use of MATLAB (with its Control
System Toolbox) and SIMULINK®, as practical computational tools to solve problems
across the spectrum of modern control. MATLAB/SIMULINK combination has become
the single most common - and industry-wide standard - software in the analysis and
design of modern control systems. In giving the reader a hands-on experience with the
MATLAB/SIMULINK and the Control System Toolbox as applied to some practical design
problems, the book is useful for a practicing engineer, apart from being an introductory
text for the beginner.
    This book can be used as a textbook in an introductory course on control systems at
the third, or fourth year undergraduate level. As stated above, another objective of the
book is to make it readable by a practicing engineer without a formal controls back-
ground. Many modern control applications are interdisciplinary in nature, and people
from a variety of disciplines are interested in applying control theory to solve practical
problems in their own respective fields. Bearing this in mind, the examples and exercises
are taken to cover as many different areas as possible, such as aerospace, chemical, elec-
trical and mechanical applications. Continuity in reading is preserved, without frequently
referring to an appendix, or other distractions. At the end of each chapter, readers are

® MATLAB, SIMULINK, and Control System Toolbox are registered trademarks of the Math Works, Inc.
xii                                        PREFACE


 given a number of exercises, in order to consolidate their grasp of the material presented
 in the chapter. Answers to selected numerical exercises are provided near the end of
 the book.
     While the main focus of the material presented in the book is on the state-space
 methods applied to linear, time-invariant control - which forms a majority of modern
 control applications - the classical frequency domain control design and analysis is not
 neglected, and large parts of Chapters 2 and 8 cover classical control. Most of the
 example problems are solved with MATLAB/SIMULINK, using MATLAB command
 lines, and SIMULINK block-diagrams immediately followed by their resulting outputs.
 The reader can directly reproduce the MATLAB statements and SIMULINK blocks
 presented in the text to obtain the same results. Also presented are a number of computer
 programs in the form of new MATLAB M-files (i.e. the M-files which are not included
 with MATLAB, or the Control System Toolbox) to solve a variety of problems ranging
 from step and impulse responses of single-input, single-output systems, to the solution
 of the matrix Riccati equation for the terminal-time weighted, multivariable, optimal
 control design. This is perhaps the only available controls textbook which gives ready
 computer programs to solve such a wide range of problems. The reader becomes aware
 of the power of MATLAB/SIMULINK in going through the examples presented in the
 book, and gets a good exposure to programming in MATLAB/SIMULINK. The numer-
 ical examples presented require MATLAB 6.0, SIMULINK 4.0, and Control System
 Toolbox 5.0. Older versions of this software can also be adapted to run the examples and
 models presented in the book, with some modifications (refer to the respective Users'
Manuals).
    The numerical examples in the book through MATLAB/SIMULINK and the Control
System Toolbox have been designed to prevent the use of the software as a black box, or by
rote. The theoretical background and numerical techniques behind the software commands
are explained in the text, so that readers can write their own programs in MATLAB, or
another language. Many of the examples contain instructions on programming. It is also
explained how many of the important Control System Toolbox commands can be replaced
by a set of intrinsic MATLAB commands. This is to avoid over-dependence on a particular
version of the Control System Toolbox, which is frequently updated with new features.
After going through the book, readers are better equipped to learn the advanced features
of the software for design applications.
    Readers are introduced to advanced topics such as HOC-robust optimal control, struc-
tured singular value synthesis, input shaping, rate-weighted optimal control, and nonlinear
control in the final chapter of the book. Since the book is intended to be of introduc-
tory rather than exhaustive nature, the reader is referred to other articles that cover these
advanced topics in detail.
    I am grateful to the editorial and production staff at the Wiley college group, Chichester,
who diligently worked with many aspects of the book. I would like to specially thank
Karen Mossman, Gemma Quilter, Simon Plumtree, Robert Hambrook, Dawn Booth and
See Hanson for their encouragement and guidance in the preparation of the manuscript.
I found working with Wiley, Chichester, a pleasant experience, and an education into
the many aspects of writing and publishing a textbook. I would also like to thank my
students and colleagues, who encouraged and inspired me to write this book. I thank all
PREFACE                                   xiii


the reviewers for finding the errors in the draft manuscript, and for providing many
constructive suggestions. Writing this book would have been impossible without the
constant support of my wife, Prachi, and my little daughter, Manya, whose total age
in months closely followed the number of chapters as they were being written.


                                                                     Ashish Tewari
This page intentionally left blank
1
Introduction

1.1 What is Control?
When we use the word control in everyday life, we are referring to the act of producing a
desired result. By this broad definition, control is seen to cover all artificial processes. The
temperature inside a refrigerator is controlled by a thermostat. The picture we see on the
television is a result of a controlled beam of electrons made to scan the television screen
in a selected pattern. A compact-disc player focuses a fine laser beam at the desired spot
on the rotating compact-disc in order to produce the desired music. While driving a car,
the driver is controlling the speed and direction of the car so as to reach the destination
quickly, without hitting anything on the way. The list is endless. Whether the control is
automatic (such as in the refrigerator, television or compact-disc player), or caused by a
human being (such as the car driver), it is an integral part of our daily existence. However,
control is not confined to artificial processes alone. Imagine living in a world where
the temperature is unbearably hot (or cold), without the life-supporting oxygen, water or
sunlight. We often do not realize how controlled the natural environment we live in is. The
composition, temperature and pressure of the earth's atmosphere are kept stable in their
livable state by an intricate set of natural processes. The daily variation of temperature
caused by the sun controls the metabolism of all living organisms. Even the simplest
life form is sustained by unimaginably complex chemical processes. The ultimate control
system is the human body, where the controlling mechanism is so complex that even
while sleeping, the brain regulates the heartbeat, body temperature and blood-pressure by
countless chemical and electrical impulses per second, in a way not quite understood yet.
(You have to wonder who designed that control system!) Hence, control is everywhere
we look, and is crucial for the existence of life itself.
    A study of control involves developing a mathematical model for each component of
the control system. We have twice used the word system without defining it. A system
is a set of self-contained processes under study. A control system by definition consists
of the system to be controlled - called the plant - as well as the system which exercises
control over the plant, called the controller. A controller could be either human, or an
artificial device. The controller is said to supply a signal to the plant, called the input to
the plant (or the control input), in order to produce a desired response from the plant,
called the output from the plant. When referring to an isolated system, the terms input and
output are used to describe the signal that goes into a system, and the signal that comes
out of a system, respectively. Let us take the example of the control system consisting
of a car and its driver. If we select the car to be the plant, then the driver becomes the
INTRODUCTION


controller, who applies an input to the plant in the form of pressing the gas pedal if it
is desired to increase the speed of the car. The speed increase can then be the output
from the plant. Note that in a control system, what control input can be applied to the
plant is determined by the physical processes of the plant (in this case, the car's engine),
but the output could be anything that can be directly measured (such as the car's speed
or its position). In other words, many different choices of the output can be available
at the same time, and the controller can use any number of them, depending upon the
application. Say if the driver wants to make sure she is obeying the highway speed limit,
she will be focusing on the speedometer. Hence, the speed becomes the plant output. If
she wants to stop well before a stop sign, the car's position with respect to the stop sign
becomes the plant output. If the driver is overtaking a truck on the highway, both the
speed and the position of the car vis-d-vis the truck are the plant outputs. Since the plant
output is the same as the output of the control system, it is simply called the output when
referring to the control system as a whole. After understanding the basic terminology of
the control system, let us now move on to see what different varieties of control systems
there are.


1.2 Open-Loop and Closed-Loop Control Systems
Let us return to the example of the car driver control system. We have encountered the
not so rare breed of drivers who generally boast of their driving skills with the following
words: "Oh I am so good that I can drive this car with my eyes closed!" Let us imagine
we give such a driver an opportunity to live up to that boast (without riding with her,
of course) and apply a blindfold. Now ask the driver to accelerate to a particular speed
(assuming that she continues driving in a straight line). While driving in this fashion,
the driver has absolutely no idea about what her actual speed is. By pressing the gas
pedal (control input) she hopes that the car's speed will come up to the desired value,
but has no means of verifying the actual increase in speed. Such a control system, in
which the control input is applied without the knowledge of the plant output, is called
an open-loop control system. Figure 1.1 shows a block-diagram of an open-loop control
system, where the sub-systems (controller and plant) are shown as rectangular blocks, with
arrows indicating input and output to each block. By now it must be clear that an open-
loop controller is like a rifle shooter who gets only one shot at the target. Hence, open-loop
control will be successful only if the controller has a pretty good prior knowledge of the
behavior of the plant, which can be defined as the relationship between the control input

               UBbirtJU uuipui                    l/UIUIUI IMJJUl

                 (desired                          (gas pedal                   (speed)
                  speed)                              force)
                                  Controller                         Plant
                                   (driver)                          (car)




Figure 1.1 An open-loop control system: the controller applies the control input without knowing the
plant output
OPEN-LOOP AND CLOSED-LOOP CONTROL SYSTEMS


and the plant output. If one knows what output a system will produce when a known
input is applied to it, one is said to know the system's behavior.
    Mathematically, the relationship between the output of a linear plant and the control
input (the system's behavior) can be described by a transfer function (the concepts of
linear systems and transfer functions are explained in Chapter 2). Suppose the driver
knows from previous driving experience that, to maintain a speed of 50 kilometers per
hour, she needs to apply one kilogram of force on the gas pedal. Then the car's transfer
function is said to be 50 km/hr/kg. (This is a very simplified example. The actual car
is not going to have such a simple transfer function.} Now, if the driver can accurately
control the force exerted on the gas pedal, she can be quite confident of achieving her
target speed, even though blindfolded. However, as anybody reasonably experienced with
driving knows, there are many uncertainties - such as the condition of the road, tyre
pressure, the condition of the engine, or even the uncertainty in gas pedal force actually
being applied by the driver - which can cause a change in the car's behavior. If the
transfer function in the driver's mind was determined on smooth roads, with properly
inflated tyres and a well maintained engine, she is going to get a speed of less than
50 krn/hr with 1 kg force on the gas pedal if, say, the road she is driving on happens to
have rough patches. In addition, if a wind happens to be blowing opposite to the car's
direction of motion, a further change in the car's behavior will be produced. Such an
unknown and undesirable input to the plant, such as road roughness or the head-wind, is
called a noise. In the presence of uncertainty about the plant's behavior, or due to a noise
(or both), it is clear from the above example that an open-loop control system is unlikely
to be successful.
    Suppose the driver decides to drive the car like a sane person (i.e. with both eyes
wide open). Now she can see her actual speed, as measured by the speedometer. In this
situation, the driver can adjust the force she applies to the pedal so as to get the desired
speed on the speedometer; it may not be a one shot approach, and some trial and error
might be required, causing the speed to initially overshoot or undershoot the desired value.
However, after some time (depending on the ability of the driver), the target speed can be
achieved (if it is within the capability of the car), irrespective of the condition of the road
or the presence of a wind. Note that now the driver - instead of applying a pre-determined
control input as in the open-loop case - is adjusting the control input according to the
actual observed output. Such a control system in which the control input is a function
of the plant's output is called a closed-loop system. Since in a closed-loop system the
controller is constantly in touch with the actual output, it is likely to succeed in achieving
the desired output even in the presence of noise and/or uncertainty in the linear plant's
behavior (transfer-function). The mechanism by which the information about the actual
output is conveyed to the controller is called feedback. On a block-diagram, the path
from the plant output to the controller input is called a feedback-loop. A block-diagram
example of a possible closed-loop system is given in Figure 1.2.
   Comparing Figures 1.1 and 1.2, we find a new element in Figure 1.2 denoted by a circle
before the controller block, into which two arrows are leading and out of which one arrow
is emerging and leading to the controller. This circle is called a summing junction, which
adds the signals leading into it with the appropriate signs which are indicated adjacent to
the respective arrowheads. If a sign is omitted, a positive sign is assumed. The output of
INTRODUCTION


                 Desired                       Control input (u)           Output (y)
                 output                          (gas pedal                 (speed)
                                                    rorcej
                                  Controller                       Plant
                                   (driver)                        (car)




                                          Feedback loop

Figure 1.2 Example of a closed-loop control system with feedback; the controller applies a control
input based on the plant output


 the summing junction is the arithmetic sum of its two (or more) inputs. Using the symbols
 u (control input), y (output), and yd (desired output), we can see in Figure 1.2 that the
 input to the controller is the error signal (yd — y). In Figure 1.2, the controller itself is a
 system which produces an output (control input), u, based upon the input it receives in
 the form of (yd — y)- Hence, the behavior of a linear controller could be mathematically
 described by its transfer-function, which is the relationship between u and (yd — .v)- Note
 that Figure 1.2 shows only a popular kind of closed-loop system. In other closed-loop
 systems, the input to the controller could be different from the error signal (yd — y).
The controller transfer-function is the main design parameter in the design of a control
 system and determines how rapidly - and with what maximum overshoot (i.e. maximum
 value of | yd — y|) - the actual output, y, will become equal to the desired output, yd- We
will see later how the controller transfer-function can be obtained, given a set of design
requirements. (However, deriving the transfer-function of a human controller is beyond
the present science, as mentioned in the previous section.) When the desired output, yd, is
a constant, the resulting controller is called a regulator. If the desired output is changing
with time, the corresponding control system is called a tracking system. In any case, the
principal task of a closed-loop controller is to make (yd — y) = 0 as quickly as possible.
Figure 1.3 shows a possible plot of the actual output of a closed-loop control system.
    Whereas the desired output yd has been achieved after some time in Figure 1.3, there
is a large maximum overshoot which could be unacceptable. A successful closed-loop
controller design should achieve both a small maximum overshoot, and a small error
magnitude |yd — y| as quickly as possible. In Chapter 4 we will see that the output of a
linear system to an arbitrary input consists of a fluctuating sort of response (called the
transient response), which begins as soon as the input is applied, and a settled kind of
response (called the steady-state response) after a long time has elapsed since the input
was initially applied. If the linear system is stable, the transient response would decay
to zero after sometime (stability is an important property of a system, and is discussed
in Section 2.8), and only the steady-state response would persist for a long time. The
transient response of a linear system depends largely upon the characteristics and the
initial state of the system, while the steady-state response depends both upon system's
characteristics and the input as a function of time, i.e. u(t). The maximum overshoot is
a property of the transient response, but the error magnitude | yd — y| at large time (or in
the limit t —>• oo) is a property of the steady-state response of the closed-loop system. In
OPEN-LOOP AND CLOSED-LOOP CONTROL SYSTEMS




                                                              Desired output, yd




                    u
                                               Time (f)

Figure 1.3 Example of a closed-loop control system's response; the desired output is achieved after
some time, but there is a large maximum overshoot


Figure 1.3 the steady-state response asymptotically approaches a constant yd in the limit
t -> oo.
    Figure 1.3 shows the basic fact that it is impossible to get the desired output imme-
diately. The reason why the output of a linear, stable system does not instantaneously
settle to its steady-state has to do with the inherent physical characteristics of all prac-
tical systems that involve either dissipation or storage of energy supplied by the input.
Examples of energy storage devices are a spring in a mechanical system, and a capacitor
in an electrical system. Examples of energy dissipation processes are mechanical friction,
heat transfer, and electrical resistance. Due to a transfer of energy from the applied input
to the energy storage or dissipation elements, there is initially a fluctuation of the total
energy of the system, which results in the transient response. As the time passes, the
energy contribution of storage/dissipative processes in a stable system declines rapidly,
and the total energy (hence, the output) of the system tends to the same function of time
as that of the applied input. To better understand this behavior of linear, stable systems,
consider a bucket with a small hole in its bottom as the system. The input is the flow
rate of water supplied to the bucket, which could be a specific function of time, and the
output is the total flow rate of water coming out of the bucket (from the hole, as well
as from the overflowing top). Initially, the bucket takes some time to fill due to the hole
(dissipative process) and its internal volume (storage device). However, after the bucket
is full, the output largely follows the changing input.
    While the most common closed-loop control system is the feedback control system, as
shown in Figure 1.2, there are other possibilities such as the feedforward control system.
In a feedforward control system - whose example is shown in Figure 1.4 - in addition
to a feedback loop, a feedforward path from the desired output (y^) to the control input
is generally employed to counteract the effect of noise, or to reduce a known undesirable
plant behavior. The feedforward controller incorporates some a priori knowledge of the
plant's behavior, thereby reducing the burden on the feedback controller in controlling
INTRODUCTION


                                                       Disturbance
                                      Feedforward
                                        controller
                                                           K
                                                         + A Control input (u)
                                      (engine RPM        *J          (fuel flow)
                                        governor)                    /
               Desired-
                                                         +          /           Output(y)
                output
                  (yd)_   +
                              p—
                                        Feedback
                                        controller
                                         (driver +
                                                         *S^JL-/
                                                                r
                                                                    » Plant
                                                                       (car)
                                                                                 ( speed)
                                                                                   —>-
                                        gas pedal)



                                               Feedback loop

Figure 1.4 A closed-loop control system with a feedforward path; the engine RPM governor takes
care of the fuel flow disturbance, leaving the driver free to concentrate on achieving desired speed with
gas pedal force


the plant. Note that if the feedback controller is removed from Figure 1.4, the resulting
control system becomes open-loop type. Hence, a feedforward control system can be
regarded as a hybrid of open and closed-loop control systems. In the car driver example,
the feedforward controller could be an engine rotational speed governor that keeps the
engine's RPM constant in the presence of disturbance (noise) in the fuel flow rate caused
by known imperfections in the fuel supply system. This reduces the burden on the driver,
who would have been required to apply a rapidly changing gas pedal force to counteract
the fuel supply disturbance if there was no feedforward controller. Now the feedback
controller consists of the driver and the gas-pedal mechanism, and the control input is the
fuel flow into the engine, which is influenced by not only the gas-pedal force, but also by
the RPM governor output and the disturbance. It is clear from the present example that
many practical control systems can benefit from the feedforward arrangement.
   In this section, we have seen that a control system can be classified as either open- or
closed-loop, depending upon the physical arrangement of its components. However, there
are other ways of classifying control systems, as discussed in the next section.


1.3 Other Classifications of Control Systems
Apart from being open- or closed-loop, a control system can be classified according to
the physical nature of the laws obeyed by the system, and the mathematical nature of the
governing differential equations. To understand such classifications, we must define the
state of a system, which is the fundamental concept in modern control. The state of a
system is any set of physical quantities which need to be specified at a given time in order
to completely determine the behavior of the system. This definition is a little confusing,
because it introduces another word, determine, which needs further explanation given in
the following paragraph. We will return to the concept of state in Chapter 3, but here let
us only say that the state is all the information we need about a system to tell what the
system is doing at any given time. For example, if one is given information about the
speed of a car and the positions of other vehicles on the road relative to the car, then
OTHER CLASSIFICATIONS OF CONTROL SYSTEMS


one has sufficient information to drive the car safely. Thus, the state of such a system
consists of the car's speed and relative positions of other vehicles. However, for the same
system one could choose another set of physical quantities to be the system's state, such
as velocities of all other vehicles relative to the car, and the position of the car with
respect to the road divider. Hence, by definition the state is not a unique set of physical
quantities.
    A control system is said to be deterministic when the set of physical laws governing the
system are such that if the state of the system at some time (called the initial conditions)
and the input are specified, then one can precisely predict the state at a later time. The laws
governing a deterministic system are called deterministic laws. Since the characteristics of
a deterministic system can be found merely by studying its response to initial conditions
(transient response), we often study such systems by taking the applied input to be zero.
A response to initial conditions when the applied input is zero depicts how the system's
state evolves from some initial time to that at a later time. Obviously, the evolution of
only a deterministic system can be determined. Going back to the definition of state, it is
clear that the latter is arrived at keeping a deterministic system in mind, but the concept of
state can also be used to describe systems that are not deterministic. A system that is not
deterministic is either stochastic, or has no laws governing it. A stochastic (also called
probabilistic) system has such governing laws that although the initial conditions (i.e.
state of a system at some time) are known in every detail, it is impossible to determine
the system's state at a later time. In other words, based upon the stochastic governing
laws and the initial conditions, one could only determine the probability of a state, rather
than the state itself. When we toss a perfect coin, we are dealing with a stochastic law that
states that both the possible outcomes of the toss (head or tail) have an equal probability
of 50 percent. We should, however, make a distinction between a physically stochastic-
system, and our ability (as humans) to predict the behavior of a deterministic system based
upon our measurement of the initial conditions and our understanding of the governing
laws. Due to an uncertainty in our knowledge of the governing deterministic laws, as
well as errors in measuring the initial conditions, we will frequently be unable to predict
the state of a deterministic system at a later time. Such a problem of unpredictability is
highlighted by a special class of deterministic systems, namely chaotic systems. A system
is called chaotic if even a small change in the initial conditions produces an arbitrarily
large change in the system's state at a later time.
    An example of chaotic control systems is a double pendulum (Figure 1.5). It consists
of two masses, m and mi, joined together and suspended from point O by two rigid
massless links of lengths LI and L2 as shown. Here, the state of the system can be
defined by the angular displacements of the two links, 0(t} and #2(0. as well as their
respective angular velocities, 0 t) and #7( }(t). (In this book, the notation used for
representing a &th order time derivative of /(r) is f ( k ) ( t ) , i.e. dkf(t)/dtk = f{k}(t).
Thus, 0j (1) (0 denotes dO(t)/dt, etc.) Suppose we do not apply an input to the system,
and begin observing the system at some time, t = 0, at which the initial conditions are,
say, 6*i(0) = 40°, 02(0) = 80°, #, (l) (0) = 0°/s, and 0^1)(0) = 0°/s. Then at a later time,
say after 100 s, the system's state will be very much different from what it would have
been if the initial conditions were, say, 0j(0) = 40.01°, 6>2(0) = 80°, 6>,(1)(0) = 0°/s, and
0( ^(0) = 0°/s. Figure 1.6 shows the time history of the angle Oi(t) between 85 s and 100 s
INTRODUCTION




Figure 1.5 A double pendulum is a chaotic system because a small change in its initial conditions
produces an arbitrarily large change in the system's state after some time




                     -100
                                           90                95                100
                                                  Time (s)

Figure 1.6 Time history between 85 s and 100 s of angle QI of a double pendulum with mi = 1 kg,
m-i = 2 kg, LI = 1 m, and 1-2 = 2 m for the two sets of initial conditions #1 (0) = 40°, #2(0) = 80°,
0J1)(0) = 0%, 0^(0) = 0% and 0,(0) = 40.01°, 02(0) = 80°, 0,(1|(0) = 0%, 0^(0) =0%.
respectively


for the two sets of initial conditions, for a double pendulum with m — 1 kg, mi = 2 kg,
LI = 1 m, and LI = 2 m. Note that we know the governing laws of this deterministic
system, yet we cannot predict its state after a given time, because there will always be
some error in measuring the initial conditions. Chaotic systems are so interesting that they
have become the subject of specialization at many physics and engineering departments.
   Any unpredictable system can be mistaken to be a stochastic system. Taking the
car driver example of Section 1.2, there may exist deterministic laws that govern the
road conditions, wind velocity, etc., but our ignorance about them causes us to treat
such phenomena as random noise, i.e. stochastic processes. Another situation when a
deterministic system may appear to be stochastic is exemplified by the toss of a coin
deliberately loaded to fall every time on one particular side (either head or tail). An
OTHER CLASSIFICATIONS OF CONTROL SYSTEMS


unwary spectator may believe such a system to be stochastic, when actually it is very
much deterministic!
   When we analyze and design control systems, we try to express their governing physical
laws by differential equations. The mathematical nature of the governing differential
equations provides another way of classifying control systems. Here we depart from the
realm of physics, and delve into mathematics. Depending upon whether the differential
equations used to describe a control system are linear or nonlinear in nature, we can call
the system either linear or nonlinear. Furthermore, a control system whose description
requires partial differential equations is called a distributed parameter system, whereas a
system requiring only ordinary differential equations is called a lumped parameter system.
A vibrating string, or a membrane is a distributed parameter system, because its properties
(mass and stiffness) are distributed in space. A mass suspended by a spring is a lumped
parameter system, because its mass and stiffness are concentrated at discrete points in
space. (A more common nomenclature of distributed and lumped parameter systems is
continuous and discrete systems, respectively, but we avoid this terminology in this book
as it might be confused with continuous time and discrete time systems.) A particular
system can be treated as linear, or nonlinear, distributed, or lumped parameter, depending
upon what aspects of its behavior we are interested in. For example, if we want to study
only small angular displacements of a simple pendulum, its differential equation of motion
can be treated to be linear; but if large angular displacements are to be studied, the same
pendulum is treated as a nonlinear system. Similarly, when we are interested in the motion
of a car as a whole, its state can be described by only two quantities: the position and
the velocity of the car. Hence, it can be treated as a lumped parameter system whose
entire mass is concentrated at one point (the center of mass). However, if we want to
take into account how the tyres of the car are deforming as it moves along an uneven
road, the car becomes a distributed parameter system whose state is described exactly by
an infinite set of quantities (such as deformations of all the points on the tyres, and their
time derivatives, in addition to the speed and position of the car). Other classifications
based upon the mathematical nature of governing differential equations will be discussed
in Chapter 2.
   Yet another way of classifying control systems is whether their outputs are contin-
uous or discontinuous in time. If one can express the system's state (which is obtained
by solving the system's differential equations) as a continuous function of time, the
system is called continuous in time (or analog system). However, a majority of modern
control systems produce outputs that 'jump' (or are discontinuous) in time. Such control
systems are called discrete in time (or digital systems). Note that in the limit of very small
time steps, a digital system can be approximated as an analog system. In this book, we
will make this assumption quite often. If the time steps chosen to sample the discontin-
uous output are relatively large, then a digital system can have a significantly different
behaviour from that of a corresponding analog system. In modern applications, even
analog controllers are implemented on a digital processor, which can introduce digital
characteristics to the control system. Chapter 8 is devoted to the study of digital systems.
   There are other minor classifications of control systems based upon the systems' char-
acteristics, such as stability, controllability, observability, etc., which we will take up
in subsequent chapters. Frequently, control systems are also classified based upon the
10                                       INTRODUCTION


number of inputs and outputs of the system, such as single-input, single-output system,
or two-input, three-output system, etc. In classical control (an object of Chapter 2)
the distinction between single-input, single-output (SISO) and multi-input, multi-output
(MIMO) systems is crucial.


 1.4 On the Road to Control System Analysis
     and Design
 When we find an unidentified object on the street, the first thing we may do is prod or poke
 it with a stick, pick it up and shake it, or even hit it with a hammer and hear the sound it
 makes, in order to find out something about it. We treat an unknown control system in a
 similar fashion, i.e. we apply some well known inputs to it and carefully observe how it
 responds to those inputs. This has been an age old method of analyzing a system. Some
 of the well known inputs applied to study a system are the singularity functions, thus
called due to their peculiar nature of being singular in the mathematical sense (their time
 derivative tends to infinity at some time). Two prominent members of this zoo are the unit
step function and the unit impulse function. In Chapter 2, useful computer programs are
presented to enable you to find the response to impulse and step inputs - as well as the
response to an arbitrary input - of a single-input, single-output control system. Chapter 2
also discusses important properties of a control system, namely, performance, stability,
and robustness, and presents the analysis and design of linear control systems using the
classical approach of frequency response, and transform methods. Chapter 3 introduces
the state-space modeling for linear control systems, covering various applications from
all walks of engineering. The solution of a linear system's governing equations using
the state-space method is discussed in Chapter 4. In this chapter, many new computer
programs are presented to help you solve the state-equations for linear or nonlinear
systems.
    The design of modern control systems using the state-space approach is introduced in
Chapter 5, which also discusses two important properties of a plant, namely its controlla-
bility and observability. In this chapter, it is first assumed that all the quantities defining
the state of a plant (called state variables) are available for exact measurement. However,
this assumption is not always practical, since some of the state variables may not be
measurable. Hence, we need a procedure for estimating the unmeasurable state variables
from the information provided by those variables that we can measure. Later sections of
Chapter 5 contains material about how this process of state estimation is carried out by
an observer, and how such an estimation can be incorporated into the control system in
the form of a compensator. Chapter 6 introduces the procedure of designing an optimal
control system, which means a control system meeting all the design requirements in
the most efficient manner. Chapter 6 also provides new computer programs for solving
important optimal control problems. Chapter 7 introduces the treatment of random signals
generated by stochastic systems, and extends the philosophy of state estimation to plants
with noise, which is treated as a random signal. Here we also learn how an optimal
state estimation can be carried out, and how a control system can be made robust with
respect to measurement and process noise. Chapter 8 presents the design and analysis of
MATLAB, SIMULINK, AND THE CONTROL SYSTEM TOOLBOX


digital control systems (also called discrete time systems), and covers many modern digital
control applications. Finally, Chapter 9 introduces various advanced topics in modern
control, such as advanced robust control techniques, nonlinear control, etc. Some of the
topics contained in Chapter 9, such as input shaping control and rate-weighted optimal
control, are representative of the latest control techniques.
   At the end of each chapter (except Chapter 1), you will find exercises that help you
grasp the essential concepts presented in the chapter. These exercises range from analytical
to numerical, and are designed to make you think, rather than apply ready-made formulas
for their solution. At the end of the book, answers to some numerical exercises are
provided to let you check the accuracy of your solutions.




Modern control design and analysis requires a lot of linear algebra (matrix multipli-
cation, inversion, calculation of eigenvalues and eigenvectors, etc.) which is not very
easy to perform manually. Try to remember the last time you attempted to invert a
4 x 4 matrix by hand! It can be a tedious process for any matrix whose size is greater
than 3 x 3 . The repetitive linear algebraic operations required in modern control design
and analysis are, however, easily implemented on a computer with the use of standard
programming techniques. A useful high-level programming language available for such
tasks is the MATLAB®, which not only provides the tools for carrying out the matrix
operations, but also contains several other features, such as the time-step integration
of linear or nonlinear governing differential equations, which are invaluable in modern
control analysis and design. For example, in Figure 1.6 the time-history of a double-
pendulum has been obtained by solving the coupled governing nonlinear differential
equations using MATLAB. Many of the numerical examples contained in this book have
been solved using MATLAB. Although not required for doing the exercises at the end of
each chapter, it is recommended that you familiarize yourself with this useful language
with the help of Appendix A, which contains information about the commonly used
MATLAB operators in modern control applications. Many people, who shied away from
modern control courses because of their dread of linear algebra, began taking interest
in the subject when MATLAB became handy. Nowadays, personal computer versions of
MATLAB are commonly applied to practical problems across the board, including control
of aerospace vehicles, magnetically levitated trains, and even stock-market applications.
You may find MATLAB available at your university's or organization's computer center.
While Appendix A contains useful information about MATLAB which will help you in
solving most of the modern control problems, it is recommended that you check with
the MATLAB user's guide [1] at your computer center for further details that may be
required for advanced applications.
   SIMULINK® is a very useful Graphical Users Interface (GUI) tool for modeling control
systems, and simulating their time response to specified inputs. It lets you work directly
with the block-diagrams (rather than mathematical equations) for designing and analyzing

® MATLAB, SIMULINK and Control System Toolbox are registered trademarks of MathWorks, Inc.
12                                    INTRODUCTION


 control systems. For this purpose, numerous linear and nonlinear blocks, input sources,
  and output devices are available, so that you can easily put together almost any practical
 control system. Another advantage of using SIMULINK is that it works seamlessly with
 MATLAB, and can draw upon the vast programming features and function library of
 MATLAB. A SIMULINK block-diagram can be converted into a MATLAB program
 (called M-file). In other words, a SIMULINK block-diagram does all the programming
 for you, so that you are free to worry about other practical aspects of a control system's
 design and implementation. With advanced features (such as the Real Time Workshop for
 C-code generation, and specialized block-sets) one can also use SIMULINK for practical
 implementation of control systems [2]. We will be using SIMULINK as a design and
 analysis tool, especially in simulating the response of a control system designed with
 MATLAB.
    For solving many problems in control, you will find the Control System Toolbox® [3]
 for MATLAB very useful. It contains a set of MATLAB M-files of numerical procedures
 that are commonly used to design and analyze modern control systems. The Control
 System Toolbox is available at a small extra cost when you purchase MATLAB, and is
 likely to be installed at your computer center if it has MATLAB. Many solved examples
 presented in this book require the Control System Toolbox. In the solved examples,
 effort has been made to ensure that the application of MATLAB is clear and direct. This
 is done by directly presenting the MATLAB line commands - and some MATLAB M-
files - followed by the numerical values resulting after executing those commands. Since
the commands are presented exactly as they would appear in a MATLAB workspace, the
reader can easily reproduce all the computations presented in the book. Again, take some
time to familiarize yourself with MATLAB, SIMULINK and the Control System Toolbox
by reading Appendix A.


References
1. MATLAB® 6.0 - User's Guide, The Math Works Inc., Natick, MA, USA, 2000.
2. SIMULINK® 4.0 - User's Guide, The Math Works Inc., Natick, MA, USA, 2000.
3. Control System Toolbox 5.0 for Use with MATLAB® - User's Guide, The Math Works Inc.
   Natick, MA, USA, 2000.
2


It was mentioned in Chapter 1 that we need differential equations to describe the behavior
of a system, and that the mathematical nature of the governing differential equations is
another way of classifying control systems. In a large class of engineering applications,
the governing differential equations can be assumed to be linear. The concept of linearity
is one of the most important assumptions often employed in studying control systems.
However, the following questions naturally arise: what is this assumption and how valid
is it anyway? To answer these questions, let us consider lumped parameter systems
for simplicity, even though all the arguments presented below are equally applicable
to distributed systems. (Recall that lumped parameter systems are those systems whose
behavior can be described by ordinary differential equations.) Furthermore, we shall
confine our attention (until Section 2.13) to single-input, single-output (SISO) systems.
For a general lumped parameter, SISO system (Figure 2.1) with input u(t} and output
y ( t ) , the governing ordinary differential equation can be written as
                                                         M
                                                             ( 0 , um-(t), . . . , « ( r ) , i«(0, 0
                                                                                            (2.1)
where y(k} denotes the &th derivative of y(t) with respect to time, t, e.g. v (n) = dny/dt",
y(n~l) = d"~ly/dt"~l, and u(k) denotes the fcth time derivative of u(t). This notation for
derivatives of a function will be used throughout the book. In Eq. (2.1), /() denotes a
function of all the time derivatives of y ( t ) of order (n — 1) and less, as well as the time
derivatives of u(t) of order m and less, and time, t. For most systems m < n, and such
systems are said to be proper.
   Since n is the order of the highest time derivative of y(f) in Eq. (2.1), the
system is said to be of order n. To determine the output y ( t ) , Eq. (2.1) must be
somehow integrated in time, with u(t) known and for specific initial conditions
j(0), j (1) (0), .y(2)(0), . . . , y("-l)(G). Suppose we are capable of solving Eq. (2.1), given
any time varying input, u(t), and the initial conditions. For simplicity, let us assume that
the initial conditions are zero, and we apply an input, u(t), which is a linear combination
of two different inputs, u(t), and U2(t), given by

                                   U(t) = CU(t) +C2«2(0                                      (2.2)
14                         UNEAR SYSTEMS AND CLASSICAL CONTROL



                    Input u(t)          Lumped parameter           Output y(t)
                                            system


         Figure 2.1 A general lumped parameter system with input, u(f), and output, y(f)


where c and c2 are constants. If the resulting output, y(t ), can be written as

                                                      c2y2(t)                              (2.3)

where y  ( t ) is the output when u(t) is the input, and y2(t) is the output when 1*2(1) is the
input, then the system is said to be linear, otherwise it is called nonlinear. In short, a linear
system is said to obey the superposition principle, which states that the output of a linear
system to an input consisting of linear combination of two different inputs (Eq. (2.2))
can be obtained by linearly superposing the outputs to the respective inputs (Eq. (2.3)).
(The superposition principle is also applicable for non-zero initial conditions, if the initial
conditions on y(t ) and its time derivatives are linear combinations of the initial conditions
on y(t) and y2(t), and their corresponding time derivatives, with the constants c and
c2.) Since linearity is a mathematical property of the governing differential equations,
it is possible to say merely by inspecting the differential equation whether a system is
linear. If the function /() in Eq. (2.1) contains no powers (other than one) of y(t) and
its derivatives, or the mixed products of y ( t ) , its derivatives, and u(t) and its derivatives,
or transcendental functions of j(0 and u(t), then the system will obey the superposition
principle, and its linear differential equation can be written as

                 any(n)(t) + an-iy(n-])(t) + • • • + aiy™(t) + a*y(t)
                                                                                           (2-4)
    Note that even though the coefficients OQ, a , . . . , an and bo,b , . . . ,bm (called the
parameters of a system) in Eq. (2.4) may be varying with time, the system given by
Eq. (2.4) is still linear. A system with time-varying parameters is called a time-varying
system, while a system whose parameters are constant with time is called time-invariant
system. In the present chapter, we will be dealing only with linear, time-invariant systems.
It is possible to express Eq. (2.4) as a set of lower order differential equations, whose
individual orders add up to n. Hence, the order of a system is the sum of orders of all
the differential equations needed to describe its behavior.

   Example 2.1
   For an electrical network shown in Figure 2.2, the governing differential equations
   are the following:

                                                                  3)   + e(t)/(RC)   (2.5a)
             l
          v2 t) = ui(0/(C 2 /? 3 ) - (W2(0/C 2 )(1//J 2 + l/*3) + e(t)/(R2C2)         (2.5b)
HOW VALID IS THE ASSUMPTION OF LINEARITY?                                               15




                                                                                              e(t)




                       Figure 2.2         Electrical network for Example 2.1


where v(t) and i>2(0 are the voltages of the two capacitors, C and €2, e(t) is the
applied voltage, and R, R2, and R^ are the three resistances as shown.
   On inspection of Eq. (2.5), we can see that the system is described by two first
order, ordinary differential equations. Therefore, the system is of second order.
Upon the substitution of Eq. (2.5b) into Eq. (2.5a), and by eliminating v2, we get
the following second order differential equation:

                                                1 + (Ci/C2)(R3/R2 +
                                 l/R3)(R3/Ri + 1) - l/R3]vi(t)
                                             l/R3)e(t)/C2 + (R3/Ri)                                   (2.6)

Assuming y(t) = v(t) and u(t) — e(t), and comparing Eq. (2.6) with Eq. (2.4), we
can see that there are no higher powers, transcendental functions, or mixed products
of the output, input, and their time derivatives. Hence, the system is linear.
     Suppose we do not have an input, u(t), applied to the system in Figure 2.1.
Such a system is called an unforced system. Substituting u(t) = u ( l ) ( t ) = u(2)(t) —
. . . = u(m}(t) = 0 into Eq. (2.1) we can obtain the following governing differential
equation for the unforced system:

        yW(t)   = f ( y ( n ~ l ) ( t ) , y("-2)(t), ..., y ( 1 ) (/), v(/), 0, 0, . . . , 0, 0, t)   (2.7)

In general, the solution, y ( t ) , to Eq. (2.7) for a given set of initial conditions is
a function of time. However, there may also exist special solutions to Eq. (2.7)
which are constant. Such constant solutions for an unforced system are called its
equilibrium points, because the system continues to be at rest when it is already
at such points. A large majority of control systems are designed for keeping a
plant at one of its equilibrium points, such as the cruise-control system of a car
and the autopilot of an airplane or missile, which keep the vehicle moving at a
constant velocity. When a control system is designed for maintaining the plant at
an equilibrium point, then only small deviations from the equilibrium point need to
be considered for evaluating the performance of such a control system. Under such
circumstances, the time behavior of the plant and the resulting control system can
generally be assumed to be governed by linear differential equations, even though
16                         LINEAR SYSTEMS AND CLASSICAL CONTROL


     the governing differential equations of the plant and the control system may be
     nonlinear. The following examples demonstrate how a nonlinear system can be
     linearized near its equilibrium points. Also included is an example which illustrates
     that such a linearization may not always be possible.

     Example 2.2
     Consider a simple pendulum (Figure 2.3) consisting of a point mass, m, suspended
     from hinge at point O by a rigid massless link of length L. The equation of motion
     of the simple pendulum in the absence of an externally applied torque about point
     O in terms of the angular displacement, 0(t), can be written as

                                   L0(2)(» + g.sin(6>(/))=0                            (2.8)

     This governing equation indicates a second-order system. Due to the presence of
     sin(#) - a transcendental function of 6 - Eq. (2.8) is nonlinear. From our everyday
     experience with a simple pendulum, it is clear that it can be brought to rest at only
     two positions, namely 0 = 0 and 9 = n rad. (180°). Therefore, these two positions
     are the equilibrium points of the system given by Eq. (2.8). Let us examine the
     behavior of the system near each of these equilibrium points.
        Since the only nonlinear term in Eq. (2.8) is sin(0), if we can show that sin(0) can
     be approximated by a linear term, then Eq. (2.8) can be linearized. Expanding sin(0)
     about the equilibrium point 0 = 0, we get the following Taylor's series expansion:

                         sin(6>) =8- 03/3! + 05/5l - B1 /1 + • • •                    (2.9)

        If we assume that motion of the pendulum about 0=0 consists of small angular
     displacements (say 0 < 10°), then sin(0) ^ 0, and Eq. (2.8) becomes

                                                          0                          (2.10)




                                             e =o

                      Figure 2.3    A simple pendulum of length L and mass m
HOW VALID IS THE ASSUMPTION OF LINEARITY?                                    17


   Similarly, expanding sin(#) about the other equilibrium point, 0 = n, by assuming
   small angular displacement, 0, such that B — n — 0, and noting that sin(0) =
   — sin(0) % —0, we can write Eq. (2.8) as

                                                                                            (2.11)

       We can see that both Eqs. (2.10) and (2.11) are linear. Hence, the nonlinear
   system given by Eq. (2.8) has been linearized about both of its equilibrium points.
   Second order linear ordinary differential equations (especially the homogeneous ones
   like Eqs. (2.10) and (2.11)) can be be solved analytically. It is well known (and you
   may verify) that the solution to Eq. (2.10) is of the form 9(t) = A. sin(f (g/L) 1/2 +
   B.cos(t(g/L)1/2), where the constants A and B are determined from the initial
   conditions, $(0) and <9(1)(0). This solution implies that 9(t) oscillates about the
   equilibrium point 0=0. However, the solution to Eq. (2.11) is of the form 0(0 =
   C. exp(?(g/L)'/ 2 ), where C is a constant, which indicates an exponentially increasing
   0(0 if </>(0) ^ 0. (This nature of the equilibrium point at 9 = JT can be experimen-
   tally verified by anybody trying to stand on one's head for any length of time!)
   The comparison of the solutions to the linearized governing equations close to the
   equilibrium points (Figure 2.4) brings us to an important property of an equilibrium
   point, called stability.

           2.5

            2
                   /Solution to Eq. (2.11) with 0(0)
           1.5

             1                          Solution to Eq. (2.10) with 6(0) = 0.2


          0.5

            0

          -0.5

           —1
                            0.2             0.4            0.6            0.8
                                              Time (s)

   Figure 2.4 Solutions to the governing differential equation linearized about the two equilibrium
   points (9 = 0 and 9 = rt)


   Stability is defined as the ability of a system to approach one of its equilibrium points
once displaced from it. We will discuss stability in detail later. Here, suffice it to say
that the pendulum is stable about the equilibrium point 9 = 0, but unstable about the
equilibrium point 9 = n. While Example 2.2 showed how a nonlinear system can be
18                         LINEAR SYSTEMS AND CLASSICAL CONTROL


linearized close to its equilibrium points, the following example illustrates how a nonlinear
system's description can be transformed into a linear system description through a clever
change of coordinates.

     Example 2.3
     Consider a satellite of mass m in an orbit about a planet of mass M (Figure 2.5).
     The distance of the satellite from the center of the planet is denoted r(r), while its
     orientation with respect to the planet's equatorial plane is indicated by the angle
     0(t), as shown. Assuming there are no gravitational anomalies that cause a departure
     from Newton's inverse-square law of gravitation, the governing equation of motion
     of the satellite can be written as

                              r (2) (0 - h2/r(t)3 + k2/r(t)2 = 0                          (2.12)

     where h is the constant angular momentum, given by

                                 h = r(f) 2 0 (1) (f) = constant                          (2.13)

     and k — GM, with G being the universal gravitational constant.
        Equation (2.12) represents a nonlinear, second order system. However, since we
     are usually interested in the path (or the shape of the orbit) of the satellite, given
     by r(0), rather than its distance from the planet's center as a function of time, r(t),
     we can transform Eq. (2.12) to the following linear differential equation by using
     the co-ordinate transformation u(9) = l/r(0):

                                 u(2e) + u(0)-k2/h2 = 0                                  (2.14)

  Being a linear, second order ordinary differential equation (similar to Eq. (2.10)),
  Eq. (2.14) is easily solved for w(0), and the solution transformed back to r(0)




  Figure 2.5 A satellite of mass m in orbit around a planet of mass M at a distance r(f) from the
  planefs center, and azimuth angle 6(t) from the equatorial plane
HOW VALID IS THE ASSUMPTION OF LINEARITY?                                19


   given by

                           r(6») = (h2/k               A(h2 / k2) cos((9 - B)]             (2.15)

   where the constants A and B are determined from r(6} and r ( l ) ( 9 ) specified at given
   values of 9. Such specifications are called boundary conditions, because they refer
   to points in space, as opposed to initial conditions when quantities at given instants
   of time are specified. Equation (2.15) can represent a circle, an ellipse, a parabola,
   or a hyperbola, depending upon the magnitude of A(h2/k2) (called the eccentricity
   of the orbit).
      Note that we could also have linearized Eq. (2.12) about one of its equilibrium
   points, as we did in Example 2.2. One such equilibrium point is given by r(t) =
   constant, which represents a circular orbit. Many practical orbit control applications
   consist of minimizing deviations from a given circular orbit using rocket thrusters
   to provide radial acceleration (i.e. acceleration along the line joining the satellite
   and the planet) as an input, u(t), which is based upon the measured deviation from
   the circular path fed back to an onboard controller, as shown in Figure 2.6. In such
   a case, the governing differential equation is no longer homogeneous as Eq. (2.12),
   but has a non-homogeneous forcing term on the right-hand side given by

                                r ( 2 ) (f) - h2/r(t)3 + k2/r(t)2 = u(t]                   (2.16)

   Since the deviations from a given circular orbit are usually small, Eq. (2.16) can be
   suitably linearized about the equilibrium point r(t) = C. (This linearization is left
   as an exercise for you at the end of the chapter.)

               Desired                                    Thruster
               circular       Measured                     radial                  Acti
                 orbit        deviation                 acceleration                ort
               r(t) = Cf       r(t) - C                     u(t)                     r(t
                                            Orbit                      Satellite
                                          controller
                      _ ' i




   Figure 2.6 On orbit feedback control system for maintaining a circular orbit of a satellite
   around a planet


   Examples 2.2 and 2.3 illustrated how a nonlinear system can be linearized for practical
control applications. However, as pointed out earlier, it is not always possible to do so.
If a nonlinear system has to be moved from one equilibrium point to another (such as
changing the speed or altitude of a cruising airplane), the assumption of linearity that is
possible in the close neighborhood of each equilibrium point disappears as we cross the
nonlinear region between the equilibrium points. Also, if the motion of a nonlinear system
consists of large deviations from an equilibrium point, again the concept of linearity is not
valid. Lastly, the characteristics of a nonlinear system may be such that it does not have
any equilibrium point about which it can be linearized. The following missile guidance
example illustrates such a nonlinear system.
20                           LINEAR SYSTEMS AND CLASSICAL CONTROL


 Example 2.4
 Radar or laser-guided missiles used in modern warfare employ a special guidance
 scheme which aims at flying the missile along a radar or laser beam that is illumi-
 nating a moving target. The guidance strategy is such that a correcting command
 signal (input) is provided to the missile if its flight path deviates from the moving
 beam. For simplicity, let us assume that both the missile and the target are moving
 in the same plane (Figure 2.7). Although the distance from the beam source to the
 target, Ri(t), is not known, it is assumed that the angles made by the missile and
 the target with respect to the beam source, #M(?) and #r(0, are available for precise
 measurement. In addition, the distance of the missile from the beam source, /?M(0,
 is also known at each instant.
    A guidance law provides the following normal acceleration command signal,
 ac(t), to the missile
                                                                                             (2.17)
 As the missile is usually faster than the target, if the angular deviation
 #M(O] is made small enough, the missile will intercept the target. The feedback
 guidance scheme of Eq. (2.17) is called beam-rider guidance, and is shown in
 Figure 2.8.

                 Altitude "
                                                   aT(0
                                                          * Target

                                   Radar
                                   or
                                   laser ,/                ac(0
                                   beam/ awc(0

                                                              Missile


                    Beam                                                   Horizon
                    source

 Figure 2.7 Beam guided missile follows a beam that continuously illuminates a moving target
 located at distance Rf(f) from the beam source


              Target's                                     Normal               Mi<jsile's
              angular         Angular                    acceleration           angular
              position        deviation                   command               DO sition
                                               Guidance     ac(0                  oM(')
                         ~N               to     law                  Missile      —»-
                         i                     Eq.(2.17)




                  Figure 2.8         Beam-rider closed-loop guidance for a missile
HOW VALID IS THE ASSUMPTION OF LINEARITY?                       21


     The beam-rider guidance can be significantly improved in performance if we can
  measure the angular velocity, 0| t), and the angular acceleration, 0£ (?), of the
  target. Then the beam's normal acceleration can be determined from the following
  equation:


  In such a case, along with ac(t) given by Eq. (2.17), an additional command
  signal (input) can be provided to the missile in the form of missile's acceleration
  perpendicular to the beam, a^c(t), given by


     Since the final objective is to make the missile intercept the target, it must be
                          id),       i(2),
  ensured that 0^(0 = 0r';(0 and 0^(0 = 9?t), even though [0j(0 - 0M(01 may
  not be exactly zero. (To understand this philosophy, remember how we catch up
  with a friend's car so that we can chat with her. We accelerate (or decelerate) until
  our velocity (and acceleration) become identical with our friend's car, then we can
  talk with her; although the two cars are abreast, they are not exactly in the same
  position.) Hence, the following command signal for missile's normal acceleration
  perpendicular to the beam must be provided:


  The guidance law given by Eq. (2.20) is called command line-of-sight guidance,
  and its implementation along with the beam-rider guidance is shown in the block
  diagram of Figure 2.9. It can be seen in Figure 2.9 that while 0r(0 is being fed
  back, the angular velocity and acceleration of the target, 0| t), and 0j t), respec-
  tively, are being fed forward to the controller. Hence, similar to the control system
  of Figure 1.4, additional information about the target is being provided by a feedfor-
  ward loop to improve the closed-loop performance of the missile guidance system.

                                                 .(2)



                                                                           Missile's
                                                        Acceleration       angular
                                                        commands           position
                                                        ac(0, aMc(f)
               Target's
                angular
               position,




            Figure 2.9      Beam-rider and command line-of-sight guidance for a missile



   Note that both Eq. (2.17) and Eq. (2.20) are nonlinear in nature, and generally cannot
be linearized about an equilibrium point. This example shows that the concept of linearity
22                         UNEAR SYSTEMS AND CLASSICAL CONTROL


is not always valid. For more information on missile guidance strategies, you may refer
to the excellent book by Zarchan [1].


2.2 Singularity Functions
It was mentioned briefly in Chapter 1 that some peculiar, well known input functions are
generally applied to test the behavior of an unknown system. A set of such test functions
is called singularity Junctions. The singularity functions are important because they can be
used as building blocks to construct any arbitrary input function and, by the superposition
principle (Eq. (2.3)), the response of a linear system to any arbitrary input can be easily
obtained as the linear superposition of responses to singularity functions. The two distinct
singularity functions commonly used for determining an unknown system's behavior are
the unit impulse and unit step functions. A common property of these functions is that
they are continuous in time, except at a given time. Another interesting fact about the
singularity functions is that they can be derived from each other by differentiation or
integration in time.
    The unit impulse function (also called the Dime delta function), 8(t — a), is seen in
Figure 2.10 to be a very large spike occurring for a very small duration, applied at time
t = a, such that the total area under the curve (shaded region) is unity. A unit impulse
function can be multiplied by a constant to give a general impulse function (whose area
under the curve is not unity). From this description, we recognize an impulse function to
be the force one feels when hit by a car - and in all other kinds of impacts.
    The height of the rectangular pulse in Figure 2.10 is 1/e, whereas its width is s seconds,
e being a very small number. In the limit e —> 0, the unit impulse function tends to infinity
(i.e. 8(t — a) —>• oo). The unit impulse function shown in Figure 2.10 is an idealization
of the actual impulse whose shape is not rectangular, because it takes some time to reach
the maximum value, unlike the unit impulse function (which becomes very large instan-
taneously). Mathematically, the unit impulse function can be described by the following
equations:

                                   S(t - a) = 0,     foTt                                  (2.21)
                                      oo
                                           8(t -a)dt = 1                                   (2.22)
                                   / -00


                                                            ls(t-a)dt=l




                                               a a+e

Figure 2.10 The unit impulse function; a pulse of infinitesimal duration (s) and very large magni-
tude (1/e) such that its total area is unity
SINGULARITY FUNCTIONS                                            23


   Note that 8(t — a) is discontinuous at t = a. Furthermore, since the unit impulse
function is non-zero only in the period a < t < a + e, we can also express Eqs. (2.21)
and (2.22) by

                                           8(t -a)dt = 1                                         (2.23)

However, when utilizing the unit impulse function for control applications, Eq. (2.22) is
much more useful. In fact, if <$(/ — a) appears inside an integral with infinite integra-
tion limits, then such an integral is very easily carried out with the use of Eqs. (2.21)
and (2.22). For example, if /(?) is a continuous function, then the well known Mean
Value Theorem of integral calculus can be applied to show that


                    / f(t)8(t-a)dt        = f ( a ) I 8(t - d)dt = f ( a )                       (2.24)
                   JT                              JT
where T < a < T^. Equation (2.24) indicates an important property of the unit impulse
function called the sampling property, which allows the time integral of any continuous
function f ( t ) weighted by 8(t — a) to be simply equal to the function /(?) evaluated at
t = a, provided the limits of integration bracket the time t = a.
    The unit step function, us(t — a), is shown in Figure 2.11 to be a jump of unit magni-
tude at time t = a. It is aptly named, because it resembles a step of a staircase. Like the
unit impulse function, the unit step function is also a mathematical idealization, because
it is impossible to apply a non-zero input instantaneously. Mathematically, the unit step
function can be defined as follows:

                                                 0    for t < a
                                                 1    for t > a

It is clear that us(t — a) is discontinuous at t = a, and its time derivative at t — a is
infinite. Recalling from Figure 2.10 that in the limit e -* 0, the unit impulse function
tends to infinity (i.e. 8(t — a) -» oo), we can express the unit impulse function, 8(t — a),
as the time derivative of the unit step function, us(t — a), at time t = a. Also, since the
time derivative of us(t — a) is zero at all times, except at t = a (where it is infinite), we
can write
                                 8(t-a)=dus(t-a)/dt                                              (2.26)




                            1-


                            0                a                              t


       Figure 2.11   The unit step function, us(t — a); a jump of unit magnitude at time t = a
24                         UNEAR SYSTEMS AND CLASSICAL CONTROL


                       r(t-a)




                              0                a


           Figure 2.12 The unit ramp function; a ramp of unit slope applied at time t = a


Or, conversely, the unit step function is the time integral of the unit impulse function,
given by
                                  us(t-a)=f           8(T-a)dr                                (2.27)
                                               J-oc

   A useful function related to the unit step function is the unit ramp function, r(t — a ) ,
which is seen in Figure 2.12 to be a ramp of unit slope applied at time t = a. It is like an
upslope of 45° angle you suddenly encounter while driving down a perfectly flat highway
at t = a. Mathematically, r(t — a) is given by


                                r(t - a) = ;
                                 v                  .   "" ' —                                (2.28)
                                          [ ( t -a)     for t > a

  Note that r(t — a) is continuous everywhere, but its slope is discontinuous at t = a.
Comparing Eq. (2.28) with Eq. (2.25), it is clear that

                                  r(t - a) = (t - a)us(t - a)                                 (2.29)

or
                                  r(t-a)=S          us(r-a)dT                                 (2.30)
                                             J-oc

Thus, the unit ramp function is the time integral of the unit step function, or conversely,
the unit step function is the time derivative of the unit ramp function, given by

                                   us(t-a} =dr(t~a)/dt                                       (2.31)

The basic singularity functions (unit impulse and step), and their relatives (unit ramp
function) can be used to synthesize more complicated functions, as illustrated by the
following examples.

     Example 2.5
     The rectangular pulse function, f(t), shown in Figure 2.13, can be expressed by
     subtracting one step function from another as

                           /(O = fo(us(t + 772) - us(t - 7/2)1                              (2.32)
SINGULARITY FUNCTIONS                                  25




                     -t          -TI2                 0            -772       t


                  Figure 2.13     The rectangular pulse function of magnitude f0


   Example 2.6
   The decaying exponential function, /(/) (Figure 2.14) is zero before t = 0, and
   decays exponentially from a magnitude of f0 at t = 0. It can be expressed by
   multiplying the unit step function with f() and a decaying exponential term, given by

                                              = f0e~t/rus(t)                        (2.33)




                          -t                     0                        t


                Figure 2.14     The decaying exponential function of magnitude f0


  Example 2.7
   The sawtooth pulse function, f ( t ) , shown in Figure 2.15, can be expressed in terms
   of the unit step and unit ramp functions as follows:

                     /(f) - (fo/T)[r(t)       - r(t -           f0us(t - T)         (2.34)




                               fn- Slope =



                                  0               T                 t

                   Figure 2.15        The sawtooth pulse of height f0 and width T


   After going through Examples 2.5-2.7, and with a little practice, you can decide merely
by looking at a given function how to synthesize it using the singularity functions. The
unit impulse function has a special place among the singularity functions, because it can be
26                           LINEAR SYSTEMS AND CLASSICAL CONTROL




                        f(r)-
                                                             Area = f (r)Ar




Figure 2.16 Any arbitrary function, f(t), can be represented by summing up unit impulse functions,
8(t — T) applied at t = r and multiplied by the area f(r) Ar for all values of r from —oo to t


used to describe any arbitrary shaped function as a sum of suitably scaled unit impulses,
S(t — a), applied at appropriate time, t = a. This fact is illustrated in Figure 2.16, where
the function f ( t ) is represented by

                                                            - r)                           (2.35)

or, in the limit Ar —>• 0,

                                      =/:     f(r)S(t-r)dr

   Equation (2.36) is one of the most important equations of modern control theory,
                                                                                           (2.36)


because it lets us evaluate the response of a linear system to any arbitrary input, /(/), by
the use of the superposition principle. We will see how this is done when we discuss the
response to singularity functions in Section 2.5. While the singularity functions and their
relatives are useful as test inputs for studying the behavior of control systems, we can also
apply some well known continuous time functions as inputs to a control system. Examples
of continuous time test functions are the harmonic functions sin(o>f) and cos(<wf)» where
o) is a frequency, called the excitation frequency. As an alternative to singularity inputs
(which are often difficult to apply in practical cases), measuring the output of a linear
system to harmonic inputs gives essential information about the system's behavior, which
can be used to construct a model of the system that will be useful in designing a control
system. We shall study next how such a model can be obtained.


2.3 Frequency Response
 Frequency response is related to the steady-state response of a system when a harmonic
junction is applied as the input. Recall from Section 1.2 that steady-state response is the
 linear system's output after the transient response has decayed to zero. Of course, the
 requirement that the transient response should have decayed to zero after some time calls
for the linear system to be stable. (An unstable system will have a transient response
 shooting to infinite magnitudes, irrespective of what input is applied.) The steady-state
FREQUENCY RESPONSE                                   27


response of a linear system is generally of the same shape as that of the applied input,
e.g. a step input applied to a linear, stable system yields a steady-state output which
is also a step function. Similarly, the steady-state response of a linear, stable system
to a harmonic input is also harmonic. Studying a linear system's characteristics based
upon the steady-state response to harmonic inputs constitutes a range of classical control
methods called the frequency response methods. Such methods formed the backbone of
the classical control theory developed between 1 900-60, because the modern state-space
methods (to be discussed in Chapter 3) were unavailable then to give the response of
a linear system to any arbitrary input directly in the time domain (i.e. as a function of
time). Modern control techniques still employ frequency response methods to shed light
on some important characteristics of an unknown control system, such as the robustness of
multi-variable (i.e. multi-input, multi-output) systems. For these reasons, we will discuss
frequency response methods here.
   A simple choice of the harmonic input, u(t can be

                       u(t) = u()cos(cot)        or u(t) = u0sin(a)t)                  (2.37)
where u0 is the constant amplitude and CD is the frequency of excitation (sometimes called
the driving frequency). If we choose to write the input (and output) of a linear system
as complex functions, the governing differential equation can be replaced by complex
algebraic equations. This is an advantage, because complex algebra is easier to deal with
than differential equations. Furthermore, there is a vast factory of analytical machinery
for dealing with complex functions, as we will sample later in this chapter. For these
powerful reasons, let us express the harmonic input in the complex space as

                                          u(t) = u(!Qlwt                               (2.38)
where / — /^T (a purely imaginary quantity), and

                                   e/a" = cos(a>f ) 4- i sin (art)                     (2.39)
Equation (2.39) is a complex representation in which cos(a>t ) is called the real part of
Ql(at and sin(cot) is called the imaginary part of &laj! (because it is multiplied by the
imaginary number i). The complex space representation of the harmonic input given by
Eq. (2.38) is shown in Figure 2.17. The two axes of the complex plane are called the real

                   Imaginary
                   axis




                                               u0 cos(o>0                Real
                                                                         axis

             Figure 2.17       Complex space representation of a harmonic input, u(0
28_                      LINEAR SYSTEMS AND CLASSICAL CONTROL                          _


and imaginary axis, respectively, as shown. Hence, complex space representation of a
harmonic function is a device of representing both the possibilities of a simple harmonic
input, namely M O COS(<W/) and M 0 sin(<wf), respectively, in one expression. By obtaining
a steady-state response to the complex input given by Eq. (2.38), we will be obtaining
simultaneously the steady-state responses of a linear, stable system to M O COS(O>/) and

    When you studied solution to ordinary differential equations, you learnt that their solu-
tion consists of two parts - the complimentary solution (or the solution to the unforced
differential equation (Eq. (2.7)), and a particular solution which depends upon the input.
While the transient response of a linear, stable system is largely described by the compli-
mentary solution, the steady-state response is the same as the particular solution at large
times. The particular solution is of the same form as the input, and must by itself
satisfy the differential equation. Hence, you can verify that the steady-state responses to
u(t) = u0cos(a)t) and u(t) = M 0 sin(<wr), are given by v J5 (r) = y0cos(a>t) and yss(t) =
y0 sin(<wr), respectively (where y0 is the amplitude of the resulting harmonic, steady-state
output, yss(t)} by plugging the corresponding expressions of u(t) and yjs(0 into Eq. (2.4),
which represents a general linear system. You will see that the equation is satisfied in
each case. In the complex space, we can write the steady-state response to harmonic input
as follows:
                                                                                      (2.40)
Here, the steady-state response amplitude, v0, is a complex function of the frequency
of excitation, a). We will shortly see the implications of a complex response amplitude.
Consider a linear, lumped parameter, control system governed by Eq. (2.4) which can be
re-written as follows
                                   D}{yss(t)} = D2{u(t)}                         (2.41)

where £>i{-} and D2{-} are differential operators (i.e. they operate on the steady-state
output, y55(0, and the input, u(t}, respectively, by differentiating them), given by

                                                                                      (2.42)

and
              D2{-} = bmdm/dtm + bm-idm-l/dtm-* + ••• + bid/dt + bo                   (2.43)

Then noting that

       '    = [(ia>Yandn/dtn + (ia>)n-lan-id"-} /dtn~l +••• + (ico)aid/dt
                                                                                      (2.44)
and

     ' wf ) = [(iw}mbmdm/dtm + (ia>r~lbm-idm-*/dtm-1 +••• + (ia>)bd/dt + b0]eia>l
                                                                           (2.45)
we can write, using Eq. (2.41),

                                    y0(ia)) = G(ia>)u0                                (2.46)
FREQUENCY RESPONSE                                   29


where G(ia>) is called the frequency response of the system, and is given by

            G(ia>) = [(ico)mbm + (/W~X-i + • • • + (iw)fci + b0]/[(ia))nan
                      + (ic0)n-lan-i +••• + (ico)a{ + a(>]                             (2,47)

Needless to say, the frequency response G(ia>) is also a complex quantity, consisting of
both real and imaginary parts. Equations (2.46) and (2.47) describe how the steady-state
output of a linear system is related to its input through the frequency response, G(ico).
Instead of the real and imaginary parts, an alternative description of a complex quantity is
in terms of its magnitude and the phase, which can be thought of as a vector's length and
direction, respectively. Representation of a complex quantity as a vector in the complex
space is called a phasor. The length of the phasor in the complex space is called its
magnitude, while the angle made by the phasor with the real axis is called its phase. The
magnitude of a phasor represents the amplitude of a harmonic function, while the phase
determines the value of the function at t = 0. The phasor description of the steady-state
output amplitude is given by

                                     y0(ia>) = ya(ia>)eia(ta>                        (2.48)

where y0(ico) is the magnitude and ct(a)) is the phase of y()(ico). It is easy to see that

                      y0(ia)) = [real {y0(ico)}2 + imag {y0(ia))}2]l/2;
                         a(co} = tan"1 [imag {y«(M}/real [y0(ia))}]                    (2.49)

where real{-} and imag{-} denote the real and imaginary parts of a complex number. We
can also express the frequency response, G(ia>), in terms of its magnitude, |G (/&>)), and
phase, 0(o>), as follows:
                                           |G(/a>)|e' 0M                           (2.50)

Substituting Eqs. (2.48) and (2.50) into Eq. (2.46), it is clear that y0(ia)) = G(ia))u(/
and a(a>) = <^>(co). Hence, the steady-state response of a linear system excited by a
harmonic input of amplitude u0 and zero phase (u0 = wf,e'°) is given through Eq. (2.40) by

         yss(t) = y0(ia>)eia>t = G(io))u0ei<t>(w)Qi(at = G(ico)u0ei[ct>t+ct>{w)]   (2.51)

Thus, the steady-state response to a zero phase harmonic input acquires its phase from the
frequency response, which is purely a characteristic of the linear system. You can easily
show that if the harmonic input has a non-zero phase, then the phase of the steady-state
response is the sum of the input phase and the phase of the frequency response, 0(co). The
phasor representation of the steady-state response amplitude is depicted in Figure 2.18.
   From Eq. (2.51), it is clear that the steady-state response is governed by the amplitude
of the harmonic input, u0, and magnitude and phase of the frequency response, G (/&>),
which represent the characteristics of the system, and are functions of the frequency of
excitation. If we excite the system at various frequencies, and measure the magnitude and
phase of the steady-state response, we could obtain G(ito) using Eq. (2.51), and conse-
quently, crucial information about the system's characteristics (such as the coefficients a/,
30                           LINEAR SYSTEMS AND CLASSICAL CONTROL


              Imaginary ,,
              axis




Figure 2.18 Phaser representations of a harmonic input, u(f), with zero phase and amplitude UQ,
and steady-state response amplitude, yo(/<w), °f a linear system with frequency response, G(ia>)


and bk, in Eq. (2.47)). In general, we would require G(ico) at as many frequencies as are
the number of unknowns, ak and bk, in Eq. (2.47). Conversely, if we know a system's
parameters, we can study some of its properties, such as stability and robustness, using
frequency response plots (as discussed later in this chapter). Therefore, plots of magnitude
and phase of G(/w) with frequency, CD, serve as important tools in the analysis and design
of control systems. Alternatively, we could derive the same information as obtained from
the magnitude and phase plots of G(i(o) from the path traced by the tip of the frequency
response phasor in the complex space as the frequency of excitation is varied. Such a
plot of G(ico) in the complex space is called a polar plot (since it represents G(ico) in
terms of the polar coordinates, G(ico) and 0(<w)). Polar plots have an advantage over
the frequency plots of magnitude and phase in that both magnitude and phase can be
seen in one (rather than two) plots. Referring to Figure 2.18, it is easily seen that a phase
(j)(u>} = 0° corresponds to the real part of G(/&>), while the phase 0(o>) = 90° corresponds
to the imaginary part of G (/&>). When talking about stability and robustness properties,
we will refer again to the polar plot.
     Since the range of frequencies required to study a linear system is usually very large,
it is often useful to plot the magnitude, |G(i<w)|, and phase, <J>(co), with respect to the
frequency, co, on a logarithmic scale of frequency, called Bode plots. In Bode plots,
the magnitude is usually converted to gain in decibels (dB) by taking the logarithm of
|G(i<w)| to the base 10, and multiplying the result with 20 as follows:

                                        = 201og, 0 |G(ia>)|                              (2.52)

As we will see later in this chapter, important information about a linear, single-input,
single-output system's behavior (such as stability and robustness) can be obtained from
the Bode plots, which serve as a cornerstone of classical control design techniques.
Factoring the polynomials in G(/<w) (Eq. (2.47)) just produces addition of terms in
Iog10 G(ico), which enables us to construct Bode plots by log-paper and pencil. Despite
this, Bode plots are cumbersome to construct by hand. With the availability of personal
computers and software with mathematical functions and graphics capability - such as
MATLAB - Bode plots can be plotted quite easily. In MATLAB, all you have to do is
FREQUENCY RESPONSE                            31


specify a set of frequencies, a), at which the gain and phase plots are desired, and use the
intrinsic functions abs and angle which calculate the magnitude and phase (in radians),
respectively, of a complex number. If you have the MATLAB's Control System Toolbox
(CST), the task of obtaining a Bode plot becomes even simpler through the use of the
command bode as follows:

»G=tf(num,den); bode(G,w) <enter> %a Bode plot will appear on the screen

Here » is the MATLAB prompt, <enter> denotes the pressing of the 'enter' (or 'return')
key, and the % sign indicates that everything to its right is a comment. In the bode
command, w is the specified frequency vector consisting of equally spaced frequency
values at which the gain and phase are desired, G is the name given to the frequency
response of the linear, time-invariant system created using the CST LTI object function tf
which requires num. and den as the vectors containing the coefficients of numerator and
denominator polynomials, respectively, of G(/o>) in (Eq. (2.47)) in decreasing powers
of s. These coefficients should be be specified as follows, before using the tf and bode
commands:

      »num=[bm b m _i ... bol; den=[a n a n -i ... a 0 ] ; <enter>

By using the MATLAB command logspace, the w vector can also be pre-specified as
follows:

»w=logspace(-2,3); <enter> %w consists of equally spaced frequencies in the
  range 0.01-1000 rad/s.

(Using a semicolon after a MATLAB command suppresses the print-out of the result on
the screen.)
   Obviously, u; must be specified before you use the bode command. If you don't specify
w, MATLAB will automatically generate an appropriate w vector, and create the plot.
   Instead of plotting the Bode plot, you may like to store the magnitude (mag), G(ico),
and the phase, <£(&>), at given set of frequencies, w, for further processing by using the
following MATLAB command:

      » [ m a g , p h a s e j w ] = b o d e ( n u m , d e n , w ) ; <enter>

For more information about Bode plots, do the following:

     »help bode <enter>

    The same procedure can be used to get help on any other MATLAB command. The
example given below will illustrate what Bode plots look like. Before we do that, let us
try to understand in physical terms what a frequency response (given by the Bode plot) is.
    Musical notes produced by a guitar are related to its frequency response. The guitar
player makes each string vibrate at a particular frequency, and the notes produced by the
various strings are the measure of whether the guitar is being played well or not. Each
string of the guitar is capable of being excited at many frequencies, depending upon where
32                        UNEAR SYSTEMS AND CLASSICAL CONTROL


 the string is struck, and where it is held. Just like the guitar, any system can be excited
 at a set of frequencies. When we use the word excited, it is quite in the literal sense,
 because it denotes the condition (called resonance) when the magnitude of the frequency
 response, |G(/o>)|, becomes very large, or infinite. The frequencies at which a system can
 be excited are called its natural (or resonant) frequencies. High pitched voice of many
 a diva has shattered the opera-house window panes while accidently singing at one of
 the natural frequencies of the window! If a system contains energy dissipative processes
 (called damping), the frequency response magnitude at natural frequencies is large, but
finite. An undamped system, however, has infinite response at each natural frequency. A
 natural frequency is indicated by a peak in the gain plot, or as the frequency where the
 phase changes by 180°. A practical limitation of Bode plots is that they show only an inter-
polation of the gain and phase through selected frequency points. The frequencies where
 G(i(o) becomes zero or infinite are excluded from the gain plot (since logarithm of zero
 is undefined, and an infinite gain cannot be shown on any scale). Instead, only frequency
 points located close to the zero magnitude frequency and the infinite gain frequencies of
the system can be used in the gain plot. Thus, the Bode gain plot for a guitar will consist
of several peaks, corresponding to the natural frequencies of the notes being struck. One
could determine from the peaks the approximate values of the natural frequencies.


   Example 2.8
   Consider the electrical network shown in Figure 2.19 consisting of three resistances,
   /?i, /?2, and /?3, a capacitor, C, and an inductor, L, connected to a voltage source,
   e(t), and a switch, 5. When the switch, 5, is closed at time t = 0, the current
   passing through the resistance R is i'i(f), and that passing through the inductor, L,
   is /2(0- The input to the system is the applied voltage, e(t), and the output is the
   current, /2(0-
      The two governing equations of the network are

                                      - 12(01                                      (2.53)

              0 = #2*2(0 + #3[*2(0 - i'i(01 + Li         + (I/O f: (r)dr
                                                                    i2             (2.54)
                                                                 Jo




                                                              :±        e(f)




                       Figure 2.19 Electrical network for Example 2.8
FREQUENCY RESPONSE                                                                33


Differentiating Eq. (2.54) and eliminating i  ( t ) , we can write
                 L/f(t) + [(R{R3 + fl,/?2 + /?2

                                                                               "(0                          (2.55)
   Comparing Eq. (2.55) with Eq. (2.4) we find that the system is linear and
of second order, with y(t) = i 2 ( t ) , u(t) = e(t), aQ = l/C, a = (R[R3 + RR2 +
R2R3)/(R} + R3), bo - 0, and b - R3/(R + R3). Hence, from Eq. (2.47), the
frequency response of the system is given by




For RI = R3 = 10 ohms, R2 = 25 ohms, L = 1 henry, and C = 10~6 farad, the
frequency response is the following:
                         x""1 /*
                         G(i(jo) = (j.5(i(t))/[(i(jL>)
                                      / A C / *      /F/ *   2
                                                                    + 30(jco) + 10 I
                                                                    i   O f f '      t   1 /~D T
                                                                                                            (2.57)
                                                                                                            / ^ £5 ""7 




Bode gain and phase plots of frequency response given by Eq. (2.57) can be plotted
in Figure 2.20 using the following MATLAB commands:

    »w=logspace(-1,4); <enter>

(This command produces equally spaced frequency points on logarithmic scale from
0.1 to 10000 rad/s, and stores them in the vector w.)

    »G=i*w*0.5. / ( - w . *w+30*i*w+1e6); <enter>




            CO




                    10                                          102                         103       104
                                                   Frequency (rad/sec)

                   90




                  -90
                                                     101        102                          103      104
                                                   Frequency (rad/sec)

Figure 2.20 Bode plot for the electrical network in Example 2.8; a peak in the gain plot and
the corresponding phase change of 180° denotes the natural frequency of the system
34                        LINEAR SYSTEMS AND CLASSICAL CONTROL


     (This command calculates the value of G(/o>) by Eq. (2.57) at each of the speci-
     fied frequency points in w, and stores them in the vector G. Note the MATLAB
     operations.* and ./ which allow element by element multiplication and division,
     respectively, of two arrays (see Appendix B).)

         »gain=20*loglO(abs(G)) ; phase=180*angle(G)/pi; <enter>

     (This command calculates the gain and phase of G(io>) at each frequency point in
     w using the MATLAB intrinsic functions abs, angle, and loglO, and stores them in
     the vectors gain and phase, respectively. We are assuming, however, that G does
     not become zero or infinite at any of the frequencies contained in if.)

     »subplot(211 ) , semilogx(w,gain) , grid, subplot(212) , semilogx(w,phase) ,
       grid <enter>

     (This command produces gain and phase Bode plots as two (unlabeled) subplots,
     as shown in Figure 2.20. Labels for the axes can be added using the MATLAB
     commands xlabel and y label.)
        The Bode plots shown in Figure 2.20 are obtained much more easily through the
     Control System Toolbox (CST) command bode as follows:

     »num=[0.5 0]; den=[1 30 Ie6]; g=tf (num,den) , bode(g,w) <enter>

        Note the peak in the gain plot of Figure 2.20 at the frequency, o> = 1000 rad/s.
     At the same frequency the phase changes by 180°. Hence, u> = 1000 rad/s is the
     system's natural frequency. To verify whether this is the exact natural frequency,
     we can rationalize the denominator in Eq. (2.57) (i.e. make it a real number by
     multiplying both numerator and denominator by a suitable complex factor - in this
     case (— a>2 + 106) — 30/o> and express the magnitude and phase as follows:
         G(ia>) = [225o>4 + 0.25w2(-ft>2 + 106)2]1/2/[(-^2 + 106)2
            0(o>) = tan~' (-(o2 + 106)/(30co)                                    (2.58)
 From Eq. (2.58), it is clear that |G(/<w)| has a maximum value (0.0167 or
 -35.547 dB) - and </>(<*>) jumps by 180° - at co = 1000 rad/s. Hence, the natural
 frequency is exactly 1000 rad/s. Figure 2.20 also shows that the gain at CD =
 0.1 rad/s is -150 dB, which corresponds to |G(0.1/)| = 10~75 = 3.1623 x 10~8,
 a small number. Equation (2.58) indicates that |G(0)| =0. Hence, CD = 0.1 rad/s
 approximates quite well the zero-frequency gain (called the DC gain) of the system.
 The frequency response is used to define a linear system's property called bandwidth
 defined as the range of frequencies from zero up to the frequency, <Wb, where
 |G(/o>b)| = 0.707|G(0)|. Examining the numerator of |G(/w)| in Eq. (2.58), we
 see that |G(/o>)| vanishes at CD = 0 and a> = 1999 100 rad/s (the numerator roots
 can be obtained using the MATLAB intrinsic function roots). Since |G(0)| =0,
 the present system's bandwidth is 0% = 1999 100 rad/s (which lies beyond the
 frequency range of Figure 2.20). Since the degree of the denominator polynomial
 of G(iu>) in Eq. (2.47) is greater than that of the numerator polynomial, it follows
FREQUENCY RESPONSE                                                  35


that G(ico) -> 0 as a> -> oo. Linear systems with G(ico) having a higher degree
denominator polynomial (than the numerator polynomial) in Eq. (2.47) are called
strictly proper systems. Equation (2.58) also shows that 0(<w) -» 90° as co —> 0,
and 0(<w) —> —90° as co —> oo. For a general system, $(&>) -> —£90° as a> -> oo,
where k is the number by which the degree of the denominator polynomial of G(ico)
exceeds that of the numerator polynomial (in the present example, k = 1).
    Let us now draw a polar plot of G(ico) as follows (note that we need more
frequency points close to the natural frequency for a smooth polar plot, because of
the 180° phase jump at the natural frequency):

    »w=[logspace(-1,2.5) 350:2:1500 logspace(3.18,5)]; <enter>

(This command creates a frequency vector, w, with more frequency points close to
1000 rad/s.)

    »G=i*w*0.5. / ( - w . *w+30*i*w+1e6); <enter>
    »polar(angle(G), a b s ( G ) ) ; <enter>

(This command for generating a polar plot requires phase angles in radians, but the
plot shows the phase in degrees.)
   The resulting polar plot is shown in Figure 2.21. The plot is in polar coordinates,
G(ia)) and 0(&>), with circles of constant radius, G(i(o), and radial lines of
constant 0 (&>) overlaid on the plot. Conventionally, polar plots show either all posi-
tive, or all negative phase angles. In the present plot, the negative phase angles have
been shown as positive angles using the transformation 0 -> (<p + 360°), which is
acceptable since both sine and cosine functions are invariant under this transfor-
mation for 4> < 0 (e.g. 0 = —90° is the same as 0 = 270°). Note that the 0° and


                              120°.,-       |
                                                                      ' =0.018




                180



                   210


                              240°"---      !      ••   300°
                                          270°

Figure 2.21   Polar plot of the frequency response, G(/&>), of the electrical system of Example 2.8
36                         LINEAR SYSTEMS AND CLASSICAL CONTROL


      90° radial lines represent the real and imaginary parts, respectively, of G(ico). The
      polar curve is seen in Figure 2.21 to be a circle of radius 0.00835 centered at the
      point 0.00835 on the real axis. The direction of increasing CD is shown by arrows on
      the polar curve. The shape and direction (with increasing o>) of a polar plot gives
      valuable insight about a linear system's stability, which will be seen in Section 2.10.


2,4 Laplace Transform and the Transfer Function
In the previous section we had confined our attention to the steady-state response of
a linear system to harmonic inputs. Here we would like to consider the total response
(both transient and steady-state) of a linear, single-input, single-output system when the
applied input is some arbitrary function of time. We saw how the representation of a
harmonic input by a complex function transformed the governing differential equations
into a complex algebraic expression for the frequency response. For a general input,
a similar complex expression can be obtained by applying the Laplace transformation
(denoted by £) to the input, u(t), defined as


                                               -L
                                      = £u(t)= I       e~stu(t)dt

 where 5 denotes the Laplace variable (a complex number), and U(s) is called the Laplace
                                                                                         (2.59)


 transform of u(t). The Laplace transform of a function u(t) is defined only if the infinite
 integral in Eq. (2.59) exists, and converges to a functional form, U(s). However, if U(s)
 exists, then it is unique. The convergence of the Laplace integral depends solely upon
 the shape of the function, u(t). It can be shown rigourously that the Laplace integral
 converges only if u(t) is piecewise continuous (i.e. any time interval, however large, can
 be broken up into a finite number of sub-intervals over each of which u(t) is continuous,
 and at the ends of each sub-interval, u(t) is finite) and bounded by an exponential (i.e.
 there exists a constant a such that e~atu(t) is bounded at all times). The term bounded
 implies that a function's value lies between two finite limits. Most of the commonly used
 input functions are Laplace transformable. For example, if u(t), is discontinuous (i.e.
 it has a jump) at t = 0, such as u(t) = 8(t) or u(t) = us(t), we can obtain its Laplace
transform. In such a case, the lower limit of integration in Eq. (2.59) is understood to be
just before t = 0, i.e. just prior to the discontinuity in u(t). Some important properties
of the Laplace transform are stated below, and you may verify each of them using the
definition given by Eq. (2.59):

(a) Linearity:
    If a is a constant (or independent of s and f) and £ f ( t ) = F(s), then
                                   £{af(t)} = a£f(t) = aF(s)                             (2.60)
      Also, if £fi(t) = F,(s) and £/2(0 = F2(s), then
                                                               F2(s)                     (2.61)
_                     LAPLACE TRANSFORM AND THE TRANSFER FUNCTION_                               37


(b) Complex differentiation:
    If £ f ( t ) = F ( s ) , then
                                      £{tf(t)} = -dF(s)/ds                                  (2.62)
(c) Complex integration:
    If £ f ( t ) = F(s), and if lirn^o f ( t ) / t exists as t = 0 is approached from the positive
    side, then
                                                        CO
                                                             F(s)ds                         (2.63)
                                                    /
(d) Translation in time:
    If £ f ( t ) = F ( s ) , and a is a positive, real number such that f ( t — a) = 0 for 0 < t <
    a, then
                                           £f(t -a) = e-asF(s)                               (2.64)
(e) Translation in Laplace domain:
    If £ f ( t ) = F(s), and a is a complex number, then

                                                                                            (2.65)
(f) Real differentiation:
    If £ f ( t ) = F(s), and if /(1)(0 is Laplace transformable, then

                                    £f([)(t)=sF(s)-f(0+)                                    (2.66)

    where /(0 + ) denotes the value of f ( t ) in the limit t —> 0, approaching t = 0 from the
    positive side. If we apply the real differentiation property successively to the higher
    order time derivatives of f ( t ) (assuming they are Laplace transformable), we can
    write the Laplace transform of the kth derivative, f ^ k ) ( t ) , as follows:

           £f(kt} = skF(s) - sk~]f(0+) - j*-2/(1)(0+) ----- /(*-1}(0+)                     (2.67)
(g) Real integration:
    If £ f ( t ) — F(s), and the indefinite integral f f ( t ) d t is Laplace transformable, then


                              I f(t)dt=F(s)/s         +( l / s } {      f(t)dt            (2.68)
                              I-/                                J -oc

    Note that the integral term on the right-hand side of Eq. (2.68) is zero if /(/) = 0
    for t < 0.
(h) Initial value theorem:
    If £ f ( t ) = F ( s ) , /(1)(0 is Laplace transformable, and lirn^oosFCs1) exists, then

                                      /(0 + )=lim s ^ 0 0 5F(5)                             (2.69)
(i) Final value theorem:
    If £f(t) = F(s), /(1)(0 is Laplace transformable, and lim^oo/X/) = /(oo)
    exists, then
                                                                       (2.70)
38_                        UNEAR SYSTEMS AND CLASSICAL CONTROL                                   _


    Since we are usually dealing with positive values of time, we will replace 0+ by 0 in all
relevant applications of the Laplace transform. It is easy to see that if the input, n(r ), and
its time derivatives are Laplace transformable, then the differential equation (Eq. (2.4)) of
a linear, time-invariant system is Laplace transformable, which implies that the output,
y(t), is also Laplace transformable, whose Laplace transform is Y(s). For simplicity, we
assume that all initial conditions for the input, u ( t ) , and its derivatives and the output,
y(t), and its derivatives are zeros. Then, using Eq. (2.67) we can transform the governing
equation of the system (Eq. (2.4)) to the Laplace domain as follows:

  (snan + s^On-i + • • • + sai + a0)Y(s) = (smbm + ^'X-i + • • • + sb, + b0)U(s)
                                                                                     (2.71)
   Equation (2.71) brings us to one of the most important concepts in control theory,
namely the transfer Junction, G(s), which is defined as the ratio of the Laplace transform
of the output, Y(s), and that of the input, U(s), given by

                                      G(5) = Y(s)/U(s)                                           (2.72)

Substituting Eq. (2.71) into (2.72), we obtain the following expression for the transfer
function of a linear, single-input, single-output system:

   G(s) = (smbm + sm-bm-i + • • • + sfci + b0)l(snan + s"-an-i + • • • + sai + a0)
                                                                                      (2.73)
As we saw in Chapter 1, the transfer function, G(s), represents how an input, U(s), is
transferred to the output, Y(s), or, in other words, the relationship between the input
and output, when the initial conditions are zero. The transfer function representation of
a system is widely used in block diagrams, such as Figure 2.22, and is very useful for
even such systems for which the governing differential equations are not available. For
such unknown systems, the transfer function is like a black-box defining the system's
characteristics.
   By applying known inputs (such as the singularity functions or harmonic signals)
and measuring the output, one can determine an unknown system's transfer function
experimentally. To do so, we have to see what are the relationships between the transfer
function and the responses to singularity functions, and between the transfer function and
the frequency response. The latter relationship is easily obtained by comparing Eq. (2.73)
defining the transfer function, G(s), with Eq. (2.47), which defines the frequency response,
G(itw). We see that the two quantities can be obtained from one another by using the
relationship s = ia> (that is the reason why we knowingly used the same symbol, G(-),
for both transfer function and the frequency response). A special transform, called the
Fourier transform, can be defined by substituting s = ia) in the definition of the Laplace
transform (Eq. (2.59). Fourier transform is widely used as a method of calculating the

                   Input, U(s)                                      Output, Y(s)
                                        Transfer function
                                         G(s) = Y(s)/U(s)


       Figure 2.22    Transfer function representation of a single-input, single-output system
LAPLACE TRANSFORM AND THE TRANSFER FUNCTION                         39


response of linear systems to arbitrary inputs by transforming an arbitrary input, u(t), to
its frequency domain counterpart, U(ico) as follows:

                                U(ico) = f e~ia"u(t)dt                              (2.74)
                                           k
(The lower limit of integration in Eq. (2.74) is replaced by —oo if u(t) ^ 0 for t <
0.) Then, from Eq. (2.72), we can determine the resulting output (assuming zero initial
conditions) in the frequency domain as Y(iu>) = G(ia))U(ia)) (where G(ico) is the pre-
determined frequency response), and apply the inverse Fourier transform to obtain the
output in the time-domain as follows:

                            y ( t ) = I/(27i) I         ziMlY(io))dto               (2.75)

   Note that in Eqs. (2.74) and (2.75), the Fourier transforms of the input and the output,
U(iaj) and Y(ia>), do not have any physical significance, and in this respect they are
similar to the Laplace transforms, U(s) and Y(s). However, the frequency response,
G(/&>), is related to the steady-state response to harmonic input (as seen in Section 2.3),
and can be experimentally measured. The transfer function, G(s), however, is a useful
mathematical abstraction, and cannot be experimentally measured in the Laplace domain.
The Laplace variable, s, is a complex quantity, s = a ± ico, whose real part, a, denotes
whether the amplitude of the input (or output) is increasing or decreasing with time. We
can grasp this fact by applying the inverse Laplace transform, £~l (i.e. going from the
Laplace domain to the time domain) to Eq. (2.59)


                                                        /'
                                                         Ja~
                                                                 Y(s)estds          (2.76)

where the integral is performed along an infinitely long line, parallel to the imaginary
axis with a constant real part, a (Figure 2.23). Note that inverse Laplace transform- is
possible, because Y(s) (if it exists) is unique.

                                     Imaginary
                                        axis


                                           S = (7+1(0




                                                                        Real axis




                             Figure 2.23     The Laplace domain
40                         UNEAR SYSTEMS AND CLASSICAL CONTROL


   From Eq. (2.76) we can see that a general output, y(t), will consist of such terms as
yoe4' (where yo is a constant}, which can be expressed as >>oea'e±lco'. The latter term
indicates a periodically changing quantity of frequency, CD, whose amplitude is a function
of time given by y$zat. When dealing with non-harmonic inputs and outputs, the use of the
Laplace transform and the transfer function, G(s), is more rewarding than working with
the Fourier transform and the frequency response, G(/o>), because the resulting algebraic
expressions are much simpler through the use of s rather than (ico). However, use of G(s)
involves interpreting system characteristics from complex (rather than purely imaginary)
numbers.
   The roots of the numerator and denominator polynomials of the transfer function, G(s),
given by Eq. (2.73) represent the characteristics of the linear, time-invariant system. The
denominator polynomial of the transfer function, G(s), equated to zero is called the
characteristic equation of the system, given by

                            s"an+sn-[an-i+--- + sal+OQ = Q                                    (2.77)

The roots of the characteristic equation are called the poles of the system. The roots of
the numerator polynomial of G(s) equated to zero are called the zeros of the transfer
function, given by
                        smbm + s m ~X-i + • • • + sb} + b0 = 0                     (2.78)

   In terms of its poles and zeros, a transfer function can be represented as a ratio
of factorized numerator and denominator polynomials, given by the following rational
expression:

          G(s) = K(s - z  ) ( s - z 2 ) . . . (s - zm)/[(s - p  ) ( s - p2)... (s - p,,)]
                       m             n
                = K Y[(s - z/)/ Y[(s - PJ)                                                    (2.79)
                    i=i        j=i
where K is a constant (sometimes referred to as the gain), zi(i = 1, 2 , . . . , m) and pj(j =
1, 2 , . . . , n) are the zeros and poles of the system, respectively, and n is a short-hand
notation denoting a product of many terms (in the same manner as I! denotes a summation
of many terms). Equation (2.79) is also called zero-pole-gain description of a linear, time-
invariant system, which can be modeled by the MATLAB Control System Toolbox's
(CST) LTI object, zpk. As in Eq. (2.1), we repeat that for most linear, time-invariant
systems m < n. Such systems are said to be proper. If m < n, the system is said to be
strictly proper. Also, note that some zeros, z,, and poles, PJ, may be repeated (i.e. two or
more poles (or zeros) having identical values). Such a pole (or zero) is said to be multiple,
and its degree of multiplicity is defined as the number of times it occurs. Finally, it may
happen for some systems that a pole has the same value as a zero (i.e. PJ = Zj for some
pair (1,7)). Then the transfer function representation of Eq. (2.79) will not contain those
poles and zeros, because they have canceled each other out. Pole-zero cancelations have
a great impact on a system's controllabilty or observability (which will be studied in
Chapter 5).
LAPLACE TRANSFORM AND THE TRANSFER FUNCTION                              41_


Example 2.9
Revisiting the electrical network of Example 2.8, we can write the system's transfer
function as
                           G(s) = 0.5s/(s2 + 305 + 106)                          (2.80)

which indicates a zero at the origin (z — 0), and the two complex poles given by
the solution of the following quadratic characteristic equation:

                                s2 + 30s + 106 = 0                               (2.81)

To get a better insight into the characteristics of a system, we can express each
quadratic factor (such as that on the left-hand side of Eq. (2.81)) of the denominator
polynomial as s2 + 2ga>ns + to2, where a>n is a natural frequency of the system (see
Section 2.3), and g is called the damping ratio. The damping ratio, g, governs how
rapidly the magnitude of the response of an unforced system decays with time. For
a mechanical or electrical system, damping is the property which converts a part
of the unforced system's energy to heat, thereby causing the system's energy - and
consequently the output - to dissipate with time. Examples of damping are resis-
tances in electrical circuits and friction in mechanical systems. From the discussion
following Eq. (2.76), it can be seen that g is closely related to the real part, a, of a
complex root of the characteristic equation (pole) given by s = a ± icu. The roots of
the characteristic equation (or, in other words, the poles of the system) expressed as
                               s2 + 2go)ns +a)2n=0                               (2.82)
are
                         s = pi= -$un - io>n(g2 - D 1/2                          (2.83)
and
                         s = P2 = -$*>„ + icon(s2 - l) l / 2                      (2.84)
   Note that the real part of each pole is a — —gu>n, while the imaginary parts
are ±o> = ±a)n(g2 — 1)1/2. For the present example, the poles are found by solving
Eq. (2.81) to be p^ = —15 ± 999.9*, which implies that the natural frequency and
damping-ratio are, u>n = 1000 rad/s and $ = 0.015, respectively. These numbers
could also have been obtained by comparing Eq. (2.81) and Eq. (2.82). The natural
frequency agrees with our calculation in Example 2.8, which was also observed as
a peak in the Bode gain plot of Figure 2.20. The positive damping-ratio (or the
negative real part of the complex poles) indicates that the amplitude of the response
to any input will decay with time due to the presence of terms such as yQeate±ta)t
in the expression for the output, y ( t ) .
   One can see the dependence of the response, y ( t ) , on the damping-ratio, g, in
Figure 2.24, which is a plot of a typical initial response of an unforced second order
system, g = 1 is the limiting case, called critical damping, because it denotes the
boundary between oscillatory and exponentially decaying response. For 0 < g < 1,
42                        LINEAR SYSTEMS AND CLASSICAL CONTROL


                                 £ = 1 (critically damped)           < 0 (unstable)
                                 £ > 1 (overdamped)
                                 0 < £ < 1 (underdamped)




                                                Time (0

     Figure 2.24   Dependence of the response of a second order system on the damping-ratio, <;


   the response is oscillatory with amplitude decreasing with time (called the under-
   damped case}, while for g > 1, the response decays exponentially (called the over-
   damped case). Clearly, the larger the value of the damping-ratio, g, the faster the
   response decays to zero. The case for which g < 0 denotes a response with expo-
   nentially increasing amplitude. A response, y(r), whose limit as t -> oo, either does
   not exist or is infinite, is called an unbounded response. Clearly, g < 0 case has an
   unbounded response. As soon as we see a linear system producing an unbounded
   response to a bounded input (i.e. an input whose finite limit exists as t —* oo) and
  finite initial conditions, we call the system unstable. A further discussion of stability
   follows a little later.

   Locations of poles and zeros in the Laplace domain determine the characteristics of a
linear, time-invariant system. Some indication of the locations of a poles and zeros can
be obtained from the frequency response, G(icu). Let us go back to Figure 2.20, showing
the Bode plots of the electrical system of Examples 2.8 and 2.9. Due to the presence of
a zero at the origin (see Eq. (2.80)), there is a phase of 90° and a non-zero (dB) gain at
co = 0. The presence of a complex conjugate pair of poles is indicated by a peak in the
gain plot and a phase change of 180°. The difference between the number of zeros and
poles in a system affects the phase and the slope of the Bode gain plot with frequency
(in units of dB per decade of frequency), when the frequency is very large (i.e. in the
limit to -> oo). From Eq. (2.79), we can say the following about gain-slope and phase in
the high-frequency limit:
                          J{201og10 G(ia))}/da) % 20(w - «) dB/decade
                                    I" (m - n)90°        if K > 0                           <2-85)
                                       (m - n)90° - 180° if K < 0
LAPLACE TRANSFORM AND THE TRANSFER FUNCTION                                 43


Note that the expressions in Eq. (2.85) are only approximate. For example, the transfer
function in Eq. (2.80) has K = 0.5, m = 1, and n = 2, which implies that the gain-slope
and phase in the limit o> -> oo should be —20 dB/decade and —90°, respectively. These
values are very good estimates (the phase is exactly —90°) of the frequency response
plotted in Figure 2.20.


  Example 2.10
  Consider a linear model describing the longitudinal dynamics of an aircraft
  (Figure 2.25). Three different output variables (in the Laplace domain) are of interest
  when the aircraft is displaced from the equilibrium point (defined by a constant angle
  of attack, O.Q, a constant longitudinal velocity, DO, and a constant pitch-angle, OQ):
  the change in airspeed, v(s), the change in the angle of attack, a (s), and the change
  in pitch angle, 0(s). The input variable in the Laplace domain is the elevator angle,
  d(s). The three transfer functions separately defining the relationship between the
  input, 5(5), and the three respective outputs, v(s), a(s), and 0(s), are as follows:

    v(s)/8(s) = -0.0005(5 - 70) (j + 0.5)/[(52 + 0.005s + 0.006)(s2 + s + 1.4)]
                                                                            (2.86)
    a(s)/8(s) = -0.02(5 + 80) (s2 + 0.0065s + 0.006)/
                         [(s2 + 0.005s + 0.006)(52 + 5 + 1 .4)]                             (2.87)
                                                    2                         2
    9(s)/8(s) - -1.4(5 + 0.02) (5 + 0.4)/[(5 + 0.005s + 0.006) (5 + 5 + 1.4)]
                                                                                (2.88)
     It should be noted that all three transfer functions have the same denominator
  polynomial, (52 + 0.005s + 0.006) (52 + s + 1.4). Since we know that the denomi-
  nator polynomial equated to zero denotes the characteristic equation of the system,
  we can write the characteristic equation for the aircraft's longitudinal dynamics as

                             (52 + 0.005s + 0.006) (s2 + 5 + 1.4) = 0                       (2.89)


            Aircraft's
          longitudinal




  Figure 2.25        Longitudinal dynamics of an airplane, with outputs a, 9, and v denoting small
  changes in angle of attack, pitch angle, and velocity component along longitudinal axis, respec-
  tively, and input, elevator deflection, S. The equilibrium condition is denoted bya = ^ = v = 5 = 0
44                          UNEAR SYSTEMS AND CLASSICAL CONTROL


     Equation (2.89) indicates that the systems complex poles are given by two
     quadratic factors (s2 + 0.005s + 0.006) and (s2 + s + 1.4). Comparing the result
     with that of Example 2.9, where the quadratic factor in the characteristic polynomial
     was expressed as s2 + 2ga)ns + co2, we can see that here we should expect
     two values of the natural frequency, &>„, and the damping-ratio, g, i.e. one
     set of values for each of the two quadratic factors. These values are the
     following:
     (a) g = 0.4226; a)n = 1.1832 rad/s      (short-period mode)
     (b) g = 0.0323; atn = 0.0775 rad/s (long-period, or phugoid mode)

     Using MATLAB's Control System Toolbox (CST) command damp, the damping-
     ratio and natural frequency associated with each quadratic factor in the characteristic
     equation can be easily obtained as follows:

     »a=[1 0.005 0.006]; damp(a) % first quadratic factor <enter>
     Eigenvalue                          Damping               Freq. (rad/sec)
     -0.0025+0.0774i                     0.0323                0.0775
     -0.0025-0.07741                     0.0323                0.0775
     »b=[1 1 1.4]; damp(b) % second quadratic factor <enter>
     Eigenvalue                          Damping               Freq. (rad/sec)
     -0.5000+1.0724i                     0.4226                1.1832
     -0.5000-1.0724i                     0.4226                1.1832

        Note that the CST command damp also lists the eigenvalues, which are nothing
     but the roots of the characteristic polynomial (same as the poles of the system).
     We will discuss the eigenvalues in Chapter 3. (Alternatively, we could have used
     the intrinsic MATLAB function roots to get the pole locations as the roots of each
     quadratic factor.) As expected, the poles for each quadratic factor in the characteristic
     equation are complex conjugates. Instead of calculating the roots of each quadratic
     factor separately, we can multiply the two quadratic factors of Eq. (2.89) using
     the intrinsic MATLAB command conv, and then directly compute the roots of the
     characteristic polynomial as follows:

     »damp(conv(a,b))% roots of the characteristic polynomial <enter>
     Eigenvalue                          Damping               Freq. (rad/sec)
     -0.0025+0.0774i                     0.0323                0.0775
     -0.0025-0.0774i                     0.0323                0.0775
     -0.5000+1.0724i                     0.4226                1.1832
     -0.5000-1.0724i                     0.4226                1.1832
    The pair of natural frequencies and damping-ratios denote two natural modes
 of the system, i.e. the two ways in which one can excite the system. The first
 mode is highly damped, with a larger natural frequency (1.1832 rad/s), and is called
 the short-period mode (because the time-period of the oscillation, T = 2n/a),, is
LAPIACE TRANSFORM AND THE TRANSFER FUNCTION                                   45


smaller for this mode). The second characteristic mode is very lightly damped with
a smaller natural frequency (0.0775 rad/s) - hence, a longer time-period - and is
called the long-period (or phugoid} mode. While an arbitrary input will excite a
response containing both of these modes, it is sometimes instructive to study the
two modes separately. There are special elevator inputs, 8 (s), which largely excite
either one or the other mode at a time. (You may refer to Blakelock [3] for details
of longitudinal dynamics and control of aircraft and missiles.)
   We now examine the Bode plots of each of the three transfer functions,
v(s)/8(s), a(s)/8(s), and 6(s)/S(s), respectively, to see how much is each output
variable influenced by each of the two characteristic modes. Figures 2.26, 2.27, and
2.28 show the gain and phase Bode plots for the three transfer functions in the limit
s = ico (they are the frequency responses of the concerned output variable). Using
Control Systems Toolbox (CST), these plots are directly obtained by the command
bode, after constructing each transfer function using the LTI object tf. Bode plot of
transfer function v ( s ) / B ( s ) (Figure 2.26) is generated using the following MATLAB
statements:

      »a=[1 - 7 0 ] ; b=[1 0 . 5 ] ; num=-0.0005*conv(a,b) <enter>
      num =
       -0.0005 0.0348 0.0175
      »a=[1 0.005 0.006]; b=[1 1 1.4]; den=conv(a,b) <enter>
      den =
        1.0000 1.0050 1.4110 0.0130 0.0084


                            Phugoid mode Short-period mode Bode plot of v(s)/6(s)
                    100




                   -200
                      10            10          10°         101         10*         103
                                             Frequency (rad/sec)

                    180 F



              CD
              8 -180 r


                   -360 I
                       10                      10°        101           102         103
                                             Frequency (rad/sec)

       Figure 2.26        Bode plot of the aircraft's transfer function v(s)/<5(s) with s = io
46                          UNEAR SYSTEMS AND CLASSICAL CONTROL


                        Phugoid mode Short-period mode Bode plot of a(s)/8(s)



         £•
                 50


                  0
                              "irnit
         1 -50


               -100
                  10~2                           10°          101           102        103
                                              Frequency (rad/sec)




                  10-2            10-1           10°          101         102          103
                                              Frequency (rad/sec)

     Figure 2.27           Bode plot of the aircraft's transfer function a(s)/<5(s) with s = ico



                        Bode plot of 6{s)/S(s)    Phugoid mode Short-period mode



         m
         T3,
          c
         'eo
         CD



                 -50
                      10               10-2            10"1           10°
                                              Frequency (rad/sec)



         9-180
          <D
         TO_


          8 -270
          (0
         a.
               -360
                      10r-3           10-2             1Q-1           10°

                                              Frequency (rad/sec)

     Figure 2.28           Bode plot of the aircraft's transfer function 0(s)/8(s) with s =
LAPLACE TRANSFORM AND THE TRANSFER FUNCTION                           47


     »vdelta = tf(num,den) <enter>
     Transfer function:
        -0.0005 8*2+0.03475 S+0.0175

     SA4+1.005 SA3+1.411 SA2+0.013 S+0.0084
     »bode(vdelta) % Figure 2.26 <enter>

   The Bode plot of transfer function a(s)/S(s) (Figure 2.27) is generated using the
following MATLAB statements:

     »a=[1 80];b=[1 0.0065 0.006]; num=-0.02*conv(a,b) <enter>

     num =
      -0.0200     -1.6001     -0.0105    -0.0096

     »alphadelta = tf(num,den) <enter>
     Transfer function:
        -0.02 s A 3-1.6 s"2-0.01052 s-0.0096

     SA4+1.005 SA3+1.411 SA2+0.013 S+0.0084

     »bode(alphadelta) % Figure 2.27 <enter>

(Note that the denominator polynomial, den, of a(s)/8(s) is same as that of
t;($)/<$($), and does not have to be re-calculated.)
    Finally, the Bode plot of transfer function 9(s)/8(s) (Figure 2.28) is generated
using the following MATLAB statements:

     »a=[1 0.02]; b=[1 0 . 4 ] ; num=-1.4*conv(a,b) <enter>
     num =
       -1.4000     -0.5880 -0.0112
     »thetadelta = tf(num,den) <enter>
     Transfer function:
        -1 .4 SA2-0.588 S-0.0112

     SA4+1.005 SA3+1.411 SA2+0.013 S+0.0084
     »bode(thetadelta) % Figure 2.28 <enter>

   From the Bode plots (Figures 2.26-2.28), we can note the natural frequencies
of the phugoid and the short period modes, respectively, as either the peaks or
changes of slope (called breaks) in the respective gain plots. The peaks due to
complex poles sometimes disappear due to the presence of zeros in the vicinity
of the poles. As expected, the natural frequencies agree with the values already
48                      LINEAR SYSTEMS AND CLASSICAL CONTROL


  calculated from the characteristic polynomial, because all the three transfer func-
  tions have the same characteristic (denominator) polynomial. Figure 2.26 shows
  that the magnitude (gain) of v(ia))/8(ia)) at the short period natural frequency is
  very small, which indicates that the short period mode oscillation is characterized
  by very small changes in forward velocity, v(iw), which can be neglected (i.e.
  v(ia)) % 0) to obtain a short period approximation. As expected, near each natural
  frequency the phase changes by 180°, except for the phugoid mode in a(ia))/8(ia>)
  (Figure 2.27). The latter strange behavior of the phugoid mode is due to the fact that
  in the transfer function a(ia))/8(i(o), one of the numerator quadratics (i.e. a pair
  of complex zeros) almost cancels out the quadratic corresponding to the phugoid
  mode in the denominator polynomial (i.e. a pair of complex poles), indicating that
  there is essentially no change in the angle-of-attack, «(/&>), in the phugoid mode.
  Also, the magnitude (gain) of a(i(o)/8(ico) at the phugoid natural frequency is seen
  to be very small in Figure 2.27 as compared to the gain at the same frequency in
  Figures 2.26 and 2.28. The fact that the phugoid oscillation does not involve an
  appreciable change in the angle-of-attack, «(/&>), forms the basis of the phugoid
  approximation in which a(ico) % 0. However, Figure 2.28 shows that considerable
  magnitude (gain) of 9(ia))/8(i(o) exists at both short period and the phugoid natural
  frequencies. Hence, both modes essentially consist of oscillations in the pitch angle,
  9 (ia)). The present example shows how one can obtain an insight into a system's
  behavior just by analyzing the frequency response of its transfer function(s).
      Note from Figures 2.26-2.28 that the gains of all three transfer functions decay
 rapidly with frequency at high frequencies. Such a decay in the gain at high
 frequencies is a desirable feature, called roll-off, and provides attenuation of high
 frequency noise arising due to unmodeled dynamics in the system. We will define
 sensitivity (or robustness) of a system to transfer function variations later in this
 chapter, and formally study the effects of noise in Chapter 7. Using Eq. (2.85),
 we can estimate the high-frequency gain-slope and phase of the three transfer
 functions given by Eqs. (2.86)-(2.88). For v(s)/S(s), K < 0, m = 2, and n = 4,
 which implies a gain-slope (or roll-off) of —40 dB/decade and a phase of —360°
 (or 0°) in the limit a> -> oo, which are confirmed in Figure 2.26. For a ( s ) / 8 ( s ) ,
  K < 0, m = 3, and n = 4, which implies a roll-off of —20 dB/decade and a phase
 of —270° (or 90°) in the limit CD -> oo, which are evident in Figure 2.27. Finally,
 for 0(s)/8(s), K < 0, m = 2, and n = 4, which implies a gain-slope (or roll-off) of
 —40 dB/decade and a phase of —360° (or 0°) in the limit o> -> oo, which are also
 seen in Figure 2.28.
      The transfer function v(s)/8(s} has a peculiarity which is absent in the other
 two transfer functions - namely, a zero at 5 = 70. A system with transfer function
 having poles or zeros in the right-half s-plane is called a non-minimum phase
 system, while a system with all the poles and zeros in the left-half s-plane, or on
 the imaginary axis is called a minimum phase system. We will see below that systems
 which have poles in the right-half s-plane are unstable. Hence, stable non-minimum
 phase systems have only zeros in the right-half 5-plane, such as the system denoted
 by v(s)/8(s). Stable non-minimum phase systems have a markedly different phase in
 the limit a> —> oo (we may have to add or subtract 360° to find non-minimum phase
LAPLACE TRANSFORM AND THE TRANSFER FUNCTION                                     49


     from Eq. (2.85)), when compared to a corresponding minimum phase system (i.e.
     a similar system with no zeros in the right-half s-plane). This usually results in an
     unacceptable transient response. A non-minimum phase system with only one right-
     half plane zero (such as v(s)/8(s)) results in a transient response which is of opposite
     sign when compared to the input. Popular examples of such systems are aircraft or
     missiles controlled by forces applied aft of the center of mass. For this reason, a
     right-half plane zero in an aircraft (or missile) transfer function is called 'tail-wags-
     the-dog zero'. Control of non-minimum phase systems requires special attention.


    Before we can apply the transfer function approach to a general system, we must know
how to derive Laplace transform (and inverse Laplace transform) of some frequently
encountered functions. This information is tabulated in Table 2.1, using the definitions
and properties of the Laplace transform (Eqs. (2.59)-(2.70)). Note that Table 2.1 gives
the Laplace transform of some commonly encountered functions, f ( t ) , which are defined
for t > 0. At t = 0, f ( t } can have a discontinuity, such as /(r) = us(t} or f ( t ) = 8(t). It
is interesting to see in Table 2.1 that the Laplace transform of the unit impulse function,
8(t), is unity, while that of the unit step function, us(t), is l/s. Since dus(t)/dt = 8(t),
the Laplace transforms of these two singularity functions agree with the properties given
by Eqs. (2.66) and (2.68).

                          Table 2.1   Laplace transforms of some common functions

s.                        f(t)                        FW = £/w = re -., /(/)rfr
No.                     (t > 0)
1           e-<"                                                    1/Gv+a)
2           e- fl '/(0                                              F(j+a)
3           f"                                                       w!/s" +l
4           Unit Step                                                   l/s
               Function, M^(/)
5           sin(w?)                                               co/(s2 + to2)
6           cos(ct)/)                                             5/(5 2 + O)2)

7           / (Ar) (0                      skF(s) - sk~lf(0) - s ~ f (0)
                                                                     k 2 w
                                                                                             /(*-1)(0)
8           I -oo f ( t ) d t                         F(s)/s + ( } / s ) f ^ x f ( t ) d t
9           Unit Impulse                                          I
              Function, 8(t)


     Example 2.11

     Consider a system with the following transfer function:

                                  G(s) = (s + 3)/[(s + l)(s + 2)]                                  (2.90)

     The second order system (denominator polynomial is of degree 2) has a zero, z =
     —3, and two poles, p = — 1 and p2 = —2. Let us assume that the system has the
50                           LINEAR SYSTEMS AND CLASSICAL CONTROL


     input, w(0, and initial conditions as follows:

                                u(t) =0,y(0) = y0, y(1)(0) =0                          (2.91)

     Since G(s) = Y(s)/U(s) when the initial conditions are zero (which is not the
     case here), we cannot directly use the transfer function to determine the system's
     response, y(0, for t > 0. Let us first derive the system's governing differential
     equation by applying inverse Laplace transform to the transfer function (with zero
     initial conditions, because that is how a transfer function is defined) as follows:

                               (s + 1)(5 + 2)K(5) = (s + 3)17(5)                      (2.92)

     or

                           s2Y(s) + 3sY(s) + 2Y(s) = sU(s) + 3U(s)                    (2.93)

     and

                   £Tl[s2Y(s) + 3sY(s) + 2Y(s)] = £~l[sU(s) + 317(5)]                 (2.94)

     which, using the real differentiation property (Eq. (2.67)) with zero initial conditions
     for both input, u(t), and output, y(0, yields the following differential equation:
                           y (2) (0 + 3y(1)(0 + 2y(0 = "(1)(0 + 3a(f)                 (2.95)
     Now, we can apply the Laplace transform to this governing differential equation
     using real differentiation property with the input and the initial conditions given by
     Eq. (2.91) as

                             (r) + 3 y ) ( 0 + 2y(01 = H n ( ( 0 + 3«(0]              (2.96)
     or
                           s2Y(s) - sy0 + 3sY(s) - 3y0 + 2Y(s) = 0                    (2.97)

     and it follows that
                               Y(s) = (s + 3)y0/[(5 + 1)(5 + 2)]                      (2.98)
     We can express Y(s) as
                               Y(s) = y0[2/(s + 1) - l/(s + 2)]                        (2.99)
     Equation (2.99) is called the partial fraction expansion of Eq. (2.98), where the
     contribution of each pole is expressed separately as a fraction and added up. In
     Eq. (2.99) the two numerator coefficients, 2 and —1, corresponding to the two
     fractions are called the residues.
        The output, y(t ), of the system can then be obtained by applying inverse Laplace
     transform to Eq. (2.99) for t > 0 as
                       y(t) = yo{£-l[2/(s + 1)] + £-'[-l/(s + 2)]}                   (2.100)
_                        RESPONSE TO SINGULARITY FUNCTIONS_                                 _51


   or, using the translation in Laplace domain property given by Eq. 2.65, we can
   write the output finally as

                            y ( t ) = 2y(}z-< - y()e~-2r;   (t > 0)                (2, 101)


   In Example 2.11 we have seen how we can evaluate a single-input, single-output
system's response if we know its transfer function, applied input and initial conditions,
by using a partial fraction expansion of Y (s). For a system with complex poles (such
as Example 2.8), finding partial fraction expansion can be very difficult. Fortunately, the
MATLAB intrinsic command residue makes finding partial fraction expansion a simple
affair. All one has to do is to specify the numerator and denominator polynomials of
the rational function in s - such as Eq. (2.98) - for which a partial fraction expansion is
desired. For example, if the rational function is N(s)/D(s), then the coefficients of the
polynomials N(s) and D(s) in decreasing powers of s are specified in two vectors, say,
n and d. Then the residue command is used as follows to give the terms of the partial
fraction expansion:

      » [ k , p 5 c ] = residue(n,d) <enter>

where p is a vector containing the poles of N(s)/D(s), k is a vector containing the
corresponding residues, and c is the direct constant. In terms of the elements of p and k,
the partial fraction expansion is given by

                    N ( s ) / D ( s ) = c + *i/(s - pi) + • • •+kn/(s - pn)             (2.102)

where all the poles, PJ, are distinct (i.e. they appear only once - as in Example 2.1 1). If
a pole, say pm , is repeated q times, then the partial fraction expansion obtained from the
residue command is given by

    N(s)/D(s) = c + k}/(s -      Pl)   + • • • + km/(s - pm) + km+{/(s - pm)2
                   + km+2/(s ~ pmf       H ----- h km+q-/(s - pm)q H ----- h kn/(s -   pn)
                                                                                   (2.103)
Now we are well equipped to talk about a linear system's response to singularity functions.


2.5 Response to Singularity Functions
In the previous two sections, we saw how frequency response, Laplace transform, and
transfer function can be used to evaluate a linear system's characteristics, and its response
to initial conditions (Example 2.11). Here we will apply a similar approach to find out a
linear system's response to singularity functions, and extend the method for the case of
arbitrary inputs. We had ended Section 2.2 with a remark on the special place held by
the unit impulse function in control theory. To understand why this is so, let us define
impulse response, g(t), as the response of a system to a unit impulse, 8(t), applied as
input at time t = 0. Furthermore, it is assumed that the system is at rest at t — 0, i.e. all
52_                       LINEAR SYSTEMS AND CLASSICAL CONTROL                            _


initial conditions (in terms of the output, y ( t ) , and its time derivatives) are zero. We know
from Table 2.1 that the Laplace transform of 5(0 is unity. Also, from the definition of the
transfer function for a single-input, single-output system (Eq. (2.72)) Y(s) = G(s)U(s).
Since, in this case, y(t) = g(0 and Laplace transform of the input, U(s)=l, it implies that
the following must be true:

                      g(t) = L~lY(s) = £-'[0(5)17(5)] = £-!0(5)                         (2.104)
   Equation (2.104) denotes a very important property of the impulse response, namely
that the impulse response of a linear, time-invariant system with zero initial conditions
is equal to the inverse Laplace transform of the system's transfer Junction. Hence, the
symbol g(t) for the impulse response! One can thus obtain G(s) from g(t) by applying
the Laplace transform, or g(t) from G(s) by applying the inverse Laplace transform.
Since the transfer function contains information about a linear system's characteristics,
we can now understand why impulse response (and the unit impulse function) deserve
a special place in control theory. In a manner similar to the impulse response, we can
define the step response, s(t), as a linear, time-invariant system's response to unit step
input, us(t), applied at time t = 0 with zero initial conditions. Again, using Table 2.1, we
note that Laplace transform of the unit step function is given by U(s) = 1/5, and the step
response can be expressed as

                           5(0 = £-![G(5)l/(5)] = £-'[0(5)75]                            (2.105)
which shows that the step response is also intimately related with a system's transfer
function, and hence with its characteristics.

  Example 2.12
  Let us revisit the second order system consisting of the electrical network of
  Examples 2.8 and 2.9, and evaluate the impulse response, g(r), and step response,
  5(0, for this system with zero initial conditions. Equation (2.80), gives the system's
  transfer function as G(s) = 0.5s /(s2 + 30s + 106). Using the partial fractions ex-
  pansion of G(s), we can write
                            0(5) = *i/(5 - p i ) + k2/(s - P2}                       (2.106)
  where p and pi are the two poles (roots of the denominator polynomial of
  and the residues k and ki are evaluated as follows:
                                            ]|JS=p, = 0.5p,/(p, - P2)                (2.107)
                      *2 - [(s - P2)G(S)]S=P2 = 0.5p2/(p2 - Pi)                     (2.108)
  Again, from Example 2.9 we know that p = — 15 — 999.9i and p2 = — 15 +
  999.9i. Then from Eqs. (2.107) and (2.108), fc, = 0.25 - 0.00375/ and k2 = 0.25 +
  0.00375/. The residues can be verified by using the MATLAB intrinsic command
  residue as follows:

       »N=[0.5 0]; D=[1 30 1e6]; [k,p,c]=residue(N,D) <enter>
RESPONSE TO SINGULARITY FUNCTIONS                                                          53


    k =
      0.25000000000000+0.003750421946201
      0.25000000000000-0.003750421946201

    P =
       1.Oe+002*
      -0.15000000000000+9.998874936711631
      -0.15000000000000-9.998874936711631




Taking the inverse Laplace transform of Eq. (2.106) with the use of Table 2.1, we
get the following expression for the impulse response, g(t):

                       g(t) = k exp(pjO + & 2 exp(/7 2 0; (t > 0)                                         (2.109)

  Using the fact that p and p2 are complex conjugates (and k and ki are also
complex conjugates), we can simplify Eq. (2.109) to give

            g(t)   = e~'5/[0.5cos(999.90 - 0.0075 sin (999.901; (t > 0)                                    (2.110)

Note that the impulse response, g ( t ) , given by Eq. (2.110) has an amplitude which
decreases exponentially with time due to the term e~ 15r . This is a characteristic of
a underdamped, stable system, as seen in Figure 2.24.
   Since the poles can also be represented in terms of their natural frequency, a)n , and
damping-ratio, g, as p2. = —gojn ± io)n(g2 — l) l / 2 , (see Eqs. (2.83) and (2.84)) we
can also write

    g(t) = y0ep(-ga>nt)sm[a>nt (1 - g2)l/2 + 0]/(l - <T 2 ) 1/2 ;                                (t > 0) (2.111)

where 9 = cos""1^) and

          yo = 2*,[(1 - < r 2 ) I / 2 ]/e /(0 - 7r / 2) = 2*2[(1 -   ?
                                                                         2
                                                                             )'/ 2 ]/ e - | '^- 3r / 2 >   (2.1 12)

    You can verify Eqs. (2.1 11) and (2.1 12) using complex algebra, but don't worry
if you don't feel like doing so, because Eq. (2.109) can be directly obtained using
MATLAB to get the impulse response, g ( t ) , as follows:

»p1=-15-999.9i; p2=conj(p1); k1=0. 25-0. 003751; k2=conj(k1); <enter>
»t=0:0. 001:1; g=k1*exp(p1*t)+k2*exp(p2*t) ; plot(t,g),
  xlabel( 'Time ( s ) ' ) , ylabel( ' g ( t ) ' ) <enter>

Here conj( ) is the intrinsic MATLAB operator that calculates the complex conju-
gate, exp( ) is the exponential function, and plot(x,y) is the MATLAB command for
plotting the vector x against the vector y. Note that both t and g are vectors of
the same size. Also, note the ease by which complex vector calculations have been
made using MATLAB. The same computation in a low-level language - such as
54_                           LINEAR SYSTEMS AND CLASSICAL CONTROL                       _


   Fortran, Basic, or C - would require many lines of programming. For more infor-
   mation on the usage of a MATLAB command type help < name of command>
   <enter> at the MATLAB prompt.
      We know from Example 2.9 that for the example electrical network, the natural
   frequency and damping-ratio are, con = 1000 rad/s and g = 0.015, respectively.
   Substituting these numerical values in Eq. (2.1 12), we get y0 = 0.5 amperes.
      We can also evaluate the step response, s(t ), of the electrical network by taking
   the inverse Laplace transform of G(s)/s as follows:

                   s(t) = £Tl[G(s)/s] = £~}[0.5/(s2 + 30s + 106)]
                        = £-'[2.5 x KT 4 //(j - p i ) - 2.5 x I0~4i/(s - p2)]           (2.113)

   or

                           s(t) = 2.5 x 10~ 4 i[exp(pif) - exp(p2')l
                               = 5 x 10" V15' sin(999.9f);       (t > 0)               (2.114)

   Note that 5(0 given by Eq. (2.114) also indicates a stable system due to the oscil-
   latory step response with a decaying amplitude of 5 x 10~4e~15'.

   The calculation of step and impulse responses can be generalized by using the partial
fraction expansion of G(s)/s and G(s), respectively. Taking the inverse Laplace transform
of Eq. (2.104), we can express the impulse response for a unit impulse input applied at
t = 0 as follows:

               g(t) = cS(t) + k exp(pif) H ----- h km exp(p m f) + km+lt exp(p m r)
                      + km+2t2 ep(pmt)/2 + • • • + km+q.itt'-1 ep(pmt)/(q - 1)!
                      + ---+knep(pnt)        (f>0)                                      (2.115)

Note that in deriving Eq. (2.1 15), we have used the translation in Laplace domain property
of the Laplace transform (Eq. (2.65)), and have written the inverse Laplace transform of
l/(s - p)k as tk~lep'/(k - 1)!. If the impulse is applied at t = tQ, the time t in Eq. (2.1 15)
should be replaced by (/ — to), since the Laplace transform of g(t — /o) is G(s) exp(— sto).
If the system is strictly proper (i.e. the degree of the numerator polynomial of the transfer
function, G(s), is less than that of the denominator polynomial), then the direct constant,
c, in the partial fraction expansion of G(s) is zero, and the impulse response does not go to
infinity at t = 0 (Eq. (2.1 15)). Hence, for strictly proper transfer functions, we can write
a computer program using MATLAB to evaluate the impulse response using Eq. (2.1 15)
with c = 0. Such a program is the M-file named impresp.m, which is listed in Table 2.2,
and can be called as follows:
        >>
             [ 9 > t ] = impresp(num,den,tO,dt,tf ) <enter>
_                            RESPONSE TO SINGULARITY FUNCTIONS _                                   55


Table 2.2 Listing of the M-file impresp. m, which calculates the impulse response of a strictly proper,
single-input, single-output system

                                             impresp . m
function [y,t]=impresp(num,den,tO,dt,tf ) ;
%Program for calculation of impulse response of strictly proper SISO
   systems
%num = numerator polynomial coefficients of transfer function
%den = denominator polynomial coefficients of transfer function
%(Coeff icients of 'num' and 'den' are specified as a row vector, in
%decreasing powers of 's')
%tO = time at which unit impulse input is applied
%dt = time-step (should be smaller than 1/ (largest natural freq.))
%tf = final time for impulse response calculation
%y = impulse response; t= vector of time points
%copyright(c)2000 by Ashish Tewari
%
%Find a partial fraction expansion of num/ (den) :-
[r,p,k]=residue(num,den) ;
%Calculate the time points for impulse response : -
t=tO:dt:tf ;
%Find the multiplicity of each pole, p(j):-
for j=1 :size(p)
n=1;
           for i=1 :size(p)
                      if p(j)==p(i)
                                        n=n+1 ;
                                        end
                       end
            end
mult( : ,j )=n;
end
%Calculate the impulse response by inverse Laplace transform of
%partial-f raction expansion :-
y=zeros(size(t) ) ;
j=1;
while j<=size(p,1)
           for i=1 :mult( : ,j )
           y=y+r(j+i-1)*((t-tO) . A (i-1)) . *exp(p(j )*(t-tO) ) /factorial (i-1 );
            end
            ]=]+i;
end


where num and den are row vectors containing numerator and denominator polynomial
coefficients, respectively, of the transfer function, G(s), in decreasing powers of s, tO is the
time at which the unit impulse input is applied, dt is the time-step size, tf is the final time
for the response, g is the returned impulse response, and t is the returned vector of time
points at which g(t) is calculated. Instead of having to do inverse Laplace transformation
by hand, we can easily use impresp to quickly get the impulse response of a strictly proper
56                          UNEAR SYSTEMS AND CLASSICAL CONTROL


Table 2.3 Listing of the M-file stepresp.m, which calculates the step response of a proper, single-input,
single-output system

                                             stepresp.m
function [y,t]=stepresp(num>den,tOJdt)tf);
%Program for calculation of step response of proper SISO systems
%num = numerator polynomial coefficients of transfer function
%den = denominator polynomial coefficients of transfer function
%(Coefficients of 'num' and 'den' are specified as a row vector, in
%decreasing powers of 's')
%tO = time at which unit step input is applied
%dt = time-step (should be smaller than 1/(largest natural freq.))
%tf = final time for step response calculation
%y = step response; t= vector of time points
%copyright(c)2000 by Ashish Tewari
%
%Find a partial fraction expansion of num/(den.s):-
[r,p,k]=residue(num,conv(den,[1 0]));
%Calculate the time points for step response:-
t=tO:dt:tf;
%Find the multiplicity of each pole, p ( j ) : -
for j=1:size(p)
n=1;
          for i=1:size(p)
                    if p(j)==p(i)
                                        if(i~=i)
                                        n=n+1;
                                        end
                    end
          end
mult(:,j)=n;
end
%Calculate the step response by inverse Laplace transform of
%partial-fraction expansion:-
y=zeros(size(t));
j=1;
while j<=size(p,1)
         for i=1:mult(:,j)
         y=y+r(j+i-1)*((t-tO).*(i-1)).*exp(p(j)*(t-tO))/factorial(i-l);
         end
            i = i + i;
end


plant. The M-file impresp.m uses only the intrinsic MATLAB functions, and is useful for
those who do not have Control System Toolbox (CST). Usage of CST command impulse
yields the same result. (We postpone the discussion of the CST command impulse until
Chapter 4, as it uses a state-space model of the system to calculate impulse response.)
Note the programming steps required in impresp to identify the multiplicity of each pole
of G(s). For increased accuracy, the time-step, dt, should be as small as possible, and, in
any case, should not exceed the reciprocal of the largest natural frequency of the system.
   In a manner similar to the impulse response, the step response calculation can be
generalized by taking the inverse Laplace transform of the partial fraction expansion of
_                          RESPONSE TO SINGULARITY FUNCTIONS_                              57


G(s)/s as follows:
           s(t) = k+k2 exp(/?20 H ----- -km exp(/7 m r) + km+it ep(pmt)
                   + km+2t2exp(pmt)/2 H ---- + km+q^~{ exp(pmt)/(q - 1)!
                                      )(f > 0 )                                       (2.116)
where k[ is the residue corresponding to the pole at s = 0, i.e. p = 0, and ^2 ... kn are the
residues corresponding to the poles of G(s), p . . . pn, in the partial fraction expansion
of G(s)/s. Note that if G(s) is a proper transfer function (i.e. numerator polynomial
is of lesser or equal degree than the denominator polynomial), then G(s)/s is strictly
proper, and the direct term, c, is zero in the partial fraction expansion of G(s)/s. Thus,
we can evaluate the step response of a proper system using Eq. (2.1 16), which should be
modified for a unit step input applied at t = to by replacing t in Eq. (2.1 16) by (t — to). A
MATLAB program called stepresp.m, which evaluates the step response of proper system
by Eq. (2.116), is listed in Table 2.3, and can be used as follows:
      »[s,t] = stepresp(num,den,tO,dt ,tf ) <enter>
where num. and den are row vectors containing numerator and denominator polynomial
coefficients, respectively, of the transfer function, G(s), in decreasing powers of s, tO is
the time at which the unit step input is applied, dt is the time-step size, // is the final
time for the response, s is the returned step response, and t is a vector containing time
points at which s(t) is calculated. The M-file stepresp.m uses only intrinsic MATLAB
functions, and is useful in case you do not have access to Control System Toolbox (CST).
The CST command step is a quick way of calculating the step response. The GUI tool
associated with the command step also lets you get the values of s(t) and t at any point
on the step response curve by merely clicking at that point.

  Example 2,13

   Let us compute and plot the step and impulse responses of the aircraft transfer
   function, 6(s)/8(s), of Example 2.10, given by Eq. (2.88). We must begin with the
   specification of the transfer function as follows:

       »a=[1 0.02]; b=[1 0 . 4 ] ; num=-1 .4*conv(a,b) <enter>
       num =
          -1.4000     -0.5880      -0.0112

       »a=[l 0.005 0.006]; b=[1 1 1.4]; den=conv(a,b) <enter>
       den =
          1.0000     1.0050     1.4110     0.0130     0.0084

  Note that the transfer function is strictly proper (the numerator polynomial is of
  second degree, while the denominator polynomial is of fourth degree). Hence, we
  can use impresp.m to compute the impulse response, g(t), and plot the result as
  follows:

       »[g,t] = impresp(num, den, 0,0. 5,250) ; plot(t,g) <enter>
58                           LINEAR SYSTEMS AND CLASSICAL CONTROL


   Note that the time-step for calculating the impulse response is smaller than inverse of
   the largest natural frequency of the system (1.18 rad/s). Similarly, the step response,
   s ( t ) , is computed using stepresp and plotted as follows:

        »[s,t] = stepresp(num,den,0,0.5,250); plot(t,s) <enter>

   The resulting plots of impulse and step responses are shown in Figure 2.29. Note
   that the plot of the impulse response clearly shows an initial, well damped oscillation
   of high-frequency (short-period mode) and a lightly damped, long-period oscillation
   (phugoid mode). This behavior meets our expectation from the natural frequencies
   and damping-ratios of the two modes calculated in Example 2.10 (recall that the
   natural frequency and damping of the short-period mode are more than 10 times
   those of the phugoid mode). It is also clear that the impulse response excites both
   the modes, while the step response is dominated by the phugoid mode. The time
   taken by the phugoid mode to decay to zero is an indicator of the sluggishness of
   the longitudinal dynamics of the airplane. The non-minimum phase character of the
   transfer function due to the zero at s = 70 is evident in the large initial undershoot
   in the impulse response.

                       0.5




                 "o> -0.5
                              Short-period mode          Phugoid mode

                                   50         100         150           200     250
                                                 Time (s)




                 ~5f    -5


                                   50         100              150      200     250
                                                    Time (s)

   Figure 2.29 Impulse response, g(t), and step response, s(f), for the aircraft transfer function,
   9(s)/S(s) (Example 2.13)




2.6 Response to Arbitrary Inputs
After learning how to find step and impulse responses of a given linear system, the next
logical step is to find the response to an arbitrary input, u(t), which is applied to a linear
RESPONSE TO ARBITRARY INPUTS                          59


system with zero initial conditions. At the end of Section 2.2 (Figure 2.16), we saw how
an arbitrary function can be expressed as a sum (or integral) of the suitably scaled impulse
functions, S(t — a), as given by Eq. (2.36). Since we know how to find the response of
a linear, time-invariant system to a unit impulse input for zero initial conditions, we can
apply the superposition principle to get the linear system's response, y(/% to an arbitrary
input, «(?), which is expressed as
                                                   OO

                                       u(t) - V u(T)&T8(t-T)                            (2.117)

and the response to the impulse input «(r)Ar<5(r — r) applied at t = r is given by

                                                ) = M(r)Arg(f - T)                      (2.118)

where g(t — T) is the impulse response to unit impulse, S(t — r), applied at t = i. Then by
the superposition principle (Eq. (2.36)), the response to a linear combination of impulses
(given by Eq. (2.35)) is nothing else but a linear combination of individual impulse
responses, g(t — r), each multiplied by the corresponding factor, «(r)Ar. Hence, we can
write the response, y ( t ) , as


                                       y(t)=              M(r)AT£(r - T)                (2.119)
                                               T = — OO



or, in the limit AT —»• 0,
                                                    OO
                                                         U (T)g(t-T)dT                  (2.120)
                                               /   -00


   Equation (2.120) is one of the most important equations in control theory, since it lets
us determine a linear system's response to an arbitrary input. The integral on the right-
hand side of Eq. (2.120) is called the superposition integral (or convolution integral).
Note that we can apply a change of integration variable, and show that the convolution
integral is symmetric with respect to u(t) and g(t) as follows:
                                  oc                             /»oo
                   y(t)                U(l)g(t - T)dl =                 U(t- T)g(T)dT   (2.121)
                             /   -oc                            J—oc


Most commonly, the input, u(t), is non-zero only for t > 0. Also, since g(t — r) = 0
for r > t, we can change the upper limit of the convolution integral to t. Hence, the
convolution integral becomes the following:


                    y(t)=              u(T)g(t-T)dT== (              U(t-T)g(T)dT       (2.122)
                                 Jo                            Jo
                                                               ./o

   We could have obtained Eq. (2.122) alternatively by applying inverse Laplace trans-
form to Y(s) = G(s)U(s) (since G(s) is the Laplace transform of g(t)).
60                              LINEAR SYSTEMS AND CLASSICAL CONTROL


     Example 2.14
      We can use the convolution integral to obtain the step response, s(t), of the second
      order system of Example 2.12 as follows:

                                    5(0= /
                                       = /      us(t -
                                                Us(t-T)g(T)dT                       (2.123)
                                           Jo
     where us(t) is the unit step function and the impulse response, g(0, is given by
     Eq. (2.110). Substituting Eq. (2.110) into Eq. (2.123), and noting that us(t - r) = 1
     for T < t and us(t — T) = 0 for T > r, we get the following expression for the step
     response:
                            f
                 5(0   =/        e~15r[0.5 cos(999.9r)- 0.0075 sin(999.9r)]rfr      (2.124)

     Carrying out the integration in Eq. (2.124) by parts, we get the same expression for
     s(t) as we obtained in Eq. (2.114), i.e. s(t) = 5 x 10"4 e~15' sin(999.9/) for t > 0.

    The use of convolution integral of Eq. (2.120) can get difficult to evaluate by hand
if the input u(t) is a more complicated function than the unit step function. Hence, for
a really arbitrary input, it is advisable to use a numerical approximation of the convo-
lution integral as a summation over a large number of finite time-steps, Ar. Such an

Table 2.4 Listing of the M-file response.m, which calculates the response of a strictly proper,
single-input, single-output system to an arbitrary input

                                             response.//?
function y=response(num,den,t,u);
%Program for calculation of the response of strictly proper SISO systems
%to arbitrary input by the convolution integral.
%num = numerator polynomial coefficients of transfer function
%den = denominator polynomial coefficients of transfer function
%(Coefficients of 'num' and 'den' are specified as a row vector, in
%decreasing powers of 's')
%t = row vector of time points (specified by the user)
%u = vector of input values at the time points contained in t.
%y = calculated response
%copyright(c)2000 by Ashish Tewari
%
%Calculate the time-step:-
dt=t(2)-t(l);
m=size(t,2)
tf=t(m);
%Calculate the convolution integral:-
y=zeros(size(t));
G=y;
[g,T]=impresp(num,den,t(1),dt,tf);
for i=1:m
y=y+dt*u(i)*[G(1:i-1) g(1:m-i+1)];
end
RESPONSE TO ARBITRARY INPUTS                                    61

approximation of an integral by a summation is called quadrature, and there are many
numerical techniques available of varying efficiency for carrying out quadrature. The
simplest numerical integration (or quadrature) is the assumption that the integrand is
constant in each time interval, AT, which is the same as Eq. (2.119). Hence, we can use
Eq. (2.119) with a finite number of time steps, AT, to evaluate the convolution integral,
and the response to an arbitrary input, u(t). Such a numerical evaluation of the convolu-
tion integral is performed by the M-file, called response.m, listed in Table 2.4. Note that
response calls impresp.m internally to evaluate the impulse response, g(t — T), for each
time interval, AT. The M-file response.m is called as follows:

     »y = response(num,den,t,u) <enter>

where num, den are the numerator and denominator polynomial coefficients of the transfer
function, G(s), (same as in impresp and stepresp), t is the row vector containing time
points at which the response, v, is desired, and M is a vector containing values of the
applied arbitrary input at the time points contained in t.

  Example 2.15
  Let us determine the pitch response, 0(t), of the aircraft transfer function, 9(s)/8(s),
  (Examples 2.10, 2.13) if the applied input is 8(t) = 0.01?.sin(1.30, beginning at
  t = 0. We first specify the time vector, t, and input vector, u, as follows:

       »t=0:0.1:20; u=0.01*t.*sin(1.3*t); <enter>



                        0.25

                         0.2

                        0.15

                          0.1

                        0.05

                           0

                       -0.05

                        -0.1

                       -0.15

                        -0.2
                                0                    10          15          20
                                                  Time (s)

  Figure 2.30 Response of the pitch angle, 0(t), for the aircraft when the elevator deflection is
  S(t) = O.OU.sin(1.3f) radians
62                           LINEAR SYSTEMS AND CLASSICAL CONTROL


     Then the response is calculated using the M-file response.m as follows:

         »y = r e s p o n s e ( n u m , d e n , t , u ) ; <enter>

     where num and den were specified in Example 2.13. The calculated response is
     plotted in Figure 2.30. Note the ease with which response.m calculates the response
     to a complicated input function. A more general method of evaluating response of
     even multi-input, multi-output systems based on the state-space approach will be
     given in Chapter 4. MATLAB (CST) functions use the state-space approach for
     calculating step, impulse, and arbitrary input responses; hence, discussion of these
     functions will be postponed until Chapter 4.


   There are three properties which determine whether a control system is good or bad,
namely its performance, stability, and robustness. We briefly discussed the implications
of each of these in Chapter 1 using the car-driver example. Now we are well equipped to
define each of these three properties precisely. Let us first consider the performance of a
control system.



2.7 Performance
Performance is all about how successfully a control system meets its desired objectives.
Figure 1.3 showed an example of a closed-loop system's performance in terms of the
maximum overshoot of the actual output, y ( t ) , from the desired constant output, v<y.
More generally, the desired output may be a specific function of time, Vd(0- In such
a case, the difference between the actual output and the desired output, called error,
e(t) = yd(t) — y(0, is an important measure of the control system's performance. If the
error, e(t), becomes zero very rapidly, the control system is said to perform very well.
However, the error of certain control systems may not exactly reach zero for even very
large times. For such systems, another performance parameter is considered important,
namely the steady-state error, ess, defined as the value of the error, e(t), in the limit
t —>• oo. The smaller the magnitude of the steady-state error, ess, the better a control
system is said to perform. There are some performance parameters that indicate the speed
of a control system's response, such as the rise time, TT, defined as the time taken by the
output, y ( t ) , to first reach within a specified band, ±e, of the steady-state value, v(oo), the
peak time, Tp, defined as the time taken to reach the first peak (or maximum overshoot),
and the settling time, 7S, defined as the time taken until the output, y ( t ) , finally settles
(or comes closer) to within a specified band, ±e, of its steady-state value, v(oo).
    The performance parameters are usually defined for the step response, s ( t ) , of a system,
which implies a constant value of the desired output, y^. Figure 2.31 shows a typical step
response for a control system, indicating the various performance parameters. Obviously,
we assume that the control system reaches a steady-state value in the limit / -> oo. Not
all systems have this property, called asymptotic stability, which we will discuss in the
next section.
PERFORMANCE                                          63




                        0    Tr Tc



            Figure 2.31     Step response, s(0, defining a control system's performance



    Note that while the swiftness, or alacrity, with which a system responds to a given input
 is described by the rise time, TT, the peak time, Tp, and the settling time, Ts, the departure
 of the output from its steady-state value is measured by the maximum overshoot, or the
first peak value, Mp, and the accuracy of the control system in reaching a final desired
 value, yd, is indicated by the steady-state error, ess. For a second order system (such as
 the one considered in Example 2.12) with damping-ratio, g, and natural frequency, &>„,
 we can find simple expressions for many of the performance parameters when a unit step
 input is applied, given by

                                                                                          (2.125)
                                                                                          (2.126)

and
                                                                                          (2.127)

    Equations (2.125)-(2.127) can be obtained from the step response, s(t), of a second-
order system, using Eq. (2.116). Note that when a successful second order control system
reaches its steady-state value asymptotically in the limit t -> oo, then for large times, it
behaves in a manner quite similar to a first order control system with a pole at 5 = — ga)n,
whose output can be expressed as y(t) = j(oo)[l — ep{—ga)nt}]. Then the settling time
can be determined as the time taken when the y(t) settles to within 2 percent of y(oo),
or 0.02 = Qp{-ga)nTs}, which gives Ts = -log(0.02)/(s"wn), or Ts = 4/(gcon), which
is the same as Eq. (2.125). In other words, the output, y(t), reaches within 2 percent of
64                           LINEAR SYSTEMS AND CLASSICAL CONTROL


 the steady-state value, y(oo) (i.e. e = 0.02) after four leaps of the time-constant, l{ga)n).
 Equation (2.127) can be obtained by using the fact that at the maximum overshoot, or the
 first peak value, Mp, the slope of the step response, ds(t)/dt, is zero.
     Note that the performance parameters are intimately related to the damping-ratio, g,
 and natural frequency, a>n, of a second order control system. If g > 1, a second order
 system behaves like a first order system, with an exponentially decaying step response
 (see Figure 2.24). Also, you can see from Eqs. (2.125)-(2.127) that the performance
parameters determining the swiftness of response (such as the peak time, Tp) and those
 determining the deviation of the response from the desired steady-state value (such as
peak value, Mp) are contradictory. In other words, if we try to increase the swiftness
of the response by suitably adjusting a control system's characteristics (which are given
by £ and con for a second order system), we will have to accept larger overshoots from
the steady-state value, y(oo), and vice versa. How the control system characteristics are
modified to achieve a desired set of performance parameters is an essential part of the
control system design.
    The performance of a control system is determined by the locations of its poles in the
Laplace domain. Generally, the poles of a control system may be such that there are a
few poles very close to the imaginary axis, and some poles far away from the imaginary
axis. As may be clear from examining expressions for step or impulse response, such as
Eqs. (2.115) and (2.116), a control system's response is largely dictated by those poles
that are the closest to the imaginary axis, i.e. the poles that have the smallest real part
magnitudes. Such poles that dominate the control system's performance are called the
dominant poles. Many times, it is possible to identify a single pole, or a pair of poles,
as the dominant poles. In such cases, a fair idea of the control system's performance can
be obtained from the damping and natural frequency of the dominant poles, by using
Eqs. (2.125)-(2.127).
    The steady-state error, ess, to an arbitrary input is an important measure of control
system performance. Consider a general single-input, single-output closed-loop system
shown in Figure 2.32, where G(s) and H(s) are the transfer-functions of the plant and
the controller (also called compensator), respectively. Such a closed-loop control system
is said to have the controller, H ( s ) , in cascade (or series) with the plant, G(s). (Another
closed-loop configuration is also possible in which H(s) is placed in the feedback path of
(or in parallel with) G(s).) The controller applies an input, U(s), to the plant based upon
the error, E(s) = Y^(s) — Y(s). We saw in Chapter 1 an example of how a controller
performs the task of controlling a plant in a closed-loop system by ensuring that the
plant output, y ( t ) , becomes as close as possible to the desired output, d(t), as quickly



                             v^ E(s)
                                         H(s)
                                                  U(s)
                                                               G(s)
                                                                           Y(s)




Figure 2.32      A single-input, single-output feedback control system with controller transfer function,
H(s), and plant transfer function, G(s)
PERFORMANCE                                         65


as possible. In any case, a successful control system must bring y(t} very close to yd(t)
when time t becomes very large, i.e. in the limit that time tends to infinity (t —> oo).
Such a system is called a tracking system, because its output, y(t), continuously tracks
a changing desired output, yd(t). Examples of tracking systems are a telescope tracking
a comet, an antenna tracking a satellite, a missile tracking an aircraft, a rifle-shooter
tracking a pigeon, etc. The error (e(t) = yd(t) — y(t)) which persists in the limit t -» oo
is called the steady-state error, ess. Obviously, the closed-loop system should first be able
to reach a steady -state (i.e. its response, y ( t ) , must be finite and constant in the limit
/ —>• oo) before its steady-state error can be defined (it is like saying you should first
be able to stand, before I can measure your height). An unstable system cannot reach
a steady-state; therefore, there is no point in talking about steady-state error of unstable
systems. We will discuss later what are the precise requirements for stability, but at
present let us confine our discussion to stable closed-loop systems, which we tentatively
define here as those systems in which a bounded yd(t) leads to a bounded y ( t ) , for all
values of t.
   Going back to Figure 2.32, we can see that the Laplace transforms of the output, y ( t ) ,
desired output, yd(t), input, u(t), and error, e(t), are given by Y(s), Yd(s), U(s), and
E(s), respectively. Then the steady-state error is expressed as

                         ess = lim^oo e(;) = lim^oo-C- 1 (£(*))                        (2.128)

However, we can avoid evaluating the inverse Laplace transform of E(s) to calculate
the steady-state error if we can utilize an important property of the Laplace transform,
namely the final value theorem given by Eq. (2.70), which yields the following result:

                             ess = lim^oc e(t) = im^()sE(s)                           (2.129)

Of course, Eq. (2.129) requires that the limit of e(t) when t -> oo (or of sE(s) when
s -> 0) must exist. Looking at the block-diagram of Figure 2.32, we can express E(s) as
follows:

      E(s) - Yd(s) - Y(s) = Yd(s) - G(s)U(s) = Yd(s) - G(s)H(s)E(s)                    (2.130)

Thus, we can write
                               E(s) = Yd(s)/[l + G(s)H(s)}                            (2.131)

On substituting Eq. (2.131) into Eq. (2.129), we get

                                                                          ]           (2.132)

Equation (2.132) implies that the steady-state error, ess, depends not only upon the two
transfer functions, G(s) and //C$0, but also on the desired output, Yd(s).
66_                      LINEAR SYSTEMS AND CLASSICAL CONTROL                            _


Example 2.16

Consider the closed-loop system of Figure 2.32 with G(s) - (2s2 + 5s + l)/(s 2 +
2^ + 3) and H(s) = K, where AT is a constant. Let us determine the steady-state
error of this system if the desired output, y^(t) is (a) a unit step function, us(t),
and (b) a unit ramp function, r(t) = t • us(t). If yd(t) = us(t) then yd(s) = /s (see
Table 2.1). Hence, the steady-state error is given by Eq. (2.132) as

            = lims^0s Yd(s)/[ + G(s)H(s)] = linw 0 *OA)/[l + KG(s)]
            = !/[! + jriinwoG(s)]                                                     (2.133)
where linis_).oG:(5) is called the DC gain of G(5), because it is a property of the
system in the limit 5 —>• 0, or frequency of oscillation, a) —> 0, in the frequency
response G(ico) - something like the direct current which is the limiting case of
alternating current in the limit w —>• 0. Here ims-^oG(s) = 1/3. Therefore, the
steady-state error to unit step function is

                            ess - 1/(1 + AT/3) - 3/(3 + AT)                            (2.134)

The CST of MATLAB provides a useful command called dcgain for calculating the
DC gain of a transfer function, which is used as follows:

     »sys= tf(num,den); dcgain(sys) <enter>

where sys is the name of the system's transfer function calculated using the LTI
object sys, and num and den are the numerator and denominator polynomial coef-
ficients (in decreasing powers of 5), respectively, of the system's transfer function.
This command is quite useful when the transfer function is too complicated to be
easily manipulated by hand.
    Note that the DC gain of the closed-loop transfer function in Figure 2.32,
G ( s ) H ( s ) / [  + G(s)H(s)], is also the steady-state value of the output, y ( t ) , when
the desired output is a unit step function. Hence, the steady-state error to a
step desired output is nothing but £ss = 1 — DC gain of the closed-loop transfer
function.
    The steady-state error given by Eq. (2.134) can be decreased by making the
controller gain, K, large. However, for any finite value of AT, we will be left with
a non-zero steady-state error. Also, there is a physical limit upto which K (and the
resulting input, U(s)) can be increased; the larger the value of AT, the greater will be
the control input, U(s), which increases the cost of controlling the system. Hence,
this closed-loop system is not very attractive for tracking a desired output which
changes by a step.
    If yd(t) = r(t), then noting that r(t) is the time-integral of us(t), we can get the
Laplace transform, Yd(s) from the real integration property (Eq. (2.68)) as follows:

                                                                   /s2               (2.135)
PERFORMANCE                                           67


     Hence, the steady-state error is given by

           e,. = ims^sYd(s)/[ + G(s)H(s)] = im^Qs(l/s2)/(l + KG(s)]
               = /[lims^Qs + sKG(s)] = oo                                          (2.136)

     Thus, the steady-state error of the present closed-loop system is infinite when the
     desired output is a ramp function, which is clearly unacceptable. An example of
     tracking systems whose desired output is a ramp function is an antenna which is
     required to track an object moving at a constant velocity. This calls for the antenna
     to move at a constant angular velocity, c. Then the desired output of the antenna is
     v d (r) -c-r(t).

  Let us see what can be done to reduce the steady-state error of system in Example 2.16
when the desired output is either a unit step or a ramp function.

     Example 2.17
     In a control system, we can change the controller transfer function, H(s), to meet the
     desired objectives. This process is called control system design. From Example 2.16,
     it is clear that H(s) = K is a bad design for a closed-loop tracking system when
     the desired output is changing like a step, or like a ramp. If we can make the
     steady-state error to a ramp function finite by somehow changing the system, the
     steady-state error to a step function will automatically become zero (this fact is
     obvious from Eqs. (2.133) and (2.136)). Let us see what kind of controller transfer
     function, H(s), will make the steady-state error to a ramp function finite (or possibly
     zero). For Yd(s) = l/s2, the steady-state error is

                                       + G(s)H(s)]
                                       3)/s[s2 + 2s + 3 + (2s2 + 5s 4- l)H(s)]
                                                                                    (2-137)

     If we choose H(s) = K/s, then Eq. (2.137) implies that ess = 3/K, which is a finite
     quantity. If H(s) = K/s2 then ess = 0 from Eq. (2.137). For both the choices of
     H(s), the steady-state error is zero when yd(t) = us(t). The choice H(s) = K/s2
     thus makes the steady-state error zero for both step and ramp functions.

  Note that for the closed-loop system of Figure 2.32, the closed-loop transfer function,
Y(s)/Yd(s), can be derived using Eq. (2.131) as follows:

                  Y(s) = G(s)H(S)E(s) = G(s)H(s)Yd(s)/[l         + G(s)H(s)]           (2.138)

or
                          Y(s)/Yd(s) = G(s)H(s)/[l      + G(s)H(s)]                    (2.139)
68                          LINEAR SYSTEMS AND CLASSICAL CONTROL


For single-input, single-output systems such as that shown in Figure 2.32, we can calculate
the closed-loop response, y(t), to a specified function, yd(t), applying the inverse Laplace
transform to Eq. (2.139).



     Example 2.18
     Let us calculate the response of the closed-loop system in Example 2.17 to a unit
     ramp function, yd(t) = r(t) and zero initial conditions, when (a) H(s) = 1/5, and
     (b) H(s) = l/s2. Using Eq. (2.139) for H(s) = l/s we can write

                  Y ( s ) / Y d ( s ) = [(2s2 + 5s + l)/(5 2 + 2s
                                  [1 + {(2s2 + 5s+ l)/(5 2 + 2s
                                = (2s2 + 55 + l)/(53 + 4s2 + 85 4- 1)            (2.140)

     or

                     F(5) = (2s2 + 55 + l)yd(s)/(s3 + 4s2 + 8s + 1)
                           = (2s2 + 5s + l)(l/5 2 )/(5 3 + 4s2 + 85 + 1)         (2.141)

     Equation (2.141) can be expressed in a partial fraction expansion as follows:

             Y(s) = ki/(s - />,) + k2/(s - P2) + k3/(s - p3) + *4/s + ks/s2      (2.142)

     where p, p2, and p^ are the poles of the closed-loop transfer function, (252 +
     55 + l)/(53 + 452 + 85 + !), and k, ki, and ^3 are the corresponding residues. &4
     and £5 are the residues due to the ramp function, Yd(s) = /s2. We know that the
     poles of the closed-loop transfer function are distinct (i.e. not repeated) because
     we used the Control System Toolbox (CST) command damp to get the poles as
     follows:

          »damp([1 481]) <enter>
          Eigenvalue               Damping        Freq. (rad/sec)
           -0.1336                 1.0000        0.1336
           -1.9332+1.9355i         0.7067        2.7356
           -1.9332-1.9355i         0.7067        2.7356

     Note that the closed-loop system has a real pole, —0.1336, and a pair of complex
     conjugate poles, -1.9332 + 1.9355/, and -1.9332 - 1.9355/. The residues of the
     partial fraction expansion (Eq. (2.142)) can be calculated using MATLAB intrinsic
     command residue as follows:

          »num=[2 51]; den=conv([1 0 0],[1 4 8 1]); <enter>
          »[k,p,c]=residue(num,den) <enter>
PERFORMANCE                                             69


      k =
          -0.0265-0.13011
          -0.0265+0.13011
          -2.9470
           3.0000
              0

      P =
       -1.9332+1.93551
       -1.9332-1.93551
       -0.1336
           0
           0
      c =


The roots of the denominator polynomial of Eq. (2.141) are contained in the vector
p, while the vector k contains the corresponding residues of Eq. (2.142). The direct
term c is a null vector, because the numerator polynomial is of a degree smaller than
the denominator polynomial in Eq. (2.141). Taking the inverse Laplace transform
of Eq. (2.142), we can express y(r) as follows:

   y(t)   = k                                    exp(/? 3 r)        kst;   (t > 0)   (2.143)

   The error e(t} = y^(t) — y(t), where y^r) = r(t), and y ( t ) is given by Eq.
(2.143) is plotted in Figure 2.33 using MATLAB as follows (we could also have




                    2.5 -
                                            H(s) = 1/S

                      2 -


                    1.5 -




                    0.5             H(s) = 1/S2


                      0                                   J      L
                          0   5    10     15        20    25    30     35   40
                                                   f(s)

Figure 2.33      Error, e(f) =/d(0 -y(0/ for the closed-loop systems of Example 2.18 when
yd(0 = r(0
70                                    LINEAR SYSTEMS AND CLASSICAL CONTROL


     obtained y(t) directly by using the M-file response.m listed in Table 2.4 by speci-
     fying a ramp input):

     »t=0:0.4:40; y = k ( 1 ) * e x p ( p ( 1 ) * t ) + k ( 2 ) * e x p ( p ( 2 ) * t ) + k ( 3 ) * e x p ( p ( 3 ) * t )
      +k(4)+k(5)*t; e=t-y <enter>
     »plot(t,e)


     Similarly, when H(s) = 1/5 , the closed-loop transfer function is

                         Y(s)/YA(s) - (2s2 + 5s + l)/(5 4 + 253 + 5s2 + 55 + 1)                                              (2.144)

and the inverse Laplace transform applied to Y(s) with Y^(s) = l/s2 yields (you may
verify using MATLAB)

    y(t) = ki exp(pif) + fc2exp(/?20 + fc3exp(p3f) + fc4exp(p40 + *5 + k6t; (t > 0)
                                                                                     (2.145)
where Pl = -0.3686+ 1.9158/, P2 = -0.3686 - 1.9158/, p3 = -1.0, p4 = -0.2627,
ki = -0.1352 - 0.1252/, k2 = -0.1352 + 0.1252/, *3 = -0.6667, k4 = 0.9371, k5 = 0,
k6 = 0. The error, e(t) = yd(t) - y(t), for H(s) = l/s2 is also plotted in Figure 2.33.
Note that ess = 3 for H(s) = l/s, and ess = 0 for H (s) = l/s2, as expected from
Example 2.17.
   We have seen in Examples 2.16-2.18 that for a plant transfer function, G(5), of a
particular form, the controller transfer function, H(s), must have either one or two poles
at the origin (s = 0) in order to reduce the closed-loop error due to ramp function.
Precisely how many poles H(s) should have to reduce the steady-state error of a closed-
loop system to a particular desired output, yd(t), depends upon the plant transfer function,
G(s), and yd(t). When yd(t) is a ramp function, Eq. (2.132) implies that

                                                        G(s)H(s)] = l/[lim 5 ^ 0 U + sG(s)H(s))]
                                                        )]                                                                  (2.146)

Clearly, if we want zero steady-state error when desired output is a ramp function,
then Eq. (2.144) requires that lims^osG(s)H(s) = oo, which is possible only if the
transfer function G(s)H(s) has two or more poles at the origin, 5 = 0 . Since G(s) in
Examples 2.17 had no poles at the origin, we had to choose H(s) with two poles at the
origin (i.e. H(s) = l/s2) to make es& = 0 when jd(0 = r(t). Classical control assigns a
type to a closed-loop system of Figure 2.32 according to how many poles the transfer
function, G(s)H(s), has at the origin. Thus, a type 1 system has exactly one pole of
G(s)H(s) at origin, a type 2 system has exactly two poles of G(s)H(s) at the origin,
and so on. The transfer function, G(s)H(s), is called the open-loop transfer function
of the system in Figure 2.32, because Y ( s ) / Y d ( s ) = G(s)H(s) if the feedback loop is
broken (or opened). We know from the real integration property of the Laplace transform
(Eq. (2.68)) that a pole at the origin results from a time-integration. Hence, it is said in
STABILITY                                            7J[


            Table 2.5    Steady-state error according to system type for selected desired outputs

Desired                        Type 0                        Type 1                       Type 2
Output,                   Steady-State Error            Steady-State Error           Steady-State Error
Vd(0


Unit step, w s ( t )    1/[1 + HnWo G(s)H(s)]                    0                             0
Unit ramp,                       oo                    l/lims^0sG(s)H(s)                      0
   t • « s (0
Unit parabola,                     oo                            oo                l/lim.^o
  t2-us(t)/2



classical control parlance that the system type is equal to the number of pure integra-
tions in the open-loop transfer function, G(s)H(s). The system of Example 2.16 with
H(s) = K is of type 0, while the system with the same plant, G(s), in Example 2.17
becomes of type 1 with H(s) = l/s, and of type 2 with H(s) = /s2,
   Based on our experience with Examples 2.16-2.18, we can tabulate (and you may
verify) the steady-state errors of stable closed-loop systems, according to their type and
the desired output in Table 2.5.
   In Table 2.5 we have introduced a new animal called the unit parabolic function, given
by t2 • w s (r)/2 (also t • r(t}/2). An example of y^(t) as a parabolic function is when it is
desired to track an object moving with a constant acceleration (recall that y^(t) = r(t)
represented an object moving with a constant velocity}. From Table 2.5, it is evident that
to track an object moving with constant acceleration, the closed-loop system must be at
least of type 2.


2.8 Stability
As stated previously, one of the most important qualities of a control system is its stability.
In Example 2.2 we saw that an inverted pendulum is unstable about the equilibrium point
9 = n. In addition, while discussing the transfer function in Section 2.4, we saw that a
second order system whose poles have negative real parts (or positive damping-ratio,
g > 0) exhibits step and impulse responses with exponentially decaying amplitudes, and
we called such a system stable. While discussing steady-state error, we required that a
closed-loop system must be stable before its steady-state error can be calculated, and
defined stability tentatively as the property which results in a bounded output if the
applied input is bounded. From Examples 2.2 and 2.12, we have a rough idea about
stability, i.e. the tendency of a system (either linear, or nonlinear) to regain its equilibrium
point once displaced from it. While nonlinear systems can have more than one equilibrium
points, their stability must be examined about each equilibrium point. Hence, for nonlinear
systems stability is a property of the equilibrium point. The pendulum in Example 2.2
has two equilibrium points, one of which is unstable while the other is stable. We can
now define stability (and instability) more precisely for linear systems. For simplicity,
we will focus on the initial response of a system (i.e. response to initial conditions when
the applied input is zero), and by looking at it, try to determine whether a linear system is
72                        LINEAR SYSTEMS AND CLASSICAL CONTROL


stable. In this manner, we avoid having to classify the stability of a system according to
the nature of the applied input, since stability is an intrinsic property of the linear system,
independent of the input. There are the following three categories under which all linear
control systems fall in terms of stability:

1. If the real parts of all the poles (roots of the denominator polynomial of the transfer
   function) are negative, then the initial response to finite initial conditions tends to
   a finite steady-state value in the limit t —* oo. Such linear systems are said to be
   asymptotically stable. The aircraft of Example 2.10 is asymptotically stable, because
   all four poles have negative real parts.
2. If any pole of the linear system has a positive real part, then its initial response to finite
   initial conditions will be infinite in magnitude in the limit t —> oo. Such a system is
   said to be unstable.
3. If all the poles of a system have real parts less than or equal to zero, and all the
   poles which have zero real parts are simple, i.e. they are not repeated (or multiple)
   poles (recall the discussion following Eq. (2.79)), the initial response of the system
   to finite initial conditions will keep on oscillating with a finite amplitude in the limit
   t -> oo. Such a system is said to be stable but not asymptotically stable (because the
   response does not tend to an infinite magnitude, but also does not approach a constant
   steady-state value in the limit / —> oo). However, if the poles having zero real part are
   repeated (i.e. they are multiple poles with the same imaginary part) the initial response
   of the system to finite initial conditions tends to infinity in the limit t —> oo, and such
   a system is said to be unstable. In physical systems, complex poles occur in conjugate
   pairs (see Examples 2.10, 2.12). Thus, the only physical possibility of two (or more)
   repeated poles having zero real parts is that all such poles should be at the origin (i.e.
   their imaginary parts should also be zero).

   We can summarize the stability criteria 1-3 by saying that if either the real part of any
one pole is positive, or any one repeated pole has zero real part then the linear system
is unstable. Otherwise, it is stable. A stable linear system having all poles with negative
real parts is asymptotically stable. Using MATLAB you can easily obtain a location
of the poles (and zeros) of a system in the Laplace domain with either the intrinsic
command roots(num) and roots(den), or the Control System Toolbox (CST) commands
pole(sys), zero(sys), or pzmap(sys), where sys is the transfer function LTI object of the
system. From such a plot, it can be seen whether the system is asymptotically stable,
stable (but not asymptotically stable), or unstable, from the above stated stability criteria.
Another MATLAB (CST) command available for determining the poles of a system is
damp(den) (see Example 2.10 for use of damp). Since the poles of a transfer function
can be directly computed using MATLAB, one does not have to perform such mental
calisthenics as the Routh-Hurwitz stability criteria (D'Azzo and Houpis [2]), which is
a method for predicting the number of poles in the left and right half planes from the
coefficients of the denominator polynomial by laboriously constructing a Routh array (see
D'Azzo and Houpis [2] for details on Routh-Hurwitz stability criteria). Tabular methods
such as Routh-Hurwitz were indispensible before the availability of digital computers
ROOT-LOCUS METHOD                                      73


and software such as MATLAB, which can directly solve the characteristic equation
and give the location of the poles, rather than their number in the left and right half
planes.
   We shall further discuss stability from the viewpoint of state-space methods (as opposed
to the classical frequency and Laplace domain methods) in Chapter 3. Before the advent
of state-space methods, it was customary to employ graphical methods in the Laplace or
the frequency domain for determining whether a closed-loop system was stable. The Bode
plot is a graphical method that we have already seen. However, we are yet to discuss
Bode plots from the stability viewpoint. Other graphical methods are the root-locus, the
Nyquist plot, and the Nichols plot. Design using graphical methods is an instructive
process for single-input, single-output, linear, time-invariant systems. Also, sometimes the
graphical methods help in visualizing the results of a multi-variable state-space design
(Chapters 5-7), and in that sense they have an important place in the modern control
system design.



2.9 Root-Locus Method
To understand the root-locus method of stability analysis, reconsider the single-input,
single-output feedback control system of Figure 2.32. The closed-loop transfer func-
tion, Y(s)/Yd(s), given by Eq. (2.139) is said to have a return difference function, 1 +
G(s)H(s), which is the same as the characteristic polynomial of the closed-loop system.
The return difference is a property of the feedback loop, and comes from the fact
that if Fd(s) — 0, then Y(s) = G(s)U(s) and U(s) — ~H(s)Y(s); combining these two
equations we can write Y(s) — —G(s)H(s)Y(s), i.e. Y(s) has returned to itself, or
[1 + G(s)H(s)]Y(s) = 0. (The function G(s)H(s) is called the return ratio.) The root-
locus method determine stability simply by investigating whether the return difference
becomes zero for any value of s in the right half of the Laplace domain (i.e. values of
s with positive real parts). If 1 + G(s)H(s) — 0 for some s in the right-half plane, it
implies that there must be a closed-loop pole with positive real part, thus (according to
stability criteria 2) the closed-loop system must be unstable. By drawing a locus of the
each of the roots of the return difference function, 1 + G(s)H(s), as a design parameter
is varied, we can find those values of the design parameter for which the system is stable
(i.e. for which the loci do not enter the right half s -plane). How far away the locus closest
to the imaginary axis is from crossing over into the right half 5-plane also indicates how
far away the system is from being unstable - in other words, the stability margin of the
closed-loop system. A pole on the imaginary axis indicates zero stability margin, which
we called the case of stable but not asymptotically stable system in stability criteria 3.
By the same criteria, more than one pole at the origin indicates instability. If we see
the loci of one (or more) poles crossing into the right-half s-plane, or the loci of two (or
more) poles simultaneously approaching the origin, we should realize that the closed-loop
system is heading towards instability.
    Constructing a root-locus plot by hand is difficult, and standard classical controls
textbooks, such as D'Azzo and Houpis [2], contain information about doing so. However,
by using either the intrinsic MATLAB command roots repeatedly for each value of the
74                             LINEAR SYSTEMS AND CLASSICAL CONTROL


design parameter, or the Control System Toolbox (CST) command rlocus the root-locus
plot is very easily constructed. In the CST command rlocus(sys), sys is the LTI object
of the open-loop transfer function, G(s)H(s). The rlocus program utilizes the MATLAB
roots command repeatedly to plot the roots of 1 -I- KG (s) H (s) as a design parameter, K,
is varied automatically. The design parameter, K, is thus a scaling factor for the controller
transfer function, H(s), and the root-locus shows what happens to the closed-loop poles
as the controller transfer function is scaled to KH(s). The user can also specify a vector
k containing all the values of K for which the roots are to be computed by entering
rlocus(sys,k) at the MATLAB prompt.


  Example 2.19

  For the closed-loop system of Figure 2.32 with plant, G(s) = (2s2 + 5s + l)/Cs 2 +
  2s + 3), and controller, H(s) = 1, the root-locus is plotted in Figure 2.34 using the
  MATLAB command rlocus when the design parameter, AT, is varied from —0.4 to
  0.4 as follows:

  »num=[2 5 1]; den=[1 2 3]; k=-0.4:0.02:0.4; GH=tf(num.den);
    p= rlocus(GH,k); <enter>
  »plot(p(1,:),'o'); hold on; p l o t ( p ( 2 , : ) , ' x ' ) <enter>

     It is clear from Figure 2.34 that both the poles of the closed-loop system have
  real part zero when K = —0.4, and then move towards the left as K is increased.

                         4         i     l             l   i       l    i
                                                                        0
                         3                                     o   °   *-^ -
                                                  o o
                                             OO °   ^^- K increasing
                         2

                  •c     1 _ f^
                   <C
                   Q.

                  1 0 - K=OA
                  c
                  8*
                  I -1       -V
                        -2              X
                                            X xx       ^^ K increasing
                                                   x
                                                       X X
                                                         „
                        -3                                     X x   K=-OA ~
                                                                       X
                        _d         I     l           I       I     l    I
                        -1.2      -1   -0.8        -0.6 -0.4 -0.2          0.2
                                                    Real part

  Figure 2.34       Root-locus plot of the closed-loop system of Example 2.19, as the design param-
  eter, K, is varied from —0.4 to 0.4
ROOT-LOCUS METHOD                                         75


  For K = —0.4, the two loci are on the verge of crossing into the right half plane.
  Hence the closed-loop system is stable for A' > —0.4 and unstable for K < —0.4.
  The value of K for which both the poles are on the imaginary axis (i.e. real part = 0)
  can be calculated by hand for this second order system by finding the characteristic
  equation as follows:

              1 + KG(s)H(s) = 1 + K(2s2 + 5s + )/(s2 + 2s + 3) = Q               (2.147)

  or

                        (1 + 2K)s2 + (2 + 5K)s + (3 + A) = 0                      (2.148)

  Note that Eq. (2.148) is the second order characteristic equation, which can be
  expressed in terms of the natural frequency, a>n, and damping-ratio, £, as Eq. (2.82).
  The poles with zero real part correspond to a damping-ratio, £ = 0. Comparing
  Eq. (2.131) with Eq. (2.82) and putting £ = 0, we get (2 + 5A") = 0, or K = -0.4,
  for which a>n = [(3 + K)/( + 2K)]l/2 = 3.606 rad/s, and the corresponding pole
  locations are p^ = ±iajn = ±3.606/, which are the same as the pole locations in
  Figure 2.34 for K = -0.4.

   We can find the values of the design parameter K for specific pole locations along the
root-loci using the CST command rlocfind as follows:

       »[k,poles]=rlocfind(sys,p) <enter>

where p is the specified vector containing the pole locations for which values of K
(returned in the vector k) are desired. You can get the value of gain, K, the pole loca-
tion, associated damping, natural frequency, and maximum overshoot of step response by
clicking at any point on the root-locus generated by the command rlocus(sys). Similarly,
the command rlocfind(sys) lets you move a cross-hair along the root-loci with the mouse
to a desired pole location, and then returns the corresponding value of K when you click
the left mouse button. To do this you must first plot a root-locus, and then use rlocfind
on the same plot as follows:

       »rlocus(sys); hold on; rlocfind(sys) <enter>

   The CST command rlocus is of limited utility in the stability analysis of closed-loop
system, because it merely scales the controller transfer function, H(s), by a factor K.
For the root-locus plot of more general systems, we should use the MATLAB command
roots, as shown in Example 2.20.

  Example 2.20

  Consider a closed-loop system shown in Figure 2.35. Note that this system is
  different from the one shown in Figure 2.32, because the controller, H ( s ) , is in the
  feedback path whereas the controller was placed in the forward path, in series (or
76                     UNEAR SYSTEMS AND CLASSICAL CONTROL


                       U(s)
                                o                               Y(s)




      Figure 2.35   A closed-loop system with plant, G(s), and feedback controller, H(s)


 cascade) with the plant, G(s), in Figure 2.32. You can show that both the systems
 have the same closed-loop transfer function, Y(s)/Yd(s), if Z(s) = H(s)Yd(s). The
 closed-loop transfer function, Y(s)/U(s), for the system in Figure 2.35 is derived
 in the following steps:

                              Y(s) =                                                (2.149)

 where

                                  Z(s) = H(s)Y(s)                                   (2.150)

 Substituting Eq. (2.150) into Eq. (2.149), we get the following expression for Y(s):

                        Y(s) = G(s)U(s) - G(s)H(s)Y(s)                              (2.151)

 or

                        Y(s)/U(s) =                 G(s)H(s)]                       (2.152)

 Note that the characteristic equation is still given by 1 + G(s)H(s) = 0. For the
 present example, let us take G(s) = (2s2 + 5s + l)/(s2 -2s+ 3) and H(s) = If
 (Ks + 1). This choice of H(s) allows introducing a pole of G(s)H(s) at a location
 that can be varied by changing the design parameter, K. (Introduction of poles
 and zeros in the open-loop transfer function, G(s)H(s), through a suitable H(s)
 to achieved desired closed-loop performance is called compensation, and will be
 studied in Section 2.12.) Let us plot the root-locus of the closed-loop system as
 the controller design parameter, AT, is varied. Then the closed-loop characteristic
 equation is given by

                     Ks3 + (3 - 2K)s2 + (3 + 3K)s + 4 =                             (2.153)

 Since //(s) is not merely scaled by K (which was the case in Example 2.19), we
 cannot use the MATLAB CST command rlocus to get the root-locus. Instead, the
 intrinsic MATLAB command roots is used repeatedly to plot the root-locus as K is
 varied from 1.0 to 1.3 as follows:

 »i=1; for k=1:0.02:1.3; r=roots([k 3-2*k 3+3*k 4 ] ) ; R(i,:)=r'; i=i+1;
   end; p l o t ( R , ' x ' ) <enter>
NYQUIST STABILITY CRITERION                                         77


   Note that the matrix R is used to store the roots in its rows. The resulting plot
   is shown in Figure 2.36. The complex conjugate roots are seen to cross into the
   right half plane for K = 1.15. Hence, the system is stable for 1 < K < 1.15 and
   unstable for K > 1.15.



                           2

                          1.5                              K" increasing

                            1

                 «
                 Gi-     0.5                      K increasing

                 ro        0 - X         X   X    X   X    X       X   X XXX88MBK
                 ^c
                 | -0.5
                          -1
                                                           K increasing
                        -1.5

                          __2

                        -2.5                          i        i
                            -7      -6       -5       -4     -3      -2      -1     0   1
                                                           Real part

   Figure 2.36         Root-locus of the closed-loop system of Example 2.20 as K varies from 0.3 to 1.3



2.10 Nyquist Stability Criterion
The Nyquist criterion determines a closed-loop system's stability using the complex-variable
theory. It employs a polar plot (see Section 2.4) of the open-loop frequency response,
G(ia))H(ico), as a) increases from — oo to oo. Such a polar plot is called a Nyquist plot.
In the 5-plane, the imaginary axis denotes an increase of CD from —oo to oo. Hence, the
Nyquist plot of G(ia>)H(ia)), as a> increases from —oo to oo is said to be a mapping in
the G(s)H(s) plane (i.e. the plane defined by real and imaginary parts of G(s)H(s)) of
all the points on the imaginary axis in the s-plane. The direction of the Nyquist plot indi-
cates the direction of increasing co. A polar plot is usually restricted to u> between 0 and
oo. However, note that a polar plot of G(ia))H(ito} drawn for negative frequencies is the
complex conjugate of the polar plot of G (ico) H (ico) drawn for positive frequencies. In other
words, the Nyquist plot is symmetrical about the real axis. Hence, the practical technique
of plotting Nyquist plot is to first make the polar plot for co increasing from 0 to oo, and
then draw a mirror image of the polar plot (about the real axis) to represent the other half
of the Nyquist plot (i.e. the frequency range —oo < a> < 0). The direction of the mirror-
image polar plot would be clear from the CD =• 0 point location on the original polar plot,
where the two plots should necessarily meet. The two mirror images should also meet at
co —> oo and co -> — oo, respectively. Hence, to —> ±00 is a single point on the Nyquist
78                         LINEAR SYSTEMS AND CLASSICAL CONTROL


plot, and the positive and negative frequency branches of a Nyquist plot form a closed
contour. It is quite possible that the two polar plots for positive and negative frequencies
of some functions may overlap. Figure 2.21 showed the polar plot for positive frequencies.
You may verify that a polar plot of the same frequency response for negative frequencies
overlaps the curve shown in Figure 2.21, but has an opposite direction for increasing a>.
   Since the Nyquist plot of G(s)H(s) is a closed contour for s = ia) when —oo < to <
oo, whose direction is indicated by increasing CD, the only possibility of the positive
and negative frequency branches meeting at co —>• ±00 is that the Laplace variable, s,
must traverse an infinite semi-circle in the right-half s-plane. In other words, the region
enclosed by the Nyquist plot in the G(s)H(s) plane is a mapping of the entire right half
s-plane. This fact is depicted in Figure 2.37. The direction of the curves in Figure 2.37
indicate the direction in which the frequency, co is increasing. The point G(s)H(s) = —1
has a special significance in the Nyquist plot, since it denotes the closed-loop characteristic
equation, 1 + G(s)H(s) = 0.
   The application of Nyquist stability criteria is restricted to linear, time-invariant control
systems with a proper open-loop transfer function, G(s)H(s). Since G(s)H(s) of a linear,
time-invariant control system is a rational function of s, a point in the .s-plane corresponds
to only one point in the G(s}H(s} plane (such a mapping is called one-to-one mapping).
Since G(s)H(s) is proper, it implies that lim,-,^ G(s)H(s) must be either zero, or a
non-zero constant. A one-to-one mapping from s-plane to the G(s)H(s)-pane in which

                                      Imaginary
                                     axis (s = k




                                                                 Real axis
                                                                     (S=a)




                                      Imaginary
                                        part of
                                       G(s)H(s)


                                                      Nyquist plot


                                                                  Real part
                                                                 of G(s)H(s)




Figure 2.37    The mapping of right-half s-plane into a region enclosed by the Nyquist plot in the
G(s)H(s) plane
NYQUIST STABILITY CRITERION                                  79


 the limit lim^oo G(s)H(s) exists and is finite is called a conformal mapping. The Nyquist
 stability criterion is based on a fundamental principle of complex algebra, called Cauchy's
 theorem, which states that if a closed contour with an anti-clockwise direction in the
 s-plane, which encloses P poles and Z zeros of I -f- G(s)H(s), and which does not
 pass through any poles or zeros of 1 + G(s)H(s), is conformally mapped into a closed
 contour (i.e. Nyquist plot) in the G(s)H(s) plane, then the latter will encircle the point
 G(s)H(s) = — 1 exactly N times in an anti-clockwise direction, where N = P — Z. An
 anti-clockwise encirclement of G(s)H(s) — — 1 is considered positive, while a clockwise
 encirclement is considered negative. Hence, N could be either positive, negative, or zero.
 The proof of Cauchy's theorem is beyond the scope of this book, but can be found
 in D'Azzo and Houpis [2], or in a textbook on complex variables. Applying Cauchy's
 theorem to the contour enclosing the entire right-half s-plane (shown in Figure 2.37), we
 find that for closed-loop stability we must have no zeros of the closed-loop characteristic
 polynomial, 1 + G(s)H(s), in the right-half .v-plane (i.e. Z = 0 must hold), and thus
 N = P, which implies that for close-loop stability we must have exactly as many anti-
 clockwise encirclements of the point G(s)H(s) = — 1 as the number poles of G(s}H(s) in
 the right-half s-plane. (The Nyquist plot shown in Figure 2.37 contains one anti-clockwise
 encirclement of — 1, i.e. N = . The system shown in Figure 2.37 would be stable if there
 is exactly one pole of G(s)H(s) in the right-half .v-plane.)
    Note that Cauchy's theorem does not allow the presence of poles of G(s)H(s) any-
 where on the imaginary axis of .s-plane. If G(s)H(s) has poles on the imaginary axis,
 the closed contour in the s-plane (Figure 2.37) should be modified such that it passes just
 around the poles on the imaginary axis. Hence, the closed contour should have loops of
 infinitesimal radius passing around the poles of G(s)H(s) on the imaginary axis, and the
 Nyquist plot would be a conformal mapping of such a contour in the G(s)H(s) plane.
 Studying the effect of each detour around imaginary axis poles on the Nyquist plot is
 necessary, and could be a tedious process by hand [2J.
    You can make the Nyquist plot using the polar plot of G(ia))H(ia>) drawn for positive
frequencies and its complex conjugate for negative frequencies, using the intrinsic MATLAB
 command polar (see Example 2.8). The abscissa of the polar plot must be modified to locate
 the point G(s)H(s) = — 1 on the negative real axis (i.e. the radial line corresponding to
 0 = 180° in Figure 2.21). (Actually, the polar plot for negative frequencies is not required,
 since the number of encirclements can be determined from the shape of the polar plot of
 G (ico) H (ia>) drawn for positive frequencies near the point — 1, and the fact that the negative
 frequency plot is the mirror image of the positive frequency plot.) An easier way of making
 the Nyquist plot is by the MATLAB Control System Toolbox (CST) command nyquist(sys),
 where sys denotes the LTI object of the open-loop transfer function, G(s)H(s).


   Example 2.21
   The Nyquist plot of the open-loop transfer function, G(s)H(s) of the system in
   Figure 2.32 with G(s) = (2s2 + 5s + l ) / ( s 2 - 2s + 3), and H(s) = 1 is obtained
   in Figure 2.38, using the following MATLAB command:

   »num=[2 5 1 ] ; den=[1 -2 3 ] ; GH=tf(num,den); nyquist(GH) <enter>
80                          UNEAR SYSTEMS AND CLASSICAL CONTROL



                                                                  G(s)H(s)-plane
                                  X''




                     -1


                     -2



                       -3         -2         -1          0
                                               Real part

              Figure 2.38     Nyquist plot of tfie closed-loop system in Example 2.21



      It is clear from the Nyquist plot in Figure 2.38 that the point — 1 is encircled
   in the anticlockwise direction exactly twice. Hence, N = 2. The open-loop transfer
   function G(s)H(s) has two poles with positive real parts (i.e. P = 2), which is seen
   by using the MATLAB CST command damp as follows:

         »damp(den) <enter>
         Eigenvalue              Damping       Freq. (rad/sec)
          1.0000+1.41421         -0.5774        1.7321
          1.0000-1.41421         -0.5774        1.7321

   Since N = P = 2, Cauchy's theorem dictates that the number of zeros of 1 +
   G(s)H(s) in the right-half plane is Z = P — N = 0, which implies that the closed-
   loop transfer function has no poles in the right half plane. Hence by the Nyquist
   stability criterion, the closed-loop system is stable. You can verify that the closed-
   loop characteristic equation is 1 + G(s)H(s) = 0, or 3s2 + 35 + 4 = 0, resulting in
   the closed-loop poles -0.5 ± 1.0408/.


   A major limitation of the Nyquist stability criterion is that it does not give any indi-
cation about the presence of multiple zeros of 1 + G(s)H(s) at 5=0, which cause
closed-loop instability due to stability criterion 3 of Section 2.8. Another limitation of
the Nyquist stability criterion is that it cannot be applied in cases where the Nyquist plot
of G(s)H(s) passes through the point G(s)H(s) = — 1, because in that case the number
of encirclements of — 1 point are indeterminate.
ROBUSTNESS                                            81


2.11 Robustness

Robustness of a control system is related to its sensitivity to unmodeled dynamics, i.e. part
of the behavior of an actual control system which is not included in the mathematical
model of the control system (governing differential equations, transfer function, etc.).
Since we have to deal with actual control systems in which it is impossible (or difficult)
to mathematically model all physical processes, we are always left with the question:
will the control system based upon a mathematical model really work? In Chapter 1, we
saw that disturbances (or noise) such as road roughness, tyre condition, wind velocity,
etc., cannot be mathematically modeled when discussing a control system for the car
driver example. If a control system meets its performance and stability objectives in the
presence of all kinds of expected noises (whose mathematical models are uncertain),
then the control system is said to be robust. Hence, robustness is a desirable property that
dictates whether a control system is immune to uncertainties in its mathematical model.
More specifically, robustness can be subdivided into stability robustness and performance
robustness, depending upon whether we are looking at the robustness of the stability of
a system (determined by the location of the system's poles), or that of its performance
objectives (such as peak overshoot, settling time, etc.).
   We intuitively felt in Chapter 1 that a closed-loop system is more robust than an
open-loop system. We are now in a position to mathematically compare the sensitivities
of open and closed-loop systems, representatives of which are shown in Figure 2.39. For
simplicity, it is assumed that for both open and closed loop systems, the controller transfer
function is a constant, given by K, while the plant transfer function is G(.9).The transfer
function of the open-loop control-system, F0(s), is given by

                                                                                            (2.154)

while that of the closed-loop system (Fc(s)) is given by Eq. (2.124)

                         FcCs) = Y(s)/Yd(s) = KG(s)/[l + KG(s)]                            (2.155)

                         (a)
                           Vd(s)              U(s)                    Y(s)
                                       K                    G(s)




                                                     U(S)                    Y(s)
                                              K                G(s)




Figure 2.39       Single-input, single-output open-loop (a) and closed-loop (b) control systems with
controller transfer function K and plant transfer function G(s)
82                         LINEAR SYSTEMS AND CLASSICAL CONTROL


    Since the controller transfer function, K, is derived based on some mathematical model
of G(s), we can determine each control system's robustness by calculating the sensitivity
of the overall transfer function, Y ( s ) / Y d ( s ) , to variation in K. Mathematically, the sensi-
tivity of either open-loop, or closed-loop system to variation in controller gain, AT, can
be expressed as
                            S(s) = [Yd(s)/Y(s)]3[Y(s)/Yd(s)]/dK                              (2.156)

where d[Y(s)/Yd(s)]/dK denotes the change in the transfer function due to a change
in K. Then the sensitivities of the open and closed-loop systems to variation in K are
given by
                          S0(s) = [/F0(s)]dF0(s)/dK = /K                      (2.157)

and
                     Sc(s) = [/Fc(s)]3Fc(s)/3K       = /[K( + KG(s))]                    (2.158)

The ratio of the open-loop sensitivity to the closed-loop sensitivity S0(s)/Sc(s) is thus

                                  S0(s)/Sc(s) = [1 + KG(s)]                                 (2.159)

 which is nothing else but our well known acquaintance, the return difference function
 (or the closed-loop characteristic polynomial)! The magnitude of the return difference,
 11 + AT G(s)|, is greater than 1, which confirms that an open-loop system is more sensitive
 (or less robust) when compared to the closed-loop system to variations in controller gain.
The greater the value of the return difference, the larger is the robustness of a closed-
loop system (Eq. (2.158)). Hence, one can measure a closed-loop system's robustness by
determining the return difference function in the frequency domain, s = ico, for a range
of frequencies, u>.
    We need not confine ourselves to closed-loop systems with a constant controller
transfer function when talking about robustness; let us consider a cascade closed-loop
system (Figure 2.32) with a controller transfer function, H(s). Either the Bode plot of
 G(ia))H(ia>), or the Nyquist plot of G(s)H(s) can be utilized to convey information
about a system's stability robustness (i.e. how robust is the stability of the system with
respect to variations in the system's model). The Nyquist plot is more intuitive for
analyzing stability robustness. From Nyquist stability theorem, we know that the closed-
loop system's stability is determined from the encirclements by the locus of G(s)H(s)
of the point —1 in the G(s)H(s) plane. Therefore, a measure of stability robustness can
be how far away the locus of G(s)H(s) is to the point —1, which indicates how far
the system is from being unstable. The farther away the G(s)H(s) locus is from —1,
the greater is its stability robustness, which is also called the margin of stability. The
closest distance of G(s)H(s) from —1 can be defined in the complex G(s )//($) plane
by two quantities, called the gain margin and the phase margin, which are illustrated in
Figure 2.40 depicting a typical Nyquist diagram for a stable closed-loop system. A circle
of unit radius is overlaid on the Nyquist plot. The closest distance of the Nyquist plot of
G(s)H(s) to —1 is indicated by two points A and B. Point A denotes the intersection
of G(s)H(s) with the negative real axis nearest to the point —7, while point B denotes
the intersection of G(s)H(s) with the unit circle. Point A is situated at a distance a from
ROBUSTNESS                                           83


                                   Imaginary axis




                                                              Real axis



                                                    Unit circle


                                            Gain margin = 20 Iog10(1/a) (dB)
                                            Phase margin = ft = 180° + 0

         Figure 2.40    The Nyquist plot of G(s)H(s) showing the gain and phase margins


the origin, while point B is located on the unit circle at an angle 0 from the positive real
axis. It is clear that the gain of G(s)H(s) at point B is unity, while its phase at the same
point is 9.
   The gain margin is defined as the factor by which the gain of G(s)H(s) can be
increased before the locus of G(s)H(s) hits the point — 1. From Figure 2.40, it is evident
that the gain margin is equal to I/a, or in dB it is given by

                           Gain Margin in dB = 20 log ]0 (l/o;)                           (2.160)

A negative gain margin indicates that the system is unstable. The phase margin is defined
as the difference between the phase of G(s)H(s) at point B, 0, and the phase of the
negative real axis, —180° (on which the point —1 is located). Thus, phase margin is
given by the angle ft in Figure 2.40:

                       Phase Margin = 0 = 9- (-180°) = 9 + 180C                           (2.161)

The gain margin indicates how far away the gain of G(s)H(s) is from 1 (i.e. the gain of
the point —1) when its phase is —180° (point A). Similarly, the phase margin indicates
how far away the phase of G(s)H(s) is from —180° (i.e. the phase of the point — 1 )
when the gain of G(s)H(s) is 1 (point B).
   Since the Bode plot is a plot of gain and phase in frequency domain (i.e. when s = iw),
we can use the Bode plot of G(s)H(s) to determine the gain and phase margins. In the
Bode gain plot, the unit circle of the Nyquist plot (Figure 2.40) translates into the line for
or zero dB gain (i.e. unit magnitude, |G(/o>)//(/co)|), while the negative real axis of the
Nyquist plot transforms into the line for — 180° phase in the Bode phase plot. Therefore,
the gain margin is simply the gain of G(io)}H(ia)) when its phase crosses the —180°
phase line, and the phase margin is the difference between the phase of G(ia))H(ico) and
— 180° when the gain of G(ico)H(io)) crosses the 0 dB line. The frequency for which the
phase of G(ia))H(ico) crosses the —180° line is called the phase crossover frequency, a>p,
84                            LINEAR SYSTEMS AND CLASSICAL CONTROL


while the frequency at which the gain of G(ia>)H(ia>) crosses the 0 dB line is called the
gain crossover frequency, O)Q.


  Example 2.22
  Consider the closed-loop system of Figure 2.32, with G(s) = (2s2 + 5s + l ) / ( s 2 +
  2s + 3) and H(s) = /s2. Figure 2.41 shows the Bode plot of G(ia>)H(ia>) which
  is obtained by the following MATLAB CST command:

  »num=[2 5 1 ] ; den=conv([1 2 3 ] , [ 1 0 0 ] ) ; G=tf(num.den); bode(G) <enter>

      Figure 2.41 shows that the phase crosses the —180° line at the phase crossover
  frequency, o>p = 3.606 rad/s. The gain present at this frequency is —14.32 dB.
  Hence, the gain margin is 14.32 dB, indicating that the gain of G(s)H(s) can be
  increased by 14.32 dB before its Nyquist locus hits the point —1. In Figure 2.41,
  we can see that the 0 dB gain line is crossed at gain crossover frequency, CDQ =
   1.691 rad/s, for which the corresponding phase angle is —148.47°. Therefore, the
  phase margin is -148.47° + 180° = 31.53°.
      The numerical values of gain margin, phase margin, gain crossover frequency,
  and phase crossover frequency, can be directly obtained using the MATLAB
  CST command margin(sys), or margin(mag,phase,w), where mag,phase,w are
  the magnitude, phase, and frequency vectors obtained using the command
  [mag,phase,w] = bode(sys,w). For a system having a frequency response,
  G(ia>)H(ico), which is changing rapidly with frequency (such as in the present

                                                          a>G = 1.691 rad/s
                      100




                co
                O



                                                             10°                 101
                                            Frequency (rad/sec)


                     -120
                                                                                       o>
                     -150                                                              i?
               <o                                                                      s™
                                                                                       eu "
               ol     -180

                            10-             10'1             10°         *       101
                                                                  o>P = 3.606 rad/s
                                            Frequency (rad/sec)

        Figure 2.41          Bode plot of G(s)H(s) for the closed-loop system of Example 2.22
ROBUSTNESS                                                85


example), the command margin(sys) may yield inaccurate results. Therefore, it is
advisable to use the command margin(mag,phase,w), with the magnitude and phase
generated at a large number of frequencies in the range where the frequency response
is changing rapidly. This is done by using the command w = logspace(a, b, n),
which generates n equally space frequencies between 10a and 10b rad/s, and stores
them in vector w. Then the command [mag,phase,w] — bode(sys,v) will give the
desired magnitude and phase vectors from which the gain and phase margins can
be calculated. This procedure is illustrated for the present example by the following
commands:

»num=[2 5 1]; den=conv([1 2 3 ] , [ 1 0 0 ] ) ; w=logspace(-2,1,1000);
 G=tf(num.den);

»[mag,phase,w]=bode(G); <enter>

»margin(mag,phase,w) <enter>

A Bode plot results, with computed gain and phase margins and the corresponding
crossover frequencies indicated at the top of the figure (Figure 2.42).
   Another way of obtaining gain and phase margins is from the Nichols plot, which
is a plot of the gain of the open-loop frequency response, G(ia))H(ico), against its
phase. The gain and phase margins can be directly read from the resulting plot
in which the point —1 of the Nyquist plot corresponds to the point 0 dB, —180°.


                                      Gm= 14.32 dB,(w= 3.606)
                                                     = 1.691)
                      100


                       50

                CO      U
                            n
                0


                      -50
                        10—2             0~1              10°
                                         Frequency (rad/sec)

                        u                                        1
                                                      '              '

                      -90 -                                                 -

                     -180                                        ^

                     -270 -                                                 -

                      Qfin
                                        10~1               10°              101
                                         Frequency (rad/sec)

Figure 2.42     Gain and phase margins and crossover frequencies for the system of Example 2.22
obtained using the MATLAB Control System Toolbox command margin
86                       UNEAR SYSTEMS AND CLASSICAL CONTROL


 In addition to the open-loop gain and phase, the Nichols plot shows contours of
 constant closed-loop magnitude and phase, Y(ia))/Yd(ico), and 0(<w), given by

                Y(io))/Yd(ia)) = G(ito)H(ia>)/[
                                                                                (2.162)

 It can be shown that the closed-loop gain and phase are related to the open-loop
 gain and phase G(ia)}H(ia>} and 0, respectively, by the following equations:

           Y(ia>)/Yd(ia)) = 1/[1 + l/G(ia>)H(ia)
                               + 2cos(0)/|G(i<y)#(i«|] l/2                      (2.163)
                                                              G(ia>)H(ia>]}   (2.164)

 where G(iu>)H(ia)) = G(ia))H(ia>zl9 . Seeing the formidable nature of
 Eqs. (2.163) and (2.164), plotting the contours of constant closed-loop gain and
 phase by hand appears impossible. However, MATLAB again comes to our rescue
 by providing the Control System Toolbox (CST) command nichols(sys) for plotting
 the open-loop gain and phase, and the command ngrid for plotting the contours of
 the closed-loop gain and phase. Here sys denotes the LTI object of the open-loop
 transfer function, G(s)H(s). Figure 2.43 shows the Nichols plot of the system in
 Example 2.22 obtained using the following MATLAB commands:

 »num=[2 5 1 ] ; den=conv([1 0 0],[1 2 3 ] ) ; G=tf (num.den) ; ngrid('new');
   nichols(G) <enter>




                 -40                                                    40 db
                  -360        -270       -180        -90
                                 Open-loop phase (deg)

                Figure 2.43     Nichols plot for the system of Example 2.22
CLOSED-LOOP COMPENSATION TECHNIQUES                               87


     The gain and phase margins are directly read from Figure 2.43 as shown.
  However, the crossover frequencies cannot be obtained from the Nichols plot. Apart
  from giving the gain and phase margins, the Nichols plot can be used to design and
  analyze the closed-loop frequency response of the system. The intersection of the
  G(ia))H(io)) Nichols plot with the closed-loop gain contours give the closed-loop
  gain frequency response, Y(ico)/Yd(i(o). The frequencies at the intersection points
  can be obtained from a Bode gain plot of G(ia))H(ia)). However, such a procedure
  is fairly complicated, and it is easier to get the closed-loop frequency response
  directly from the Bode plot of Y(io})/'Y&(ico).


   We have seen how the stability robustness of a closed-loop control system is defined by
the gain and phase margins determined from the open-loop transfer function, G(s}H(s),
We have considered variations in the overall transfer function, Y(s)/Y&(s~), for defining
robustness, and shown that closed-loop systems are more robust to such variations than
open-loop systems. Variations in the overall transfer function are called process noise.
However, closed-loop systems are susceptible to another form of noise, which is absent
in open-loop systems, and which arises due to errors in measuring (and feeding back) the
output, Y(s). Such a noise is called measurement noise. Invariably, the measurement noise
is caused by imperfections in the sensors used to measure the output, and usually occurs
at higher frequencies than the natural frequencies of the closed-loop system. To reduce the
sensitivity of a closed-loop system to measurement noise (or to make the system robust
with respect to measurement noise), the frequency response of the closed-loop system
must have smaller gains at higher frequencies. This requirement results in the magnitude
Bode plot of the closed-loop system decaying rapidly (or rolling-off) with frequency, at
high frequencies. Hence, a controller transfer function must be selected to provide not
only good gain and phase margins, which indicate the closed-loop system's robustness
to process noise, but also a large decay (or roll-off) of the gain at high frequencies,
indicating robustness due to the measurement noise.
   While designing a closed-loop system, one is not only interested in stability in the
presence of modeling uncertainties (such as process and measurement noise), but also
in maintaining a desired level of performance, i.e. one would like to achieve perfor-
mance robustness as well. It can be appreciated that for achieving performance robust-
ness, we should first achieve stability robustness (i.e. there is no point in talking about
the performance of an unstable control system). Criteria for achieving stability and
performance robustness of multivariable systems are more generally expressed with the
use of modern state-space methods (rather than the classical single-input, single-output,
frequency domain procedures), as discussed in Chapter 7.


2.12 Closed-Loop Compensation Techniques for
     Single-Input, Single-Output Systems
We have seen in the previous sections how the steady-state error, stability, and gain and
phase margins can be affected by changing the controller transfer function, H ( s ) , in a
88                         UNEAR SYSTEMS AND CLASSICAL CONTROL


typical single-input, single-output closed-loop system of Figure 2.32. Since we can use
H(s) to compensate for the poor characteristics of a plant, G(s), such a controller, H(s),
is called a compensator, and the procedure of selecting a controller, H(s), in order to
remove the deficiencies of the plant, G(s), (such as improving stability, performance, and
robustness), is called closed-loop compensation. Classical control techniques of designing
single-input, single-output control systems based upon their frequency response charac-
teristics largely rely upon closed-loop compensation. We will consider some commonly
employed closed-loop compensation techniques. Closed-loop compensation is generally
of two types: cascade (or series) compensation in which H(s) is placed in series with the
plant (Figure 2.32), and feedback (or parallel) compensation in which H(s) is placed in
the feedback path of G(s) (Figure 2.35). Cascade and feedback compensation represent
two alternatives for achieving the same closed-loop characteristics. Where we insert the
compensator in the control system depends largely upon the physical aspects of imple-
mentation. We study only cascade compensation techniques here, which can be easily
extended to feedback compensation.


2.12.1 Proportional-integral-derivative compensation

A popularly used compensator with the transfer function, H(s) = (K&s2 + Kps +
K)/s, where K&, Kp, and K are constants, is called the proportional plus integral
plus derivative (PID) compensator, because its transfer function can be expressed as
H(s) = Kp + K&s + KI/S, signifying that the output of the controller, U(s), is a sum
of its input, E(s), multiplied by constant Kp, the integral of the input times K,
and the derivative of the input times K&, i-e. U(s) = KpE(s) + KE(s)/s + KosE(s)
(recall that E(s)/s is the Laplace transform of the integral of the function, e(t),
and sE(s) is the Laplace transform of the derivative of e(t) if the initial conditions
are zero). PID compensators are very common in industrial applications due to their
good robustness over a wide frequency range. The presence of the integral term, K/s,
in H(s) increases the type of the closed-loop system due to the pole at the origin,
thereby reducing the steady-state error. The derivative term, KQS, and the proportional
term, Kp, can be used to place two zeros of H(s) at suitable locations, to change
the phase characteristics of the closed-loop system. Let us consider an example of
PID compensation.

     Example 2.23
     Consider a hard-disk read/write head positioning system with the following transfer
     function:
                      Y(s)/U(s) = G(s) = 700/(s2 + 155 + 100000)                   (2.165)

     The output, Y(s), is the angular position of the head in radians, while the input,
     U(s), is the current in milli-Amperes (mA) supplied to the head positioning solenoid.
     The poles, natural frequencies, and damping-ratios for this second order plant are
     as follows:
CLOSED-LOOP COMPENSATION TECHNIQUES                                                                                    89

      »num=700; den = [1 15 1e5]; damp(den) <enter>
      Eigenvalue                                                        Damping                               Freq. (rad/sec)
      -7.50006+000+3.1614e+002i                                         2.3717e-002                          3.1623e+002
      -7.50006+000-3.1614e+002i                                         2.37176-002                          3.16236+002

Note that the damping is very small, and hence the head positioning system,
will oscillate a lot before coming to a steady-state. Since the plant is of type 0,
the steady-state error due to a step input will be non-zero. To make the steady-
state error zero for a step input, we initially choose a PID compensator with
KD = 0, Kp = 1, and K = 1100, which makes the controller transfer function the
following:

                                             H(s)-(s + 1100)/s                                                                       (2.166)

Since H(s) has no derivative term, it is essentially a. proportional-plus-integral (PI)
compensator, with a zero at s = —1100 and a pole at s = 0. Connecting H(s) and
G(s) in series, and then closing the feedback loop as shown in Figure 2.32, we get
the following closed-loop transfer function:

     Y ( s ) / Y d ( s ) = (700s + 770000)/(s3 + 15s2 + 1 00700s + 770000)                                                           (2.167)

The Bode plots of the plant, G(s), the compensator, H(s), and the closed-loop
system are obtained as follows, and are shown in Figure 2.44:

»G=tf(num,den); w=logspace(-l,4); [magi,phase1,w]=bode(G,w); %
 Bode plot of the plant <enter>

                      IUU _ _ i    i i imi|        i i imii|             1   1 llllll|       1   1

                             ""       - - . . _ . .Com aensator
                            Closed-loop sytem
               S"   n
               2,           Plant                               "u^-x
                c
               'to
               0 -100                                                                                                     ^-_

                                              il   i   i i I mil         i   1 1 1 1   ml    i i       1 1 Hill   1   1 1 Mill
                     -200  1
                        1Cr                  10°                 io1                   io2                  103                1(


                                                            Frequency (rad/s)

                        0
                            Compensator                          ""••-
                                                                                                   1
               ^ -100                                                                                                          -

                D)
                CD                                                                                   _Plant
               ? -200
                                                                                        Closedrloop sytem
               1
                               1   1 1 1 1 1 III   1   !   1 1 ! Illl    1   1 1 1 1 Mil     1   1 1 1 1 Illl     1   1 1 1 1 1 II


                        10~1                10°               101       102                                 103                1(


                                                            Frequency (rad/s)

Figure 2.44 Bode plots of the plant, PI compensator, and closed-loop system for the hard-disk
read/write head
90                         UNEAR SYSTEMS AND CLASSICAL CONTROL


           1 1100]; d1 = M 0] ;H=tf (n1 ,d1); [mag2,phase2,w]=bode(H,w); %
       Bode plot of the compensator <enter>
     »nCL=[700 770 000]; dCL=[1 15 100 700 770 000]; GCL=tf(nCL.dCL);
      <enter>
     »[mag3,phase3,w]=bode(GCL J w); % Bode plot of the closed-loop system
       <enter>

        Note from Figure 2.44 that the PI compensator increases the gain, while
     decreasing the phase at low frequencies, and leaves the high frequency gain
     unaffected. The DC gain of the closed-loop system is brought to 0 dB, indicating
     that the step response will have a zero steady-state error. There is a reduction
     in the gain margin of the closed-loop system due to the increased gain at low
     frequencies, when compared to that of the plant, indicating a loss of robustness.
     The plant's natural frequency of 316.23 rad/s is visible as a peak in the gain plot.
     The closed-loop poles are the following:

           »damp(dCL) <enter>

           Eigenvalue                          Damping           Freq. (rad/sec)
           -3.67466+000+3.1722e+002i           1.15836-002       3.17246+002
           -3.67466+000-3.1722e+002i           1.1583e-002       3.17246+002
           -7.65076-1-000                      1.00006+000       7.6507e+000

     Note that the closed-loop damping near plant's natural frequency is slightly reduced,
     while another pole is placed at s = —7.6507. How does this closed-loop pole config-
     uration affect the step response of the system? This question is best answered by
     comparing the plant's step response with that of the closed-loop system. The step
     responses are calculated using the M-file stepresp.m of Table 2.3 as follows:

     »[s1,t] = stepresp(num,den,0,0.01,1); % step response of the plant
      <enter>
     »[s2,t] = stepresp(nCL,dCL,0,0.01,1); % step response of the
      closed-loop system <enter>

     The two step responses are compared in Figure 2.45. Note that while the closed-
     loop steady-state error is brought to zero, the settling time and the large number of
     oscillations of the plant are unaffected.
        Furthermore, let us compare the gain and phase margins of the closed-loop system
     with those of the plant, to see how the stability robustness is affected. The gain and
     phase margins of the plant, with the respective crossover frequencies, are calculated
     using the command margin as follows:

         »[gm,pm,wg,wp]=margin(G) <enter>
         gm =
          Inf
CLOSED-LOOP COMPENSATION TECHNIQUES                                      91




                                            0.4          0.6
                                                  Time (s)




                               Step response of the closed-loop system



                                  0.2       0.4          0.6    0.8



Figure 2.45    Step responses of the plant and the PI compensated closed-loop system for the
hard-disk read/write head

    pm =
     Inf
    wg =
     NaN
    wp =
     NaN

where inf denotes oo, and NaN stands for 'not a number', i.e. an undefined quantity.
The plant thus has infinite gain and phase margins, and the corresponding crossover
frequencies are thus undefined. The margins for the closed-loop system are the
following:

    »[gmCL,pmCL,wgCLJwpCL] = margin(GCL) <enter>
    gmCL =
     0.9750
    pmCL =
     -3.8267
    wgCL =
     318.4062
    wpCL =
     318.6843

Both gain and phase margins of the closed-loop system have been drastically reduced
to only 0.975 (-0.22 dB) and -3.8267°, respectively, with the gain and phase
crossover frequencies quite close together at 318.7 rad/s and 318.4 rad/s, respec-
tively. Clearly, the closed-loop system is quite less robust than the plant. In summary,
92                         LINEAR SYSTEMS AND CLASSICAL CONTROL


     the PI compensator given by Eq. (2.166) not only results in a highly oscillatory
     response, but also a significant loss in robustness.
         Let us now improve the PID compensation by selecting the values of A^D, Kp,
     and KI, that lead to a desired closed-loop response. It is desirable to have a well
     damped closed-loop response, to reduce the number of oscillations, as well as the
     settling time. Hence, let us select a damping-ratio of £ = 0.707 for the closed-loop
     system, without changing the plant's natural frequency, a>,, =316.23 rad/s. The
     general transfer function of the forward path, G ( s ) H ( s ) , can then be written as
     follows:
               G(s)H(s) = 7W(KDs2 + KPs + tfi)/[5(52 + 155 + 100000)]                (2.168)
     Note that the closed-loop system's type is increased from 0 to 1, due to the presence
     of the pole at 5 = 0 in G(s)H(s). Hence, the steady-state error to step input will be
     zero, irrespective of the values of KD, Kp, and K. The closed-loop transfer function
     is G(s)H(s}/[ + G(s)//(s)], which can be expressed as N(s)/D(s), where N ( s )
     and D(s) are the following numerator and denominator polynomials, respectively:
              N(s) = 700(tfD5 + KPs + K}) D(s) = s + (15
                       + (100 000 + 700/^)5 + 700tfi                                (2.169)
     Note that the closed-loop system is of third order. We can write D(s) as a quadratic
     factor in s multiplied by a first order polynomial in 5, as follows:
                             D(s) = (s2 + 2$a)ns + w 2 )(5 + p)                     (2.170)
     Note from Eq. (2.116) that the step (or impulse) response of a system is domi-
     nated by the poles with the smallest real part magnitudes. If we select the two
     poles of the closed-loop system resulting from the roots of (s2 + 2£ tons + to2)
     to be closer to the imaginary axis than the third pole s = —p, the closed-loop
     response would be dominated by the quadratic factor in D(s), with (s + p) influ-
     encing the closed-loop response by a lesser extent. In such a case, the roots of
     (s2 + 2t;cons + co2) are called the dominant poles of the closed-loop system. Since
     we have already selected the closed-loop damping-ratio as £ = 0.707, and natural
     frequency as, con = 316.23 rad/s, we can choose the pole s = —pto be further away
     from the imaginary axis in the left-half plane by having p > £&>„ (i.e. p > 223.57).
     Let us take p = 300. Substituting the values of £, con, and p into Eq. (2.170) and
     comparing with D(s) given in Eq. (2.169), we get the following values of the
     PID compensator constants that would result in the desired closed-loop dynamics:
     KI = 42857.14, KD = 1.0459, KP = 191.64, and the compensator's transfer func-
     tion is given by
                        H ( s ) = (.0459s2 + 191. 645 +42 857. 14) /s             (2.171)
     With this PID compensator, we get the following closed-loop transfer function:
       Y(s)/Yd(s)
          = (732.15s2 + 134 1405 + 3 x 107)/[(5 + 300)(52 + 447.155 +  00000)]
                                                                           (2.172)
CLOSED-LOOP COMPENSATION TECHNIQUES                                     93


Let us check the closed-loop step response as follows:
»nCL = [732.15 134140 3e7]; dCL = conv([1 300],[1 447.15 1e5]); <enter>
»[s,t] = stepresp(nCL,dCL,0,0.0005,0.03); plot(t,s) <enter>

The resulting closed-loop step response is plotted in Figure 2.46. Note the settling
time of 0.025 seconds (as compared to 0.7 seconds for the plant), and a complete
lack of high frequency oscillations in the step response, with a zero steady-state
error. The performance is thus greatly improved by the PID compensation.
   Finally, let us determine the gain and phase margins of the PID compensated
closed-loop system as follows:

    »[gmCL,pmCL,wgCL,wpCL]=margin(GCL) <enter>
    gmCL =
     Inf
    pmCL =
     144.8891
    wgCL =
      NaN
    wpCL =
     583.6209

Note that the closed-loop gain margin is infinite, and the phase margin is 144.9°
occurring at gain crossover frequency of 583.6 rad/s. Although the phase margin
is no longer infinite as for the plant, it is quite large and adequate. The large




                            0.005    0.01    0.015     0.02   0.025     0.03
                                            Time (s)

Figure 2.46      Closed-loop step response of the PID compensated hard-disk read/write head
positioning system
94                              LINEAR SYSTEMS AND CLASSICAL CONTROL


                          1UU
                                                Compensator
                                  Closed-loop system
                  CD
                  TJ                                _^-^
                                  Plant                  "*~           -—       -______^
                         -100

                          ?nn
                                              102              103                       104
                                                Frequency (rad/s)
                                    1
                          100           ' '     i        ' • ' ' '.'.''i    i...j..i.ij-1-u
                                                           ..•'"""         Compensator
                                                        .''"S'^--^    Closed-loop
                   <D                         _...-•'        1 ^"'--.^ system
                   (/>
                   CO    -100
                  Q.                                         1                 Plant

                            101               102                    103                 104
                                                Frequency (rad/s)

   Figure 2.47 Bode plots of the plant, PID compensator, and closed-loop system for the hard-disk
   read/write head


   value of the gain crossover frequency indicates a very fast response, which is
   evident in Figure 2.46. In short, the PID compensated closed-loop system has a
   good combination of performance and stability robustness. The Bode plots of the
   PID compensator and the closed-loop system are compared with those of the plant
   in Figure 2.47. Note that the PID compensator has a decreasing gain at low frequen-
   cies, and an increasing gain at high frequencies. Also, the PID compensator provides
   a phase-lag at frequencies below the plant's natural frequency, and a phase-lead
   at higher frequencies. The resulting closed-loop gain and phase plots are much
  flatter (compared to the plant). However, due to an increased closed-loop gain at
   high frequencies, there is an increased sensitivity (and decreased robustness) with
   respect to the high frequency measurement noise, which is undesirable.



   The process of finding suitable PID constants A^D, Kp, and K (as illustrated very simply
in Example 2.23) is called PID tuning. Often, PID tuning in trying to achieve desirable
closed-loop characteristics is an iterative procedure A PID (or PI) compensator contains an
integrator (i.e. a pole s = 0) which requires special implementation techniques. Mechani-
cally, a pure integration is possible using a rate-integrating gyroscope - a commonly used
(but expensive) device in aircraft, missile, and spacecraft control systems. Figure 2.48(a)
depicts the schematic diagram of a single degree of freedom rate gyroscope, with gimbal
angle (i.e. rotation of the wheel assembly about the jc-axis), 9, as the output and the
angular velocity of the case about the z-axis, Q, as the input. If we neglect the stiffness
and inertia of the gimbal and wheel about the jc-axis, we can write the following transfer
CLOSED-LOOP COMPENSATION TECHNIQUES                                     95




   Z-*




Figure 2.48      (a) Schematic diagram of a single degree of freedom, rate integrating gyroscope with
output, 0(s) and input, Q(s). H is the angular momentum vector with a constant magnitude, H; (b) Active
circuit of an operational amplifier connected as an integrator with input, ei (f) and output,


function for the rate-integrating gyroscope:

                                                    = H/(cs)                                  (2.173)

where H is the constant magnitude of the angular momentum vector, H, of the wheel about
the >'-axis, and c is the viscous damping coefficient of the gimbal (i.e. rotary mechanism
about the jc-axis) (see Figure 2.48(a)). Equation (2.173) indicates that the gimbal angle
output is the time integral of the input angular velocity of the case.
   Modern control systems are relatively inexpensively implemented using either passive
(unpowered) or active (powered) electronic circuits. Figure 2.48(b) shows an active circuit
which uses an operational amplifier to represent a pure integrator. An operational amplifier
has two input voltages, e  ( t ) and e^(t}, and an output voltage, e^(t). In the circuit shown
in Figure 2.48(b), ^(0 = 0, and the equation governing the circuit is the following:


                                                        f                                     (2.174)

which implies that the output voltage, e^(t), is the time integral of the input voltage,
e(t), multiplied by the constant — l/(/?C). Operational amplifiers can also be used to
represent summing junctions, and other useful devices.
    Control systems based upon operational amplifiers (and other active circuits), are gener-
ally more expensive and sensitive to noise than those based on passive circuits. A simpler
alternative to operational amplifier is the approximation of the pure integrator by a passive
circuit, called lag circuit. The chief difficulty in implementing PID compensators is the
ideal differentiator (i.e. the term K^s in the expression for H(s)). An ideal differentiator
is difficult to set up, and leads to the amplification of any noise present in the input signal.
The noise amplification may interfere with the working of the entire control system. For
these reasons, a pure differentiator is never used practically, but only an approximate
differentiation is implemented using a passive circuit (called a lead circuit). Hence, the
96                       LINEAR SYSTEMS AND CLASSICAL CONTROL


ideal PID compensator is practically implemented by a combination of lag and lead
circuits (called a lead-lag compensator), which represent approximate integration and
differentiation.


2.12.2 Lag, lead, and lead-lag compensation
Consider a compensator with the following transfer function:

                               H(s) = (s + a>0)/(s + a>0/a)                          (2.175)

where a is a real constant and co0 is a constant frequency. If or > 1, the compensator is
called a lag compensator, because it always has a negative phase angle, i.e. a phase-lag.
In the limit a -> oo, the lag compensator approaches an ideal PI compensator. Hence,
a lag compensator can be used to approximate a PI compensator in practical implemen-
tations. A lag compensator is useful in reducing the steady-state error of type 0 plants,
and decreasing the gain of the closed-loop system at high frequencies (which is desirable
for reducing the sensitivity to the measurement noise). However, lag compensation slows
down the closed-loop transient response (i.e. increases the settling time). Lag compen-
sation is relatively simple to use, because the passive circuit through which it can be
implemented is quite inexpensive.
    In Eq. (2.175), if a < 1, the resulting compensator is called a lead compensator,
because it always has a positive phase angle, i.e. a phase-lead. A lead compensator
is useful for increasing the speed of the closed-loop response (i.e. decreasing the settling
time), and increasing the phase margin of the closed-loop system, which also results in
smaller overshoots in the transient response. Lead compensation usually requires amplifi-
cation of error signals, which results in an expensive electrical circuit for implementation.
Also, lead compensation increases the gain at high frequencies, which is undesirable due
to increased sensitivity to measurement noise. A lead compensator given by the transfer
function of Eq. (2.175) would decrease the DC gain of the type 0 open-loop transfer
function, G(s)H(s), which is undesirable as it would increase the steady-state error due
to a step input. So that the DC gain of the type 0 open-loop transfer function, G(s)H(s).
is unchanged with a lead compensator, the lead compensator transfer function is usually
multiplied by the factor I/or, resulting in

                               H(s) = (s+ o)0)/(as + a>0)                            (2.176)

Conversely, if we do not wish to increase the DC gain of G(s)H(s) (which may be infinite
due to poles of G(s) at s = 0) with lag compensation, we would choose a lag compensator
with the transfer function given by Eq. (2.176). Phase lag (or lead) compensation is
traditionally employed in a variety of control applications.
   To combine the desirable properties of the lead and lag compensators, sometimes it
is better to use a compensator which has both a phase-lag at low frequencies, and a
phase-lead at high frequencies. Such a compensator is called a lead-lag compensator, and
has the transfer function

                  H(s) = [(s + o>,)/(5 + <wi/a)][(s + a>2)/(s/a + a*,)]             (2.177)
CLOSED-LOOP COMPENSATION TECHNIQUES                                    97


where a > 1, and a) and a>2 are constant frequencies. Note that the transfer function
suggests that the lead-lag compensator consists of a lag compensator in series with a lead
compensator. Also, note that the lag part of the transfer function is designed to increase the
DC gain of open-loop system, G(s)H(s). The frequencies, a> and a>2, and the constant,
a, must be selected to achieve desired closed-loop characteristics. It is easy to see that in
the limit a -> oo, the lead-lag compensator approaches an ideal PID compensator.
   Figure 2.49 shows the passive circuits used to implement the lag, lead, and lead-
lag compensators. In each circuit, e(t) and e2(t) are the input and output voltages,
respectively. The transfer function of the lag circuit (Figure 2.49(a)) is expressed as

                    H(s) =                            R2Cs}/[                                 (2.178)

Comparing Eqs. (2.178) and (2.176), it is clear that a>0 = l/(R2C) and a = (R +
R2)/R2. The lead circuit in Figure 2.49(b) has the transfer function

           H(s) = E 2 ( s ) / E l ( s ) =       R l C s ) / [ ( R l + R2)                      (2.179)

                      (a)




                                                                             E2(s)




                      (b)




                                                                             E2(s)




                      (c)




                                                                             E2(s)




Figure 2.49     (a) Lag circuit with input voltage EI(S) and output voltage £2(5); (b) Lead circuit with
input voltage £)(s) and output voltage EI(S); (c) Lead-lag circuit with input voltage FI(S) and output
voltage £2(5)
98_                       LINEAR SYSTEMS AND CLASSICAL CONTROL                          _


which implies that co0 = l/(RC) and a = R2/(R + R2). Finally, the transfer function
of the lead-lag circuit shown in Figure 2.49(c) is the following:

H(s) = E 2 ( s ) / E l ( s ) = [(1 + /?iC,5)(l + /?2C2s)]/[(l + /?,C,s)(l + R2C2s) + /?,C2s]
                                                                                     (2.180)
Comparing Eqs. (2. 1 80) and (2. 1 77), you may verify that a> = /(RC),a>1 = l/(/? 2 C 2 ),
and a is obtained by factoring the denominator (i.e. solving a quadratic equation) in
Eq. (2.180).

  Example 2.24

  Consider the roll dynamics of a fighter aircraft with the following transfer function:

                          <f>(s)/8(s) = G(s) = 1000/[s(s + 5)]                     (2.181)

   The output, y(s) = 0(5), is the roll-angle, while the input, U(s) = 6(5), is the
   aileron deflection angle. The maneuverability of an aircraft depends upon the time
  taken to achieve a desired roll-angle, (or bank-angle) Y^(s) = <f>d(s). It is required to
   design a closed-loop control system to achieve a unit step desired roll-angle in about
   three seconds, with a maximum overshoot less than 2 percent. Since the plant has a
  pole at s = 0, it is not asymptotically stable and the steady-state condition would not
  be achieved by plant alone, thereby requiring a feedback compensation that would
  provide asymptotic stability. Since the plant is of type 1 due to the pole at the origin,
  a simple feedback system with H(s) = K (where K is a constant) will achieve
  a zero steady-state error to a step desired output. With such a compensator, the
  closed-loop characteristic equation would be s2 + 5s + 1000 K = 0, and the closed-
  loop poles would be s_2 = -2.5 ± (1000AT2 - 6.25)1/2i, with a damping-ratio, £ =
  0.0791/V^, and natural frequency, o>n = 31.6228v/tf. If we want to achieve a
  settling time, Ts, of 3 seconds, then from Eq. (2.125) we have Ts =4/(go>n), or
   £con = 4/3. The closed-loop system with H (s) = K can give us gcon = 0.0791 x
  31.6228 = 2.5, or Ts = 4/2.5 = 1.6 seconds, which is a smaller settling time than
  required. The maximum overshoot requirement of 2 percent of steady-state response,
  according to Eq. (2.127) results in the condition Mp = 1.02 = 1 + exp[— gn/( —
  S- 2 ) 1 / 2 ], or £ = 0.7797, which requires JK = 0.0791/0.7797 = 0.1014, or K =
  0.0103. Hence, we should have K < 0.0103 in order to satisfy both settling time and
  maximum overshoot requirements. Let us choose K = 0.01, which gives us a closed-
  loop settling time, rs=1.6 seconds, and maximum overshoot, Afp = 1.0172, or the
  maximum percentage overshoot of 1 .72 percent. Thus, the performance requirements
  are met quite successfully with H(s) = 0.01.
      Let us now consider a lag-compensator for this task. Since G(s) is of type 1,
  we do not need to increase the DC gain of G(s)//(s) to reduce the steady-state
  error to a step input. Hence, we would like to use a lag compensator transfer
  function of the form H(s) = (s + a)0)/(as +co0), with a > 1, which leaves the
  DC gain of G(s)H(s) unchanged. A candidate lag-compensator transfer function
  which achieves the desired performance is H(s) = (s + 0.001 )/( 100s +0.001),
  i.e. a>o = 0.001 rad/s and a = 100. The closed-loop transfer function is thus the
CLOSED-LOOP COMPENSATION TECHNIQUES                                          99


following:
             (s)/(t>d(s) = 1000(5 + 0.001)/(100s3 + 500s2 + 1000^ + 1)                   (2.182)
The natural frequencies and damping-ratios of the closed-loop system are the
following:

      »nCL=[0 0 1000 1]; dCL=[100 500 1000 1]; damp(dCL) <enter>
      Eigenvalue                       Damping Freq. (rad/sec)
       -0.0010                         1.0000 0.0010
        -2.4995+1.9359i                0.7906             3.1615
        -2.4995-1.9359i                0.7906             3.1615

Note that there is a closed-loop pole at s = —0.001. Since there is a closed-loop
zero at the same location, after canceling the pole with the zero at s = —0.001, the
closed-loop transfer function can be written as:
                                                                            10)          (2.183)
which is the same transfer function as that obtained with H(s) — 0.01! This is an
interesting result, and shows that the lag compensator has resulted in a third order
closed-loop system, which essentially behaves as a second order system due to a
pole-zero cancelation. The performance objectives are met by such a lag compen-
sator, as shown above for H(s) = 0.01.
   Figure 2.50 compares the Bode plots of the plant, the lag compensator, and the
closed-loop system. The lag compensator provides a negative phase and a reduction

                    200

                    100 -




                                           10-4             10-2            10o    102
                                                   Frequency (rad/s)

                             .     >         I        '     .--I ..... "•'•-.. I
                                 " Lag compensator                            
                                       "•-,, T    .-•' 'Closed-loop system-
                   -100 -

                                                    Plant

                   -200 6
                       10~                                  io-2            10°    102
                                                   Frequency (rad/s)

Figure 2.50 Bode plots of the plant, lag compensator, and closed-loop system for the roll
control of a fighter aircraft
100                    LINEAR SYSTEMS AND CLASSICAL CONTROL


 in gain in the frequencies below aa)Q (i.e. 0.1 rad/s). Since the closed-loop gain never
 crosses the 0 dB line, and the closed-loop phase tends asymptotically to —180°, the
 gain and phase margins are infinite for the closed-loop system. Also, note that there
 is no change in the slope of gain reduction with frequency (i.e. roll-off) at high
 frequencies of the closed-loop system, when compared to that of the plant, which
 implies that there is no reduction in the robustness with respect to high-frequency
 measurement noise.


 Example 2.25
 Consider a large chemical plant with the following transfer function:

              Y(s)/U(s) = G(.s) = 0.025/[(s2 + 0.3s + 0.01)(s + 0.33)]           (2.184)

 where the output, Y(s), is the temperature, and the input, U(s), is the mass flow-rate
 of Xylene gas. The natural frequencies of the plant are calculated as follows:

 »num=0.025; den=conv([1 0.33],[1 0.3 0.01]); damp(den) <enter>

 Eigenvalue        Damping       Freq. (rad/sec)
  -0.0382          1.0000        0.0382
  -0.2618          1.0000        0.2618
  -0.3300          1.0000        0.3300

 The plant's response is dominated by the pole, 5 = —0.0382, which is very much
 closer to the imaginary axis than the other two poles. Hence, the plant has a settling
 time of approximately Ts = 4/0.0382 =105 seconds. The steady-state error of the
 plant is e(oo) = 1 — lim^o^Cs) = —6.5758 for a unit step input. It is required
 to design a closed-loop control system such that the steady-state error is brought
 down to less than ±0.15, with a maximum overshoot of 10 percent, and a settling
 time less than 20 seconds to a unit step desired output, Yd(s). Consider a lead
 compensator with COQ = 0.15 rad/s and a = 0.01, which results in a compensator
 transfer function, H(s) = (s + 0.15)/(0.01s + 0.15). The closed-loop transfer func-
 tion, G(s)H(s)/[ + G(s)H(s)], is thus

 Y(s)/Yd(s) = 0.025(s +0.15)/(0.01s4 + 0.1563s3 + 0.09559s2 +0.041383* + 0.004245)
                                                                                (2.185)
 The closed-loop poles and natural frequencies are the following:

 »nCL=0.025*[1 0.15]; dCL=[0.01 0.1563 0.09559 0.041383 0.004245]; damp
   (dCL) <enter>

 Eigenvalue              Damping        Freq. (rad/sec)
  -0.1358                1.0000          0.1358
  -0.2414+0.3873i        0.5289          0.4563
  -0.2414-0.3873i        0.5289          0.4563
  -15.0115               1.0000         15.0115
CLOSED-LOOP COMPENSATION TECHNIQUES                              101




                         0    20    40     60        80   100    120     140
                                            Time (s)




                                          Closed-loop system (chemical
                   0.5                    plant with lead compensator)




                                                10          15           20
                                            Time (s)

Figure 2.51    Step responses of the chemical plant and the closed-loop system with the lead
compensator



Since there is no clearly dominant pole (or conjugate pair of poles), the settling
time of the closed-loop system is determined by the first three poles, which indi-
cates a dominant third order system. The step response of the closed-loop system is
compared with that of the plant in Figure 2.51, obtained using the M-file stepresp.m.
Note from Figure 2.51 that the closed-loop settling time is about 19 seconds, while
the maximum overshoot is about 8 percent. The closed-loop steady-state error is
calculated to be e(oo) = 1 — lirn v _»o s Y ( s ) — 0.1166. Hence, the performance objec-
tives have been met.
   The robustness properties of the closed-loop chemical plant control system are
indicated by a Bode plot of the closed-loop transfer function, which is shown
along with the Bode plots of the plant and the lead compensator in Figure 2.52.
Note that the lead compensator provides a phase lead and a gain increase in the
frequency range au>Q < co < OJQ/OI (i.e. 0.0015 < CD < 1500 rad/s). This results in a
speeding-up of the closed-loop response, which is evident in a reduced settling time
and an increased phase crossover frequency. Using the CST command margin, the
gain and phase margins of the plant are calculated to be 8.349 dB and 33.6°, respec-
tively, with gain and phase crossover frequencies of 0.1957 rad/s and 0.3302 rad/s,
respectively. The closed-loop system has, however, a gain margin of 32.79 dB and
an infinite phase margin, with a phase crossover frequency of 2.691 rad/s. Hence,
the closed-loop system has a greater robustness to transfer function variations, and
a faster response than the plant. However, due to an increased closed-loop gain
at high frequencies, the roll-off at high frequencies is reduced for the closed-loop
system, when compared to the plant. This implies an increased sensitivity of the
closed-loop system to the high-frequency measurement noise.
102                          UNEAR SYSTEMS AND CLASSICAL CONTROL


                       100                               «M|   , imu,,    , ,imi,|
                                                          Lead compensator
                         0
                                   Closed-loop system
                      -100                                           Plant ^


                             10-       1C   3
                                                1(T2      10-1      10°         101    102
                                                 Frequency (rad/s)

                       200

                 o>                                                            -..x.
                 <D
                                                                  .Closed-loop system
                 0)
                 | -200                                Plant
                 0.

                      -400
                                                10~2      1Q-1      10°         101    102
                                                 Frequency (rad/s)

  Figure 2.52    Bode plots of the large chemical plant, lead compensator, and the closed-loop
  system



   From Examples 2.24 and 2.25, it is clear that while a lag compensator reduces the
closed-loop steady-state error by providing a phase-lag at low frequencies, a lead compen-
sator speeds-up the closed-loop response by providing a phase-lead at high frequencies.
Let us see an application of the lead-lag compensation, which combines the desirable
features of lag and lead compensators.

  Example 2.26
  In Example 2.25, the use of lead compensation resulted in a faster closed-loop
  response of a chemical plant. However, the closed-loop steady-state error with
  lead compensation was non-zero. Let us try to reduce the steady-state error, while
  speeding up the response, with the help of lead-lag compensation. In Example
  2.25, a lead compensator with transfer function, H(s) = (s + 0.15)/(0.01s + 0.15),
  produced a closed-loop steady-state error of 0.1166 and a settling time of 19 seconds.
  Let us choose the same transfer function for the lead part of the lag-lead compen-
  sator, i.e. a>2 = 0.15 rad/s and I/a = 0.01 (i.e. or = 100). The lag part of the lead-lag
  compensator would reduce the steady-state error by increasing the DC gain of the
  open-loop transfer function, G(s)H(s). Let us therefore modify our design require-
  ments to a closed-loop steady-state error of less than 0.002 and a settling time
  less than 20 seconds, while accepting a 10 percent maximum overshoot in the step
  response. To meet the new design requirements, a lag compensation frequency of
  CD =0.13 rad/s is selected, resulting in the following lead-lag compensator transfer
_                    CLOSED-LOOP COMPENSATION TECHNIQUES _                           103


function:

            H(s) = [(s + 0.15)(.v + 0. 13)]/[(0.01.s + 0.15)0? + 0.0013)]     (2.186)

which gives us the following closed-loop transfer function:


     = (0.0255 + 0.007)/(0.0 Is4 + 0.15631s3 + 0.095793s2 + 0.041507s + 0.0075163)
                                                                              (2.187)
The closed-loop poles, damping, and natural frequencies are as follows:

»nCL=[0.025 0.007] ;dCL=[1e-2 1.56316-1 9.57936-2 4.1507e-2 7.51636-3];
 damp(dCL) <enter>

Eigenvalue                           Damping             Freq. (rad/sec)
-1 .34836 -001+4. 87776 -002i        9.40366-001         1.43396-001
-1 .34836-001 -4. 8777e-002i         9.40366-001         1.43396-001
-1 .75146-001+3.57076-0011           4.40376-001         3.97706-001
-1 .75146-001 -3. 5707e-001i         4.40376-001         3.97706-001
-1.50116+001                         1.0000e+000         1.50116+001

The first four poles, roughly located the same distance from the imaginary axis,
are the dominant poles of the closed-loop system. The DC gain of the closed-loop
system indicates the steady-state value of the step response, and is calculated using
the MATLAB (CST) command dcgain as follows:

      »GCL=tf (nCL,dCL) ; dcgain(GCL) <enter>=
      ans =
        0.9987
Hence, the closed-loop steady-state error is brought down to 1 — 0.9987 = 0.0013,
which is acceptable. The closed-loop step response is plotted in Figure 2.53 for three
different values of the lag frequency, u>. For a> =0.13 rad/s (used in the above
calculations), the closed-loop response has a settling time of about 16 seconds,
and a maximum overshoot of about 30 percent, which is unacceptable. Figure 2.53
shows that the maximum percentage overshoot can be reduced by decreasing a).
For co = 0.05 rad/s, the maximum percentage overshoot is about 10 percent, and
the settling time is about 13 seconds. However, decreasing u> below 0.05 rad/s
results in an increase in the settling time, as is evident from the step response for
ct>2 = 0.03 rad/s which has a maximum overshoot of about 5 percent, but a settling
time of about 22 seconds. The steady-state error is unaffected by changing o>i . We
select GL> — 0.05 rad/s, which gives a fast response and an acceptable maximum
overshoot.
    The Bode plots of the plant, the lead-lag compensator with a>2 = 0. 15 rad/s, co =
0.05 rad/s, a = 100, and the resulting closed-loop system are shown in Figure 2.54.
104                          LINEAR SYSTEMS AND CLASSICAL CONTROL


                             1.4

                             1.2
                                                                          1.02SH
                               1
                                                                          0.98s(~)
                               8
                      IF °-
                                                        ^=0.05 rad/s
                      "55" 0.6                          o>2=0.10 rad/s
                                                        0^=0.13 rad/s

                             0.4

                             0.2

                              0
                                      10         20       30         40         50
                                                   Time (s)

 Figure 2.53      Closed-loop step response of the chemical plant with a lead-lag compensator for
 various values of the lag frequency, 102


                       100
                                             Lead-rag compensator

                 CO                                             ^
                                                            I.^Closed-loop system
                 TJ

                      -100

                      -200
                             10-     1 i-2
                                        fl       ic-1       10°                      102
                                               Frequency (rad/s)

                                                            Lead-lag compensator


                                                               Closed-loop system
                      -200
                                                  Plant
                                                                   --..i -
                             1 fl-               IC-1       10°                      102
                                               Frequency (rad/s)

 Figure 2.54      Bode plots of the large chemical plant, the lead-lag compensator, and the
 closed-loop system


 Comparing Figure 2.54 with Figure 2.52, the phase-lag and decreasing compensator
 gain below 0.1 rad/s, and phase-lag and increasing compensator gain above 0.1 rad/s
 are evident for the lead-lag compensator. The high-frequency closed-loop behavior
 is largely unaffected, when compared to the lead compensation in Figure 2.52. The
 closed-loop gain and phase margins are computed by the command margin to be
 38.9 dB and 104.5°, respectively, with gain and phase crossover frequencies of
MULTIVARIABLE SYSTEMS                                 105


  0.3656 rad/s and 2.5456 rad/s, respectively. Comparing these values with those of
  Example 2.25 with lead compensation, we find that there is a slight increase in
  the gain margin, while the phase margin has been reduced from infinite to 104.5°.
  Furthermore, there is a slight slowing down of the closed-loop response due to
  the added lag compensation, which is evident in a slight reduction in the phase
  crossover frequency. The slowing down of the closed-loop response is also clear in
  the overshoot and settling time of the step response. The lead compensated system of
  Example 2.25 had an 8 percent overshoot and settling time of 19 seconds. To achieve
  the same overshoot, the lead-lag compensated system would require a settling time
  slightly larger than 20 seconds, which is obvious from Figure 2.53. Example 2.26
  illustrates the iterative process of determining the three unknowns (a, w, OLK) of a
  lead-lag compensator to meet a conflicting set of performance requirements. Since
  a lead-lag compensator is a practical (approximate) implementation of the ideal
  PID compensator, we have witnessed an example of PID tuning in which the three
  unknown constants Kp, K®, and K are determined in a similar manner.

   The Control System Toolbox (CST) offers an interactive Graphical Users Interface
(GUI) tool, called the SISO Design Tool, to carry out the steps illustrated in this section
for the design of closed-loop compensators in a user-friendly manner. To use this design
feature, go to MATLAB launch pad, click on the Control System Toolbox, and select the
icon for 5/5*0 Design Tool from the resulting menu. Another interactive GUI tool available
in the CST menu is the LTI Viewer, which lets you directly view all the important graphs
of a linear, time-invariant system (step and impulse responses, Bode, Nyquist, root-locus,
Nichols plots, and pole-zero map, etc.), as well as the performance characteristics of
the system (peak response, rise time, settling time, and steady-state), along with several
graphical operations. As an exercise to familiarize yourself with these GUI tools, repeat
Examples 2.23-2.26 with the 5/50 Design Tool, and use LTI Viewer to check the closed-
loop system's characteristics.


2.13 Multivariable Systems
So far we have considered only single-input, single-output systems (an exception was the
aircraft in Example 2.10, which had three outputs, and one input). A practical modern
control system may simultaneously contain several inputs and several outputs. Such
systems are called multivariable systems. For multivariable systems, we must re-define
the relationship between the Laplace transform of the input, U(s), and the Laplace trans-
form of the output, Y(s), both of which are now vectors, consisting of more than one
signal. Each element of U(s) is the Laplace transform of the corresponding element of the
input vector, u(t). Similarly, each element of Y(,v) is the Laplace transform of the corre-
sponding element of the output vector, y(r). The input and output vectors are related in the
Laplace domain by a transfer matrix (instead of the transfer function for the single-input,
single-output systems), G(s), which is defined as follows:

                                    Y(s) = G(s)U(s)                                (2.188)
106                      LINEAR SYSTEMS AND CLASSICAL CONTROL


Note that we are using bold letters to denote vectors and matrices. This notation will be
followed throughout the book. Refer to Appendix B, or Gantmacher [4] and Kreyszig [5]
for vectors, matrices, and their properties.
   In Eq. (2.188) if the system consists of p outputs and r inputs, then the sizes of Y(s),
U(s), and G(s) are (p x 1), (r x 1), and (p x r), respectively. (Clearly, the single-input,
single-output system is a special case of the multivariable systems where p = 1 and
r = 1.) Since we are dealing with vectors and matrices here, we have to be careful how
we multiply them such that the sizes of the multiplied quantities are compatible (e.g. we
can not write Eq. (2.188) as Y(s) = U(s)G(s)!).


  Example 2.27
  Let us derive the transfer matrix of the multivariable system of Example 2.10.
  Recall that the system (longitudinal dynamics of an aircraft) consists of a single
  input whose Laplace transform is <5(s), and three outputs with Laplace transforms
  u(s), a(s), and 9(s}. Thus, we can write


                                                                                (2.189)


  The transfer matrix between G(s) can be obtained using the relationships between
  the input and the individual elements of Y(s) given by Eqs. (2.86)-(2.88) as follows:

                                               v(s)/8(s)
                         Y(S) =    a(s)                                         (2.190)
                                   0(s)        0(s)/S(s)
  or

 Y(5)
           -0.0005(5 - 7 ) 5 + 0 5 / ( 2 + 0.0055 + 0 0 6 ( 2 +5 + 1.4)]
                        0(       .)[5                 .0)5
           -0.02(5 + 8 ) 5 + 0 0 6 5 + 0 0 6 / ( 2 + 0 0 5 + 0 0 6 ( 2 + s + 1.4)]
                      0(2 .05             .0)[5         . 0 5 .0)5                    U(5)
           -1.4(5 + 0.02)(5 + 0.4)/[(52 + 0.0055 + 0.006)(52 +5+1.4)]
                                                                                (2.191)
  which, from Eq. (2.188), gives

    G(s)
            -0.0005(5 - 70)(5 + 0.5)/[(52 + 0.0055 + 0.006)(52 +5 + 1.4)]
            -0.02(5 + 80)(52 + 0.00655 + 0.006)/[(52 + 0.0055 + 0.006)(52 + 5+1.4)]
            -1.4(5 + 0.02)(5 + 0.4)/[(52 + 0.0055 + 0.006)(52 + s + 1.4)]
                                                                           (2.192)
  Note that the transfer matrix, G(s), is of size (3 x 1), denoting a single-input,
  three-output system.
MULTIVARIABLE SYSTEMS                                          107




Figure 2.55      Three types of connections in multivariable control systems: (a) parallel, (b) series, and
(c) negative feedback


   We must be able to determine a system's transfer matrix from the block diagram of
a multivariable system, which may include transfer matrices of the various sub-systems.
As in single-input, single-output (SISO) systems, there are three distinct ways in which
the multivariable sub-systems can be connected to each other, as shown in Figure 2.55.
Figure 2.55(a) depicts two sub-systems of transfer matrices 61 (s) and 62(5), respectively,
connected in parallel. Here, the outputs of the two sub-systems, YI(.S) and Y2(*) (which
clearly must be vectors of the same size) are added-up at the summing junction to give
the system's output, Y(s), by
            = Y,(s) + Y2(5) -                                     - [6, (5)                       (2.193)

   Hence, the parallel system's transfer matrix is the sum of the transfer matrices of its
two (or more) components, i.e. G(s) — 61(5) + 62(5). The system of Figure 2.55(b) is
in series, and it can be easily seen (left as an exercise for you) that the transfer matrix
of such a system is given by the product of the transfer matrices of the two (or more)
components, i.e. G(s) = G 2 (s)GiCs). In series combinations, one has to be careful in the
sequence of multiplication (i.e. 62(5)61 (5), and not G (.5)62(5), etc.), because the matrix
multiplication is not always conformable (i.e. for a matrix product G(s) = 62(5)61(5)
to be defined, the number of columns in 61(5) must be equal to the number of rows in
62(5)) (see Appendix B). The third kind of connection, shown in Figure 2.55(c) is the
feedback arrangement. The two sub-systems of this combination are the forward trans-
mission, given by the transfer matrix 61 (5), and the feedback transmission, whose transfer
matrix is 62(5). If the feedback signal, Z(s), is subtracted from the input, U(s) - as in
Figure 2.55(c) - then the system is said to be of a negative feedback kind, and if Z(s) is
added to U(s) at the summing junction, the system is called a positive feedback system.
Again, as in SISO systems, we usually encounter the negative feedback arrangement in
multivariable control systems, whose objective is to drive the inverse Laplace transform of
the error vector, E(s) = U(s) — ZOs), to zero as t —> oo. For a negative feedback system,
we can write
                                               = Gi(s)[U(5) -                                     (2.194)
108_                     UNEAR SYSTEMS AND CLASSICAL CONTROL                        _


or
                           P + Gi(5)G2(j)]Y(5) = d(5)U(5)                          (2.195)
and it follows that
                                                                                   (2.196)
where [ ]"' denotes the inverse of a (square) matrix, and I is the identity
matrix of the same size as the product 61(5)62(5) (Appendix B). Hence,
from Eq. (2.196), the transfer matrix of a negative feedback system is given
by G(s) = [I + Gi(5)G2(5)]"1Gi(5). (Note that for a SISO system, the transfer
matrix (function) becomes G(s) = Gi(.s)/[l + Gi(s)G2(5)].) Again, we must be
careful with the sequence of matrix multiplication involved in expressions such as
Eq. (2.196). Not all multi variable closed-loop systems are of the kind shown in
Figure 2.55(c).
   Trying to find the transfer matrices of multivariable systems from their block diagrams
can be a daunting task. The Control System Toolbox (CST) helps in constructing the
transfer function from its individual components with model building commands, such
as series, parallel, feedback, and append. For example, the multivariable system of
Figure 2.55(a) can be constructed using the command parallel as follows:

          »sys = parallel (G1 ,G2) <enter>
where Gl, G2 are the LTI objects (either transfer matrices, or state-space models (see
Chapter 3)) of the two parallel sub-systems, G t and G2, respectively. Alternatively, we
could type

          »sys = G1+G2 <enter>
to get the transfer matrix (or state-space model) of the overall system. Similarly, we can
use the series command for the system of Figure 2.55(b) as follows:

          »sys = series(G1 ,G2) <enter>

or type

          »sys = G2*G1 <enter>
For multivariable systems in which only some of the outputs of Gl are the inputs to
G2, both parallel and series commands can be used with two additional input arguments
such as

          »sys = series (G1,G2,OUTPUTS1,INPUTS2) <enter>
which specifies that the outputs of Gl denoted by the index vector OUTPUTS 1 are
connected to the inputs of G2 denoted by INPUTS2. (The vectors OUTPUTS 1 and
INPUTS2 contain indices into the outputs and inputs of Gl and G2, respectively.) For the
MULTIVARIABLE SYSTEMS                                       109


feedback multivariable system the CST command feedback gives the closed-loop transfer
matrix as follows:

         »sys = feedback(G1,G2,FEEDIN,FEEDOUT,sign) <enter>
The vector FEEDIN contains indices into the input vector of Gl, and specifies which
inputs are involved in the feedback loop. Similarly, FEEDOUT specifies which outputs
of Gl are used for feedback. If the sign is omitted, a negative feedback system is assumed,
while sign=l results in a positive feedback system. If FEEDIN and FFEDOUT are omitted
from the feedback command, it is assumed that all the outputs of Gl are the inputs to G2
(as shown in Figure 2.55(c)).

  Example 2.28

  Consider the multivariable control system of Figure 2.56. The system's block-
  diagram indicates that only the second and third outputs of GI (s) are inputs to
  GaCs), while the second output of 62(5) is an input to 63(5). It is also clear
  that G]0) and 62(5) are in series, while GI(S) is in a negative feedback arrange-
  ment with G(s) and 62(5). The closed-loop system's transfer matrix from the
  input vector, U(s) = U(s), and the output vector, ¥(5) = [Y2(s)Y^(s)]r can be
  determined using the CST commands as follows:
   »G1=tf({1; -2; 1},{[1 1]; [1 0]; [1 0 5 ] } ) % transfer matrix,G1 <enter>
   Transfer function from input to output...
          1
   #1:
              s+1

         -2
   #2;




                U,(s)                  1/(s+1)                                          Y2( s)
                               GI(S) = -2/s
                                       1/(s2+5)                                         Y3(
                                                             Gj>(s)= P
                                                                     -1/s    ° 1
                                                                             s+1




                                 G3(s) = -2(s+2)/(s2+3s+2)



   Figure 2.56          A multivariable closed-loop system consisting of sub-systems, GI , Gj, and
110                         LINEAR SYSTEMS AND CLASSICAL CONTROL

           1
 #3:
          s~2+5

 »G2=tf({[1 0] 0;-1 [1 1]},{1 1;[1 0] 1}) % transfer matrix, G2 <enter>

 Transfer function from input 1 to output...

 #1: s
     -1
 #2: --
     s
 Transfer function from input 2 to output...

 #1: 0
 #2: s+1
 »G3=tf(-2*[1 2],[1 3 2]) % transfer matrix, G3 <enter>

 Transfer function:

  -2s-4
  s"2+3s+2

 (Note the ease with which the transfer matrices are constructed using the LTI object,
 tf. The coefficients of the numerator and denominator polynomials are specified using
 {•}, {•}, with the transfer functions on different rows separated by;.)

 »G2G1=series(G1,G2,[2 3 ] , [ 1 2 ] ) %transfer matrix of the series
  connection <enter>

 Transfer function from input to output...




        s"3+3s~2+10
 #2: .........

 »GCL=feedback(G2G1 , G3, 1 , 2 ) % closed-loop transfer matrix from Ui(s)
  to [ Y 2 ( s ) ; Y 3 ( s ) ] <enter>

 Transfer function from input to output...
        -2s"6-6s~5-14s~4-30s~3-20s"2+7.43e-015s
 #1 :                .........................................
          s"6+3s'5+5s / s 4+5s"3-2s / v 2-20s-40
MULTIVARIABLE SYSTEMS                                111


         S'5+6sM+11s"3+16s A 2+30s+20
   #2:
         S"6+3s"5+5s"4+5s A 3-2s"2-20s-40


   Thus the closed-loop transfer matrix indicates a sixth order, single-input, two-output
   system. The transfer function of the forward path from U(s) = U](s) to Y(s) is
   easily seen from Figure 2.56 to be /(s + 1). Note that the denominator polynomials
   of the two transfer functions constituting GCL are the same, which indicates that the
   closed-loop system's poles can be obtained by factoring the common denominator
   polynomial. The closed-loop zeros are the zeros of transfer functions constituting
   GCL, which are easily identified from Figure 2.56 as z = — 1 and 12 = —2. Let us
   determine the closed-loop zeros and poles using CST as follows:

         »zero(GCL) <enter>
         ans =
          -1.0000
          -2.0000
         »pole(GCL) <enter>
         ans =
          -2.0000
          -1.3584+1.36341
          -1.3584-1.36341
           0.1132+1.90001
           0.1132-1.90001
           1.4904

   Due to the presence of three poles with positive real parts, the closed-loop system
   is unstable.

    Example 2.28 indicates that, to determine the performance, stability, and robustness of
a multivariable, linear, time-invariant control system, we should be first able to express
its transfer matrix G(,v), as a matrix of rational transfer functions, Gy(s), given by

                                                           Gim(s)
                                                                                    (2.197)
                                Gni(s)    (
where n is the number of outputs and m is the number of inputs. Example 2.28 also
illustrates that we can extend the logic of poles and zeros of a single-input, single-output
system to multivariable systems by defining the roots of the denominator and numerator
polynomials of all the elemental transfer functions, GJJ(S), as the system's poles and
zeros, respectively. Such a definition also suggests that the characteristic polynomial of
the multivariable system be defined as a single common denominator polynomial, and
the roots of the characteristic polynomial are the poles of the system. Then we can apply
the same stability criteria as for the single-input, single output systems by looking at the
112                      LINEAR SYSTEMS AND CLASSICAL CONTROL


locations of the system's poles. Similarly, the determination of responses to the singularity
functions (or to an arbitrary input) can be carried out from G(s) in the same manner as
we did for the single-input, single output systems, if we consider one input at a time.
The robustness of a multivariable system can be determined using frequency response
methods (see Chapter 7), provided we define scalar measures for multivariable systems
analogous to gain and phase margins.
   For analyzing the robustness of a general closed-loop multivariable system, consider
the multivariable counterpart of the single-input, single-output closed-loop system of
Figure 2.32, in which we take G(s) and H(s) to denote the plant and controller transfer
matrices, respectively. Note that for the system of Figure 2.32, the closed-loop transfer
matrix, Gc(s), defined as Y(s) = G c (s)Yd(s), is given by
                           Gc(5) = [I + G(s)H(s)r!G(s)H(s)                           (2.198)
where I is identity matrix, G(s) is the plant's transfer matrix, and H(s) is the transfer
matrix of the controller. In a manner similar to the single-loop feedback systems, we
can define a return difference matrix. However, there are two different return difference
matrices for the multivariable systems: the return difference matrix at the plant's output,
[I + G(s)H(s)], and the return difference matrix at the plant's input, [I + H(s)G(s)].
These return difference matrices are the coefficient matrices of the output, Y(s), and the
input, U(s), respectively, when the expressions relating the desired output, Yd(.s), with
Y(s) and U(s), respectively, are written as [I + G(s)H(s)]Y(s) = G(s)H(s)Y d (s) and
[I + H(s)G(s)]U(.s) = H(s)YdCs). Continuing the analogy with the single-input, single-
output systems, the matrices G(s)H(s) and H(s)G(.s) are called the return ratio matrices
at the plant output and input, respectively. For studying robustness of the closed-loop
system, the return difference (and return ratio) matrices are considered important, as we
shall discuss in Chapter 7.
   Before we can define quantities analogous to gain and phase margins of single-loop
systems, we have to assign a scalar measure to the return difference matrix at the output,
[I + G(s)H(.s)]. Such a scalar measure assigned to a matrix is its determinant. Since
the determinant of the return difference matrix at the output is set to zero (i.e. |I +
G(s)H(s)| = 0) is the characteristic equation which determines the closed-loop system's
poles, we obtain stability robustness information by studying Bode or Nyquist plot of the
determinant of the return difference matrix at the output, |I + G(.s)H(s)|.
   Since the return difference matrix at the output appears as an inverse in the closed-loop
transfer function, we expect [I + G(s)H(s)] to be singular (i.e. a matrix whose inverse is
not defined because its determinant is zero) at the poles of the system. If the closed-loop
system is asymptotically stable, the poles must lie in the left-half s-plane. The stability
robustness in this case is, therefore, a measure of how much the controller transfer matrix,
H(s), is allowed to vary before the poles cross into the right half s-plane.

  Example 2.29
  Consider a two-input, two-output chemical process plant with transfer matrix G(s)
  (Figure 2.52) controlled by three flow control servo-valves, each of which has a
  constant transfer function (or gain), K. The outputs, Y(s), and J^U), are fed back
  to the individual servo-control valves as shown. The plant's transfer matrix, G(s).
MULTIVARIABLE SYSTEMS                                          113

is expressed as

                                                 3/s         -
                                                                                                          (2.199)
                                                0.05/5       -250/[s(s + 6) (5 + 30)]

The closed-loop system of Figure 2.57 can be reduced to that of Figure 2.55(c), with
the plant transfer matrix, G(s} = G(s), given by Eq. (2.199), and the controller
transfer matrix, G2(s} = H(s), given by

                                                              K      0
                                                 H(5) =                        Kl                         (2.200)
                                                              0      K

For a given value of controller design parameter, K, the resulting closed-loop
transfer matrix, Gc(s) = [l + Gi(s)G2(s)rlGi(s) = [I + G^Hfa)]-1 G(s), can


                      m
                     u^,^1^1                         O/S          -^UU/LS(,& + D^4> + JU^J
                                            G(s) =
                                                     0.05/s -250/[s(s + 6)(s + 30)]
                                  i>2(s)
                    pH                 ^                                                         ^




Figure 2.57      A chemical plant with transfer matrix G(s),                            controlled by two feedback
servo-valves, each of transfer function, K


                            10              I            I            I          I           I


                           10


                            5                                                  |
                                                                                0 |P2
               Imaginary




                            0 -     OO(X)OCOOOOCOOOOOOCX)0€KOCaHDffiDO ($Hm
                                                                           ^— "~                     -


                                                                                OJP3
                           -5


                           -10


                           -15              1            1            1          1           1
                            -1 00          -80       -60            -40        -20           0       2
                                                                    Real

Figure 2.58      Root-locus of the multivariable chemical control system as the controller gain, K,
varies from 1 to 10. The arrows indicate how each of the four poles pi, P2, P3/ and p4 move as K
is increased
114                      LINEAR SYSTEMS AND CLASSICAL CONTROL


   be calculated using MATLAB (CST) with the use of the feedback command. Alter-
   natively, the closed-loop poles of the system are obtained by setting the determinant
   of the return difference matrix at the output to zero, i.e. |I + G(.s)H(s)| = 0, which
   results in the following characteristic equation:

                 |I + G(s)H(s)| = s4 + (36 + 3/Os3 + (180 + 108/O*2
                                    + 29QKs - 14QK2 = 0                             (2.201)

   Figure 2.58 is a plot of the closed-loop poles (i.e. roots of Eq. (2.201)) p, p2, pi,
   and p4 as the controller gain K varies from 1 to 10. It is noted that for all values of
   K, one of the poles (p^) is always in the right-half s-plane, indicating instability.
   Hence, the system is unstable in the range 1 < K < 10. Although for this two-
   loop system we can plot the root-locus by using the determinant |I + G(s)H(.s)|,
   such a procedure quickly becomes unwieldy as the number of inputs and outputs is
   increased.


    Example 2.29 showed how |I + G(s)H(,s)| = 0 (i.e. the return difference matrix at the
output, [I + G(s)H(s)], being singular) can be used to find out whether a multivariable
 system is stable. However, the determinant of a matrix is not a very good measure of how
 close the matrix is to being singular. Thus a Bode or Nyquist plot of |I -I- G(.s)H(s)| in the
frequency domain is not going to give us a very accurate information about the stability
robustness (such as gain and phase margins), and we need another scalar measure which
is a better indicator of how close the return difference matrix is to being singular. One
such measure is the set of singular values of the return difference matrix in the frequency
domain (s = ico), which we will study in Chapter 7.
    Examples 2.28 and 2.29 illustrate the increased difficulty of estimating stability of
a multivariable system using the classical frequency domain methods. While MATLAB
allows that multivariable systems can be represented by their transfer matrices, an eval-
uation of their performance would require calculation of step (or impulse) responses
of individual elements of the transfer matrix - a task which becomes unwieldy as the
number of inputs and outputs are increased. A better mathematical procedure of handling
arbitrary input responses of multivariable systems is to employ the methods of matrix
algebra in a more tractable manner through the introduction of a state-space model of
the system. The chief advantage of the state-space methodology is that time responses
of a multivariable system are obtained directly by solving a set of first-order differential
equations (called state equations) which are used to represent the governing differential
equations. The direct calculation of a system's response to an arbitrary input enables
the design and analysis of multivariable systems in the time (rather than frequency, or
Laplace) domain. The state-space approach treats a single-input, single-output system in
exactly the same way as it does a multivariable system, irrespective of the number of
inputs and outputs involved. The remainder of this book will discuss the application of
the state-space methods in control system analysis and design. However, as we will see in
Chapter 7, analyzing robustness of multivariable systems requires a return to frequency
domain analysis through complex function theory.
EXERCISES                                        115


Exercises
2.1. Consider an inverted pendulum of length L and mass m on a moving cart of mass, M
     (Figure 2.59). It is assumed that the cart moves on a frictionless, flat plane. The force,
     f ( t ) , applied to the cart is the input, while the output is the angular deflection, 9(t), of
     the pendulum from the vertical. The displacement of the cart from a fixed point is given
     by x ( t ) . The governing differential equations of the system are as follows:
               (M + m)x(2t) + mL9(2)(t} cos(0(f)) - mL[6> (1) (0] 2 sin(0(f)) = f ( t )     (2.202)
                                      (2)                            (2)
                                 rojt (0 cos(0(0) + mL0 (0 - mg sin(0(0.) = 0                 (2.203)

     (a) What is the order of the system?
     (b) Eliminate x(t) from Eqs. (2.202) and (2.203) to get a differential equation in terms of
         the output, 0(f), and input, f ( t ) .
     (c) Linearize the system about the equilibrium point, 6(t) = 0.
     (d) Find the transfer function of the linearized system, ®(s)/F(s), where 0(5) = £0(0
         and F(s) = L f ( t ) .
     (e) What are the poles of the linearized system? Is the linearized system stable?

2.2. Certain unforced physical systems obey the following governing differential equation,
     called van der Pol equation:

                                            •a[x(t)2 - l].x(1)(0 + MO = 0                    (2.204)

     where x(t) is the output variable, and a and b are positive constants. Can you linearize
     such a system about an equilibrium point?

 2.3. The governing equations of an electrical network (Figure 2.60(a)) are as follows:
                                                                                             (2.205)
                             vl)(t) = [u2(0 - v l ( t ) ] / ( R 2 C l ) - i,                (2.206)
                             u 2 n (r) = [u,(0 - U2(0]/(/?2C 2 ) - / 2 (0/C 2                (2.207)
                              /2 (0 — —v2(t)/L                                               (2.208)

                                                           0=0




                           Figure 2.59        Inverted pendulum on a moving cart
116                         LINEAR SYSTEMS AND CLASSICAL CONTROL


                   (a)
                                       v (t)
                                        *          ^xxv         "i(f)
                                                    ^
                                3 L
                                                                            1

                         /2(0



                   (b)




                                       Dead-zone

                                            /
                                  -a




      Figure 2.60    (a) Electrical network for Exercise 2.3;    (b) Nonlinear current, i] (f), with a
      dead-zone in the voltage band — a < vi (f) < a


      where i(t) is the current flowing through a nonlinear resistance, R, /2(0 is the current
      flowing through the inductor, L, and v  ( t ) and 1^2(1) are the voltages across the capaci-
      tors, C and C2, respectively. The function f ( v  ( t ) ) is shown in Figure 2.60(b). Such a
      nonlinear function is said to have a dead-zone in the voltage band, — a < v  ( t ) < a.
      (a) Find the equilibrium points of the system, and linearize the system about each of them.
      (b) Derive the transfer function, G(s), between the current, i(t), as the output and the
          current, /2(0. as the input, of the system linearized about each equilibrium point.
      (c) Investigate the stability of the system about each equilibrium point.
      (d) What is the step response of the linearized system when the current MO is in the
          dead-zone?

2.4. Linearize the governing differential equation of a satellite in an orbit around a planet
     (Eq. 2.16) about the equilibrium point denoted by the circular orbit, r(t) = C. What are
     the natural frequency and damping-ratio of the linearized orbital dynamics? Is the orbital
     system stable about the equilibrium point? Find the response of the deviation of the satellite
     from the equilibrium point denoted by the circular orbit, if the input radial acceleration is
     1000 m/s2 applied as a step input at t = 0, i.e. u(t) = QOOus(t). What are the maximum
     overshoot, settling time, and steady-state value of the response? (Assume that the satellite
     is in a circular orbit of radius, C = 3.0 x 108m, around Mars, with an angular momentum,
     h = 3.0 x 1012 m2/s. For Mars, k2 = 4.27 x 1013 m3/s2.)


2.5. Repeat Exercise 2.4 for a satellite in orbit around Jupiter, with C = 4.0 x 109 m, h =
     4.8 x 1013 m2/s, and k2 = 1.27 x 1017 m3/s2.
EXERCISES                                            117




               Figure 2.61    Spring-mass-damper system with input, f(t), and output, x(f)


2.6. Consider the spring-mass-damper system shown in Figure 2.61, with mass, w, spring
     stiffness, k, and damping coefficient, c. The deflection, x(t), of the mass is measured
     from its static equilibrium position (given by x(t) = 0), and is the system's output. A
     force, ,/ (f), applied to the mass is the input. The governing differential equation of the
     system is

                                             c x ((1)( t ) + kx(t) = f ( t )
                                                   )
                                                                                             (2.209)
     (a) Derive an expression for the system's frequency response.
     (b) What are the expressions for the natural frequency, «„, and damping-ratio, g, of the
         system?
     (c) Assuming zero initial conditions, derive the step response and impulse response of
         the system. Plot the step response for g = 0.1 and g = 2.0. Calculate the maximum
         percentage overshoot, peak-time and settling-time in both the values of g.
     (d) If c = 0, is the system stable?

2.7. Calculate the impulse response of the following transfer functions:
     (a) (s + l)/[(j + 0.01)Cs+0.3)]
     (b) (s2 + 3.v + l)/(s 3 + 2s2 + Is + 10)
     (c)

2.8. Plot the step response of the following transfer functions, and calculate the maximum
     overshoot, settling time, and the steady-state output:
     (a) s / ( s + 5)
    (b) (j2 + l)/(j 2 + 3s + 2)
     (c) 10(s3 + 2s2 + 4s + l)/(s4 + s3 + 10s2 + 5s + 10)

2.9. Calculate and plot the response of a system with transfer function, G(s) = 100(s2 +
     2)/(s3 + s2 + 5s + 1) to the input, u(t) = 10e~~l sin(5f), assuming zero initial conditions.
     What is the magnitude of the maximum overshoot? What is the steady-state value of the
     output?
118                       LINEAR SYSTEMS AND CLASSICAL CONTROL


2.10. For the linearized satellite orbital dynamics of Exercise 2.4, plot the deviation from the
      circular orbit if the input is given by u(t) = 5000[sin(0.1r) +cos(0.2/)], assuming zero
      initial conditions. What is the magnitude of the maximum deviation from the circular
      orbit?

2.11. Plot the response of the spring-mass-damper system of Exercise 2.5, if m = 1 kg, k = 10
      N/m, c = 0.1 Ns/m, and f ( t ) = 10e~2' cos(lOf), assuming zero initial conditions.

2.12. The transfer function of a control system is given by

                   Y(s)/U(s) = G(s) = 20(s3 + 4s2 + 5s + 2)/(s5 4- 15s4 + 30s3)           (2.210)
      (a) Investigate the stability of the system.
      (b) Plot the response to a unit ramp function, r(r), for zero initial conditions.
      (c) Draw a Bode plot of the system.

2.13. For a second-order linear system, prove that the step response goes to infinity in the limit
      t —» oo if the system has repeated poles with real part equal to zero.

2.14. Consider the control system shown in Figure 2.32, where the plant's transfer function is
      G(s) = l/[(s + 0.1)(s +0.2)]. It is intended to use a PID compensator for controlling
      this plant.
      (a) What are the values of the PID compensator constants, KP, K, and A"D, for achieving a
          zero steady-state error with a closed-loop pole at s = — 1, and two complex conjugate
          poles with damping ratio, £ = 0.707, and natural frequency, con = 1 rad/s?
      (b) Derive the closed-loop transfer function, Y(s)/YA(s), with the compensator in part (a),
          and compute the closed-loop system step response. What is the maximum percentage
          overshoot, settling time, and steady-state error of the closed-loop step response?
      (c) Plot the locus of the closed-loop poles as K varies from 0 to 10, with KD and Kp
          remaining constant at the values calculated in part (a). What are the values of K for
          which the closed-loop system is stable?
      (d) Draw a Bode plot of the closed-loop system of part (a), and determine the gain and
          phase margins, and the respective crossover frequencies.

2.15. For the control system shown in Figure 2.32, it is desired to track an object moving with
      a constant acceleration in m/s2 given by y<i(0 = 5r2 • us(t), by moving an antenna whose
      transfer function is G(s) = 2Q/[s(s + 100)]. Find a controller transfer function, H(s),
      such that the steady-state tracking error is less than 0.001 m/s2, with a settling time of
      about 0.1 seconds. Plot the closed-loop error response as a function of time. Determine
      the gain and phase margins, and the respective crossover frequencies of the closed-loop
      system. What are the maximum overshoot, settling time, and steady-state error of the
      closed-loop system if the desired output is a unit step function?
EXERCISES                                       119


                                                               2        Y(s)
                                                    G(s) = 1/(s + 9)




                         Figure 2.62    Two loop control system for Exercise 2.16


2.16. (a) Derive the transfer function, Y(s)/Yd(s),      of the closed-loop system shown in
          Figure 2.62.
     (b) What is the type of this system?
      (c) Find the values of K, K2, and AT3 such that the closed-loop transfer function becomes
                               Y(s)/Yd(s) = (s + 10)/(s + 2)(r + % + 5)                  (2.211)
     (d) Determine the step response of the system in part (c).
      (e) Using the convolution integral, determine the response of the system in part (c) to a
          rectangular pulse (Figure 2.13) of magnitude, /0 = 1 and duration, T = 10 s.
      (f) Determine the gain and phase margins, and the respective crossover frequencies of the
          system in part (c).

2.17. For the control system in Exercise 2.16, determine the gain and phase margins if K — 10,
      K2 = 25, and K3 = 150.

2.18. For the control system shown in Figure 2.63:
      (a) Derive the closed-loop transfer function, Y(s)/Yd(s). If this control system is to be
          expressed as a negative feedback connection of two systems, G(s) and H(s), as shown
          in Figure 2.35, identify the plant transfer function, G(s), and the controller transfer
          function, H(s).
     (b) What is the type of this system?
      (c) Is the plant, G(s), stable?




                             Figure 2.63    Control system for Exercise 2.18
120                       LINEAR SYSTEMS AND CLASSICAL CONTROL


      (d) Plot the locus of closed-loop poles if K = 10, a = 2, K2 = 25, #3 = 150, and K{ is
          varied from 1 to 500.
      (e) What is the value of K for which the closed-loop system has a dominant pair of
          complex poles with natural frequency, a>n = 1.83 rad/s and damping-ratio, g = 0.753?
      (f) Plot the step response of the closed-loop system for the value of K desired in part (e).
          What is the resulting maximum percentage overshoot, settling-time and the steady-state
          error?
      (g) Draw the Bode plots of the plant, G(s), the controller, H(s), and the closed-loop
          system, and find the gain and phase margins of the control system with K of part (e).

2.19. For the electrical system of Example 2.8, consider a feedback control system of Figure 2.32
      using a constant controller transfer function H(s) = K.
      (a) Draw a root-locus of the closed-loop poles as K is varied. What is the range of K for
          which the closed-loop system is stable?
      (b) Find the value of K for which the closed-loop system has a damping ratio, £ = 0.707.
          Plot the step response of the closed-loop system, and find the maximum overshoot,
          settling time, and steady-state error.

2.20. Re-design the controller, H(s), in Exercise 2.19 to make the steady-state error zero, and
      the damping ratio, £ = 0.707. Plot the step response of the closed-loop system, and find
      the maximum overshoot and settling time.

2.21. For the closed-loop system shown in Figure 2.32, the plant's transfer function is G(s) =
      150000/(s3 + 110s2 + 1000s). It is desired to use a lag compensator to control this plant.
      (a) Draw a Bode plot of the plant, G(s), and find the gain and phase margins of the plant.
      (b) Draw a Bode plot of the appropriate lag compensator, //(s), for co0 = 1 rad/s and
          a = 10. What is the frequency at which the phase of H(s) is the minimum? What is
          the change in the gain of H(s) between 0 and 10 rad/s?
      (c) Compare the steady-state error, maximum overshoot, and settling time of the plant
          with those of the closed-loop system with the controller parameters of part (b), if the
          desired output is a unit step function.
      (d) Draw a Bode plot of the closed-loop system with the lag compensator of part (b). Find
          the gain and phase margins of the closed-loop system.
      (e) Repeat parts (b)-(d) with o>0 = 1 rad/s and a = 1.1.

2.22. For the closed-loop system shown in Figure 2.32, the plant's transfer function is G(s) =
      1000/(s2 + 2s + 5). It is desired to use a lead compensator to control this plant.
      (a) Draw a Bode plot of the plant, G(s), and find the gain and phase margins of the plant.
      (b) Draw a Bode plot of the lead compensator, //(s), for a>0 = 40 rad/s and a = 0.01.
          What is the frequency at which the phase of H(s) becomes a maximum? What is the
          total change in gain over the entire frequency range?
EXERCISES                                     121


      (c) Compare the steady-state error, maximum overshoot, and settling time of the plant
          with those of the closed-loop system if the desired output is a unit step function.
      (d) Draw a Bode plot of the closed-loop system with the lead compensator of part (b).
          Find the gain and phase margins of the closed-loop system.
      (e) Repeat parts (b)-(d) with coa — 40 rad/s and a = 0.45.


2.23. A plant's transfer function is G(s) = 06/(s2 + 0.99s - 0.01). It is desired to use a lead-
      lag compensator in the control system of Figure 2.32 to control this plant.
      (a) Draw a Bode plot of the plant, G(s), and find the gain and phase margins of the plant.
      (b) Draw a Bode plot of the lead-lag compensator, H ( s ) , for co = 0.1 rad/s, o>2 = 1000
          rad/s and a = 5. What are the frequencies corresponding to minimum and maximum
          phase of H(s)l
      (c) Compare the steady-state error, maximum overshoot, and settling time of the plant
          with those of the closed-loop system if the desired output is a unit step function.
      (d) Draw a Bode plot of the closed-loop system with the lead-lag compensator of part (b).
          Find the gain and phase margins of the closed-loop system.
      (e) Keeping the values of a> and a>2 the same as in part (b), what is the value of a for
          which the maximum overshoot of the closed-loop step response is 30 percent? What is
          the corresponding settling time? Calculate the new closed-loop gain and phase margins
          for this value of a.


2.24. Suppose the closed-loop system shown in Figure 2.32 has plant's transfer function, G(s) =
      (s + l)/(s 2 + 2s — 3) and controller's transfer function, H ( s ) = K/s. Such a controller is
      called an integral compensator, since it is obtained from the PID compensator by setting
      Ki = K, and KP = KD = 0.
      (a) Is the plant alone stable?
      (b) Derive the closed-loop transfer function, Y ( s ) / Y d ( s ) .
      (c) From a root-locus determine the range of variation of K for which the closed-loop
          system stable.
      (d) Derive the step response of the closed-loop system for K = 50. What is the maximum
          percentage overshoot, peak-time, settling-time and the steady-state error of the system?
      (e) What is the steady-state error of the closed-loop system with K = 50 if y c j(r) = t •
          «,(*)?
      (f) Determine the gain and phase margins, and the respective crossover frequencies of the
          system for K = 50.
      (g) Repeat (d)-(f) for K = 15.


2.25. For the aircraft in Example 2.10, it is desired to increase the damping in phugoid mode
      by using a lead compensator, with the plant's transfer function is G(s) = v(s)/S(s).
122_                       LINEAR SYSTEMS AND CLASSICAL CONTROL                              _


      (a) Find the gain and phase margins for the plant, G(s) = v(s)/8(s).
      (b) Find the values of the lead compensator parameters, a>0 and a, such that the closed-
          loop system has a gain margin greater than 10 dB and a phase margin greater than
          130°.

      (c) Compare the settling time and maximum overshoot of the plant with those of the
          closed-loop system with the lead compensator designed in part (b), if the desired
          output is a unit step function, us(t).


2.26. For the aircraft in Example 2.10, it is desired to reduce the steady-state error in the
      angle of attack, a(s), (which is largely influenced by the short-period mode) by using a
      lag compensator as a controller in the closed-loop configuration of Figure 2.32, where the
      plant's transfer function is G(s) = a(s)/8(s). From Figure 2.27, it is clear that the phugoid
      mode does not appreciably affect, a(s)/8(s), implying that the denominator quadratic
      corresponding to the phugoid mode, (s2 + 0.0055 + 0.006), gets approximately canceled
      by the numerator quadratic (s2 + 0.00655 -I- 0.006) in the expression for a(s)/8(s) given
      by Eq. (2.87). Thus, we can write the approximate plant transfer function, a(s)/8(s), as
      follows:

                              a ( s ) / 8 ( s ) % -0.02(5 + 80)/(52 + 5 + 1 .4)           (2.212)
      (a) Compare the Bode plot of the approximate a(5)/<5(5) given by Eq. (2.212) with that
          shown in Figure 2.27 for the exact a(5)/<5(5).
      (b) Compare the gain and phase margins for the approximate and exact plant transfer
          function, G(5) = a(s)/8(s).
      (c) Find the values of the appropriate lag compensator parameters, <a0 and a, such that the
          closed-loop system has a gain margin greater than 1 1 dB and a phase margin greater
          than 130°.
      (d) Compare the settling time and maximum overshoot of the plant with those of the
          closed-loop system with the lag compensator designed in part (b), if the desired output
          is a unit step function, us(t).


2.27. In an aircraft, the actuator of a control surface - such as the elevator in
      Example 2.10 - takes some (non-zero) time to achieve the desired control-surface
      deflection angle, 8(t). The simplest model for such an actuator is given by a first-order
      transfer function, 8(s)/8d(s) = l/(Ts + 1), where T is a time-constant, and 8d(s) is the
      desired deflection angle.
      (a) If T = 0.02 second, find the step response of <5(5)/<5d(5) = /(Ts + 1) (i.e. 8(t) when
          <5d(0 = us(t)). What is the settling time and the steady-state error?
     (b) Make a Bode plot of the actuator transfer function for T = 0.02 second. What are the
         DC gain, and gain and phase margins of the actuator?
     (c) For the actuator of parts (a) and (b), plot the actual control-surface deflection,
         when the desired deflection, <5 d (f), is a rectangular pulse of width 0.5 second and
         height 0.05 radian, applied at t = 0. (Such a pulse elevator input is normally applied
         by the pilot to excite the phugoid mode.)
EXERCISES                                               123


      (d) To account for the presence of the actuator, the longitudinal transfer functions of
          Example 2.10, are multiplied by the elevator actuator transfer function, 8(s)/8d(s) =
           /(Ts + 1), resulting in the transfer functions, v ( s ) / 8 d ( s ) , a(s)/8d(s), and 0(s)/8d(s).
          If T = 0.02 second, compare the Bode plots of v(s)/8d(s), a(s)/8d(s), and 9(x)/8d(s),
          with those of v(s)/8(s), a ( s ) / 8 ( s ) , and 0(s)/8(s) (shown in Figures 2.26-2.28),
          respectively. Is there any difference in the corresponding gain and phase margins?

      (e) Plot the step response of 0(s)/8d(s), and compare it with that of Q(s)/8(s) shown in
          Figure 2.29. Is there a difference in the two step responses?

      (f) Repeat the design of a lead compensator for controlling the phugoid mode carried
          out in Exercise 2.25 with a plant transfer function, G(s) = v(s)/8d(s), instead of
          G(s) = v(s)/8(s).


2.28. For controlling the deviation of a satellite from a circular orbit (Exercise 2.4), it is desired
      to use a derivative compensator, H(s) = Ks, in the feedback arrangement of Figure 2.35,
      such that the plant's transfer function is G(s), and the feedback controller transfer function
      is H ( s ) . It is required that the closed-loop response to a step input of magnitude 1000 m/s2
      (i.e. u(t) = 1000M.S(0) should have a maximum overshoot of 2 m and a settling time
      less than 13 seconds. Find the value of A" which achieves this, and plot the closed-
      loop step response. What are the maximum overshoot and the settling time? Plot the
      output, z ( t ) , of the compensator, H(s). What is the maximum magnitude of the controller
      output, z(t)l Draw the Bode plots of the plant, the compensator, and the closed-loop
      system, and compare the gain and phase margins of the plant with those of the closed-loop
      system.


2.29. Find the poles and zeros, and analyze the stability of multivariable systems with the
      following transfer matrices:

      (a) G(s) = [(s + l ) / ( s + 3)s/(s 2 - 7* + 1)]

                        l/(s + l) 0


                      (s + 4)/Cv 2 + 35 + 2) s/(s + 2)
      (c) G(s) =
                      l/s                         1/0?+4)

2.30. Consider a multivariable system of Figure 2.32, with plant transfer matrix, G(s). and
      controller transfer matrix, H (.$•), given by


                                                                                                    (2.213)

      (a) Derive the characteristic equation of the system.

      (b) Plot the root-locus as K varies from 0.01 to 10. For what range of variation of K is
          the system stable?
124                       LINEAR SYSTEMS AND CLASSICAL CONTROL



References
1. Zarchan, P. Tactical and Strategic Missile Guidance, 2nd Edition, Vol. 157. Progress in Aero-
   nautics and Astronautics, American Institute of Aeronautics and Astronautics, Washington, DC,
   1994.
2. D'Azzo, J.J. and Houpis, C. Feedback Control System Analysis and Synthesis, 2nd Edition.
   McGraw-Hill, 1966.
3. Blakelock, J.H. Automatic Control of Aircraft and Missiles, 2nd Edition. Wiley, 1991.
4. Gantmacher, F.R. Theory of Matrices, Vol. 1. Chelsea, New York, 1959.
5. Kreyszig, E. Advanced Engineering Mathematics. Wiley, New York, 1972.
3
State-Space Representation

3.1 The State-Space: Why Do I Need It?
In Chapter 1, we defined the state of a system as any set of quantities which must be
specified at a given time in order to completely determine the behavior of the system.
The quantities constituting the state are called the state variables, and the hypothetical
space spanned by the state variables is called the state-space. In a manner of speaking,
we put the cart before the horse - we went ahead and defined the state before really
understanding what it was. In the good old car-driver example, we said that the state
variables could be the car's speed and the positions of all other vehicles on the road.
We also said that the state variables are not unique; we might as well have taken the
velocities of all other vehicles relative to the car, and the position of the car with respect
to the road divider to be the state variables of the car-driver system. Let us try to under-
stand what the state of a system really means by considering the example of a simple
pendulum.

  Example 3.1
   Recall from Example 2.2 that the governing differential equation for the motion
   of a simple pendulum on which no external input is applied (Figure 2.3) is given
   by Eq. (2.8). If we apply a torque, M(r), about the hinge, O, as an input to the
   pendulum, the governing differential equation can be written as

                           L0(2)(t) + gsin(6>(?)) - M(r)/(mL)                        (3.1)

  where # (2) (0 represents the second order time derivative of 0(t), as per our notation
  (i.e. d20(t)/dt2 = 0 (2) (0)- Let the output of the system be the angle, 0(f), of the
  pendulum. We would like to determine the state of this system. To begin, we must
  know how many quantities (i.e. state variables) need to be specified to completely
  determine the motion of the pendulum. Going back to Chapter 2, we know that
  for a system of order n, we have to specify precisely n initial conditions to solve
  the governing differential equation. Hence, it must follow that the state of an nth
  order system should consist of precisely n state variables, which must be specified
  at some time (e.g. t = 0) as initial conditions in order to completely determine the
  solution to the governing differential equation. Here we are dealing with a second
  order system - which implies that the state must consist of two state variables. Let
126                           STATE-SPACE REPRESENTATION




                                     The State-Space for
                                     a simple pendulum




      Figure 3.1 The two-dimensional state-space for a simple pendulum (Example 3.1 )


 us call these state variables x(t) and X2(t), and arbitrarily choose them to be the
 following:

                                    *, (0=0(0                                       (3-2)
                                                                                    (3.3)

 The state-space is thus two-dimensional for the simple pendulum whose axes are
 *i(0 and jc2(0 (Figure 3.1).
     It is now required that we express the governing differential equation (Eq. (3.1))
 in terms of the state variables defined by Eqs. (3.2) and (3.3). Substituting Eqs. (3.2)
 and (3.3) into Eq. (3.1), we get the following first order differential equation:

                      x(2l)(t) = M(t)/(mL2) - (s/L)sin(jt,(0)                     (3.4)

     Have we transformed a second order differential equation (Eq. (3.1)) into a
 first order differential equation (Eq. (3.4)) by using the state-variables? Not really,
 because there is a another first order differential equation that we have forgotten
 about - the one obtained by substituting Eq. (3.2) into Eq. (3.3), and written as

                                    *j !) (0=*2(0                                   <3-5>

 Equations (3.4) and (3.5) are two first order differential equations, called the state
 equations, into which the governing equation (Eq. (3.1)) has been transformed. The
 order of the system, which is its important characteristic, remains unchanged when
 we express it in terms of the state variables. In addition to the state equations
 (Eqs. (3.4) and (3.5)), we need an output equation which defines the relationship
 between the output, 0(0, and the state variables x(t) and x2(t). Equation (3.2)
 simply gives the output equation as
                                     0(0=*i(0                                       (3-6)

 The state equations, Eqs. (3.4) and (3.5), along with the output equation, Eq. (3.6),
 are called the state-space representation of the system.
THE STATE-SPACE: WHY DO I NEED IT?                                127


      Instead of choosing the state variables as 9(t) and 6> { l ) (f), we could have selected
   a different set of state variables, such as
                                                                                        (3.7)
   and
                                        x2(t) = L2e(l}(t)                             (3.8)
   which would result in the following state equations:
                                                                                        (3.9)

                            x2lt) = M(t)/m-gLsin(xi(t)/L)                             (3.10)
   and the output equation would be given by
                                          0(t)=X](t)/L                                 (3.11)


    Although the state-space representation given by Eqs. (3.9)-(3.11) is different from
that given by Eqs. (3.4)-(3.6), both descriptions are for the same system. Hence, we
expect that the solution of either set of equations would yield the same essential character-
istics of the system, such as performance, stability, and robustness. Hence, the state-space
representation of a system is not unique, and all legitimate state-space representations
should give the same system characteristics. What do we mean by a legitimate state-
space representation? While we have freedom to choose our state variables, we have to
ensure that we have chosen the minimum number of state variables that are required
to describe the system. In other words, we should not have too many or too few state
variables. One way of ensuring this is by taking precisely n state variables, where n is
the order of the system. If we are deriving state-space representation from the system's
governing differential equation (such as in Example 3.1), the number of state-variables is
easily determined by the order of the differential equation. However, if we are deriving
the state-space representation from a transfer function (or transfer matrix), some poles
may be canceled by the zeros, thereby yielding an erroneous order of the system which
is less than the correct order.

  Example 3.2
   Consider a system with input, u(t), and output, y ( t ) , described by the following
   differential equation:

                   y(2t) + (b- a ) y ( l ) ( t ) - ab y(t) = u ( l ) ( t ) - au(t)    (3.12)

   where a and b are positive constants. The transfer function, Y(s)/U(s), of this
   system can be obtained by taking the Laplace transform of Eq. (3.12) with zero
   initial conditions, and written as follows:
      Y(s)/U(s) = (s- a)/[s2 + (b- a)s - ab] = (s - a)/[(s - a)(s + b)]                (3.13)
128                             STATE-SPACE REPRESENTATION


   In Eq. (3.13), if we cannot resist the temptation to cancel the pole at s = a with the
   zero at s = a, we will be left with the following transfer function:

                                   Y(s)/U(s) = l/(s+b)                                 (3.14)

   which yields the following incorrect differential equation for the system:

                                    y ( l ) ( t ) + by(t) = u(t)                       (3.15)

   Since the pole cancelled at s = a has a positive real part, the actual system given
   by the transfer function of Eq. (3.13) is unstable, while that given by Eq. (3.14) is
   stable. Needless to say, basing a state-space representation on the transfer func-
   tion given by Eq. (3.14) will be incorrect. This example illustrates one of the
   hazards associated with the transfer function description of a system, which can be
   avoided if we directly obtain state-space representation from the governing differ-
   ential equation.


   Another cause of illegitimacy in a state-space representation is when two (or more)
state variables are linearly dependent. For example, if x(t) = 0(t) is a state variable,
then X2(t) = L9(t} cannot be another state variable in the same state-space representation,
because that would make x(t) and x2(t) linearly dependent. You can demonstrate that with
such a choice of state variables in Example 3.1, the state equations will not be two first
order differential equations. In general, for a system of order n, if x (t), x2(t),..., xn- (/)
are state variables, then xn(t) is not a legitimate state variable if it can be expressed as a
linear combination of the other state variables given by

                       xn(t) = ci*i (0 + c2x2(t) + ••• + cH-}xn-i(t)                      (3.16)

where c,c2,..., c n _i are constants. Thus, while we have an unlimited choice in selecting
state variables for a given system, we should ensure that their number is equal to the
order of the system, and also that each state variable is linearly independent of the other
state variables in a state-space representation.
   In Chapter 2, we saw how single-input, single-output, linear systems can be designed
and analyzed using the classical methods of frequency response and transfer function.
The transfer function - or frequency response - representations of linear systems were
indispensable before the wide availability of fast digital computers, necessitating the use
of tables (such as the Routh table [1]) and graphical methods, such as Bode, Nyquist,
root-locus, and Nichols plots for the analysis and design of control systems. As we saw
in Chapter 2, the classical methods require a lot of complex variable analysis, such as
interpretation of gain and phase plots and complex mapping, which becomes complicated
for multivariable systems. Obtaining information about a multivariable system's time-
response to an arbitrary input using classical methods is a difficult and indirect process,
requiring inverse Laplace transformation. Clearly, design and analysis of modern control
systems which are usually multivariable (such as Example 2.10) will be very difficult
using the classical methods of Chapter 2.
THE STATE-SPACE: WHY DO I NEED IT?                                   129


   In contrast to classical methods, the state-space methods work directly with the govern-
ing differential equations of the system in the time-domain. Representing the governing
differential equations by first order state equations makes it possible to directly solve the
state equations in time, using standard numerical methods and efficient algorithms on
today's fast digital computers. Since the state equations are always of first order irrespec-
tive of the system's order or the number of inputs and outputs, the greatest advantage
of state-space methods is that they do not formally distinguish between single-input,
single-output systems and multivariable systems, allowing efficient design and analysis
of multivariable systems with the same ease as for single variable systems. Furthermore,
using state-space methods it is possible to directly design and analyze nonlinear systems
(such as Example 3.1), which is utterly impossible using classical methods. When dealing
with linear systems, state-space methods result in repetitive linear algebraic manipula-
tions (such as matrix multiplication, inversion, solution of a linear matrix equation, etc.),
which are easily programmed on a digital computer. This saves a lot of drudgery that is
common when working with inverse Laplace transforms of transfer matrices. With the
use of a high-level programming language, such as MATLAB, the linear algebraic manip-
ulations for state-space methods are a breeze. Let us find a state-space representation for
a multivariable nonlinear system.

  Example 3.3
  Consider an inverted pendulum on a moving cart (see Exercise 2.1), for which the
  governing differential equations are the following:
      (M + m)x(2)(t)+mLe{2)(t)cos(6(t))-mL[e(l}(t)]2sm(e(t))                      - f(t)      (3.17)
                         m* (2) (0cos(0(0) +mLO(2)(t} - mgsm(0(t)) =0                         (3.18)
  where m and L are the mass and length, respectively, of the inverted pendulum,
  M is the mass of the cart, 9(t) is the angular position of the pendulum from the
  vertical, x ( t ) is the horizontal displacement of the cart, /(/) is the applied force on
  the cart in the same direction as x(t) (see Figure 2.59), and g is the acceleration
  due to gravity. Assuming f ( t ) to be the input to the system, and x(t} and 0(0 to
  be the two outputs, let us derive a state-space representation of the system.
        The system is described by two second order differential equations; hence, the
  order of the system is four. Thus, we need precisely four linearly independent
  state-variables to describe the system. When dealing with a physical system, it is
  often desirable to select physical quantities as state variables. Let us take the state
  variables to be the angular position of the pendulum, 0(0, the cart displacement,
  x ( t ) , the angular velocity of the pendulum, 0 ( l ) (0> and the cart's velocity, x ( l ) ( t ) .
  We can arbitrarily number the state variables as follows:
                                          jc, ( 0 = 0 ( 0                                     (3.19)
                                                                                              (3.20)
                                                                                              (3.21)
                                                                                              (3.22)
130                          STATE-SPACE REPRESENTATION


 From Eqs. (3.19) and (3.21), we get our first state-equation as follows:
                                    JC, ( I ) (0=JC 3 (0                             (3.23)
 while the second state-equation follows from Eqs. (3.20) and (3.22) as
                                                                                     (3.24)
 The two remaining state-equations are derived by substituting Eqs. (3.19)-(3.22)
 into Eq. (3.17) and Eq. (3.18), respectively, yielding

           jcnO = *sin(jc,(0)/L-jc;                                                 (3.25)


                     - [mL/(M + m)]x(3l)(t) cos(jc,(0) + f ( t ) / ( M + m)         (3.26)
 The two output equations are given by
                                                                                    (3.27)
                                     x(t) = x2(t)                                   (3.28)
 Note that due to the nonlinear nature of the system, we cannot express the last two
 state-equations (Eqs. (3.25), (3.26)) in a form such that each equation contains the
 time derivative of only one state variable. Such a form is called an explicit form
 of the state-equations. If the motion of the pendulum is small about the equilib-
 rium point, 0 = 0, we can linearize Eqs. (3.25) and (3.26) by assuming cos(0(0) =
 cos(*i(0) - 1, sin(0(0) = sin(jt,(0) = *i(0, and [0(1>(012sin«9(0) = [x^(t)f
 sin(;ci(0) = 0. The corresponding linearized state equations can then be written in
 explicit form as follows:

                      (0 =                                 - /(0/(ML)               (3.29)
                          = -(mg/M)xi(t)        + f(t)/M                            (3.30)
 The linearized state-equations of the system, Eqs. (3.23), (3.24), (3.29), and (3.30),
 can be expressed in the following matrix form, where all coefficients are collected
 together by suitable coefficient matrices :

                        0                0   1    0
                        0                0   0    1
                                                                                    /(O
                   (M+m)g/(ML)           0   0    0
                      -mg/M              0   0    0        JC4(/)             1/M
       '(Oj
                                                                                    (3.31)
 with the output matrix equation given by


                  [0(0]      fl   0 0 0 ]
                  L ^ ( o J ~ L ° i ° °J
                                                              -I-
                                                                    [S] /(O         (3.32)
THE STATE-SPACE: WHY DO I NEED IT?                                131




I   Note that the state-space representation of the linearized system consists of linear I
    state-equations, Eq. (3.31), and a linear output equation, Eq. (3.32).               (

   Taking a cue from Example 3.3, we can write the state-equations of a general linear
system of order n, with m inputs and p outputs, in the following matrix form:

                                                                                              (3.33)

and the general output equation is

                                      y(0 - Cx(0 + Du(0                                       (3.34)

where x(0 = [x(t); *2(0; . . . ; xn(t)]T is the state vector consisting of n state variables
as its elements, x (1) (0 = [jcj'V); x2lt); • • • '•> x(nl)(t)]T is the time derivative of the state
vector, u(0 = [«i(0; "2(0; • • • ; «/-(OJ r is the input vector consisting of r inputs as its
elements, y(0 = lji(0; ^2(0; • • •; yp(t)]T is the output vector consisting of p outputs as
its elements, and A, B, C, D are the coefficient matrices. Note that the row dimension
(i.e. the number of rows) of the state vector is equal to the order of the system, n, while
those of the input and output vectors are r and p, respectively. Correspondingly, for the
matrix multiplications in Eqs. (3.33) and (3.34) to be defined, the sizes of the coefficient
matrices, A, B, C, D, should be (n x n), (n x r), (p x «), and (p x r), respectively.
The coefficient matrices in Example 3.3 were all constant, i.e. they were not varying
with time. Such a state-space representation in which all the coefficient matrices are
constants is said to be time-invariant. In general, there are linear systems with coefficient
matrices that are functions of time. Such state-space representations are said to be linear,
but time-varying. Let us take another example of a linear, time-invariant state-space
representation, which is a little more difficult to derive than the state-space representation
of Example 3.3.

    Example 3.4
    Re-consider the electrical network presented in Example 2.8 whose governing differ-
    ential equations are as follows:

           Rii(t) + R3[i}(t) - 12 (01 = e(t)                                             (3.35)
             •(2)      r,                                         .(1)




               = [R3/(R[+R3)]e(l)(t)                                                       (3.36)

    If the input is the applied voltage, e(t), and the output, y(t), is the current in the
    resistor R3 (given by i(t) — *2(0) when the switch S is closed (see Figure 2.19),
    we have to find a state-space representation of the system. Looking at Eq. (3.36),
    we find that the time derivative of the input appears on the right-hand side. For a
    linear, time-invariant state-space form of Eqs. (3.33) and (3.34), the state variables
    must be selected in such a way that the time derivative of the input, e(lt), vanishes
    from the state and output equations. One possible choice of state variables which
132_                          STATE-SPACE REPRESENTATION                      _


   accomplishes this is the following:

                         *i (0 = i2(0                                             (3.37)
                                    !)
                         x2(t) = i< (0 - R3e(t)/[L(Ri + *3)1                      (3.38)

   Then the first state-equation is obtained by substituting Eq. (3.37) into Eq. (3.38),
   and expressed as

                         *i(1)(0 = *2(0 + *3«(0/[L(Ki + *3)1                      (3.39)

   Substitution of Eqs. (3.37) and (3.38) into Eq. (3.36) yields the second state-equat-
   ion, given by



                                         R3e(t)/L(Ri + *3)] -*i(0/O.C)           (3.40)

   The output equation is given by using Eq. (3.35) as follows:

               yi(0 = «i(0 ~ '2(0 = [«(0 + *3*i(0]/(*i + K3) - *i(0
                    = -*,jr,(0/(Ki + R3) + *(0/(*i + /?3)                         (3.41)

   In the matrix notation, Eqs. (3.39)-(3.41) are expressed as


                                                   4- R2R3)/[L(Ri + K3)l J [ *2(0 J

                                                                       (f)       (342)
                                                                       V
                                                                           '     ^    ^


                                         0]        + !/(/?, + /?3MD              (3.43)

   Comparing Eqs. (3.42) and (3.43) with Eqs. (3.33) and (3.34), we can find the
   constant coefficient matrices, A, B, C, D, of the system, with the input vector,
   u(0 = e(t), and the output vector, y(f) = y(t).


   If we compare Examples 3.3 and 3.4, it is harder to select the state variables in
Example 3.4 due to the presence of the time derivative of the input in the governing
differential equation. A general linear (or nonlinear) system may have several higher-order
time derivatives of the input in its governing differential equations (such as Eq. (2.4)).
To simplify the selection of state variables in such cases, it is often useful to first draw
a schematic diagram of the governing differential equations. The schematic diagram is
drawn using elements similar to those used in the block diagram of a system. These
elements are the summing-junction (which adds two or more signals with appropriate
THE STATE-SPACE: WHY DO I NEED IT?                           133


                                x(f) —J     r    U^ !x(t)dt




                                    Gain element




                                       X 2 (f)

                                   Summing junction

                   Figure 3.2    The state-space schematic diagram elements


signs), and the two transfer elements, namely the gain element (which multiplies a signal
by a constant), and the integrator (which integrates a signal). The arrows are used to
indicate the direction in which the signals are flowing into these elements. Figure 3.2
shows what the schematic diagram elements look like.
   Let us use the schematic diagram approach to find another state-space representation
for the system in Example 3.4.


  Example 3.5
  The system of Example 3.4 has two governing equations, Eqs. (3.35) and (3.36).
  While Eq. (3.35) is an algebraic equation (i.e. a zero order differential equation),
  Eq. (3.36) is a second order differential equation. Let us express Eq. (3.36) in terms
  of a dummy variable (so called because it is neither a state variable, an input, nor
  output) z ( t ) , such that

    z (2) (0 + [(RiR3 + R}R2 + R2Ri)/[L(R} + * 3 )k (1) (0 + /(LC}z(t) = e(t)
                                                                           (3.44)
  where

                            i2(f) = * 3 /[£(*i+*3)]z (l) (0                         (3.45)

  We have split Eq. (3.36) into Eqs. (3.44) and (3.45) because we want to elimi-
  nate the time derivative of the input, e(lt), from the state-equations. You may
  verify that substituting Eq. (3.45) into Eq. (3.44) yields the original differential
  equation, Eq. (3.36). The schematic diagram of Eqs. (3.44) and (3.45) is drawn in
  Figure 3.3. Furthermore, Figure 3.3 uses Eq. (3.35) to represent the output, y  ( t ) =
  i(t) — /2(0- Note the similarity between a block diagram, such as Figure 2.1, and
  a schematic diagram. Both have the inputs coming in from the left, and the outputs
  going out at the right. The difference between a block diagram and a schematic
  diagram is that, while the former usually represents the input-output relationship as
  a transfer function (or transfer matrix) in the Laplace domain, the latter represents
134                            STATE-SPACE REPRESENTATION




                                             ;     1 i           i-l
                                             1+^3)]—>Jfil/(fil+^3)—W>>-
                                                  •  *       — --I x_y    y(0

                  e(0




             Figure 3.3   Schematic diagram for the electrical system of Example 3.4


 the same relationship as a set of differential equations in time. Note that the number
 of integrators in a schematic diagram is equal to the order of the system.
     A state-space representation of the system can be obtained from Figure 3.3 by
 choosing the outputs of the integrators as state variables, as shown in Figure 3.3.
 Then using the fact that the output from the second integrator from the left,
 is the time integral of its input, x2(t), the first state-equation is given by

                                                                                       (3.46)

  The second state-equation is obtained seeing what is happening at the first summing
 junction from the left. The output of that summing junction is the input to the
 first integrator from left, x2lt), and the two signals being added at the summing
 junction are e(t) and -*i(f)/(LC) - [(^3 + /?i/?2 + R2R3)/[L(R + /?3)]*2(0.
  Therefore, the second state-equation is given by

                                                                             e(t)
                                                                               (3.47)
 The output equation is obtained by expressing the output, y(t) = i(t) — i 2 (t),
 in terms of the state variables. Before relating the output to the state variables,
 we should express each state variable in terms of the physical quantities, i(t),
 i 2 (0, and e(t). We see from Figure 3.3 that x2(t) = z(1)(0; thus, from Eq. (3.45),
 it follows that
                                                                                       (3.48)

 Then, substitution of Eq. (3.48) into Eq. (3.47) yields

      jti(r) = LC[e(t) - h
                                                                              (3.49)
 Using the algebraic relationship among /i(r), i2(t) and e(t) by Eq. (3.35), we can
 write the output equation as follows:
T H E STATE-SPACE: W H Y D O I NEED I          T        ?   1     3   5


              y}(t) = -R1R3/L(R] + R3)"]x2(t) + e(t)/(R + /?3)                      (3.50)

   In matrix form, the state-space representation is given by

                        0                              1




                                                                                      (3.52)

Note the difference in the    state-space representations of the same system given
by Eqs. (3.42), (3.43) and    by Eqs. (3.51), (3.52). Also, note that another state-
space representation could    have been obtained by numbering the state variables
in Figure 3.3 starting from   the left rather than from the right, which we did in
Example 3.5.

Example 3.6
Let us find a state-space representation using the schematic diagram for the system
with input, u(t), and output, y(t), described by the following differential equation:
            y("t) + an-iy(n-])(t) + • • • + ai>' (1) (0 + aQy(t)
                = bnu(n)(t)+bn^u(n~l}(t) + • • •+blu{l)(t)+b0u(t)                     (3.53)

Since the right-hand side of Eq. (3.53) contains time derivatives of the input, we
should introduce a dummy variable, z(t), in a manner similar to Example 3.5,
such that

             z(n)(t) + an-iz(n~l)(t) + • • • + fliz(1)(0 + a0z(t) = u(t)              (3.54)

and

            bnz(n)(t) + bn-iz(n-"(t) + ••• + b l Z ( ] ) ( t ) + b0z(t) = y(t)        (3.55)

Figure 3.4 shows the schematic diagram of Eqs. (3.54) and (3.55). Note that
Figure 3.4 has n integrators arranged in a series.
   As in Example 3.5, let us choose the state variables to be the integrator outputs,
and number them beginning from the right of Figure 3.4. Then the state-equations
are as follows:

                                    xlt)=x2(t)                                     (3.56a)

                                    x(7])(t)=x3(t)                                   (3.56b)
136                             STATE-SPACE REPRESENTATION


                                                                                 y(0


                                                 W-2          "1

                                                                         X,(t)




                                                       --O
 Figure 3.4     Schematic diagram for the controller companion form of the system in Example 3.6



                                                                                          (3.56c)

                     = -[a n _ijc w (r)+a n _2                                            (3.56d)

 The output equation is obtained by substituting the definitions of the state variables,
 namely, jci(r) = z(r), x2(t) = z(1)(0, ...,*„(*)= z(n~l)(t) into Eq. (3.55), thereby
 yielding

                                 + bix2(t) + •••+ bn-ixn(t) + bHx™ (t)                     (3.57)

 and substituting Eq. (3.56d) into Eq. (3.57), the output equation is expressed as
 follows:
                                                      ?„_! - an-bn)xn(t) + bnu(t)
                                                                             (3.58)
 The matrix form of the state-equations is the following:

                         0      1       0     ...        0
                         0     0        1     ...        0

                         0      0       0     ...        1         xa-i(t)
                        -GO    —a    —02     •••      —&n-         xa(t)
                                                                                           (3.59)
 and the output equation in matrix form is as follows:



      y(0 = [(bo - a^bn) (b - abn)... (bn- - an-bn}]                         bnu(t)    (3.60)

                                                                   _*«(')_
_                        THE STATE-SPACE: WHY DO I NEED IT?_                                   137


    Comparing Eqs. (3.59) and (3.60) with the matrix equations Eqs. (3.33)
and (3.34), respectively, we can easily find the coefficient matrices, A, B, C, D, of
the state-space representation. Note that the matrix A of Eq. (3.59) has a particular
structure: all elements except the last row and the superdiagonal (i.e. the diagonal
above the main diagonal) are zeros. The superdiagonal elements are all ones, while
the last row consists of the coefficients with a negative sign, — UQ, —a, . . . , —an-.
Taking the Laplace transform of Eq. (3.53), you can verify that the coefficients
a®, ai, . . . ,an-i are the coefficients of the characteristic polynomial of the system
(i.e. the denominator polynomial of the transfer function, Y(s)/U(s)) given by
sn + an~sn~l + • • • + as + ao. The matrix B of Eq. (3.59) has all elements zeros,
except the last row (which equals 1). Such a state-space representation has a name:
the controller companion form. It is thus called because it has a special place in the
design of controllers, which we will see in Chapter 5.
    Another companion form, called the observer companion form, is obtained as
follows for the system obeying Eq. (3.53). In Eq. (3.53) the terms involving deriva-
tives of y(t} and u(t) of the same order are collected, and the equation is written
as follows:


                                                          ) - bQu(t)] = 0         (3.61)

On taking the Laplace transform of Eq. (3.61) subject to zero initial conditions, we
get the following:

             sn[Y(s) - bnU(s)] + sn~[an
                + • • - + s [ a i Y ( s ) - biU(s)] + [aoY(s) - b0U(s)] = 0           (3.62)

Dividing Eq. (3.61) by sn leads to

  Y(s) = bnU(s) + [bn^U(s) - an^Y(s}]/s + • • • + [b{U(s] -              a}Y(S)]/Sn
                                                                                  (3.63)

We can draw a schematic diagram for Eq. (3.63), using the fact that the multi-
plication factor 1/5 in the Laplace domain represents an integration in time.
Therefore, according to Eq. (3.63), [bn_iU(s) - an-Y(s)] must pass through one
integrator before contributing to the output, Y(s). Similarly, [biU(s) — aY(s)]
must pass through (n — 1) integrators, and [boU(s) — aoY(s)] through n inte-
grators in the schematic diagram. Figure 3.5 shows the schematic diagram of
Eq. (3.63).
   On comparing Figures 3.4 and 3.5, we see that both the figures have a series of
n integrators, but the feedback paths from the output, y(t), to the integrators are
in opposite directions in the two figures. If we select the outputs of the integrators
as state variables beginning from the left of Figure 3.5, we get the following state-
equations:
138                            STATE-SPACE REPRESENTATION




 Figure 3.5   Schematic diagram for the observer companion form of the system in Example 3.6



                        = -aoxn(t) + (b0 - a0bn)u(t)
                 (l)
                x 2 ( t ) = x,(0 - aixn(t)         - a}bn)u(t)

                                                                                     (3.64)

               ^_i(0 = xn-2(t) - an-2xn(t) + (bn-2 - an-2bn
                x(nl)(t) = -an.ixn(t) + (bn-i - an-ibn)

 and the output equation is

                                 y(t) = xn(t) + bnii(t)                              (3.65)

 Therefore, the state coefficient matrices, A, B, C, and D, of the observer companion
 form are written as follows:
                  0 0 ...        0     -oo
                  1 0 ...        0      -a,                  (b -a[bn)
                  0 1 ...        0     -o2                   (b2 - a2bn)
                                                   B =


                  0 0 ...       1 -fl n _ 2                  ,_ 2 -an-2bn)
                 ^0 0 ...       0 -o n _iJ
           C = [0      0 ...    0    1];   1                                         (3.66)

 Note that the A matrix of the observer companion form is the transpose of the
 A matrix of the controller companion form. Also, the B matrix of the observer
THE STATE-SPACE: WHY DO I NEED IT?                            139


  companion form is the transpose of the C matrix of the controller companion form,
  and vice versa. The D matrices of the both the companion forms are the same. Now
  we know why these state-space representations are called companion forms: they
  can be obtained from one another merely by taking the transpose of the coefficient
  matrices. The procedure used in this example for obtaining the companion forms of
  a single-input, single-output system can be extended to multi-variable systems.

   Thus far, we have only considered examples having single inputs. Let us take up an
example with multi-inputs.

  Example 3.7
  Consider the electrical network for an amplifier-motor shown in Figure 3.6. It is
  desired to change the angle, 0(0, and angular velocity, 0 (1) (0, of a load attached
  to the motor by changing the input voltage, e(t), in the presence of a torque, 7/XO»
  applied by the load on the motor. The governing differential equations for the
  amplifier-motor are the following:
                              + (R + Ro)i(t) + aO(])(t) = KAe(t)                    (3.67)
                                 (2}            (l)
                              J0 (t) + be (t) - ai(t) = -TL(t)                      (3.68)

  where /, R, L, and b are the moment of inertia, resistance, self-inductance, and
  viscous damping-coefficient of the motor, respectively, and a is a machine constant.
  RO and KA are the resistance and voltage amplification ratio of the amplifier.
     Since the loading torque, 7/,(0, acts as a disturbance to the system, we can
  consider it as an additional input variable. The input vector is thus given by u(0 =
  [e(t) TL(t)]r. The output vector is given by y(0 = [0(0; 0(1)(0]r- We see from
  Eqs. (3.67) and (3.68) that the system is of third order. Hence, we need three state
  variables for the state-space representation of the system. Going by the desirable
  convention of choosing state variables to be physical quantities, let us select the state
  variables as xi(t) = 0(t), x2(t) = 0 (1) (0» and Jt3(0 — i(t). Then the state-equations
  can be written as follows:




                           Amplifier

                      Figure 3.6       Amplifier-motor circuit of Example 3.7
140                               STATE-SPACE REPRESENTATION


                ,<'>(,) =*2<0                                                          (3.69)
                x(2l)(t) = -(b/J)x2(t) + (a/J)x3(t) - TL(t)/J                          (3.70)
                x™(t) = -(a/L)jt 2 (f) - [(R + Ro)/L]x3(t) + (^A/L)e(0                 (3.71)
   and the output equations are
                                          0(0 =*,<*)                                  (3.72)
                                          (I (
                                        0 > »=* 2 <0                                  (3.73)
   In matrix form, the state-equation and output equations are written as Eqs. (3.33)
   and (3.34), respectively, with the state-vector, x(?) = [x(t); x2(t)', x^(t)]T and the
   following coefficient matrices:

                   " 0 1                °         1                0       0 1
            A=      0 -b/J             a/J            ;   B=       0     -1/7 ;
                   _o -a/L -(R + RQ)/L                        _i<A/L     0 J
                  |~1 0 0]               |"0     0]
            C                  ;                                                      (3.74)
                ~ [o i oj                |_° °J

3.2 Linear Transformation of State-Space
    Representations
Since the state-space representation of a system is not unique, we can always find another
state-space representation for the same system by the use of a state transformation. State
transformation refers to the act of producing another state-space representation, starting
from a given state-space representation. If a system is linear, the state-space representa-
tions also are linear, and the state transformation is a linear transformation in which the
original state-vector is pre-multiplied by a constant transformation matrix yielding a new
state-vector. Suppose T is such a transformation matrix for a linear system described by
Eqs. (3.33) and (3.34). Let us find the new state-space representation in terms of T and
the coefficient matrices, A, B, C, D. The transformed state-vector, x'(f), is expressed as
follows:
                                         x'(r) = Tx(r)                                   (3.75)

Equation (3.75) is called a linear state-transformation with transformation matrix, T. Note
that for a system of order n, T must be a square matrix of size (n x «), because order
of the system remains unchanged in the transformation from x(f) to x'(r). Let us assume
that it is possible to transform the new state-vector, x'(f), back to the original state-vector,
x(f), with the use of the following inverse transformation:

                                        x(r) = T-1x'(r)                                  (3.76)
LINEAR TRANSFORMATION OF STATE-SPACE REPRESENTATIONS                       141


Equation (3.76) requires that the inverse of the transformation matrix, T ', should exist (in
other words, T should be nonsingular). Equation (3.70) is obtained by pre-multiplying
both sides of Eq. (3.75) by T"1, and noting that T T"1 = I. To find the transformed
state-equation, let us differentiate Eq. (3.76) with time and substitute the result, x (!) (?) =
T~'x' u; (0, along with Eq. (3.76), into Eq. (3.33), thereby yielding

                                             AT~ l x'(r)                                 (3.77)

Pre-multiplying both sides of Eq. (3.77) by T, we get the transformed state-equation as
follows:
                                            V(0 + TBu(0                           (3.78)

We can write the transformed state-equation Eq. (3.78) in terms of the new coefficient
matrices A', B', C', D', as follows:



where A' = TAT~ J , and B' = TB. Similarly, substituting Eq. (3.76) into Eq. (3.34) yields
the following transformed output equation:

                                   y(t) = C'x'(r) + D'u(f)                               (3.80)

where C' = CT"1, and D' = D.
   There are several reasons for transforming one state-space representation into another,
such as the utility of a particular form of state-equations in control system design (the
controller or observer companion form), the requirement of transforming the state vari-
ables into those that are physically meaningful in order to implement a control system,
and sometimes, the need to decouple the state-equations so that they can be easily solved.
We will come across such state-transformations in the following chapters.

  Example 3.8
  We had obtained two different state-space representations for the same electrical
  network in Examples 3.4 and 3.5. Let us find the state-transformation matrix, T,
  which transforms the state-space representation given by Eqs. (3.42) and (3.43) to
  that given by Eqs. (3.51) and (3.52), respectively. In this case, the original state-
  vector is x(r) = [/2(0; i(2t} ~ R3e(t)/{L(R + /?3)}]r, whereas the transformed
  state-vector is x'(0 = [LC{e(t) - i2(t)(RRi + R1R2 + R2R3)/R3 - Li(2l)(t)
  (Ri + #3)//?3}; i2(t)L(R} +Ri)/Ri]T. The state-transformation matrix, T, is of
  size (2 x 2). From Eq. (3.69), it follows that

         LC{e(t) - i
                                    i2(t)L(Rl

                                                                                      (3.81)
                       22        (t)-R3e(t)/{L(R{+R3)}
142                           STATE-SPACE REPRESENTATION


 where Tn, T2, T2, and 722 are the unknown elements of T. We can write the
 following two scalar equations out of the matrix equation, Eq. (3.81):

       LCe(t) - LCi2(t)(RiR3 + /?i/?2 + /?2/?s)//?3 - L2Ci(2l)(t)(Ri + /?3)//?3
          - r,,i 2 (f) + Tl2[i2]t) - R3e(t)/{L(R + K3)}]                                (3.82)
       i2(t)L(Ri + R3)/R3 = r 2 ii 2 (f) + T22[i2t) - R3e(t)/[L(R[     + J? 3 )J]         (3.83)
 Equating the coefficients of i2(t) on both sides of Eq. (3.82), we get
                        r,, = -LC(R{R3 + R,R2 + /?2*3)/tf3                            (3.84)
 Equating the coefficients of e(t) on both sides of Eq. (3.82), we get
                              7,2 = -L2C(R} + /?3)//?3                                (3-85)
 Note that the same result as Eq. (3.85) is obtained if we equate the coefficients
 of i2l)(t) on both sides of Eq. (3.82). Similarly, equating the coefficients of corre-
 sponding variables on both sides of Eq. (3.83) we get


                                 72i = L(R} + R3)/R3                                      (3.86)
 and

                                         722 = 0                                          (3.87)
 Therefore, the required state-transformation matrix is


                                                                   0                       '

 With the transformation matrix of Eq. (3.88), you may verify that the state-space
 coefficient matrices of Example 3.5 are related to those of Example 3.4 according
 to Eqs. (3.79) and (3.80).


 Example 3.9
 For a linear, time-invariant state-space representation, the coefficient matrices are
 as follows:

                                                        [1   21;   D = [0   0]      (3 89)
                                                                                      '

 If the state-transformation matrix is the following:

                                      =H _Jj                                          (3.90)

 let us find the transformed state-space representation. The first thing to do is to check
 whether T is singular. The determinant of T, |T| =2. Hence, T is nonsingular and
LINEAR TRANSFORMATION OF STATE-SPACE REPRESENTATIONS                    143


its inverse can be calculated as follows (for the definitions of determinant, inverse,
and other matrix operations see Appendix B):

                                                                     —1
                                                    - (1/2)                    (3.91)


Then the transformed state coefficient matrices, A', B', C', D', of Eqs. (3.79)
and (3.80) are then calculated as follows:

 A'-
 A -
                                                     l    -l
                                                                     1/2
                                                                   -3/2
                                                                             7/2'
                                                                            -1/2
                                                                               (3.92)
               -i
  ' = TB =
                 i - i ii ro o
                           i                                                   (3.93)


                                                     -3/2]                     (3.94)

 D' = D = [ 0 0 ]                                                              (3.95)

It will be appreciated by anyone who has tried to invert, multiply, or find the
determinant of matrices of size larger than (2 x 2) by hand, that doing so can be a
tedious process. Such calculations are easily done using MATLAB, as the following
example will illustrate.



Example 3.10
Consider the following state-space representation of the linearized longitudinal
dynamics of an aircraft depicted in Figure 2.25:

         "v(1)(0"  " -0.045    0.036 -32                  - 2 "1 " t>(0~|
          a {1> (0   -0.4    -3      -0.3                 250     (y(t)
              (l)
          6> (0 ~      0       0       0                    1      9(t)
             n)
         _4 (0_        0.002  -0.04    0.001              -3.2J L ?(OJ

                               o o.r
                           -30 0         p(0l                                  (3.96)
                              0 0        UoJ
                          _-10 0


           r.vioi      |"0 0    1   01    a(t)      ro o i r ^ o l             (3.97)
144                               STATE-SPACE REPRESENTATION


 where the elevator deflection, 8(t) (Figure 2.25) and throttle position, /z(f) (not
 shown in Figure 2.25) are the two inputs, whereas the change in the pitch angle, 0(t),
 and the pitch-rate, q(t} = 0 (1) (0> are the two outputs. The state-vector selected to
 represent the dynamics in Eqs. (3.96) and (3.97) is x(f) = [v(t); a(f); 0(r); q(t)]T,
 where v(?) represents a change in the forward speed, and a(t) is the change in the
 angle of attack. All the changes are measured from an initial equilibrium state of
 the aircraft given by x(0) = 0. Let us transform the state-space representation using
 the following transformation matrix:
                                        1             0    0
                                        0            -2    0
                             T=                                                   (3.98)
                                       -3.5           0   -1
                                        0             2.2  3

 You may verify that T is nonsingular by finding its determinant by hand, or using
 the MATLAB function det. The state-transformation can be easily carried out using
 the intrinsic MATLAB functions as follows:

 »A=[-0.045 0.036 -32 -2; -0.4 -3 -0.3 250; 0 0 0 1 ; 0.002 -0.04 0.001
  -3.2]; <enter>
 »B=[0 0.1;-30 0;0 0;-10 0]; C=[0 0 1 0; 0 0 0 1]; D=zeros(2,2); <enter>
 »T=[1 -1 0 0; 0 0 -2 0; -3.5 1 0 -1; 0 0 2.2 3]; <enter>
 »Aprime=T*A*inv(T), Bprime=T*B, Cprime=C*irw(T) <enter>
 Aprime =
       -4.3924           -77.0473          -1.3564      -84.4521
       0                 -0.7333           0            -0.6667
       4.4182            40.0456           1.3322       87.1774
       0.1656            -2.6981           0.0456       -2.4515

 Bprime =
        30.0000                  0.1000
        0                        0
            -20.0000             -0.3500
            -30.0000             0
 Cprime =
                       -0.5000                0
                       0.3667                 0.3333

 and iy is, of course, just D. The transformed state coefficient matrices can be obtained
 in one step by using the MATLAB Control System Toolbox (CST) command ss2ss.
 First, a state-space LTI object is created using the function ss as follows:

            sys1=ss(A,B,C,D) <enter>
      a =
                            x1                 x2              x3       x4
              x1            -0.045             0.036           -32      -2
              x2            -0.4               -3              -0.3     250
LINEAR TRANSFORMATION OF STATE-SPACE REPRESENTATIONS                145

            x3            0              0                   0       1              1
            x4            0.002          -0.04               0.001   -3.2           1

    b =                                                                             1
                      u1                u2                                          I
             X1       0                 0.1
            x2        -30               0
            x3        0                 0
            x4        -10               0
        =
    c
                      x1          x2    x3        x4
            yi         0           0     1         0
            y2         0           0     0         1

    d =
                      u1           u2
            yi         0           0                                                1
            y2         0           0                                                I

    Continuous-time model.

   Then, the function ss2ss is used to transform the LTI object, sysl, to another
state-space representation, sys2 :

    »sys2 = ss2ss (sys1,T) <enter>
    a =
                      x1                 x2                x3         x4
            x1        -4.3924            -77.047           -1.3564    -84.452
            x2        0                  -0.73333          0          -0.66667
            x3        4.4182             40.046            1.3322     87.177
            x4        0.1656             -2.6981           0.0456     -2.4515       1
   b =                                                                              I
                     u1                 u2                                          1
            x1       30                  0.1                                        1
            x2       0                  0                                           I
            x3
            x4
                     -20
                     -30
                                        -0.35
                                        0
                                                                                    1
                                                                                    I
   c =                                                                              1
                      x1                x2             x3            *4             I
            yi        o                 -0.5           o             0              I
            y2        0                 0.36667        0             0.33333        1
   d =                                                                              1
                     u1           u2                                                1
            yi        o            o                                                1
            y2        o            o                                                I
   Continuous-time model.
146_                           STATE-SPACE REPRESENTATION                        _


   Since a system's characteristics do not change when we express the same system
by different state-space representations, the linear state transformations are also called
similarity transformations. Let us now see how we can obtain information about a
system's characteristics - locations of poles, performance, stability, etc. - from its state-
space representation.


3.3 System Characteristics from State-Space
    Representation
In Chapter 2, we defined the characteristics of a system by its characteristic equation,
whose roots are the poles of the system. We also saw how the locations of the poles
indicate a system's performance - such as natural frequency, damping factor, system
type - as well as whether the system is stable. Let us see how a system's characteristic
equation can be derived from its state-space representation.
    The characteristic equation was defined in Chapter 2 to be the denominator polynomial
of the system's transfer function (or transfer matrix) equated to zero. Hence, we should
first obtain an expression for the transfer matrix in terms of the state-space coefficient
matrices, A, B, C, D. Recall that the transfer matrix is obtained by taking the Laplace
transform of the governing differential equations, for zero initial conditions. Taking the
Laplace transform of both sides of the matrix state-equation, Eq. (3.33), assuming zero
initial conditions (i.e. x(0) = 0) yields the following result:

                                 sX(s) = AX(s) + BU(s)                                (3.99)

where X(s) = £[x(r)], and U(.s) = £[u(f)L Rearranging Eq. (3.99), we can write

                                  (si - A)X(s) = BU(s)                               (3. 100)

or
                                 X(5) = (sI-A)~ 1 BU(5)                             (3.101)

Similarly, taking the Laplace transform of the output equation, Eq. (3.34), with Y(s) =
£[y(t)], yields
                                 (s) = CX(j) + DU(s)                            (3. 102)

Substituting Eq. (3.101) into Eq. (3.102) we get

        Y(s) = C(sl - A)-'BU(j) + DU(j) = [C(sl - A)"!B + D]U(s)                     (3.103)

From Eq. (3.103), it is clear that the transfer matrix, G(s), defined by Y(s) = G
is the following:
                                                 A)- 1 B-|-D                      (3.104)

Equation (3.104) tells us that the transfer matrix is a sum of the rational matrix
(i.e. a matrix whose elements are ratios of polynomials in s), C(sl — A)~ ! B, and the
SYSTEM CHARACTERISTICS FROM STATE-SPACE REPRESENTATION                       147


matrix D. Thus, D represents a direct connection between the input, U(s), and the
output, Y(s), and is called the direct transmission matrix. Systems having D = 0 are
called strictly proper, because the numerator polynomials of the elements of G(s) are
smaller in degree than the corresponding denominator polynomials (see the discussion
following Eq. (2.1) for the definition of strictly proper single variable systems). In
Example 2.28, we had obtained the characteristic equation of a multivariable system
from the denominator polynomial of G(s). Hence, the characteristic polynomial of
the system must be related to the denominator polynomial resulting from the matrix,



  Example 3.11
  For a linear system described by the following state coefficient matrices, let us
  determine the transfer function and the characteristic equation:

                         1
                               ~ '   ~        ' *'   ~    " 1];      D=0         (3.105)

  The inverse (5! — A) ' is calculated as follows:

                         OsI-Ar 1 =adj(sI-A)/|(.sI-A)|                           (3.106)

  where the determinant (sl — A)| is given by

                                                                                 (3.107)
                                         (s — i )

  and the adjoint, adjCsI — A), is given by




  (See Appendix B for the definitions of the inverse, adjoint, and determinant.) Substi-
  tuting Eqs. (3.107) and (3.108) into Eq. (3.106) we get

                                                                                 (3.109)
                                                         —^-    $ — i ) i
  Then the transfer matrix is calculated as follows:
                        -1 _         2                    (S~ 1)        2   1
                                                              2
                                                          L -       (J-DJ
                                        2
                             = [ l / ( 5 - Z s + 5)][(5-3) (5 + 1)]              (3.110)

                             = [l/(5 2 -2s + 5)][(s-3);        (5+1)]

                             = (s - 3)/(52 - 2s + 5)                             (3.111)
148                            STATE-SPACE REPRESENTATION


   The conversion of a system's state-space representation into its transfer matrix is
   easily carried out with the MATLAB Control System Toolbox's (CST) LTI object
   function tf as follows:

       »sys = tf(sys) <enter>

   Example 3.12

   Let us convert the state-space representation of the aircraft longitudinal dynamics
   (Example 3.10) given by Eqs. (3.96) and (3.97) into the transfer matrix of the
   system, as follows:

       »sys1=tf (sysl) <enter>

       Transfer function from input 1 to output...
                     -10s~2-29.25s-1.442
       #1:
             S"4+6.245S"3+19.9s"2+1.003S+0.7033

             -10s~3-29.25S~2-1.442S-5.2936-016
       #2:
             SA4+6.245SA3+19.9S"2+1.003S+0.7033

       Transfer function from input 2 to output...
                      0.0002S+0.0022
       #1:
             S~4+6.245S"3+19.9s"2+1.003S+0.7033

                0.0002s~2+0.0022S+3.671e-019
       #2:
             SM+6.245S~3+19. 9S"2+1 .003S+0.7033



   Note that the single-input, single-output system of Example 3.11, the transfer function
has a denominator polynomial s2 — 2s + 5, which is also the characteristic polyno-
mial of the system (see Chapter 2). The denominator polynomial is equal to |(sl — A)|
(Eq. (3.107)). Thus, the poles of the transfer function are the roots of the characteristic
equation, (sl — A)| = 0. This is also true for the multivariable system of Example 3.12,
where all the elements of the transfer matrix have the same denominator polynomial.
Using linear algebra, the characteristic equation of a general, linear time-invariant system
is obtained from the following eigenvalue problem for the system:
                                        Av*=A*v*                                    (3.112)
where A/t is the Jtth eigenvalue of the matrix A, and v* is the eigenvector associated with
the eigenvalue, A* (see Appendix B). Equation (3.112) can be written as follows:
                                      (XI-A)v = 0                                   (3.113)
SYSTEM CHARACTERISTICS FROM STATE-SPACE REPRESENTATION                  149


For the nontrivial solution of Eq. (3.113) (i.e. v / 0), the following must be true:
                                      |(A1-A)|=0                                   (3.114)

Equation (3.114) is another way of writing the characteristic equation, whose the roots
are the eigenvalues, A. Hence, the poles of the transfer matrix are the same as the
eigenvalues of the matrix, A. Since A contains information about the characteristic
equation of a system, it influences all the properties such as stability, performance
and robustness of the system. For this reason, A is called the system's state-dynamics
matrix.

  Example 3.13
  For the state-space representation of the electrical network derived in Examples 3.4
  and 3.5, let us substitute the numerical values from Example 2.8 (R = R?, = 10
  ohms, R2 — 25 ohms, L = 1 henry, C = 10~6 farad) and calculate the transfer
  functions and eigenvalues for both the state-space representations.
     The state-space representation of Example 3.4 yields the following state coeffi-
  cient matrices:
     A=                       E
          l ?n6        Ll;       = °',5J'      C = [-0.5      0];   D = 0.05 (3.115)
          [-10       -30 J         L~ 1 5 J
  while the state-space representation of Example 3.5 has the following coefficient
  matrices:

                       -30 J ;    B
                                  '=
                                                                              (3.116)
  Either using Eq. (3.104) by hand, or using the CST LTI object function, tf, we can
  calculate the respective transfer functions as follows:

  »A=[0 1;-1e6 -30]; B=[0.5; -15]; C = [ - 0 . 5 0] ; D=0.05;sys1=ss(A,B,C,D) ;
   sys1=tf (sysl ) <enter>

  Transfer function:
  0.05s"2+1 .255+56004

     s"2+30s+1e006

  » A=[0 1;-1e6 -30]; B=[0; 1]; C=[0 -0.25]; D=0.05;sys2=ss(A,B,C,D);
   sys2=tf(sysl) <enter>

  Transfer function:
  0.05sA2+1.25s+5e004

     s"2+30s+1e006

  Note that the two transfer functions are identical, as expected, because the two
  state-space representations are for the same system. The characteristic equation is
150                          STATE-SPACE REPRESENTATION


  obtained by equating the denominator polynomial to zero, i.e. s2 + 30s + 106 = 0.
  Solving the characteristic equation, we get the poles of the system as follows:

       »roots([1 30 1e6]) <enter>

       ans =
       - 1 . 50006+001 +9 . 9989e+002i
       - 1 . 5000e+001 -9 . 99896+0021

  which agree with the result of Example 2.8. These poles should be the same as the
  eigenvalues of the matrix, A(= A'), obtained using the intrinsic MATLAB function
  eig as follows:

       »eig([0             -30]) <enter>

       ans =
       - 1 . 50006+001 +9 . 9989e+002i
       - 1 . 50006+001 - 9 . 9989e+002i


Example 3.13 shows that the system's characteristics are unchanged by using different
state-space representations.

  Example 3.14
  Consider the following two-input, two-output turbo-generator system [2]:

           "-18.4456   4.2263 -2.2830  0.2260               0.4220 -0.0951"
             -.97 -.76
              407     600      5.6825 - . 9 6
                                       066                -1.2246   0.2873
               1.4449  1.4336 - . 4 7
                               267     069
                                        .02                 087 -.30
                                                             .99 020
             -.03
              009      0.2302 - . 0 2 -0.1764
                               050                        -6.3152   0.1350
             - . 4 4 -0.3489
              006              0.7238  6.3117             -.86
                                                           068      0.3645
           _ - . 6 2 -0.2361
              000              0.2300  0.0915             -0.3214 - . 0 7 _
                                                                    028

           "- . 7 8
             024          3.1463 "
            -0.0501      - 9.3737
            -0.1550        749
                            .26
             0.0716      -4.9176
            -0.0814     -10.2648
             004
              .24         13.7943

            ).5971 -0.7697   4.8850         4.8608 -9.8177 -8.8610
            1.1013   9.3422 - . 0 0
                             560           -0.7490   2.9974 10.5719


      -is :i                                                                 (3.117)
SYSTEM CHARACTERISTICS FROM STATE-SPACE REPRESENTATION                    T_51


The eigenvalues and the associated natural frequencies and damping factors of the
system are found by using the MATLAB command damp(A) as follows:

      »damp(A) <enter>

      Eigenvalue                            Damping               Freq. (rad/sec)
      -2.3455e-001                          1.00006+000           2.34556-001
      -3.4925e-001+6.3444e+000i             5.4966e-002           6.35406+000
      -3.4925e-001-6.3444e+000i             5.4966e-002           6.3540e+000
      -1.04446+000                          1.00006+000           1.04446+000
      -1.03876+001                          1.00006+000           1.0387e+001
      -1.58736+001                          1.OOOOe+000           1.5873e+001

Note that there are four real eigenvalues, and a pair of complex conjugate eigenvalues.
All the eigenvalues (i.e. poles) have negative real parts, implying an asymptoti-
cally stable system from the stability criteria of Chapter 2. Also from Chapter 2, the
damping factors associated with all real eigenvalues with negative real parts are 1.0,
since such eigenvalues represent exponentially decaying responses. Only complex
conjugate eigenvalues have damping factors less than 1.0. These eigenvalues repre-
sent an oscillatory response. If it were possible to decouple the state-equations by the
use of a state transformation, such that the each of the transformed state-equations
is in terms of only one state variable, then each eigenvalue would represent a partic-
ular mode in which the system can respond. Hence, there are six modes in this sixth
order system, consisting of four real (or first order) modes, and a second order mode
defined by a pair of complex conjugate eigenvalues. Note that the second order mode
has a relatively small damping factor (0.055). The transfer matrix, G(s), defined by
Y(s) = G(s)UCs), of this two-input, two-output system, is written as follows:

                               G(.v) = [G,(5) G2(s)]                            (3.118)

where ¥(5) = Gi(s)U(s) + G2(s)U2(s), with U(s) and U2(s) being the two
inputs. Gj(s) and G2(s) are usually obtained using the CST LTI objects ss and
ff as follows:

»syst=ss(A,B,C,D); syst=tf(syst) <enter>
Transfer function from input 1 to output...
    0.048298^5+1.876s~4+1.949s~3-1228s A 2-5762s-2385
#1:        -
    S A 6+28.24s"5+258.3S~4+1468s A 3+8214s A 2+88018+1631
      - 0.4919s"5+9.483s A 4-49.05s"3+551.6s"2-939.6S+907.6
#2:
      s~6+28.24s~5+258.3s"4+1468s"3+8214s"2+88018+1631
Transfer function from input 2 to output...
      0.02915s"5+1 .289SM-0.30418 A 3-2.388e004s ~2-8.29e005s
                                       -9.5446005
152                             STATE-SPACE REPRESENTATION


   #1 : .....................................................
        S"6+28 . 24s"5+258 . 3s"4+1 468s"3+821 4sA2+8801 S+1 631

       - 0 . 671 6s~5+804 . 5s~4+2 . 781 e004s"3+8 . 085e004s"2+1 . 21 4e006s
                                            +1 .0826006
   #2 : .......................................................
       S~6+28.24s~5+258. 3s"4+1 468s"3+821 48*2+8801 S+1 631

   Therefore,


      _ r(0.04829s5 + l. 876s4 + 1. 949s3 -1228-s2- 5762s -2385)A/(s) 1
      ~ [(-0.49 1 9s5 + 9.483s4- 49.05s3 + 55 1.6s2- 939.6s + 907.6) /d(s) J
   G( )
    2 S


      _ |"(0.02915s5 + 1.289s4 -0.304 Is3- 2.388 x 10* s2 - 8.29 x lO5*- 9.544 x lO5)/*/^)!
      ~ |_(-0.6716s5 + 804.5s4 + 27810s3 + 8085s2+1.214x 106s + 1.082x ltf)/d(s)          J
                                                                                    (3.119)
   where
      d(s) = (s6 + 28.24s5 + 258.3s4 + 1468s3 + 8214s2 + 8801s + 1631)              (3.120)

   For brevity, the coefficients have been rounded off to four significant digits. If
   the MATLAB's long format is used to report the results, a greater accuracy is
   possible. Note that all the elements of the transfer matrix G(s) have a common
   denominator polynomial, whose roots are the poles (or eigenvalues) of the system.
   This is confirmed by using the coefficients of d(s) rounded to five significant digits
   with the intrinsic MATLAB function roots as follows:

   »roots([1 28.238 258.31 1467.9 8214.5 8801.2 1630.6]) <enter>

   ans =
   -15.8746
   -10.3862
   -0.3491+6.34441
   -0.3491-6.34441
   - 1 . 0444
   -0.2346




3.4 Special State-Space Representations:
    The Canonical Forms
In Section 3.1 we saw how some special state-space representations can be obtained,
such as the controller and observer companion forms. The companion forms are members
of a special set of state-space representations, called canonical forms. In addition to
the companion forms, another canonical form is the Jordan canonical form, which is
derived from the partial fraction expansion of the system's transfer matrix as described
below. In Section 3.3, we saw how the transfer matrix can be obtained from a state-space
_              SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS_                                  153


representation. Now we will address the inverse problem, namely deriving special
state-space representations from the transfer matrix. For simplicity, consider a single-input,
single-output system with the transfer function given by the following partial fraction
expansion:

                                                                                                       2
   Y ( s ) / U ( s ) = k() + k { / ( s -pi) + k2/(s - p2) + • • • + k i / ( s - /?/) + ki+l/(s -    Pi)
                                             m+{
                   + •••+ ki+m/(s -       Pi}      + ••• + kn/(s - pn)                             (3. 121)

where n is the order of the system, and all poles, except s = Pi, are simple poles. The
pole, s = pi, is of multiplicity (m + 1), i.e. (s — /?,) occurs as a power (m + 1) in the
transfer function. Let us select the state-variables of the system as follows:

                                = /(s - /?,); X2(s)/U(s) = /(s - p2); . . . ;
                 Xi(s)/U(s) = /(s - Pi); Xi+[(s)/U(s) - /(s - Pl)2- . . . ;
                                                m+l
              Xi+m(s)/U(s) = /(s -        Pi)     ;...;XM/U(s)            =  / ( s - pn)     (3.122)

Taking the inverse Laplace transform of Eq. (3.122), we get the following state-equations:



                                          = p2X2(t)    + U(t)




                                                                                                   (3.123)


                                 x^[)(t) = Pnxn(t} + u(t)

and the output equation is given by

                   y ( t ) = k i x i ( t ) -f £2*2(0 H ----- 1- kiXi(t) + ki+ixi+i (?)
                            + - • • + ki+mxi+m(t) + • • • + knxn(t) + k()u(t)                      (3.124)

(Note that in deriving the state-equations corresponding to the repeated pole, s = /?/,
we have used the relationship Xi+i(s) = X(/(s - /?,-), Xi+2(s) = Xi+i/(s - Pi), and so
on.) The state-space representation given by Eqs. (3.123) and (3.124) is called the Jordan
canonical form. The state coefficient matrices of the Jordan canonical form are, thus, the
154                                STATE-SPACE REPRESENTATION


following:

                     "PI      0        .. 0            0      0       ... 0 0       ... 0
                        0     P2       .. 0            0      0       ... 0 0       ... 0
                        0     0      . .. 0            0      0       ... 0 0       ... 0


                        0     0        .. pi 0 0 ...                       0 o;    ... 0
                        0     0      . .. l Pi 0 ...                       0 0    ... 0
                        0     0      . .. ;0 1 Pi ...                       0 o:    ... 0

                        0     0      .    .. io        0      0       ...   1 Pi ...     0


                        0     0      . .. 0            0      0       ... 0 0       ...   Pn_


                      1 1                 l
                                          " """              ..Pi 1     •    1],T




                     .*!     *2    -. .       ki   1:,-+i    ... ^           .. *„]
               V = k0                                                                              (3.125)

   Note the particular structure of the A matrix in Eq. (3.125). The system's poles (i.e. the
eigenvalues of A) occur on the main diagonal of A, with the repeated pole, p,, occurring
as many times as the multiplicity of the pole. A square block associated with the repeated
pole, pi, is marked by a dashed border, and is known as the Jordan block of pole, p,.
The diagonal below the main diagonal - called the subdiagonal - of this block has all
elements equal to 1. All other elements of A are zeros. The matrix B also has a particular
structure: all elements associated with the simple poles are ones, the first element of the
Jordan block of repeated pole, p, - shown in dashed border - is one, while the remaining
elements of the Jordan block of p, are zeros. The elements of matrix C are simply the
residues corresponding to the poles in the partial fraction expansion (Eq. (1.121)), while
the matrix D is equal to the direct term, &o, in the partial fraction expansion. If a system
has more than one repeated poles, then there is a Jordan block associated with each
repeated pole of the same structure as in Eq. (3.125). If none of the poles are repeated,
then A is a diagonal matrix. The Jordan canonical form can be also obtained similarly
for multi-input, multi-output systems.


  Example 3.15
  Let us find the Jordan canonical form of the following system:

                            Y(s)/U(s) = (5 + l)/[(5 - 1)2(5 - 3)]                               (3.126)
SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS                 155


  The partial fraction expansion of Eq. (3.126) is the following:
                   Y ( s ) / U ( s ) = /(s - 3) - l/(s - 1) - l/(5 - I) 2       (3.127)
  Comparing Eq. (3.127) with Eq. (3.121) and using Eq. (3.125), we get the following
  Jordan canonical form:
                                   3 0 0"
                            A =    0 |l 0!         B       I'll
                                   0     l              ioi
                                                       D
                            c =[ i E                       =                     (3.128)
  The Jordan block associated with the repeated pole, s = , is shown in dashed
  borders.

   While Jordan canonical form is an easy way of obtaining the state-space representation
of a system, it has a major drawback: for the Jordan canonical form to be a practical
representation, all the poles of the system (i.e. eigenvalues of A) must be real. After all,
the purpose of having state-space representations is to practically implement a control
system, using electrical circuits or mechanical devices. A state-space representation with
complex coefficient matrices cannot be implemented in a hardware (have you ever heard
of a complex electrical resistance, or a spring with complex stiffness!). To make some
sense out of Jordan canonical form for a system with complex poles, we can combine the
partial fractions corresponding to each pair of complex conjugate poles, p^ = a ± /'&>,
into a second order real sub-system as follows:
     k/(s - p) + k2/(s - p2) = 2[as - (oca + pa))]/(s2 - 2as + a2 + or)           (3.129)
where k^ — a ± ifi are the residues corresponding to the poles, p^- Remember that the
residues corresponding to complex conjugate poles are also complex conjugates. Since the
complex poles always occur as complex conjugates, their combination into real second
order sub-systems using Eq. (3.129) will lead to a real state-space representation. From
Eq. (3.129), it can be shown that the real Jordan block in A corresponding to a pair of
complex conjugate poles, p^ — a ± ito, is a 2 x 2 block with real parts on the diagonal,
and the imaginary parts off the diagonal as follows:

                      Jordan block of pti — a ± iu> in A = i
                                                                  —a>   a           (3.130)

   The MATLAB Control System Toolbox function canon provides an easy derivation
of the canonical forms, using the methodology presented above. The function is used as
follows:

     »[csys,T] = canon(sys,'type') <enter>
where sys is an LTI object of the system (either transfer matrix, or state-space), 'type'
is either 'modal' for Jordan canonical form, or 'companion' for the observer companion
156                                STATE-SPACE REPRESENTATION


form, csys is the returned canonical form, and T is the returned state-transformation matrix
which transforms the state-space representation from sys to csys (T is meaningful only
if sys is a state-space representation, and not the transfer matrix). The matrix A of the
Jordan canonical form obtained using canon has each pair of complex eigenvalues in a
real Jordan block given by Eq. (3.130).


  Example 3.16
  For the system of Example 3.14, let us obtain the canonical forms. For the Jordan
  canonical form, the MATLAB (CST) command canon is used as follows:

  » syst=ss(A, B, C, D); [ j s y s t . T ] = canon(syst, 'modal') <enter>
  a =

                   x1               x2          x3              X4           x5
        x1         -15.873          0           0               0            0
        x2         0                -10.387     0               0            0
        x3         0                0           -0.34925        6.3444       0
        x4         0                0           -6.3444         -0.34925     0
        x5         0                0           0               0            -1.0444
        x6         0                0           0               0            0
                   x6
        x1         0
        x2         0
        x3         0
        x4         0
        x5         0
        x6         -0.23455

  b =
               U1                  u2
         X1    0.50702             -20.055
         x2     -0.36131           30.035
         x3    0.092163            -5.577
         X4    0.13959             13.23
         x5    -0.17417            8.7113
         x6    0.021513            14.876

  c =
              x1                   x2           x3              X4         X5
         y1   0.86988              2.3105       2.7643          6.459      2.8803
         y2   -7.9857              -11.128      -0.19075        -0.78991   3.2141

              x6
              -9.885
         y2   10.406

  d =
              u1              u2
              0               0
         y2   0               0

  Continuous-time model.
SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS            157



 Columns 1 through 2
 -1.67367664062877           0.82071823417532
 0.93271689676861            -1.37011949477365
 0.00703777816771            0.01235017857500
 -0.01678546516033           0.05675504485937
 0.01434336645020            0.32743224909474
 0.00550594309107            -0.03421867428744

 Columns 3 through 4
 -0.64877657888967           0.02185375479665
 1.30954638127904            0.00863637157274
 0.06144994008648            1.42410332092227
 -0.12409538851455           0.03844790932243
 1.10820137234454            0.07909786976484
 0.01382978986462            -0.04137902672467

 Columns 5 through 6
 0.15933965118530            -0.03863614709032
 -0.32626410503493           0.08854860917358
 -0.00622411675595           0.07244625298095
 -1.41411419523105           0.02977656775124
 -0.08538437917204           0.21852854369639
 -0.01967206771160           1.01709518519537


Note the 2 x 2 real Jordan block in A corresponding to the complex eigenvalues
/?3,4 = —0.349 25 ± 6.34441. Also, note that the corresponding terms in the matrices
B and C are also real. The transformation matrix, T, has been reported in long format
for greater accuracy in calculations. Next, we calculate the observer canonical form
of the system as follows:

»[csyst, T] = canon(syst, 'companion') <enter>
a =
           x1          x2           x3            x4           X5
      x1   9.60346-015 -1.30176-013 1 , 68226-012 -4.87726-011 1.58626-009
      x2   1           5.68996-014 1 , 69646-012 -3.44766-011 7.77626-010
      x3   7.77166-016 1            2, 60686-013 -4.65416-012 1.04256-010
      x4   4.51036-017     2.49976-015   1              -8.33116-013   1.90146-011
      x5   1.51796-018     2.78646-016   5. 53036-015   1              2.15296-012
      x6   5.4216-020      1.01036-017   1.96026-016    -3.25436-015   1

           x6
      x1   -1630.6
      x2   -8801.2
      x3   -8214.5
      x4   -1467.9
      x5   -258.31
      x6   -28.238

b =
           u1              u2
      X1   1               945.61
      x2 0                 1128.8
      x3 0                 201 .9
158                              STATE-SPACE REPRESENTATION


         x4 0 36.481
         x5 0 4.0669
         X6 0 0.1451

   C =
              x1             x2         x3        X4        X5
         yi   0.04829        0.51209    -24.985   -725.97   204
                                                             04
         y2   -0.49194       23.374     -581.99   11670     -2.10416+005

              x6
         y1   -3.4886+005
         y2   3 5 4 6 0 6
               . 9 4 + 0

   d =
              u1             u2
         y1 0                0
         y2 0                0

   Continuous-time model.
   T =
    Columns 1 through
    0.36705413565042     -1.48647885543276
    0.48941400292950     04760762
                          .6450868
    0.06992034388180     0.10572273608335
    0.01406952155565     0.02165321186650
    0.00129963404010     0.00361303652580
    00034907
     .0094070            00056935
                          .0176980

    Columns 3 through 4
    3.02790751537344     -2, 47039343978461
    10.58180159205530    -2, 47081762640110
    1.83987823178029     -0, 61525593744681
    03363077
     .4807472            -0. 10310276871196
    0 0 0 3 3 0 2 4
     . 4 0 8 7 4 0 4     -0. 00922166413447
    0.00145527317768     -0. 0 0 8 1 4 6 6
                              0 2 9 6 8 0 4

    Columns 5 through
    -1.39030096046515       63.91103372168656
    -2.11561239460537       73.88483216381728
    -0.39195667361013       13.19012284392485
    -0.09863522809937       2 3 0 6 9 2 2 9
                             . 6 7 7 7 7 6 6
    -0.01208541334668       0.26314010184181
    -0.00043627032173       0.00940569645931

      In the A matrix of the computed observer companion form, all the elements
   except those in the last column and the subdiagonal are negligible, and can be
   assumed to be zeros. We can also derive the controller companion form merely by
   taking the transposes of A, B, and C of the observer form computed above. The
   controller companion form is thus denoted by the coefficient set (A7, Cr, B 7 , D).

   The Jordan canonical form is useful for decoupling the state-equations of systems with
distinct eigenvalues; such systems have a diagonal A matrix of the Jordan canonical form.
SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS                   159


The companion forms are useful in designing control systems. However, a great disadvan-
tage of the companion forms (both controller and observer) is that they are ill-conditioned,
which means that the eigenvalues and eigenvectors of the matrix A are very sensitive to
perturbations in the elements of A. This results in large inaccuracies in the computed
eigenvalues (and eigenvectors), even if there is a small error in calculating A. Since a
system's characteristics are governed by the eigenvalues and eigenvectors of A, an ill-
conditioned A matrix is undesirable. The ill-conditioning of companion forms generally
gets worse as the order of the system increases. Hence, we should normally avoid using
the companion forms as state-space representations, especially for large order systems.
MATLAB assigns a condition number to each square matrix. The condition number indi-
cates how close a matrix is to being singular (i.e. determinant of the matrix being zero). A
larger condition number means that the matrix is closer to being singular. With MATLAB
we can assess the condition number of a square matrix, A, using the command cond(A). If
cond(A) is small, it indicates that A is well-conditioned. If cond(A) is very large, it implies
an ill-conditioned A. Whenever we try to invert an ill-conditioned matrix, MATLAB issues
a warning that the matrix is ill-conditioned and the results may be inaccurate.

   Example 3.17
   Let us compare the condition numbers for the Jordan canonical form and the observer
   companion form derived in Example 3.16. The condition number for the Jordan
   canonical form is calculated by first retrieving the state coefficient matrices from
   the LTI object jsyst using the Control System Toolbox (CST) function ssdata, and
   then applying cond to matrix A as follows:

       » [Aj,Bj,Cj,Dj]=ssdata(jsyst); cond(Aj) <enter>
       ans =
                 67.6741

   while the condition number for the companion form is the following:

       » [ A c , B c , C c , D c ] = s s d a t a ( c s y s t ) ; cond(Ac) <enter>

       ans =
                 9.1881e+004

     The condition number for the companion form is, thus, very large in comparison
  to that of the Jordan canonical form, confirming that the former is ill-conditioned.
  Why is a companion form ill-conditioned while the Jordan canonical form is not?
  The answer lies in all the diagonal elements, except the last, being zeros in the
  matrix A of the companion forms. In contrast, the Jordan form's matrix A has a
  populated diagonal, i.e. none of the diagonal elements are zeros.

 For conversion of a transfer matrix into a state-space representation, you can use the
MATLAB (CST) LTI object ss. However, the state-space conversion of a transfer matrix
160                                     STATE-SPACE REPRESENTATION


with ss results in the controller companion form, which we know to be ill-conditioned.
Hence, we should avoid converting a transfer matrix to state-space representation using
the command ss, unless we are dealing with a low order system.


3.5 Block Building in Linear, Time-Invariant
    State-Space
Control systems are generally interconnections of various sub-systems. If we have a state-
space representation for each sub-system, we should know how to obtain the state-space
representation of the entire system. Figure 2.55 shows three of the most common types
of interconnections, namely the series, parallel, and feedback arrangement. Rather than
using the transfer matrix description of Figure 2.55, we would like to depict the three
common arrangements in state-space, as shown in Figure 3.7.
   The series arrangement in Figure 3.7(a) is described by the following matrix equations:

                                                                                           (3.131)
                                                                                           (3.132)
                                                                                           (3.133)
                                                                                           (3.134)

where the state-space representation of the first sub-system is (Aj, BI, Ci, DI), while
that of the second subsystem is (A2, 82, C2, D2). The input to the system, u(f), is also


(a) u(f)                                                                         y(0
                                                       x2<1>(0 = A^
                   = C 1 x 1 (f)-»-D 1 u(0             y(0 = 02X2(0+0^(0

(b)




       u2(0                                              ya(0
                            y2(0 = C2x2(0+D2u2(0

(c)        a(0                                                                                y(0
                         xc(1)(0 = Acxc(0+Bc[yd(0-y(Ol           V1)(0 = ApXpW+BpUfO
           -0*                                            -
                                                          u(0



           Figure 3.7     Three common arrangements of sub-systems models in state-space
BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE                   161


the input to the first sub-system, while the system's output, y ( t ) , is the output of the
second sub-system. The output of the first sub-system, yi(/), is the input to the second
sub-system. Substitution of Eq. (3.132) int Eq. (3.133) yields:

                        x^(r) = A 2 x 2 (/) + B 2 C l X , (0 + B 2 D,uU)             (3.135)

and substituting Eq. (3.132) into Eq. (3.134), we get

                              - C 2 x 2 (f) + D 2 C,x,(?) + D 2 D,u(0                (3.136)

If we define the state-vector of the system as x(f) = [xf (0; x 2 (?)] r , Eqs. (3.131) and
(3.135) can be expressed as the following state-equation of the system:

                                     A           0
                                         '   A       lx(0 + LBjJu(,)                (3.137)
                                             Ac

and the output equation is Eq. (3.136), re-written as follows:

                           y(0 = [D2Ci       C 2 ]x(f)+D 2 Diu(f)                    (3.138)

   The MATLAB (CST) command series allows you to connect two sub-systems in series
using Eqs. (3.137) and (3.138) as follows:

      »sys = series(sys1,sys2) <enter>

The command series allows connecting the sub-systems when only some of the outputs
of the first sub-system are going as inputs into the second sub-system (type help series
(enter] for details; also see Example 2.28). Note that the sequence of the sub-systems
is crucial. We will get an entirely different system by switching the sequence of the
sub-systems in Figure 3.7(a), unless the two sub-systems are identical.
   Deriving the state and output equations for the parallel connection of sub-systems
in Figure 3.7(b) is left to you as an exercise. For connecting two parallel sub-systems,
MATLAB (CST) has the command parallel, which is used in a manner similar to the
command series.
   The feedback control system arrangement of Figure 3.7(c) is more complicated than
the series or parallel arrangements. Here, a controller with state-space representation
(AC,BC, CC,DC) is connected in series with the plant (Ap, Bp, Cp, Dp) and the feedback
loop from the plant output, y(/), to the summing junction is closed. The input to the
closed-loop system is the desired output, yd(0- The input to the controller is the error
[yd(0 ~ y(OL while its output is the input to the plant, u(/). The state and output equations
of the plant and the controller are, thus, given by

                          x p ( l ) (r) = ApXp(r) + Bpu(r)                           (3.139)
                              y(0 - Cpxp(r) + DpU(0                                  (3.140)
                              (l)
                           Xc (f) = Acxc(0 + Bc[yd(0 - y(r)J                         (3.141)
                              u(0 = C c xc(r) + Dc[yd(0 - y(r)]                      (3.142)
162_                         STATE-SPACE REPRESENTATION                        _


Substituting Eq. (3.142) into Eqs. (3.139) and (3.140) yields the following:
                   xp (1) (0 = ApXp(f) + BpCcXc(r) + BpDc[yd(r) - y(r)]                (3.143)
                       y(0 = CpXpO + DpCcXc(r) + DpDc[yd(0 - y(/)]                     (3.144)
Equation (3.144) can be expressed as
      y(r) = (I + DpDc)-1[CpXp(0 + DpCcXc(0] + (I + DpDc)-1DpDcyd(0                    (3.145)
provided the square matrix (I + DpDc) is non-singular. Substituting Eq. (3.145) into
Eq. (3.143) yields the following state-equation of the closed-loop system:
                                                                                       (3.146)
and the output equation of the closed-loop system is Eq. (3.145) re-written as:
                                   y(0 = Cx(f)+Dyd(0                                   (3.147)
where



           A =
                      -Bc(I + DpDc) >Cp

           C = (I + DPDC) -'[Cp D P C C ];

           D = ( I + DpDc)-1DpDc;        B= [          .                                (3.148)

Using MATLAB (CST), the closed-loop system given by Eqs. (3.146)-(3.148) can be
derived as follows:

»sysO = series (sysc, sysp) % series connection of LTI blocks sysc
 and sysp <enter>

»sys1=ss(eye(size(sysO))) % state-space model (A=B=C=0, D=I) of
 the feedback block, sysl <enter>

»sysCL= feedback(sysO, sysl ) % negative feedback from output to
  input of sysO <enter>

where sysO is the state-space representation of the controller, sysc, in series with the plant,
sysp, sysl is the state-space representation (A = B = C = 0, D = I) of the feedback block
in Figure 3.7(c), and sysCL is the state-space representation of the closed-loop system.
Note that sysO is the open-loop system of Figure 3.7(c), i.e. the system when the feedback
loop is absent.




I
    Example 3.18                                                                             I
    Let us derive the state-space representation of an interesting system, whose I
    block-diagram is shown in Figure 3.8. The system represents a missile tracking |
BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE                              163


                                      Aircraft

                         xa(1)(0 == Aaxa(0 + Ba u(0
          u(0        +    yd(0 = Caxa(0 + Dau(0
                                                                       yd<o

    i
    T
        / ^-
           fc
                u°m(0 = ccxjo   + Dcc[ydd(o-y(0]
                                                   •uo   x   (1
                                                                  >(
                                                             y(0 = Cmxm(0 + Dmum(0
                                                                                               (0

                         Controller
                                                                       Missile




      Figure 3.8      Block diagram for the aircraft-missile control system of Example 3.1 8


a maneuvering aircraft. The pilot of the aircraft provides an input vector, u(r), to
the aircraft represented as (Aa, Ba, Ca, Da). The input vector, u(t), consists of the
aircraft pilot's deflection of the rudder and the aileron. The motion of the aircraft
is described by the vector, yd(0, which is the desired output of the missile, i.e. the
missile's motion - described by the output vector, y ( t ) - should closely follow that
of the aircraft. The output vector, y(f), consists of the missile's linear and angular
velocities with respect to three mutually perpendicular axes attached to the missile's
center of gravity - a total of six output variables. The state-space representation for
the missile is (Am, Bm, Cm, Dm). The missile is controlled by a feedback controller
with the state-space representation (Ac, Bc, Cc, Dc) whose task is to ultimately make
y(r) = ya(?), i-e. cause the missile to hit the maneuvering aircraft.
   The matrices representing the aircraft missile, and controller are as follows:

     " -0.0100 -0.1000    0        0        0       0       0      -
        0      -0.4158    1.0250   0        0        0      0
        0        0.0500 -0.8302    0        0       0       0
Aa =    0        0        0      -0.5600 - 1.0000    0.0800 0.0400
        0        0        0        0.6000 -0.1200 -0.3000 0
        0        0        0      -3.0000    0.4000 -0.4700 0
        0        0        0        0        0.0800   1.0000 0      _

     " 0         0
        0        0
        0        0
Ba =    0.0730 0.0001
      -4.8000 1 .2000
        1 .5000 10.0000
        0        0
164                               STATE-SPACE REPRESENTATION


              "i       oo    o o o 01              ro 01
               0  00 250 000           00
               02500  0 0 0 0   _     00
      3   —                     Do =
                                  a
               0  00  0 0 1 0 '       00
               0 0 1 0 0 0 0         0 0
              .0       oo    o i o oj              l_o oj
              " 0.4743   0       0.0073   0       0       0      1
                 0     -0.4960   0        0      0       0
               -0.0368   0     -0.4960    0      0       0
 /"m.01 —
                 0     -0.0015   0      -0.0008   0       0.0002
                 0       0     -0.2094    0     -0.0005   0
                 0     -0.2094   0       0       0      -0.0005 J

              "o            o        o       i         ri o o o o 0 1
       191.1918   0      0                             0    1   0   0   0   0
         0      191.1918 0       .                     0    0   1   0   0   0
 Bm =                                             m
         0        0      1.0000 '                   ~ 0     0   0   1   0   0
         0      232.5772 0                             0    0   0   0   1   0
      _232.5772   0      0     J                     [ o    O   O   O   O   l J

       "0          0   01
        0          0   0
        0          0   0
   m =
        0          0   0
        0          0   0
       .0          0   oj

       ~ 0    0   0   1.0 0   0 1
          0    0   0  0   1.0 0
          0    0  0   0   0   1.0
  Ac =
        -1.0  0   0 -0.3 0    0
          0  -1.0 0   0 -0.3 0
          0    0 -1.0 0   0 -0.3 J

       ~0               0        0        0        0     0      1
         0              0        0        0        0     0
         0              0        0        0        0     0
  Bc =
         0.0000         0.0000   0.0000   0.0000 0.0000 0.0001
         0.6774         0.0000   0.0052   0.0000 -0.0001 0.0000
       _ 0.0000         0.0000   0.0000   0.0000 0.0000 0.0000 J

              100000'                         000000
              0 1 0 0 0 0                     000000
              0 0 1 0 0 0                     000000
BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE                165


Note that the aircraft is a seventh order sub-system, while the missile and the
controller are sixth order sub-systems. The state-space representation of the entire
system is obtained as follows:

»sysc=ss(Ac,Bc,Cc,Dc) ; sysm=ss(Am,Bm,Cm,Dm) ; sysO = series(sysc,sysm) ;
  <enter>
»sys1=ss(eye(size(sysO) ) ) ; <enter>
»sysCL=feedback(sysO,sys1 ) ; <enter>
»sysa=ss(Aa,Ba,Ca,Da) ; syst=series(sysa, sysCL) <enter>
a =
         x1             x2             x3               x4              x5
  X1     0. 4743        0              0.0073258        0      0
  x2     0              -0.49601       0        0       0
  x3     -0 .036786     0              -0.49601         0      0
  X4     0              -0.0015497     0                -0.00082279     0
  x5     0        0              -0 .20939      0               -0.00048754
  x6     0              -0.20939       0                -8.22796-006    0
  x7     0        0     0        0     0
  x8     0        0     0        0     0
  x9     0        0     0        0     0
  x10    0        0     0        0     0
  X11    -0 .6774       0              -0.0052          0              0.0001
  x12    0        0     0        0     0
  x13    0        0     0        0     0
  x14    0        0     0        0     0
  x15    0        0     0        0     0
  X16    0        0     0        0     0
  x17    0        0     0        0     0
  x18    0        0     0        0     0
  x19    0        0     0        0     0

         x6               x7            x8                  x9   x10
  x1     0                0         0   0           0
  x2     0                191 .19       0           0       0
  x3     0                0             191.19              0    0
  x4     0. 00017749      0         0   1           0
  x5     0                0             232.58              0    0
  x6     -0 .00048754     232.58        0           0       0
  x7     0                0         0   0           1
  x8     0                0         0   0           0
  x9     0                0         0   0           0
  X10    -0 .0001         -1            0           0  -0.3
  X11    0                0             - 1           0          0
  x12    0                0         0             - 1 0
  x13    0                0         0   0        0
  x14    0                0         0   0        0
  x15    0                0         0   0        0
  x16    0                0         0   0        0
  x17    0                0         0   0        0
  x18    0                0         0   0        0
  x19    0                0         0       0    0                                     |
166                               STATE-SPACE REPRESENTATION




1      x1
       x2
       x3
       x4
            X11
            0
            0
            0
            0
                    x12
                     0
                     0
                     0
                     0
                            x13
                             0
                             0
                             0
                             0
                                  x14
                                   0
                                   0
                                   0
                                   0
                                          x15
                                           0
                                           0
                                           0
                                           0

       x5      0            0        0              0         0
       x6      0            0        0              0         0
       x7      0            0        0              0        0
       x8      1            0        0              0        0
       x9      0            1        0              0        0
      x10      0            0        0              0        0
      X11    -0.3           0     0.6774           1 .3   -0.0001
      x12     0           -0.3       0              0        0
      x13     0            0       -0.01          -0.1       0
      x14     0            0         0          -0.4158    1.025
      x15     0            0         0           0.05     -0.8302
      x16     0            0         0              0        0
      x17     0            0         0              0        0
      x18     0            0         0              0        0
      x19     0            0         0              0        0

             x16        x17         X18          x19
       x1      0         0           0            0
       x2      0         0           0            0
       x3      0         0           0            0
       x4      0         0           0            0
       x5      0         0           0            0
       x6      0         0           0            0
       x7      0         0           0            0
       x8      0         0           0            0
       x9      0         0           0            0
      x10      0      0.0001         0            0
      X11      0         0           0            0
      x12      0         0           0            0
      x13     0          0           0            0
      x14     0          0           0            0
      x15     0          0           0            0
      x16   -0.56          -1     0.08          0.04
      x17    0.6          -0.12    -0.3           0
      x18     -3           0.4    -0.47           0
      x19     0           0.08       1            0

 b =
             U1            u2
       x1       0          0
       x2       0          0
       x3       0          0
       x4       0          0
       x5       0          0
       x6       0          0
       x7       0          0
       x8       0          0
       x9       0          0
      x10       0          0
      X11       0          0
BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE             167


   x12        0         0
   x13        0         0
   X14        0         0
   x15        0         0
   x16     0.073     0.0001
   x17      -4.8       1.2
   x18       1 .5       10
   x19        0         0

C =
            x1         x2      x3    x4    x5
      yi     1         0       0      0     0
      y2     0          1      0      0    0
      y3     0         0        1     0    0
      y4     0         0       0      1    0
      y5     0         0       0      0     1
      y6     0         0       0      0     0
            x6         x7      x8    x9   X10
      yi     0         0        0    0     0
      y2     0         0       0     0     0
      y3     0         0        0    0     0
      y4     0         0       0     0     0
      y5     0         0       0     0     0
      y6     1         0        0    0     0

            X11       x12     x13   x14   x15
      yi     0         0       0     0     0
      y2     0         0       0     0     0
      V3     0         0       0     0     0
      y4     0         0       0     0     0
      y5     0         0       0     0     0
      y6     0         0       0     0     0

            x16       X17     x18   X19
      yi     0         0       0     0
      y2     0         0       0     0
      ys     0         0       0     0
      y4     0         0       0     0
      y5     0         0       0     0
      y6     0         0       0     0

d =
            u1         U2
      yi     0         0
      y2     0         0
      ya     0         0
      y4     0         0
      y5     0         0
      y6     0         0

Continuous-time model.

The total system, syst, is of order 19, which is the sum of the individual orders
of the sub-systems. If the entire system, syst, is asymptotically stable, the missile
168                              STATE-SPACE REPRESENTATION


  will ultimately hit the aircraft, irrespective of the pilot's inputs to the aircraft. To
  analyze whether the pilot can escape the missile by maneuvering the aircraft with
  the help of rudder and aileron inputs, let us find the eigenvalues of the entire system
  as follows:

         » [a,b,c,d]=ssdata(syst); damp(a) <enter>

         Eigenvalue                         Damping          Freq. (rad/s)
          3.076-001+1.026+0001             -2.896-001        1.066+000
          3.07e-001-1 .026+0001            -2.896-001        1.066+000
          -7.236-004                       1.006+000         7.236-004
          -8.236-004                       1 .006+000        8.236-004
          -1.006-002                       1.006+000         1.006-002
          -1.556-002                       1.006+000         1 .556-002
          -1 .59e-002                      1.006+000         1.596-002
          -2. 746-002+1. 136+0001          2.426-002         1.136+000
          -2.746-002-1.136+0001            2.426-002         1.136+000
          -1.396-001+9.896-0011            1.396-001         9.996-001
          -1.396-001-9.896-0011            1.396-001         9.996-001
          -1.506-001+9.896-0011            1.506-001         1.006+000
          -1 .506-001-9.896-0011           1 .506-001        1.006+000
          -3.166-001                       1.006+000         3.166-001
          -3.826-001                       1.006+000         3.826-001
          -5.046-001                       1.006+000         5.046-001
          -5.386-001                       1.006+000         5.386-001
          -9.306-001                       1 .006+000        9.306-001
          -1 .096+000                      1.006+000         1.096+000

 The complex conjugate eigenvalues 0.307 ± 1.02/ with a positive real part indicate
 that the system is unstable. Hence, it is possible for the pilot to ultimately escape
 the missile. The controller, sysc, must be re-designed to enable a hit by making the
 entire system asymptotically stable.



Exercises
3.1. Derive a state-space representation for each of the systems whose governing differential
     equations are the following, with outputs and inputs denoted by y,(r) and uf(t) (if i > 1),
     respectively:
      (a) ld*y(t)/dt3 + I0dy(t)/dt - 2y(f) = 2du(t)/dt + 5u(t).
      (b) J 2 yi (t)/dt 2 + 3dy} (t)/dt - 6y2(r) = -u , (r)/7; -2d2y2(t)/dt2 + 9y2(r) - </y, (/)/
          dt = 5dui(t)/dt-u2(t).
      (c) 100J4y(0/^4 - 33d3y(t)/dt3 + I2d2y(t)/dt2 + 8y(f) = 21dui(t)/dt -
          5ii 2 (r).
      (d) d5yi(t)/dt + 9y,(r) -Id2y2(t)/dt2 +dy2(t)/dt = 2d*u(t)/dt* -          6d2u(t)/dt2
          41du(t)/dt
EXERCISES                                          169


3.2. Derive a state-space representation for the systems whose transfer matrices are the
     following:
     (a) Y(s)/U(s) = (s2 -3s + l)/(s5 + 4s3 + 3s2 - s + 5).
     (b) Y(.s-)/U(s) - [(s + l ) / ( s 2 +25 + 3) s / ( s + 3) /(s3 + 5)].




3.3. Derive a state-space representation for a satellite orbiting a planet (Example 2.3). Linearize
     the nonlinear state-space representation for small deviations from a circular orbit.

3.4. For a missile guided by beam-rider guidance law (Eq. (2.19)), derive a state-space repre-
     sentation considering the commanded missile acceleration, a^c(t), as the input, and the
     missile's angular position, B^(t), as the output.

3.5. For the closed-loop beam-rider guidance of a missile shown in Figure 2.8, derive a state-
     space representation if the target's angular position, Oj(t), is the input, and the missile's
     angular position, #M(?), is the output.

3.6. For a missile guided by the command line-of-sight guidance law (Eq. (2.20)), derive a
     state-space representation considering the commanded missile acceleration, aMc(t), as the
     input, and the missile's angular position, #M(0» as the output.

3.7. For the closed-loop command line-of-sight guidance of a missile shown in Figure 2.9,
     derive a state-space representation if the target's angular position, 9j(t), is the input, and
     the missile's angular position, 9M(t), is the output. Can the state-space representation be
     linearized about an equilibrium point?

3.8. Derive a state-space representation for the longitudinal dynamics of an aircraft (Exam-
     ple 2.10) with elevator deflection, 8(t), as the input, and [v(t) a(t) d(t)]T as the output
     vector. Convert the state-space representation into:
     (a) the Jordan canonical form,
    (b) the controller companion form,
     (c) the observer companion form.

3.9. Derive a state-space representation for the compensated closed-loop chemical plant of
     Example 2.25, with the closed-loop transfer function given by Eq. (2.159). Convert the
     state-space representation into:
    (a) the Jordan canonical form,
    (b) the controller companion form,
    (c) the observer canonical form.
170                               STATE-SPACE REPRESENTATION


3.10. For the closed-loop multivariable chemical process of Example 2.29, derive a state-space
      representation. Transform the state-space representation into:
      (a) the Jordan canonical form,
      (b) the controller companion form,
      (c) the observer canonical form.


3.11. For the aircraft longitudinal dynamics of Example 3.10 derive:
      (a) the Jordan canonical form,
      (b) the controller companion form,
      (c) the observer canonical form.


3.12. For the nonlinear electrical network of Exercise 2.3, derive a state-space representation
      with input as the voltages, v  ( t ) and i>2(0» and the output as the current i°2(/). Linearize
      the state-space representation about the equilibrium point falling in the dead-zone, —a <
      v i ( t ) < a. Use L = 1000 henry, R{ = 100 ohm, R2 = 200 ohm, C = 2 x 10~5 farad,
      and €2 = 3 x 10~5 farad. Is the electrical network stable about the equilibrium point?


3.13. Repeat Exercise 2.29 using a state-space representation for each of the multivariable
      systems.


3.14. For the multivariable closed-loop system of Exercise 2.30, derive a state-space represen-
      tation, and convert it into the Jordan canonical form.


References
1. Nise, N.S. Control Systems Engineering. Addison-Wesley, 1995.
2. Maciejowski, J.M. Multivariable Feedback Design. Addison-Wesley, 1989, pp. 406-407.
4
Solving the State-Equations

4.1 Solution of the Linear Time Invariant
    State Equations
We learnt in Chapter 3 how to represent the governing differential equation of a system
by a set of first order differential equations, called state-equations, whose number is
equal to the order of the system. Before we can begin designing a control system based
on the state-space approach, we must be able to solve the state-equations. To see how
the state-equations are solved, let us consider the following single first order differential
equation:
                                                                                         (4.1)

where x(t) is the state variable, u(t) is the input, and a and b are the constant coefficients.
Equation (4. 1 ) represents a first order system. Let us try to solve this equation for t > ?o
with the initial condition, x(to) = XQ. (Note that since the differential equation, Eq. (4.1),
is of first order we need only one initial condition to obtain its solution). The solution to
Eq. (4.1) is obtained by multiplying both sides of the equation by exp{— a(t — to]} and
re-arranging the resulting equation as follows:

      exp{-a(f - fo)}*(1)(0 - exp{-a(f - t())}ax(t) = exp{-a(f - t0)}bu(t)               (4.2)

We recognize the term on the left-hand side of Eq. (4.2) as d/dt[exp{ — a(t — to)}x(t)],
Therefore, Eq. (4.2) can be written as

                    d/dt[exp{-a(t - t(})}x(t)] = exp{-a(t - t0)}bu(t)                    (4.3)

Integrating both sides of Eq. (4.3) from to to f, we get


                                                = ('
               exp{— a(t — to)}x(t) — x(to) = / exp{—a(r — to)}bu(T}dr
                                              Jtl}
                                                                                         (4.4)

Applying the initial condition, x(to) — XQ, and multiplying both sides of Eq. (4.4) by
exp{a(t — to}}, we get the following expression for the state variable, x(t):
                                                r<
                 x ( t ) = Qxp{a(t — t())}xo + / e fl -   •bu(r}dx   (t > to)           (4.5)
172_                           SOLVING THE STATE-EQUATIONS                          _


    Note that Eq. (4.5) has two terms on the right-hand side. The first term, exp{a(f —
to)}xo, depends upon the initial condition, JCQ, and is called the initial response of the
system. This will be the only term present in the response, x(t), if the applied input, u(t),
is zero. The integral term on the right-hand side of Eq. (4.5) is independent of the initial
condition, but depends upon the input. Note the similarity between this integral term
and the convolution integral given by Eq. (2.120), which was derived as the response
of a linear system to an arbitrary input by linearly superposing the individual impulse
responses. The lower limit of the integral in Eq. (4.5) is to (instead of — oo in Eq. (2.120)),
because the input, u(t), starts acting at time to onwards, and is assumed to be zero at
all times t < to- (Of course, one could have an ever-present input, which starts acting
on the system at t = — oo; in that case, to = — oo). If the coefficient, a, in Eq. (4.1) is
negative, then the system given by Eq. (4.1) is stable (why?), and the response given
by Eq. (4.5) will reach a steady-state in the limit t —> oo. Since the initial response of
the stable system decays to zero in the limit / —> oo, the integral term is the only term
remaining in the response of the system in the steady-state limit. Hence, the integral term
in Eq. (4.5) is called the steady-state response of the system. All the system responses to
singularity functions with zero initial condition, such as the step response and the impulse
response, are obtained form the steady-state response. Comparing Eqs. (2.120) and (4.5),
we can say that for this first order system the impulse response, g(t — to), is given by

                                   g(t- t0) = ep{a(t - t0)}b                            (4.6)

You may verify Eq. (4.6) by deriving the impulse response of the first order system
of Eq. (4.1) using the Laplace transform method of Chapter 2 for u(t) = 8(t — to) and
X(IQ) = 0. The step response, s(t), of the system can be obtained as the time integral of
the impulse response (see Eqs. (2.104) and (2.105)), given by


                      s(t) = i ea(t~T)bdT = [exp{a(r - /0)} - U/«                        (4.7)
                             Jt
                             JtQ




Note that Eq. (4.7) can also be obtained directly from Eq. (4.5) by putting u(t) = us(t —
t0) and *(fo) = 0.
   To find the response of a general system of order n, we should have a solution for each
of the n state-equations in a form similar to Eq. (4.5). However, since the state-equations
are usually coupled, their solutions cannot be obtained individually, but simultaneously
as a vector solution, (t), to the following matrix state-equation:

                                           = Ax(r) + Bu(f)                               (4.8)

Before considering the general matrix state-equation, Eq. (4.8), let us take the special case
of a system having distinct eigenvalues. We know from Chapter 3 that for such systems,
the state-equations can be decoupled through an appropriate state transformation. Solving
_               SOLUTION OF THE LINEAR TIME INVARIANT STATE EQUATIONS_                   173


decoupled state-equations is a simple task, consisting of individual application of Eq. (4.5)
to each decoupled state-equation. This is illustrated in the following example.

   Example 4.1
   Consider a system with the following state-space coefficient matrices:




   Let us solve the state-equations for t > 0 with the following initial condition:




   The individual scalar state-equations can be expressed from Eq. (4.8) as follows:

                                  jc[ 1} (f) = -3jc,(0 + M(0                       (4.11)
                                  x(2l}(t) = -2jc2 (f) - u(t)                      (4.12)

   where x(t) and X2(t} are the state variables, and u(t) is the input defined for t > 0.
   Since both Eqs. (4.11) and (4.12) are decoupled, they are solved independently of
   one another, and their solutions are given by Eq. (4.5) as follows:

                      jd(0 = e~3r + / e~3(t~T)u(T)dT           (t > 0)            (4.13)
                                    Jo

                      x2(t) = -       Q-2(!~r}u(T)dr      (t > 0)                 (4.14)



   Example 4.1 illustrates the ease with which the decoupled state-equations are solved.
However, only systems with distinct eigenvalues can be decoupled. For systems having
repeated eigenvalues, we must be able to solve the coupled state-equations given by
Eq. (4.8).
   To solve the general state-equations, Eq. (4.8), let us first consider the case when
the input vector, u(0, is always zero. Then Eq. (4.8) becomes a homogeneous matrix
state-equation given by
                                     x ( 1 ) (r)=Ax(0                             (4.15)

We are seeking the vector solution, x(0, to Eq. (4.15) subject to the initial condition,
x(?o) = XQ. The solution to the scalar counterpart of Eq. (4.15) (i.e. x^t) = ax(t)) is
just the initial response given by x ( t ) = exp{a(t — t0)}x0, which we obtain from Eq. (4.5)
by setting u(t) = 0. Taking a hint from the scalar solution, let us write the vector solution
to Eq. (4.15) as
                                 x(0 = exp{A(f - fo)}x(r 0 )                           (4.16)
174                            SOLVING THE STATE-EQUATIONS


In Eq. (4.16) we have introduced a strange beast, exp{A(f — to)}, which we will call the
matrix exponential of A(f — to). This beast is somewhat like the Loch Ness monster,
whose existence has been conjectured, but not proven. Hence, it is a figment of our
imagination. Everybody has seen and used the scalar exponential, exp{a(r — to)}, but
talking about a matrix raised to the power of a scalar, e, appears to be stretching our
credibility beyond its limits! Anyhow, since Eq. (4.16) tells us that the matrix exponential
can help us in solving the general state-equations, let us see how this animal can be
defined.
   We know that the Taylor series expansion of the scalar exponential, exp{a(f — to)}, is
given by

              exp{a(/ - to)} = 1 + a(f - to) + a2(t - t0)2/2
                                + at - r0)3/3! + • • • + ak(t - t0)k/k + •••            (4.17)

Since the matrix exponential behaves exactly like the scalar exponential in expressing the
solution to a first order differential equation, we conjecture that it must also have the same
expression for its Taylor series as Eq. (4.17) with the scalar, a, replaced by the matrix,
A. Therefore, we define the matrix exponential, exp{A(f — to)}, as a matrix that has the
following Taylor series expansion:

             exp{A(/ - to)} = I + A(r - to) + A 2 (r - r0)2/2!
                                + A 3 (r - /0)3/3! + • • • + k(t - t0)k/k + •••         (4.18)

Equation (4.18) tells us that the matrix exponential is of the same size as the matrix
A. Our definition of exp{A(/ — to)} must satisfy the homogeneous matrix state-equation,
Eq. (4.15), whose solution is given by Eq. (4.16). To see whether it does so, let us
differentiate Eq. (4.16) with time, t, to yield

          x (1) (r) = d/dt(exp{A(t - t0)}x(t0)] = d/dt[cxp{(t - t0)}]x(to)             (4.19)

The term d/dt[exp{(t — to)}] is obtained by differentiating Eq. (4.17) with respect to
time, t, as follows:

 d/dt[exp{(t - to)}]
    = A + 2(t - to) + A3(r - r0)2/2! -I- A4(f - r0)3/3! + • • • + A*+1 (t - t0)k/k + • • •
    = A[I + A(r - t0) + A2(t - t0)2/2 + A 3 (/ - r0)3/3! + • • • + k(t - tQ)k/k + • • •]
    = Aexp{A(f-/ 0 )}                                                                   (4-20)

(Note that the right-hand side of Eq. (4.20) can also be expressed as [I + A(/ —1 0 ) +
A2(f - f 0 ) 2 /2!+A 3 (r - t0)3/3 + • • • + A*(f - t0)k/k + - • -]A = exp{A(r - f 0 ))A, which
implies that Aexp{A(/ - t0)} = exp{A(f - to)}A.) Substituting Eq. (4.20) into Eq. (4.19),
and using Eq. (4.16), we get

                           x (1) (0 = Aexp{A(r — to)}xo = x(t)                         (4.21)
_               SOLUTION OF THE LINEAR TIME INVARIANT STATE EQUATIONS_                            175


which is the same as Eq. (4.15). Hence, our definition of the matrix exponential by
Eq. (4.18) does satisfy Eq. (4.15). In Eq. (4.20) we saw that the matrix exponential,
exp{A(f - to)}, commutes with the matrix, A, i.e. Aexp{A(? — fn)} = exp{A(? - fn)}A.
This is a special property of exp{A(f — to)}, because only rarely do two matrices commute
with one another (see Appendix B). Looking at Eq. (4.16), we see that the matrix expo-
nential, exp{A(? — to)}, performs a linear transformation on the initial state-vector, x(?o),
to give the state-vector at time t, x(f). Hence, exp{A(? — to)}, is also known as the state-
transition matrix, as it transitions the system given by the homogeneous state-equation,
Eq. (4.15), from the state, x(?0), at time, to, to tne state x(f), at time, t. Thus, using the
state-transition matrix we can find the state at any time, t, if we know the state at any
previous time, to < t. Table 4.1 shows some important properties of the state-transition
matrix, which you can easily verify from the definition of exp{A(r — /o)K Eq. (4.18).
   Now that we know how to solve for the initial response (i.e. response when u(?) = 0)
of the system given by Eq. (4.8), let us try to obtain the general solution, x(/), when the
input vector, u(t), is non-zero for t > ?o- Again, we will use the steps similar to those
for the scalar state-equation, i.e. Eqs. (4.1)-(4.5). However, since now we are dealing
with matrix equation, we have to be careful with the sequence of matrix multiplications.
Pre-multiplying Eq. (4.8) by exp{ — (t — t0)}, we get

      exp{-A(r - r 0 )}x (1) (0 = exp{-A(r - ?0)}Ax(0 + exp{-A(f - f 0 )}Bu(/)                 (4.22)

Bringing the terms involving x(?) to the left-hand side, we can write

                exp{-A(f - ? 0 )}[x (1) (0 - Ax(01 - exp{-A(r - f 0 )}Bu(0                     (4.23)

From Table 4.1 we note that d/dt[ep{ — A(t — to)}] = -exp{— A(f - to)} A. Therefore,
the left-hand side of Eq. (4.23) can be expressed as follows:

                exp{-AU - ? 0 )}x (1) (0 - exp{-A(f - fo)}Ax(f)
                   = exp{-A(f - f 0 )}x (1) (f) + d/dt[Gxp{-(t - r0)}]x(r)
                                   -(t - f 0 )}x(r)]                                          (4.24)

Hence, Eq. (4.23) can be written as

                   JA/r[exp{-A(r - t0)}x(t)] = exp{-A(r - f 0 )}Bu(r)                          (4.25)

               Table 4.1      Some important properties of the state-transition matrix

S. No.        Property                              Expression

  1           Stationarity                          exp{A(?o — to)} = I
  2           Commutation with A                    Aexp{A(r — r0)} = exp{A(r — f 0 )}A
  3           Differentiation with time, t          d/dt[exp{A(t — /0)}] = exp{A(? — to)} A.
  4           Inverse                               [exp{A(f - ^o)}]^ 1 = exp{A(r0 - 01
  5           Time-marching                         exp{A(r - t  ) } exp{A(f] - t0)} = exp{A(? - r0)}
176                             SOLVING THE STATE-EQUATIONS


Integrating Eq. (4.25) with respect to time, from to to t, we get


               exp{-A(/ - /0)}x(0 - x(f0) =             exp{-A(r - r0)}Bu(r)dr            (4.26)


Pre-multiplying both sides of Eq. (4.26) by exp{A(f — to)}, and noting from Table 4.1 that
exp{—A(f — to)} = [exp{A(r — to)}]~1, we can write the solution state-vector as follows:

                                     /"
        x(f) = exp{A(f — to)}(to) + I exp{A(f — r)}Bu(r)dr;                (/ > to)      (4.27)


   Note that the matrix equation, Eq. (4.27), is of the same form as the scalar equation,
Eq. (4.5). Using Eq. (4.27), we can calculate the solution to the general matrix state-
equation, Eq. (4.8), for / > to. However, we do not yet know how to calculate the state-
transition matrix, exp{A(r — to)}.



4.2 Calculation of the State-Transition Matrix

If we can calculate the state-transition matrix, exp{A(r — /o)K when the state-dynamics
matrix, A, and the times, to and t > to, are specified, our task of solving the linear state-
equations will simply consist of plugging exp{A(f — to)} into Eq. (4.27) and getting the
solution x(r), provided we know the initial state-vector, x(f0), and the input vector, u(r),
for t > to. As stated at the beginning of Section 4.1, the easiest way to solve a matrix
state-equation is by decoupling the individual scalar state-equations, which is possible only
if the system has distinct eigenvalues. First, let us calculate the state-transition matrix for
such a system.
    For a linear system of order n, having n distinct eigenvalues, k, A.2       A.,,, the eigen-
value problem (see Chapter 3) is written as follows:

                              Av*=A*v*;           (*=l,2,...,n)                           (4.28)

We know from Chapter 3 that such a system can be decoupled (or diagonalized) by using
the following state-transformation:

                          x'(r) = Tx(0;      T = [v,; v 2 ; . . . ; ¥„]-'                 (4.29)

and the state-dynamics matrix then becomes diagonalized as follows:

                                             A,     0 0 ...          0
                                             0      X 2 0 ...        0
                                                                                          (4.30)
                                              0     0    0    ... A.n
CALCULATION OF THE STATE-TRANSITION MATRIX                                               177


You can easily show from the definition of the state-transition matrix, Eq. (4.18), that the
state-transition matrix for the decoupled system is given by
                          'exp{A.i(f-f 0 )}                  0         0 ...                     0
    exp{A(f                     0                     exp{A.2(f - fo)} 0 ...                     0

                                     0                       0             0 ...
                                                                      exp{X B (f-f 0 )}
                                                                                       (4.31)
Equation (4.31) shows that the state-transition matrix for a decoupled system is a diagonal
matrix. In general, the state-transition matrix for any transformed system, x'(t) = Tx(r),
can be expressed as
 exp{A(f -t0)}
   = l + A'(t-t0) + (A')t-t0)2/2 + (A')t-to)3/3 + --- + (Af)k(t-t0)k/kl                                  + ---
           1          1                           1 2            2
   = TT" + (TATr )(f - fo) + (TAT" ) (f - t0) /2l
                                / 3 ! + - - - + (TAT- 1 ) /c (r-f 0 )V^! + - - -
                                (r - f 0 ) 2 /2! + A 3 (/ - f 0 ) 3 /3! + • • • + Ak(t - t 0 ) k / k l + • • -JT"1
                            1
                                                                                                            (4.32)


  Example 4.2

  Let us calculate the state-transition matrix of the following system, and then solve
  for the state-vector if the initial condition is x(0) = [ 1; O] 7 and the applied input
  is u(t) = 0:
                                          -1      :


  The eigenvalues of the system are obtained by solving the following characteristic
  equation:
                      + 1)     -2
       |AJ-A| =                      = (A + 1) (X + 3) + 2 = r + 4A + 5 = 0
                      1     (A + 3)
                                                                          (4.34)
  which gives the following eigenvalues:
                                             A.i,2 = -2 ± /                                             (4.35)
  Note that the negative real parts of both the eigenvalues indicate an asymptotically
  stable system. Since the eigenvalues are distinct, the system can be decoupled using
  the state-transformation given by Eq. (4.29). The eigenvectors, YI = [u n ; v2]T and
  V2 = [vi2', V22]T are calculated from Eq. (4.28). The equation Avi = X.v yields the
  following scalar equations:
                                                      -v +2t'2i                                     (4.36a)
                                                      —v - 3v2                                     (4.36b)
178                                        SOLVING THE STATE-EQUATIONS


 Note that Eqs. (4.36a) and (4.36b) are linearly dependent, i.e. we cannot get the two
 unknowns, v, and 1*21, by solving these two equations. You may verify this fact
 by trying to solve for V[ and V2. (This behavior of the eigenvector equations is
 true for a general system of order n; only (n — 1) equations relating the eigenvector
 elements are linearly independent). The best we can do is arbitrarily specify one
 of the two unknowns, and use either Eq. (4.36a) or Eq. (4.36b) - since both give
 us the same relationship between v and V2 - to get the remaining unknown. Let
 us arbitrarily choose v = 1. Then either Eq. (4.36a) or (4.36b) gives us vi =
 (1 + A.0/2 = (-1 + 0/2. Hence, the first eigenvector is v, = [ 1; (-1 + i ) / 2 ] T .
 Similarly, the second eigenvector is obtained by 'solving' Av2 = X2V2, yielding the
 second eigenvector as ¥2 = [ 1; (— 1 — i ) / 2 ] T . Plugging the two eigenvectors in
 Eq. (4.29), we get the state-transformation matrix, T, as


                                                            (-1-0/2J               (l+/)/2   '
                                                                                                 (4.37)
 Then the diagonalized state-dynamics matrix, A', is given by

                       A' TAT-' = r*1 X°iJ |_r ( - 2+/) (-2-0 Ji
                       A=TAT
                                  [            0   0  2
                                                           °
                                                           =                                     /A™
                                                                                                 (4 38)
                                                                                                  '
 and the state-transition matrix for the transformed system is
                   ,   6       =
                                        o ] r e ( - 2+/) '                       o
                                                                                                 (4 39)
                                   [   0          exp(A2oH             0      e<-                  '
 Note that t0 = 0 in this example. Then from Eq. (4.32) the state-transition matrix
 for the original system is given by


          r        i                   i       ire(-2+/)'         o i [0-0/2 -n
       ~ [(-!+ 0/2 (-1-0/2JL                        0          e<- 2 -''>'JL(l+i)/2   ij

              [(1 - i)e
                                                                 [(1
                                                                                 (4.40)
 Those with a taste for complex algebra may further simplify Eq. (4.40) by using the
 identity ea+lb = efl[cos(&) + i sin(t)], where a and b are real numbers. The resulting
 expression for eAr is as follows:
                                                              2e-sin,,)       1
                                       2                    2/
                           L       -e~ ' sin(r)           e~ [cos(r) - sin(f)] J
 The solution, x(0, is then given by Eq. (4.27) with u(0 = 0 as follows:

      x(0 = [,, (,); ,2(,)f = e-x(O) =
CALCULATION OF THE STATE-TRANSITION MATRIX                            179


   The state variables, x(t) and X2(t), given by Eq. (4.42) are plotted in Figure 4.1.
   Note that both the state variables shown in Figure 4.1 decay to zero in about 3 s,
   thereby confirming that the system is asymptotically stable.




                        0.8


                        0.6


                        0.4


                        0.2


                          0


                       -0.2
                                               2           3      4         5
                                                Time (s)

           Figure 4.1     The calculated state variables, XT (f) and X2(0, for Example 4.2


   The method presented in Example 4.2 for calculating the state-transition matrix is
restricted to those systems which have distinct eigenvalues. The intrinsic MATLAB func-
tion expm3 lets you use the diagonalization method for the calculation of the matrix
exponential for systems with distinct eigenvalues as follows:

     »eP = expm3(P) <enter>

where P is a square matrix of which the matrix exponential, eP, is to be calculated.
Alternatively, you can use the intrinsic MATLAB function eig as follows to calculate
the eigenvector matrix, V, and the diagonalized matrix, D, with eigenvalues of P as its
diagonal elements:

     »[V,D] = eig(P) <enter>

Then use the MATLAB function exp as follows to calculate the matrix exponential of D:

     »eD = e x p ( D ) - r o t 9 0 ( e y e ( s i z e ( D ) ) ) <enter>

The MATLAB function exp(D) calculates a matrix whose elements are exponentials of
the corresponding elements of the matrix D. The matrix exponential of D is obtained by
subtracting the off-diagonal elements of exp(D) (which are all ones) from exp(D); this
is done by forming a matrix whose diagonal elements are zeros and whose off-diagonal
elements are all ones-an identity matrix of same size as D, eye(size(D)), rotated by 90
180                             SOLVING THE STATE-EQUATIONS


degrees using the command rot90(eye(size(D))). Finally, the matrix exponential of P can
be obtained as follows, using eP = VeDV"1:

      »eP = V*eD*inv(V) <enter>

  Example 4.3
  Using MATLAB, let us calculate the state-transition matrix for the system in
  Example 4.2 for /0 = 0 and t = 2 s. First, let us use the command expmS as follows:
      »A=[-1 2; -1 -3]; eAt = expm3(A*2) <enter>
        eAt =
        9.03246-003          3.3309e-002
        -1.66546-002         -2.42766 -002
  Now let us use the alternative approach with the command eig as follows:
        »[V, D] = eig(A*2) <enter>

        V =

        8.16506-001                                8.16506-001
        -4.08256-001 +4.08256-0011                 -4.08256-001 -4.08256-0011

        D =

        -4.00006+000+ 2.00006+0001                      0

                 0           -4.00006+000- 2.00006+0001

  Then the state-transition matrix of the diagonalized system is calculated as follows:
        »eD = e x p ( D ) - r o t 9 0 ( e y e ( s i z e ( D ) ) ) <enter>

        eD =
        -7.62206-003+1.66546-0021                   0
              0                                    -7.62206-003 -1.66546-0021

  Finally, using the inverse state-transformation from the diagonalized system to the
  original system, we get the state-transition matrix, e A/ , as follows:
        »eAt = V*eD*inv(V) <enter>

       eAt =
       9.03246-003           3.33096-002           -2.26466-0181
       -1.66546-002          -2.42766-002          +1.65056-0181

  which is the same result as that obtained using expm3 (ignoring the negligible
  imaginary parts). You may verify the accuracy of the computed value of e^ by
  comparing it with the exact result obtained in Eq. (4.41) for / = 2 s.
CALCULATION OF THE STATE-TRANSITION AAATRIX                           181

   For systems with repeated eigenvalues, a general method of calculating the state-
transition matrix is the Laplace transform method, in which the Laplace transform is taken
of the homogeneous state-equation, Eq. (4.15) subject to the initial condition, x(0) = x()
as follows:
                                   sX(s) - x(0) = AX(s)                             (4.43)

where X(s) = £[x(t)]. Collecting the terms involving X(s) to the left-hand side of
Eq. (4.43), we get

                                (si - A)X(s) = x(0)                                    (4.44)

                      X(s)     (si - ArVO) = (si -                                     (4.45)

Taking the inverse Laplace transform of Eq. (4.45), we get the state-vector, x ( t ) , as

              x(f) = £~[[X(s)] = £~l[(sl - Ar'xo] = £~][(sl - A)~ 1 ]x 0               (4.46)

Comparing Eq. (4.46) with Eq. (4.16), we obtain the following expression for the state-
transition matrix:
                                                            1
                               eA? = j r - « [ ( 5 i _ A ) - ]                  (4.47)

Thus, Eq. (4.47) gives us a general method for calculating the state-transition matrix for
/ > 0. The matrix (5! — A)"1 is called the resolvent because it helps us in solving the
state-equation by calculating e Ar . If the initial condition is specified at t — to, we would
be interested in the state-transition matrix, exp{A(? — to)}, for t > to, which is obtained
from Eq. (4.47) merely by substituting t by (t — to).

  Example 4.4
   Consider a system with the following state-dynamics matrix:
                                           -2 I      5'
                                  A =        0 0    —3                              (4.48)
                                             0 0     0

  Let us calculate the state-transition matrix and the initial response, if the initial
  condition is x(0) = [0; 0; 1 ] r . The eigenvalues of the system are calculated as
  follows:
                                    + 2)    -1     -5
                                    0        A      3                               (4.49)
                                    0        0      A

  From Eq. (4.49) it follows that the eigenvalues of the system are A] = ^2 =       0, and
  A. 3 = —2. Since the first two eigenvalues are repeated, the system cannot be     decou-
  pled, and the approach of Example 4.2 for calculating the state-transition        matrix
  is inapplicable. Let us apply the Laplace transform approach given by Eq.         (4.47).
  First, the resolvent (si — A)~ ! is calculated as follows:
182                                 SOLVING THE STATE-EQUATIONS


         (si - A)- 1 = adj((5l - A)/|5l - A| = l/[52(5 + 2)]
                                           2
                           X
                                   r *   5
                                                    0
                                                5(5 + 2)
                                                           0 I7
                                                           0
                                   |_ (55 + 3) -3(5 + 2) 5(5 + 2) _
                               ~ l / ( 5 + 2)          1,/[5(5+2)J             (55 + 3)/[52(5 + 2)]l
                                                                                          2
                      =                0                          1/5                     -3/5                  (4.50)
                                       0                           0                       1/5              J

 Taking the inverse Laplace transform of Eq. (4.50) with the help of partial fraction
 expansions for the elements of (5! —A)"1 and using Table 2.1, we get the state-
 transition matrix as follows:
              l~e-2'           (l-e- 2 ')/2 7(1 -e- 2 ')/4 + 3r/2~
          A
         e '=    0                 1                 -3r           ;                                    (f>0)   (4.51)
              |_ 0                 0                   1
 Note that the inverse Laplace transform of 1/5 is us(t) from Table 2.1. However,
 since we are interested in finding the state-transition matrix and the response only
 for t > 0 (because the response at t = 0 is known from the initial condition, x(0))
 we can write £~'(l/5) = 1 for t > 0, which has been used in Eq. (4.51). The initial
 response is then calculated as follows:

        x(r) =     X2(t)           = eA'x(0) =                               -3r                    ;   (r>0)   (4.52)
                 L*3(0_                                                       1
 Note that the term 3t/2 makes x(t) keep on increasing with time, t > 0. Similarly,
 X2(t) keeps on increasing with time. This confirms that the system is unstable. A
 plot of jcj(0, X2(t), and Jt3(/) is shown in Figure 4.2.

                       10                      i             '*i(0 '   • -
                                                                   ^-^^
                           5                                 ^>^^ -
                           0
                                     ""••«._                                   I
                                                                              x3(0
                                                                                            -
                       -5                          "••-...
                                                             "•--..           x2(f)
                      -10


                      -15                  i                 i           i            i
                               0           1                 2          3             4         5
                                                                 Time (s)

      Figure 4.2   The calculated state variables, xj (t), X2(f), and xj(t), for Example 4.4
UNDERSTANDING THE STABILITY CRITERIA THROUGH THE STATE-TRANSITION MATRIX              183



4.3 Understanding the Stability Criteria through the
    State-Transition Matrix
In Section 2.6 we listed the criteria by which we can judge whether a system is stable. The
state-transition matrix allows us to understand the stability criteria. We saw in Example 4.2
that the elements of eA/ are linear combinations of exp(A^), where A^ for k = 1,2              n
are the distinct eigenvalues of the system (Eq. (4.40)). Such elements can be expressed as
exp(a^r) multiplied by oscillatory terms, sin(/v) and cos(&*0» where a^ and b^ are real
and imaginary parts of the &th eigenvalue, A* = ak + ibk (Eq. (4.41)). If the real parts,
ak, of all the eigenvalues are negative - as in Example 4.2 - the initial responses of all
the state-variables will decay to zero as time, /, becomes large due to the presence of
exp(a^r) as the factor in all the elements of e Ar . Hence, a system with all eigenvalues
having negative real parts is asymptotically stable. This is the first stability criterion. By
the same token, if any eigenvalue A*, has a positive real part, a^ then the corresponding
factor exp(#£/0 will diverge to infinity as time, t, becomes large, signifying an unstable
system. This is the second stability criterion.
     In Example 4.4, we saw that if a zero eigenvalue is repeated twice, it leads to the
presence of terms such as ct, where c is a constant, in the elements of eAr (Eq. (4.51)).
More generally, if an eigenvalue, A#, which is repeated twice has zero real part (i.e.
A/.. = ibk), then eA/ will have terms such as ?sin(^0 and t cos(bkt) - and their combi-
nations - in its elements. If an eigenvalue with zero real part is repeated thrice, then eA/
will have combinations of t2 sin(^r), t2 cos(Z^/), t sin(^f), and / cos(^-f) in its elements.
Similarly, for eigenvalues with zero real parts repeated larger number of times, there will
be higher powers of t present as coefficients of the oscillatory terms in the elements of
e Ar . Hence, if any eigenvalue, A*, having zero real part is repeated two or more times,
the presence of powers of t as coefficients of the oscillatory terms, sin(^r) and cos(^f),
causes elements of eA? to blow-up as time, t, increases, thereby indicating an unstable
system. This is the third stability criterion.
     Note that individual initial responses to a specific initial condition may not be sufficient
to tell us whether a system is stable. This is seen in the following example.
   Example 4.5
   Reconsider the system of Example 4.4 with the initial condition, x(0) = [1; 0; O j 7 .
   Substituting the initial condition into Eq. (4.16), we get the following initial response
   for the system:
                                                        e -2r
                                              x(0)                  (t > 0)            (4.53)

   Equation (4.53) indicates that x(f) -> 0 as t -> oo. Thus, a system we know to
   be unstable from Example 4.4 (and from the third stability criterion), has an
   initial response decaying asymptotically to zero when the initial condition is x(0) =
   [1: 0; 0 ] r , which is the characteristic of an asymptotically stable system.
  Example 4.5 illustrates that we can be fooled into believing that a system is stable if
we look at its initial response to only some specific initial conditions. A true mirror of the
184_                           SOLVING THE STATE-EQUATIONS                          _


system's stability is its state-transition matrix, which reflects the three stability criteria.
If any element of the state-transition matrix grows to infinity as time becomes large, the
system is unstable. Then it is possible to find at least one initial condition that leads to an
unbounded initial response. The state-transition matrix contains information about how a
system will respond to an arbitrary initial condition. Hence, the stability of a system is
deduced from all possible initial conditions (i.e. the state-transition matrix), rather than
from only some specific ones.


4.4 Numerical Solution of Linear Time-Invariant
    State-Equations
In the previous sections, we saw two methods for calculating the state-transition matrix,
which is required for the solution of the linear state-equations. The diagonalization method
works only if the system eigenvalues are distinct. Calculating the state-transition matrix
by the inverse Laplace transform method of Eq. (4.47) is a tedious process, taking into
account the matrix inversion, partial fraction expansion, and inverse Laplace transfor-
mation of each element of the resolvent, as Example 4.4 illustrates. While the partial
fraction expansions can be carried out using the intrinsic MATLAB function residue, the
other steps must be performed by hand. Clearly, the utility of Eq. (4.47) is limited to
small order systems. Even for the systems which allow easy calculation of the state-
transition matrix, the calculation of the steady-state response requires time integration of
the input terms (Eq. (4.27)), which is no mean task if the inputs are arbitrary functions
of time.
   The definition of the matrix exponential, exp{A(r — /o)K by the Taylor series expansion
of Eq. (4.18) gives us another way of calculating the state-transition matrix. However,
since Eq. (4.18) requires evaluation of an infinite series, the exact calculation of
exp{A(f — to)} is impossible by this approach. Instead, we use an approximation to
exp{A(f — ?o)} in which only a finite number of terms are retained in the series on the
right-hand side of Eq. (4.18):

               exp{A(/ - r0)} % I + A(r - t0) + A 2 (r - t0)2/2
                                 + A3(t - f 0 ) 3 /3! + • • • + N(t - t0)N/N           (4.54)

   Note that the approximation given by Eq. (4.54) consists of powers of A(r — to) up
to N. In Eq. (4.54), we have neglected the following infinite series, called the remainder
series, R/v, which is also the error in our approximation of exp{A(f — to)}:

           RN = A"+1 (/ - t0)N+l/(N + 1)! + A" +2 (f - t0)N+2/(N + 2)!
                                                              oc
                  + N+3(t-t0)N+3/(N + 3)! + • • - . = £ A.k(t-t0)k/k                 (4.55)
                                                           *=yv+i

   Clearly, the accuracy of the approximation in Eq. (4.54) depends upon how large is
the error, RN, given by Eq. (4.55). Since RN is a matrix, when we ask how large is the
error, we mean how large is each element of R#. The magnitude of the matrix, R#, is
NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS                   185


a matrix consisting of magnitudes of the elements of R^. However, it is quite useful to
assign a scalar quantity, called the norm, to measure the magnitude of a matrix. There
are several ways in which the norm of a matrix can be defined, such as the sum of the
magnitudes of all the elements, or the square-root of the sum of the squares of all the
elements. Let us assign such a scalar norm to measure the magnitude of the error matrix,
R/v, and denote it by the symbol ||R/v||, which is written as follows:


                 IRA/II =                                    ||A*||(f-fo)V*             (4.56)


The inequality on the right-hand side of Eq. (4.56) is due to the well known triangle
inequality, which implies that if a and b are real numbers, then a + b < a + b. Now,
for our approximation of Eq. (4.54) to be accurate, the first thing we require is that the
magnitude of error, ||R/vli» be a finite quantity. Secondly, the error magnitude should
be small. The first requirement is met by noting that the Taylor series of Eq. (4.18)
is convergent, i.e. the successive terms of the series become smaller and smaller. The
mifinite series on the extreme right-hand side of Eq. (4.56) - which is a part of the
Taylor series - is also finite. Hence, irrespective of the value of N, ||R#|| is always finite.
From Eq. (4.56), we see that the approximation error can be made small in two ways:
(a) by increasing N, and (b) by decreasing (t — to). The implementation of Eq. (4.54) in
a computer program can be done using an algorithm which selects the highest power, TV,
based on the desired accuracy, i.e. the error given by Eq. (4.56). MATLAB uses a similar
algorithm in its function named expm2 which computes the matrix exponential using the
finite series approximation. Other algorithms based on the finite series approximation to
the matrix exponential are given in Golub and van Loan [1] and Moler and van Loan [2J.
The accuracy of the algorithms varies according to their implementation. The MATLAB
functions expm and expm] use two different algorithms for the computation of the matrix
exponential based on Laplace transform of the finite-series of Eq. (4.54) - which results
in each element of the matrix exponential being approximated by a rational polynomial
in s, called the Fade approximation. Compared to expm2 - which directly implements
the finite Taylor series approximation - expm and expml are more accurate.
   There is a limit to which the number of terms in the approximation can be increased.
Therefore, for a given N, the accuracy of approximation in Eq. (4.54) can be increased
by making (t — fo) small. How small is small enough? Obviously, the answer depends
upon the system's dynamics matrix, A, as well as on N. If (t — to) is chosen to be small,
how will we evaluate the state-transition matrix for large time? For this purpose, we will
use the time-marching approach defined by the following property of the state-transition
matrix (Table 4.1):

                     exp{A(f - t0)} = exp{A(r - f , ) } exp{A(ri - r{))}                (4.57)

where to < t < t. The time-marching approach for the computation of the state-transition
matrix consists of evaluating e AAf as follows using Eq. (4.54):

       eAAf % I + AA? + A 2 (A0 2 /2! + A 3 (Ar) 3 /3! + • • • + AN(&t)N/N             (4.58)
186_                               SOLVING THE STATE-EQUATIONS                                      _


where Af is a small time-step, and then marching ahead in time - like an army marches
on with fixed footsteps - using Eq. (4.57) with t = r0 + «Af and t = to + (n — l)Af as
follows:
                    exp{A(f0 + n A?)} = eAA' exp{A[f0 + (n - l)Af]}               (4.59)

   Equation (4.59) allows successive evaluation of exp{A(f0 + «Af)} for n = 1, 2, 3, ...
until the final time, f, is reached. The time-marching approach given by Eqs. (4.58)
and (4.59) can be easily programmed on a digital computer. However, instead of finding
the state-transition matrix at time, t > to, we are more interested in obtaining the solution
of the state-equations, Eq. (4.8), x(f), when initial condition is specified at time tQ. To do
so, let us apply the time-marching approach to Eq. (4.27) by substituting t = to + wA/,
and writing the solution after n time-steps as follows:
                                        to+nAt
                                                 exp{A(fo + n&t - r)}Bu(T)</r;             (n = 1, 2, 3, . . .)
                                 / -j
                                                                                                       (4.60)
For the first time step, i.e. n = 1, Eq. (4.60) is written as follows:
                                                        'o+A/
                                                                exp{A(r0 + Ar - r)}Bu(r)dr             (4.61)
                                                  / j
The integral term in Eq. (4.61) can be expressed as
             fo+f
             fo+Af                                                   /-A/
                                                                     /-/
                     exp{A(r0 + A/ - r)}Bu(r)dr = eAA' /                    e~ Ar Bu(/ 0 + T)dT        (4.62)
       / .j                                            Jo
where T = r — t0. Since the time step, Ar, is small, we can assume that the integrand
vector e~ArBu(?o + T) is essentially constant in the interval 0 < T < Af , and is equal to
e~AA'Bu(?o + A/). Thus, we can approximate the integral term in Eq. (4.62) as follows:
      /•Af
eAA' /        e-A7"Bu(r0 + T)dT % eAA'e-AA'Bu(r0 4- Ar)Af = Bu(r0 + Ar)Ar = Bu(r 0 )Ar
    Jo
                                                                               (4.63)
Note that in Eq. (4.63), we have used u(fo + Ar) = u(fo), because the input vector is
assumed to be constant in the interval to < t < to + A/. Substituting Eq. (4.63) into
Eq. (4.61), the approximate solution after the first time step is written as

                                x(r0 + AO % e AA 'x(r 0 ) + Bu(r 0 )Af                                 (4.64)

For the next time step, i.e. n = 2 and t = to + 2Af , we can use the solution after the first
time step, x(tQ + Af), which is already known from Eq. (4.64), as the initial condition
and, assuming that the input vector is constant in the interval tQ + Af < t < to + 2Ar,
the solution can be written as follows:

                          x(r0 + 2Af) % eAA'x(r0 + A/) + Bu(r0 + A/) A/                                (4.65)

The process of time-marching, i.e. using the solution after the previous time step as the
initial condition for calculating the solution after the next time step, is continued and the
NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS                                      187


solution after n time steps can be approximated as follows:

                                                      Bu(f0 + (n - l ) A / ) A f ;     (n = 1 , 2 , 3 , . . . )
                                                                                                          (4.66)
A special case of the system response is to the unit impulse inputs, i.e. u(f) = S(t —
r0)[ 1; 1; . . . ; 1 ] T . In such a case, the integral in Eq. (4.62) is exactly evaluated as
follows, using the sampling property of the unit impulse function, S(t — to), given by
Eq. (2.24):

                         f
                         J'to
                           tn
                                  exp{A(f0 + Af - r)}Bu(r)jT = e AAf B                                   (4.67)

which results in the following solution:

                                          -(n - l ) A / ) + B A f ] ;   (n = 1, 2, 3 , . . . )            (4.68)

Note that the solution given by Eq. (4.68) is an exact result, and is valid only if all the
inputs are unit impulse functions applied at time t = IQ.
   By the time-marching method of solving the state-equations we have essentially
converted the continuous-time system, given by Eq. (4.8), to a discrete-time (or digital)
system given by Eq. (4.66) (or, in the special case of unit impulse inputs, by Eq. (4.67)).
The difference between the two is enormous, as we will see in Chapter 8. While in a
continuous-time system the time is smoothly changing and can assume any real value, in
a digital system the time can only be an integral multiple of the time step, A? (i.e. A/
multiplied by an integer). The continuous-time system is clearly the limiting case of the
digital system in the limit A? —> 0. Hence, the accuracy of approximating a continuous-
time system by a digital system is crucially dependent on the size of the time step, A?; the
accuracy improves as A/ becomes smaller. The state-equation of a linear, time-invariant,
digital system with to = 0 can be written as

        x(/iAr) = A d x ( ( n - l ) A f ) + B d u ( ( n - l ) A f ) ;   (« = 1,2, 3, ...)                 (4.69)
where Ad and B<j are the digital state coefficient matrices. Comparing Eqs. (4.66) and
(4.69) we find that the solution of a continuous-time state-equation is approximated by
the solution of a digital state-equation with Ad = e AAr and Bd = BAf when the initial
condition is specified at time / = 0. The digital solution, x(«AO, is simply obtained from
Eq. (4.69) using the time-marching method starting from the initial condition, x(0), and
assuming that the input vector is constant during each time step. The digital solution of
Eq. (4.69) is easily implemented on a digital computer, which itself works with a non-zero
time step and input signals that are specified over each time step (called digital signals).
   The assumption of a constant input vector during each time step, used in Eq. (4.63),
results in a staircase like approximation of u(?) (Figure 4.3), and is called a zero-order
hold, i.e. a zero-order linear interpolation of u(f) during each time step, (n — 1)A/1 < t <
nAt. The zero-order hold approximates u(0 by a step function in each time step. It is a
good approximation even with a large time step, A?, if u(?) itself is a step like function
in continuous-time, such as a square wave. However, if u(0 is a smooth function in
continuous-time, then it is more accurate to use a higher order interpolation to approximate
u(t) in each time step, rather than using the zero-order hold. One such approximation is
188                                SOLVING THE STATE-EQUATIONS


                            u(t)
                                     First-order hold


                                                        Continuous-time



                                            Zero-order hold
                                    At




Figure 4.3   The zero-order and first-order hold digital approximations of a continuous-time input, u(f)


the first-order hold which approximates u(0 as a ramp function (i.e. a first-order linear
interpolation) in each time step (n — 1)A/ < / < nA/ (Figure 4.3).
   The conversion of a continuous-time system to the corresponding digital approximation
using the zero-order hold for the input vector (Eq. (4.66)) is performed by the MATLAB
Control System Toolbox (CST) function c2d, which calculates eAA' using the intrinsic
MATLAB function expm. The command c2d is employed as follows:

      »sysd = c2d(sysc,Ts,'method') <enter>

where sysc is the continuous-time state-space LTI object, Ts is the specified time step,
(Ar), and sysd is the resulting digital state-space approximation of Eq. (4.69). The
'method' allows a user to select among zero-order hold ('zo/O, first-order hold ('/o/i'), or
higher-order interpolations for the input vector, called Tustin (or bilinear) approximation
( l tustin'), and Tustin interpolation with frequency prewarping ('prewarp'). The Tustin
approximation involves a trapezoidal approximation for u ( l ) (/) in each time step (we
will discuss the Tustin approximation a little more in Chapter 8). Tustin interpolation with
frequency prewarping ('prewarp') is a more accurate interpolation than plain'tustin'. An
alternative to eld is the CST function c2dm, which lets the user work directly with the
state coefficient matrices rather than the LTI objects of the continuous time and digital
systems as follows:

      »[Ad,Bd,Cd,Dd] = c2dm(A,B,C,D,Ts,'method') <enter>

where A, B, C, D are the continuous-time state-space coefficient matrices, Ad, Bd, Cd,
Dd are the returned digital state-space coefficient matrices, and Ts and 'method' are the
same as in eld. For more information on these MATLAB (CST) commands, you may
refer to the Users' Guide for MATLAB Control System Toolbox [3].
   How large should be the step size, Ar, selected in obtaining the digital approximation
given by Eq. (4.69)? This question is best answered by considering how fast the system
is likely to respond to a given initial condition, or to an applied input. Obviously, a
fast changing response will not be captured very accurately by using a large Ar. Since
the state-transition matrix, e AA ', has elements which are combinations of exp(A*Ar),
where kk, k = 1, 2, etc., are the eigenvalues of A, it stand to reason that the time step.
NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS                  189


Af, should be small enough to accurately evaluate the fastest changing element of e A A r .
which is represented by the eigenvalue, A.fc, corresponding to the largest natural frequency.
Recall from Chapter 2 that the natural frequency is associated with the imaginary part,
b, of the eigenvalue, Ajt = a+bi, which leads to oscillatory terms such as s'm(bAt)
and cos(&Af) in the elements of e AAf (Example 4.2). Hence, we should select At such
that A? < l/l&lmax where |b|max denotes the largest imaginary part magnitude of all the
eigenvalues of A. To be on the safe-side of accuracy, it is advisable to make the time
step smaller than the ten times the reciprocal of the largest imaginary part magnitude, i.e.
A? < 0. l/|£| max . If all the eigenvalues of a system are real, then the oscillatory terms are
absent in the state-transition matrix, and one can choose the time step to be smaller than
the reciprocal of the largest real part magnitude of all the eigenvalues of the system, i.e.

   Once a digital approximation, Eq. (4.69), to the linear, time-invariant, continuous-time
system is available, the MATLAB (CST) command Ititr can be used to solve for x(«A/)
using time-marching with n = 1, 2, 3, ..., given the initial condition, x(0), and the input
vector, u(r), at the time points, t = (n — l ) A r , n = 1. 2, 3, . . . as follows:

      »x = ltitr(Ad,Bd,u,xO) <enter>

where Ad, Bd, are the digital state-space coefficient matrices, xO is the initial condition
vector, u is a matrix having as many columns as there are inputs, and the /th row of u
corresponds to the z'th time point, x is the returned matrix with as many columns as there

                           Table 4.2    Listing of the M-file march.m

                                    march.m
function [y,X] = march(A,B,C,D,XO,t,u,method)
% Time-marching solution of linear, time-invariant
% state-space equations using the digital approximation.
% A= state dynamics matrix; B= state input coefficient matrix;
% C= state output coefficient matrix;
% D= direct transmission matrix;
% X0= initial state vector; t= time vector.
% u=matrix with the ith input stored in the ith column, and jth row
% corresponding to the jth time point.
% y= returned output matrix with ith output stored in the ith column,
% and jth row corresponding to the jth time point.
% X= returned state matrix with ith state variable stored in the ith
% column, and jth row corresponding to the jth time point.
% method= method of digital interpolation for the inputs(see 'c2dm')
% copyright(c)2000 by Ashish Tewari
n-size(t,2);
dt=t(2)-t(1);
% digital approximation of the continuous-time system:-
[ad,bd,cd,dd]=c2dm(A,B,C,D,dt,method);
% solution of the digital state-equation by time-marching:-
X=ltitr(ad,bd,u,XO);
% calculation of the outputs:-
y=X*C'+u*D';
190                            SOLVING THE STATE-EQUATIONS


are state variables, and with the same number of rows as u, with the ith row corresponding
to the ith time-point (the first row of x consists of the elements of xO).
   The entire solution procedure for the state-space equation using the digital approxima-
tion of Eq. (4.66) can be programmed in a new M-file named march, which is tabulated
in Table 4.2. This M-file can be executed as follows:

      >>
           [y>x] = march(A,B,C,D,xO,t,u,'method') <enter>

where A, B, C, D, xO, u, x, and 'method' are the same as those explained previously in the
usage of the MATLAB (CST) command c2dm, while t is the time vector containing the
equally spaced time-points at which the input, u, is specified, and y is the returned matrix
containing the outputs of the system in its columns, with each row of y corresponding to
a different time-point.


  Example 4.6
  Using the time-marching approach, let us calculate the response of the system given
  in Example 4.1 when «(/) = us(t). Since the largest eigenvalue is —3, we can select
  the time step to be Ar < 1/3, or Ar < 0.333. Selecting A/ = 0.1, we can generate
  the time vector regularly spaced from t = 0 to t = 2 s, and specify the unit step
  input, M, as follows:

       »t=0:0.1:2; u=ones(size(t,2),1); <enter>




                       0.5




                                                             y2(0
                      -0.5
                                      0.5          1          1.5
                                                 Time (s)

               Figure 4.4    The calculated outputs, yi (t) and 72(t), for Example 4.6
NUMERICAL SOLUTION OF LINEAR TIME-IN VARIANT STATE-EQUATIONS                    191


Then, the M-file march.m is executed with zero-order hold, after specifying the state
coefficient matrices and the initial condition vector (it is assumed that the outputs
are the state variables themselves, i.e. C — I, D = 0) as follows:

»A= [-3 0; 0 -2]; B = [1; -1]; C = eye(2); D = zeros(2,1); XO = [1; 0]; <enter>
>>
  [y,X] = march(A,B,C,D,XO,t,u,'zoh'); <enter>

The outputs, which are also the two state variables, x(t) and x2(t), are plotted
against the time vector, t, in Figure 4.4 as follows:

     »plot(t,y) <enter>

You may verify that the result plotted in Figure 4.4 is almost indistinguishable from
the analytical result obtained in Eqs. (4.13) and (4.14), which for a unit step input
yield the following:
                   A-,(?) = (2e~3/ 4- l)/3;   x2(t) = (e~2t - 0/2                    (4.70)


Example 4.7
 In Examples 2.10 and 3.10, we saw how the linearized longitudinal motion of
 an aircraft can be represented by appropriate transfer functions and state-space
 representations. These examples had involved the assumption that the structure
 of the aircraft is rigid, i.e. the aircraft does not get deformed by the air-loads
 acting on it. However, such an assumption is invalid, because most aircraft have
 rather flexible structures. Deformations of a flexible aircraft under changing air-loads
 caused by the aircraft's motion, result in a complex dynamics, called aeroelasticity.
 Usually, the short-period mode has a frequency closer to that of the elastic motion,
 while the phugoid mode has little aeroelastic effect. The longitudinal motion of a
flexible bomber aircraft is modeled as a second order short-period mode, a second-
 order fuselage bending mode, and two first-order control-surface actuators. The
 sixth order system is described by the following linear, time-invariant, state-space
 representation:
    " 0.4158     1.025   -0.00267     -0.0001106   -0.08021                    0
     -5.5      -0.8302   -0.06549     -0.0039      -5.115                      0.809
       0     0 0           1.0          0        0
 A=
     -1040     -78.35    -34.83       -0.6214      -865.6                     -631
       0     0 0       0          -75            0
       0     0 0       0 0            -100

       " 0
         0
         0
        0
       75
        0 100
192                             SOLVING THE STATE-EQUATIONS


                                                Pitch-rate,      Normal
                                                   y2(0        acceleration,




                                                     C.G.       Normal
                                                              acceleration
                                                                                 Elevator
                                                                sensor

      Figure 4.5   Inputs and outputs for the longitudinal dynamics of a flexible bomber aircraft




      -[   -1491 -146.43 -40.2
                0    1.0   0
                                         -0.9412
                                           0
                                                       -1285 -564.66'


                                                                                             (4.71)

 The inputs are the desired elevator deflection (rad.), MI(/), and the desired canard
 deflection (rad.), U2(t), while the outputs are the sensor location's normal accelera-
 tion (m/s2), yi(0, and the pitch-rate (rad./s), j2(0- See Figure 4.5 for a description
 of the inputs and outputs.
    Let us calculate the response of the system if the initial condition and the input
 vector are the following:


            x(0) = [0.1; 0;       0;   0; 0;                  u(r) =                        (4.72)
                                                                             sin(120

 First, let us select a proper time step for solving the state-equations. The system's
 eigenvalues are calculated using the command damp as follows:

 »damp(A) <enter>

 Eigenvalue                                Damping               Freq. (rad/sec)
 -4.2501e-001 + 1.87486+OOOi               2.21096-001           1.92246+000
 -4.25016-001 - 1.87486+OOOi               2.21096-001           1.92246+000
 -5.08696-001 + 6.0289e+000i               8.40776-002           6.05036+000
 -5.08696-001 - 6.02896+OOOi               8.40776-002           6.05036+000
 -7.50006+001                              1 .00006+000          7.50006+001
 -1.00006+002                              1 .00006+000          1 . 00006+002

 The largest imaginary part magnitude of the eigenvalues is 6.03, while the largest
 real part magnitude is 100. Therefore, from our earlier discussion, the time step
 should be selected such that Af < 0.1/6 s and Ar < 1/100 s. Clearly, selecting the
 smaller of the two numbers, i.e. Ar < 1/100 s, will satisfy both the inequalities.
NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS                  193


Hence, we select A? = 1/150 s = 6.6667e — 003 s. The time vector, t, the input
matrix, u, and initial condition vector, xO, are then specified as follows:

»t = 0:6.66676-3:5; u = [ -0.05*sin(10*t) ; 0.05*sin(12*t) ] ' ;
 XO = [ 0 , 1 zeros(1 ,5) ] ' ; <enter>


Then the M-file march.m is used with a first-order hold for greater accuracy (since
the inputs are smoothly varying) as follows:

    »[yf,Xf] = march(A,B,C,D,XO,t,u, 'foh1 ) ; <enter>

To see how much is the difference in the computed outputs if a less accurate zero-
order hold is used, we re-compute the solution using march.m with 'zo/z' as the
'method':

    »[yz,Xz] =                                 j U , ' z o h ' ) ; <enter>


The computed outputs, y  ( t ) , and y2(t), are plotted in Figures 4.6 and 4.7, respec-
tively, for the zero-order and first-order holds. It is observed in Figure 4.6 that the
output y  ( t ) calculated using the first-order hold has slightly lower peaks when
compared to that calculated using the zero-order hold. Figure 4.7 shows virtually
no difference between the values of y2(/) calculated by zero-order and first-order
holds.


                    200                                  r          i
                                                          Zero-order hold
                    150                                  -First-order hold-.

                    100

                     50

                      0

                    -50

                   -100

                   -150

                  -200
                          0               2              3
                                              Time (s)

Figure 4.6 The normal acceleration output, /i(f), for the flexible bomber aircraft of
Example 4.7
194                             SOLVING THE STATE-EQUATIONS




                      0.05 -




                    -0-05 -


                      -0.1 -                                  Zero-order hold _
                                                              First-order hold


                    -0.15



      Figure 4.7    The pitch-rate output, 72(0, of the flexible bomber aircraft of Example 4.7


  The MATLAB (CST) function Isim is an alternative to march for solving the state-
equations by digital approximation, and is used as follows:
      >>
           [y,t,x] = lsim(sys,u,t,xO,'method'); <enter>

where sys is an LTI object of the system, while the arguments u, t, 'method' (either 'zo/i',
or '/0/z') and the returned output matrix, y, and state solution matrix, x, are defined in
the same manner as in the M-file march. The user need not specify which interpolation
method between 'zoh' and 'foh' has to be used in Isim. If a 'method' is not specified, the
function Isim checks the shape of the input, and applies a zero-order hold to the portions
which have step-like changes, and the first-order hold to the portions which are smooth
functions of time. In this regard, Isim is more efficient than march, since it optimizes the
interpolation of the input, u(r), portion by portion, instead of applying a user specified
interpolation to the entire input done by march. However, Isim can be confused if there
are rapid changes between smooth and step-like portions of the input. Hence, there is a
need for selecting a small time step for rapidly changing inputs in Isim.

  Example 4.8
  For the system in Example 4.7, compare the solutions obtained using the MATLAB
  (CST) command Isim and the M-file march when the initial condition is xO =
  [0.1; 0; 0; 0; 0; 0] r when the elevator input, M I ( f ) is a rectangular pulse
  applied at t = 0 with amplitude 0.05 rad. and duration 0.05 s, while the canard input,
  u2(t), is a sawtooth pulse applied at t = 0 with amplitude 0.05 rad. and duration
  0.05 s. The rectangular pulse and the sawtooth pulse are defined in Examples 2.5
  and 2.7, respectively.
NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS                    195


   Mathematically, we can express the input vector as follows, using Eqs. (2.32)
and (2.33):

                                  0.05[M.V ( f + 0 . 0 5 ) - M S ( 0 ]
                                                                                   (4.73)
                             r(0 - r(t - 0.05) - 0.05w,(f - 0.05)

where us(t) and r(0 are the unit step and unit ramp functions, respectively. Using
MATLAB, the inputs are generated as follows:

»dt=6.6667e-3; t=0:dt:5; u1=0.05*(t«3.05+dt); i=find(t<0.05+dt);
 u2=u1; u2(i)=t(i); u = [u1' u 2 ' ] ; <enter>

Assuming that A, B, C, D, xO are already available in the MATLAB workspace
from Example 4.7, we can calculate the response of the system using march as
follows:

    »[Y1,X1] = m a r c h ( A , B 3 C , D } X O , t , u J ' z o h ' ) ; <enter>

where Yl is the returned output matrix for zero-order hold. For comparison, the
solution is also obtained using him and the output is stored in matrix Y2 as follows:

    »sys=ss(A,B,C,D); [Y2,t,X2] = lsim(sys,u,t,XO); <enter>

   The computed outputs, y (0 and }>2(0, by the two different methods are compared
in Figures 4.8 and 4.9, respectively. Note that the responses calculated using march
with zero-order hold and him are indistinguishable.


                                                i         i         i
                                                - march with zero-order hold
                                                  Isim




Figure 4.8 Normal acceleration output for the flexible bomber aircraft in Example 4.8 with
rectangular pulse elevator input and sawtooth pulse canard input
196                                SOLVING THE STATE-EQUATIONS




                         0.05 -




                       -0.05



                        -0.1 -                    march with zero-order hold
                                                  Isim

                       -0.15
                               0


   Figure 4.9 Pitch-rate output for the flexible bomber aircraft in Example 4.8 with rectangular
   pulse elevator input and sawtooth pulse canard input


   When the inputs are impulse functions, the M-files march and Isim cannot be used
directly, because it is impossible to describe the impulse function (which, by definition,
goes to infinity in almost zero time) by an input vector. Instead, the digital approximation
is obtained using an equation similar to Eq. (4.68), which gives the solution if all the
inputs are unit impulse functions applied at t = IQ. For a more general case, i.e. when the
input vector is given by u(r) = 8(t — /o)[ c; C2', . . . ; cm ]T, where c, C 2 , . . . , cm are
constants, we can write the solution to the state-equation as follows:

       x(r0 +         = eAA'[x(?0 + (n- 1)AO + BcAf];            (n = 1, 2, 3 , . . . )     (4.74)

where c = [c GI ...; cm ]T. Comparing Eqs. (4.68) and (4.74), we find that the
digital approximation for impulse inputs is given by A<j = eAA' and B<j = e AA 'B Af, if and
only if the input vector is given by u(r) = us(t)c. For calculating the response to general
impulse inputs of this type applied at t = 0, we can write a MATLAB M-file in a manner
similar to march.m. Such an M-file, called impgen.m is given in Table 4.3. MATLAB
(CST) does have a standard M-file for calculating the impulse response called impulse.m,
which, however, is limited to the special case when all of the imputs are simultaneous
unit impulses, i.e. all elements of the vector c are equal to 1. Clearly, impgen is more
versatile than impulse. (MATLAB (CST) also has a dedicated function for calculating
the step response, called step, which also considers all inputs to be simultaneous unit
step functions.) The advantage of using the MATLAB command impulse (and step) lies
in quickly checking a new control design, without having to generate the time vector,
because the time vector is automatically generated. Also, for systems that are not strictly
proper (i.e. D ^ 0) the CST function impulse disregards the impulse in the response at
NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS                 197


                          Table 4.3    Listing of the M-ftle impgen.m

                                 impgen.m

function [y,X] = impgen(A,B,C,D,XO,t,c)
% Time-marching solution of linear, time-invariant
% state-space equations using the digital approximation when the
% inputs are impulse functions scaled by constants. The scaling
% constants for the impulse inputs are contained in vector 'c'.
% A= state dynamics matrix; B= state input coefficient matrix;
% C= state output coefficient matrix;
% D= direct transmission matrix;
% X0= initial state vector; t= time vector.
% y= returned output matrix with ith output stored in the ith
% column, and jth row corresponding to the jth time point.
% X= returned state matrix with ith state variable stored in the
% ith column, and jth row corresponding to the jth time point.
% copyright(c)2000 by Ashish Tewari
n=size(t,2);
m=size(c,2);
dt=t(2)-t(1);
% digital approximation of the continuous-time system:-
[ad,bd,cd,dd]=c2dm(A,BJC,D,dt,'zoh');
Bd=ad*bd;
u=ones(n,1)*c';
% time-marching solution of the digital state equation:-
X=ltitr(ad,Bd,u,XO);
% calculation of the outputs:-
y=X*C'+u*D';


t = 0 (see Eq. (2.115)). For details on the usage of these specialized CST functions, use
the MATLAB help command.


  Example 4.9
  For the flexible bomber aircraft of Example 4.7, let us determine the response if
  the initial condition is xO — [0.1; 0; 0; 0; 0; 0]T and the input vector is
  given by:



  First, the time vector, t, and the coefficient vector, c, are specified as follows:
       »dt=6.6667e-3; t=0:dt:10; c = [ 0 . 1 ; - 0 . 1 ] ; <enter>
  Then, impgen is invoked as follows, assuming A, B, C, D, xO have been already
  computed and stored in the MATLAB workspace:
198                                   SOLVING THE STATE-EQUATIONS


                       200        i     i       i      l        l       l     l    l    l

               «r 100
               1
               X    °
                * -100
                              A/w i     i      i       1
                                                           y^




                                                                1       1     1    1    1
                       200
                              )   1     2      3      4        5        6     7    8    9     10
                                                            Time (s)
                       0.4        l     i       l      i        i       i     i    i    i
                •ST     0.2
                ^a
                ~       0
                                                      _^
                ^ -0.2

                      -0.4(       l     l      l       i        i       i     i    i    i

                              ^
                              )   1     2      3      4        5
                                                            Time (s)
                                                                     6        7    8    9


   Figure 4.10 Response of the flexible bomber aircraft of Example 4.9 to elevator and canard
                                                                                              10




   impulse inputs of same magnitude but opposite signs

       » [ y , X ] =impge n ( A , B , C , D , XO , t , c ) ;        <enter>
   The computed outputs, y(t) and y2(0, which are the first and second columns of
   the returned matrix, y, respectively, are plotted in Figure 4.10. Note that we could
   not get this response from the CST function impulse, which is confined to the case
   ofc = [l;          If.


4.5 Numerical Solution of Linear Time-Varying
    State-Equations
There is no general analytical procedure of solving the state-equations for linear time-
varying systems (i.e. when the state coefficient matrices, A,B,C,D, are functions of time).
Thus, numerical solution procedures using digital approximation methods, similar to those
of the previous section, are required for solving the state-equations of such systems. For
special time-varying systems in which the state-dynamics matrix, A, is a constant and the
matrices B, C, and D are functions of time, the analytical solution given by Eq. (4.27) is
valid with the following modification:

                      = exp{A(r -                                    - r) B(r)u(r)dr;       > f0)   (4.76)
                                                      Jtn

where x(fo) is the initial condition and B(r) indicates the controls coefficient matrix
evaluated at time t = r. For linear, time-varying systems the output equation is given by:

                                                                                                    (4.77)
_              NUMERICAL SOLUTION OF LINEAR TIME-VARYING STATE-EQUATIONS_              199


For systems with a constant A matrix, the output can be calculated by Eq. (4.77), in which
x(f ) is calculated using Eq. (4.76). A digital approximation of Eq. (4.76) is given by

      x(nAr) = Adx((« - l)AO+B d ((n - l)A/)u((n - l)Af); (n = 1 - 2 , 3 . . . . )   (4.78)

where Ad = e AA/ and Bd((n — 1)AO = B((« — l)Ar)Ar. The solution given by
Eq. (4.78) can be implemented in a computer program, such as march.m. However, since
time-varying systems with a constant A matrix are rarely encountered, such a program
will be rarely used. Instead, we need a general solution procedure which is applicable to
a general time-varying system given by:

                                x ( I ) (0 = A(r)x(r) + B(r)u(r)                     (4.79)

   A practical procedure for solving Eq. (4.79) is the application of the time-marching
approach of Section 4.5, assuming that A(0 is constant during each time step, Ar, but

                            Table 4.4   Listing of the M-file vmarch.m

                                         vmarch.m
function [ y , X ] = vmarch(tvfun,XO,t,u, method)
% Time-marching solution of linear, time-varying
% state-space equations using the matrix exponential.
% X0= initial state vector; t= time vector;
% u=matrix with the ith input stored in the ith column, and jth row

% corresponding to the jth time point
% y= returned matrix with the ith output stored in the ith column,
  and jth row
% corresponding to the jth time point
% X= returned matrix with the ith state variable stored in the ith column,
% and jth row corresponding to the jth time point
% method= method of digital interpolation for the inputs (see 'c2dm')
% copyright (c)2000 by Ashish Tewari
n=size(t,2) ;
dt=t(2)-t(l);
% initial condition: -
X(1,:)=XO';
% function evaluation of time varying state coefficient matrices
% using the M-file 'tvfun.m' for initial time t=t(1):-
[A,B,C,D]=feval(tvfun,t(1));
% outputs for t=t(1 ) : -
y(1,:)=X(1,:)*C'+u(1,:)*D';
% beginning of the time-loop: -
for i=1 :n-1
% function evaluation of time varying state coefficient matrices
% using the M-file 'tvfun.m' for t=t(i):-
[A,B,C,D]=feval(tvfun,t(i));
% digital approximation of the continuous-time system: -
[ ad , bd , cd , dd ] =c2dm ( A , B , C , D , dt , method ) ;
% solution of the digital state and output equations :-
        : )=X(i, :)*ad'+u(i, :)*bd' ;
end
200_                              SOLVING THE STATE-EQUATIONS                           _


varies as we proceed from one time step to the next. In essence, this procedure applies a
zero-order hold to A(r). Thus, the approximate digital solution for a general time-varying
system can be written as follows:

        = Ad((n - l)AOx((n - l)Af) + Bd((n - l)Af)u((w - 1)A/); (n - 1, 2, 3, . . .)
                                                                                   (4.80)
where Ad = exp{A((n - l)Af)Af} and Bd((n - l)Af) = B((n - l)Af)Ar. A MATLAB
M-file can be written based on Eqs. (4.80) and (4.77) for computing the time marching
output of a general linear, time-varying system. Such an M-file, called vmarch.m is given
in Table 4.4.


  Example 4.10
  Consider the following linear, time-varying system:

                          -O.lsin(r)       0       1                    r0.2sin(f)~|    ,. 01.
                           0              -0.7cos(r)J ;       B( ) =
                                                                 '     [o         J    (4 81)
                                                                                         '
                              -1];     D(r) = -0.05 cos(r)                              (4.82)

  Let us calculate the output, y(0, when the initial condition is x(0) = [0; — l]r
  and the input is a unit setp function, u(t) = us(t). The time vector, initial condition,
  and input are specified by the following MATLAB command:

      »t = 0:0.1:10; XO = [0 - 1 ] ' ; u = ones(size(t,2) , 1); <enter>

  The time- vary ing coefficient matrices are calculated by the M-file timv.m tabulated
  in Table 4.5. Then, the solution to the time-varying state-equations and the output
  are obtained by calling vmarch.m as follows:
      >>
           [ y » X ] = vmarch( 'timv' , X O , t , u , ' z o h ' ) ; <enter>

  The resulting output, y(0, is plotted in Figure 4.11.

                              Table 4.5     Listing of the M-file timv.m
                                          timv.m
  function [A.B.C.D
  % Linear time-varying state coefficient matrices for Example 4.10.
  A=[-0.1*sin(t) 0;0 -0.7*cos(t) ] ;
  B=[0.2*sin(t);0];
  C=[1 - 1 ] ;
  D=-0.05*cos(t);
NUMERICAL SOLUTION OF LINEAR TIME-VARYING STATE-EQUATIONS                      201

                    2.2
                      2
                    1.8
                    1.6
                    1.4
                    1.2
                      1
                    0.8
                    0.6
                    0.4
                          0                     4              6               10
                                                    Time (s)

           Figure 4.11        Output of the linear, time-varying system of Example 4.10




Example 4.11
Let us obtain the response of an interesting time-varying system. Consider a surface-
to-air missile propelled by a rocket engine. Once launched, the rocket consumes
the fuel rapidly, thereby changing the mass, center-of-gravity, and moments of
inertia of the missile. Also, as the fuel is burned, the missile accelerates and
changes altitude. The aerodynamic forces and moments acting on the missile are
functions of the flight velocity and the altitude; therefore, the aerodynamic prop-
erties of the missile also keep changing with time. The motion of the missile is
described by the following state variables: velocities, U, V, and W, along three
mutually perpendicular axes, x, y, z, respectively, passing through the missile's
center of gravity, and the rotation rates, p, q, and r, about x, y, and z, respec-
tively. The state-vector is thus x(f) = [U(t) V(t); W(t); p(t); q(t}; r ( t ) ] T . All the
state-variables are assumed to be the outputs of the system. A diagram of the
missile showing the state-variables and the inputs is given in Figure 4.12. One
input to the missile is the rolling-moment, AL, about the longitudinal axis of the
missile caused by the deflection of an aerodynamic control surface. In addition, the
thrust from the rocket engine can be vectored (i.e. deflected) by small angles, a
and ft, in the longitudinal (X, Z) plane and lateral (Y, Z) plane, respectively, of
the missile (Figure 4.12). These thrust deflection angles constitute two additional
inputs to the missile. The input vector is u(?) = [a; ft; AL] r . The thrust of the
missile is assumed constant until the rocket motor burns-out at t = 20 s, after which
time the thrust is zero. The time-varying state-coefficient matrices representing the
202                                    SOLVING THE STATE-EQUATIONS


                                X, U




                                                                                Y, V




                                                                        Thrust

 Figure 4.12 State-variables and inputs for a surface-to-air missile equipped with thrust
 vectoring and aerodynamic roll control surfaces



 linearized motion of the missile are calculated by the M-file misstimv.m tabulated
 in Table 4.6.
 Let us calculate the response of the missile if the initial condition is zero, and the
 inputs are given by

                                                      0.01 sin(0
                                         u(f) =            0                                     (4.83)
                                                      0.01 cos(0

 The time vector, initial condition, and input are specified by the following MATLAB
 command:

 »t = 0:0.2:30; XO = zeros(6,1); u = [0.01*sin(0.1*t)' 0.01*cos(0.1*t)'
  z e r o s ( s i z e ( t , 2 ) , 1 ) ] ; <enter>


 The output and state solution are then calculated by the following call to vmarch.m:
      >>
           [ y J X ] = v m a r c h ( ' m i s s t i m v ' , X O , t , u , ' z o h ' ) ; <enter>

 The calculated outputs, £7(0, V(t), W(t), and p(t), are plotted in Figure 4.13, while
 the outputs q(t) and r(r) are shown in Figure 4.14. Note the discontinuity in the
 slopes of all the responses at t = 20 s, which is the rocket burn-out time.
NUMERICAL SOLUTION OF LINEAR TIME-VARYING STATE-EQUATIONS


           600                                             6

       5F 400                                     3/T 4
                                                  £
       § 200                                      "**•—'   P




              0                                            0
                  0   10          20    30                     0    10          20    30
                           t(s)                                          t(s)

            20                                             0

                                                  -0.01
       |              0
                                                  -0.02
       |f -20
                                                  -0.03

           -40                                    -0.04
                  0   10          20    30                     0    10          20    30
                           t(s)                                          t(s)

Figure 4.13 The outputs U(t), V(t), W(f), and p(t), for the missile of Example 4.11




                                       10    15                20    25              30




                                       10    15                20    25


      Figure 4.14 The outputs q(f) and r(t) for the missile of Example 4.11
204                           SOLVING THE STATE-EQUATIONS


                          Table 4.6    Listing of the M-file misstimv.m

                                  misstimv.m
   function [A,B,C,D]=misstimv(t);
   % Linear, time-varying state coefficient matrices for a missile
   %x=[uvwpqr]';
   % A= state dynamics matrix; B= state input coefficient matrix
   % C= state output coefficient matrix; D= direct transmission
   matrix
   % t= time after launch
   % copyright(c)2000 by Ashish Tewari
   % Thrust as a function of time:-
   if t<=20
         Th=1.27176+005;
   else
         Th=0;
   end
   % inertia properties as functions of time:-
   m=983.6716-29.4208*t-0.5812*tA2+0.0338*tA3;
   iy=1000*(2.5475-0.0942*t+0.0022*t~2);ix=iy/10;
   xcg=3.6356-0.0217*t-0.0008*t~2;
   % aerodynamic and propulsive properties as functions of time:-
   Zw=-(246.44+21.9038*t-1.5996*t*t+0.0244*tA3);
   Mw=-(872.95-52.7448*t-0.0006*tA2+0.0368*tA3);
   Mq=(-3-1.39*t+0.08*tA2)/10;
   Lr=0.0134+0.0029*t-0.0001*t~2;
   Lp=-0.0672-0.0143*t+0.0006*t~2;
   Lv=-0.1159-0.0317*t+0.0015*tA2;
   Zu=-9.5383-2.592*t+0.1209*t~2-0.0011*tA3;
   Xw=1 .9067+0.5186*t -0.0242*t "2+0.0002*^3;
   Md=1e5*(1.3425-2.3946*t+0.1278*t"2-0.0017*tA3);
   Zd=1e4*(-2.0143-3.6649*t+0.1854*tA2-0.0023*tA3);
   Yv=Zw;Nv=Mw;Nr=Mq;Np=Lp/10;Xu=Th/400+Zu/10;ci=(iy-ix)/iy;
   % the state coefficient matrices:-
   A=[Xu/m 0 Xw/m 0 0 0;0 Yv/m 0 0 0 0;Zu/m 0 Zw/m 0 0 0 ;
     0 Lv/ix 0 Lp/ix 0 Lr/ix;0 0 Mw/iy 0 Mq/iy 0;
     0 Nv/iy 0 Np/iy 0 Nr/iy];
   B=[0 0 0;Th/m 0 0;0 Th/m 0;0 0 1;0 Th*xcg/iy 0;Th*xcg/iy 0 0];
   C=eye(6);D=zeros(6,3);


4.6 Numerical Solution of Nonlinear State-Equations
The nonlinear state-equations are the most difficult to solve. As for time-varying systems,
there is no analytical solution for a set of general nonlinear state-equations. There are
several numerical schemes available for solving a set of nonlinear, first-order differential
equations using the digital approximation to the continuous-time differential equations.
Since the state-equations of a nonlinear system are also a set of nonlinear, first-order
differential equations, we can use such numerical schemes to solve the state-equations of
nonlinear systems. Due to the nonlinear nature of the differential equations, the solution
procedure often is more complicated than merely marching forward in time, as we did
NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS                       205


for linear systems in the previous two sections. Instead, an iterative solution procedure
may be required at each time step, which means that we assume a starting solution, and
then go back and keep on changing the assumed solution until the solution converges (i.e.
stops changing appreciably with the steps of the iteration).
   A general set of nonlinear state-equations can be expressed as follows:

                                 x ( l ) (0 = /(x(0.u(0,0                             (4.84)

where x(0 is the state-vector, u(0 is the input vector, and /(x(0, u(0, 0 denotes a
nonlinear function involving the state variables, the inputs, and time, t. The solution,
x(0, of Eq. (4.84) with the initial condition, x(?o) = x0 may not always exist. The exis-
tence of solution of nonlinear differential equations requires that the nonlinear function,
/(x(0, u(0, t), should be defined and continuous for all finite times, t > to. Also, it is
required that /(x(0, u(0, 0 must satisfy the following condition, known as the Lipschitz.
condition:
                  |/(x(0, u(f), 0 - /(x*(0, u(0, 01 < K  x ( t ) - x*(OI           (4.85)

where x*(0 is a vector different from x(0, K is a constant, and |V| denotes a vector
consisting of the absolute value of each element of the vector V. For greater details on
the existence of solution of ordinary nonlinear differential equations see a textbook on
ordinary differential equations, such as Henrici [4]. In this book, we will assume that we
are dealing with nonlinear system which have a solution to their state-equations. Owing
to the nonlinear nature of the differential equations, the numerical procedure cannot be
a one-shot (i.e. an open-loop) process, such as that used for linear differential equations.
Instead, an iterative solution procedure is required for nonlinear systems, which consists
of repeatedly evaluating the solution in a loop (such as the feedback loop) at each time
step, until the solution meets certain desirable conditions. Hence, a nonlinear solution
procedure itself is a closed-loop system.
    The digital solution procedures for Eq. (4.84) can be divided into single-step methods,
multi-step methods, and hybrid methods. The single-step methods obtain the approximate
solution vector by using the state-vector and input vector only at the previous time step.
The time marching solution methods of the previous two sections are single-step methods
for linear state-equations. For nonlinear systems, examples of single-step methods are
Runge-Kutta and Adams methods. The multi-step methods use information from more
than one previous time steps to obtain the approximate solution at a given time step. The
predictor-corrector methods are examples of multi-step methods. The hybrid methods are
those that either do not fall into the categories of single- and multi-step methods, or those
that use information from previous time steps as well as future (extrapolated) time steps.
The Euler method falls in the hybrid category. For more information on the numerical
solution methods for nonlinear differential equations see Ralston and Rabinowitz [5].
    While choosing which method to use for solving a nonlinear set of differential equations
one should consider numerical accuracy (how large is the digital approximation error),
efficiency (how fast is the algorithm when implemented on a computer), numerical stability
(whether the algorithm converges to a solution), and starting problem (how the algorithm
can be started). While the multi-step and hybrid methods offer a greater efficiency for
a comparable accuracy than the single-step methods, they are usually very difficult to
206_                          SOLVING THE STATE-EQUATIONS                                         _


start, and special attention must be paid in changing the time steps to avoid stability
problems. Such issues make multi-step or hybrid methods more complicated than the
single-step methods. Complexity of an algorithm often results in a reduced efficiency
when implemented in a computer program. A single-step method which is simple to
implement, and which provides good accuracy in a wide variety of problems is the
Runge-Kutta method. The Runge-Kutta method uses the following digital approximation
to Eq. (4.84):
                                                  p
                               (tn) - (tn-i) = ^ Ufa                          (4.86)
                                                 i=i
where tn and tn- are the nth and (n — l)th time steps, respectively, wf are constants, and
                                    1=1
                  k, = Afn/Cxa.-O + Tftyk^ua,-! ),*„_, +a l -Af n )                               (4.87)

where A?n =tn— tn-, a, and fa are constants, with a = 0. The time step size, Ar w ,
can be variable. The constants a, and fa are evaluated by equating the right-hand side
of Eq. (4.86), with the following Taylor series expansion:

                                                                   kx^fo-i)/*!                    (4.88)

However, since we cannot numerically evaluate an infinite series, the right-hand side of
Eq. (4.88) is approximated by a finite series of m terms as follows:
                                                          m
                         x(tn) - xfo,-,) %                        Ar^U-i)/*!                      (4.89)

The approximation given by Eq. (4.89) leads to a Runge-Kutta method of order m. The
higher the number of terms in the series of Eq. (4.89), the greater will be the accuracy
of the approximation. Comparing Eqs. (4.86) and (4.89), it can be shown that the largest
number of terms that can be retained in the series of Eq. (4.89) is m = p. Usually,
when m = 4, the resulting fourth order Runge-Kutta method is accurate enough for
most practical purposes. It can be shown [5] that substituting Eq. (4.89) into Eq. (4.86),
and making use of the exact differential equation, Eq. (4.84), results in the following
relationships for the parameters of the fourth order Runge-Kutta method:

                                                ;;;           (/=2,3,4)                           (4.90)
                                      7=1




                              '   '     '   *         f       ^     I     *   *   f   ^   '   '




                                      = 1/6;              W3d2p32 + ^("^42 + a 3/843) =
                                      +"3^43) = 1/8;                    W4&2P32P41 = 1/24         (4.91)
NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS                                  207


Equations (4.90) and (4.91) represent 11 equations and 13 unknowns. Hence, we can
obtain the solution of any 11 unknowns in terms of the remaining two unknowns, which
we choose to be a2 and #3. The Runge-Kutta parameters are thus the following:
       w = 1/2 + [1 - 2(a2 + a 3 )]/(I2a 2 a 3 );       w2 = (2a3 - l)/[12a3(a3 - «2)0 - « 2 )]
 u'3 = (1 -2a 2 )/[12a 3 (a 3 -a 2 )(l -a 3 )];   w4 = 1/2 + [2(a 2 +a 3 ) - 3]/[12(l - a 2 ) ( l -a 3 )]
                      032 = 023 = «,(«., - a 2 )/[2a 2 ( I - « 2 )];   «4 - 1                      (4.92)
    £42 = ^ = (1 - a 2 )[a 2 + a, - 1 - (2a3 - l) 2 ]/{2a 2 (a 3 - «2)[6a2a3 - 4(a2 + a 3 ) + 3]}
          043 = 034 = (I - 2a 2 )(l - a 2 )(l - a 3 )/{a 3 (a 3 - a2)[6a2a3 - 4(a2 + a 3 ) + 3]}


Obviously, we should take care to avoid selecting those values for the two parameters, «2
and «3, which lead to the denominators of the expressions in Eq. (4.92) becoming zero.
A popular choice of these two parameters is a2 = «3 — 1/2. However, the choice which
minimizes the approximation error in the fourth order Runge-Kutta method is ao — 0.4,
and «3 = 7/8 - (3/16)^5.
   The Runge-Kutta algorithm consists of marching in time using Eq. (4.86) with a vari-
able time step size, Atn. The truncation-error (i.e. error of approximating Eq. (4.88) by
Eq. (4.89)) is estimated using the matrix norm (such as the one defined in Section 4.5)
after each time step. If the error is acceptable, then the solution is updated; if not, the time
step size is reduced, and the error re-calculated until the error becomes acceptable. This
process is repeated for the next time step, using the solution from the previous step, and so
on until the final time is reached. Using MATLAB, a Runge-Kutta algorithm can be easily
programmed. Fortunately, MATLAB comes with intrinsic nonlinear functions ode23 and
ode45, which are based on third and fifth order Runge-Kutta algorithms, respectively.
Other MATLAB functions for solving nonlinear equations are ode 113, ode15s, ode23s,
ode23t, and ode23tb. The function odel!3 uses a variable order integration method for
nonlinear equations. The functions with names ending with the letters s, t, or tb are
specially suited for solving stiff equations. Stiff equations [5] are a set of first-order
nonlinear equations with a large difference in their time scales (e.g. solution to each
equation may have a significantly different time for reaching a steady state). The normal
solution procedure that takes into account only the shortest time scale of stiff equations
may either fail to converge, or may require very large number of time steps to arrive
at a steady state. Hence, stiff equations require special solution procedures [5]. We will
consider the more common variety of nonlinear equations (i.e. non-stiff equations) that
can be solved using ode23, odel!3, and ode45. These functions are used as follows to
obtain a solution to a set of nonlinear state-equations:

      »[t,X] = ode23(@fun,tspan,XO,options); <enter>

where @fun denotes a user supplied M-file, fun.m, in which the time derivative of the
state-vector, x (1) (r), is evaluated using Eq. (4.84), tspan = [ti tl t2 13 .. .tf] is a row
vector containing the initial time, ti, at which the initial condition vector, xO, is specified,
any intermediate times, tl, t2, t3, ..., at which the solution is desired (optional), and the
final time, tf, and t is a vector containing the time points at which the returned solution.
208                             SOLVING THE STATE-EQUATIONS


x, is obtained. The returned matrix x contains as many rows as there are the time points,
and each column of x corresponds to a state variable. The first executable statement of
the M-fileywn.ra should be the following:

      »function xdot = (t,x)
and the remaining statements offun.m should evaluate the derivative of the state-vector,
xdot, based on the state-vector, x, and time, t. Note that the input vector, u(r), is internal to
the M-file/wn.m, i.e. it is not used directly in ode23, odel!3 or ode45, but only indirectly
through xdot. The fourth input argument, options, can be used to specify relative error
and absolute error tolerances, Reltol (a scalar) and Abstol (a vector of the same size
as x), respectively, for convergence through the function odeset. This ensures that the
error in the ith component of the solution vector, JC,, does not exceed the greater number
between Reltolxi and Abstol(i). If options are not specified, then the default values of
relative tolerance of 0.001 and absolute tolerance of 10~6 are used. For more information
on the ode functions use the MATLAB's help command.

  Example 4.12
   Consider a double-pendulum (Figure 1.5). A choice of the state variables for this
   fourth order system is xi(r) = 6(t), x2(t) = 92(t), x3(t) = 0, (I) (f); x4(t) = 02t),
   which results in the following state-equations:




                        4(0 sin(x2(0 -
                        m 2 )gsin(;ti(f))]/[Li(mi + m 2 ) - m2L cos2(jr2(0 -
                        jc2(0) + L,jc 3 2 (/)sin(jr 2 (f) -jc,(r)) +   Lix(3l}(t)cos(x2(t)
              - jc, (r))]/L2 + u(t)/(m2L$)                                                   (4.93)

  where u(t) is the input torque applied on the mass, m 2 . Note that the last state-
  equation has a term involving x3lt) on the right-hand side. This has been done for
  the sake of brevity (you can substitute x3]t) from the previous state-equation
  into the last state-equation to obtain the state-equations in explicit form). It is
  desired to obtain the solution of Eq. (4.93) for the initial condition x(0) = [0.7 rad.;
   1.4 rad.; 0 rad./s; 0 rad./s]r and input, u(t) = 0.01 sin(5r)W-m. The function M-
  file for evaluating the time derivative of the state-vector, x ( 1 ) (f), is called doub.m
  and is tabulated in Table 4.7. Note that the input, u(t), must be specified within
  the function file doub.m, while the initial condition is specified in the call to the
  Runge-Kutta solver (either ode23 or ode45).
NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS                                                           209


                                       Table 4.7           Listing of the M-file doub.m

                                                            doub.m
function xp=doub(t,x)
% Nonlinear state-equations for a double-pendulum, excited
% by input, u ( t ) , torque acting on mass m2.
% x=[theta1 theta2 thetadotl thetadot2]
% xp is the time derivative of the state-vector, x.
% copyright(c)2000 by Ashish Tewari
m1=1;m2=2;l1=1;12=2;g=9.8;
u=0.01*sin(5*t);
xp(1,1)=x(3);
xp(2,1)=x(4);
x21=x(2)-x(1);
xp(3,1)=(m2*H*x(3)*x(3)*sin(x21)*cos(x21)+m2*l2*x(4)*x(4)*sin(x21)
   + m2*g*sin(x(2))*cos(x21)-(m1+m2)*g*sin(x(1)))/((m1+m2)*l1-...
   m2*H*cos(x21 ) * c o s ( x 2 1 ) ) ;
x p ( 4 , 1 ) =- ( g * s i n ( x ( 2 ) ) + l 1 * x ( 3 ) * x ( 3 ) * s i n ( x 2 1 ) + H * x p ( 3 ) * c o s ( x 2 1 ) ) / l 2
+u/(m2*12*12);

                                                             ode23.m;              ode45.m




                                   2

                                   1

                                   0

                                 -1
                                 -2
                                                                4              6                         10
                                                                    Time (s)

Figure 4.15 The calculated state variables, xi(f) = 6-(f) and X2(f) = #2(0 for the double-
pendulum, Example 4.12


    Let us compare the solutions obtained using ode23 and ode45, as follows:
» [ t 1 , x 1 ] = ode23(@doub, [0 10], [0.7 1.4 0 0 ] ' ) ; <enter>
» [ t 2 , x 2 ] = ode45(@doub, [0 10], [0.7 1.4 0 0 ] ' ) ; <enter>
»subplot(211), p l o t ( t 1 , x 1 ( : , 1 ) , t 2 , x 2 ( : , 1 ) ) , hold on, subplot(212),
 p l o t ( t 1 , x 1 ( : , 2 ) , t 2 , x 2 ( : , 2 ) ) <enter>
210                              SOLVING THE STATE-EQUATIONS


                                           ode23. m;               ode45. m
                       10
                        5
                        0
                      -5
                     -10
                            0        2          4              6          8        10
                                                    Time (s)




                      -5
                                                4              6                   10
                                                    Time (s)

 Figure 4.16 The calculated state variables, x3 (t) = 0{ ] ' (t), and X4 (0 = ^'' ( f ) k>r ^e double-
 pendulum, Example 4.12



    The resulting plots of Jti(r) and Jt2(0 are shown in Figure 4.15. Figure 4.16
 plotting xi(t) and x^(t} is obtained by the following commands:

 »newfig <enter>

 »subplot(211), p l o t ( t 1 , x 1 ( : , 3 ) , t 2 l x 2 ( : , 3 ) ) l hold on, subplot(212),
   plot(t1,x1(:,4) > t2,x2(:,4)) <enter>


     Note that in Figures 4.15 and 4.16, a very small difference is observed between
 the state variables calculated by ode23.m and those calculated by ode45.m. This
 difference is seen to increase with time, indicating a larger truncation error for
 the third order Runge-Kutta method of ode23.m when compared to the fifth order
 Runge-Kutta method of ode45. Since the truncation error is added up after each
 time step, there is an error accumulation as time increases. The double-pendulum
 falls into a special category of nonlinear systems, called chaotic systems, which were
 discussed in Section 1.3. Figure 1.6 compared the state variable, .*2(/), calculated
 for two very slightly different initial conditions and a zero input, and was generated
 using ode45. Figure 1.6 showed a large difference in the response, *2(r), when the
 initial conditions differed by a very small amount, which is the hallmark of a chaotic
 system.
_                NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS_                        211


Example 4.13
Let us consider another interesting nonlinear system, called the wing-rock
phenomenon. Wing-rock is a special kind of rolling and yawing motion observed
in modern fighter type aircraft when operating at a large angle of attack (defined as
the angle made by the longitudinal axis of the aircraft and the direction of flight).
The nonlinear state-equations modeling the wing-rock dynamics of a fighter aircraft
are the following [6J:




                                          Lrx5(t)


       4 ( t ) =x5(t)
       ( l}
        5 (t)   = -Npx2(t) - Npx4(t) - Nrx5(t)                                     (4.94)
where the state variables are, x(t): bank angle (rad.), x2(t): roll-rate (rad./s),
aileron deflection angle (rad.), X4(t): sideslip angle (rad.), and x^(t): sideslip-rate
(rad./s). The input, u(t), is the desired aileron deflection (rad.). The constants &>,
/Zj, ^L2, b, b2, LS, Lp, Lr, Np, Np, and Nr depend on the inertial and aerodynamic
properties of the aircraft, while the constant k is the aileron-actuator's time-constant
(the aileron is an aerodynamic control surface which is deployed using a first order
actuator). Let us obtain the solution to Eq. (4.94) when the initial condition is
x(0) = [1.0 rad.; 0.5 rad./s; 0 rad.; 0 rad.; 0 rad./s]r and the input is zero. The time
derivative of state-vector, x (1) (0, is evaluated using the M-file called wrock.m, which
is tabulated in Table 4.8.
    Using ode45, the initial response (i.e. response when u(t) = 0) is obtained as
follows:
    »[t,x]= ode45(@wrock, [0 700], [0.2 0 0 0 0]'); <enter>
   The plot of the bank angle, x(t), from / = 0 s to / = 700 s is shown in
Figure 4.17. Note that instead of decaying to zero in the limit t -> oo, the initial
response keeps on oscillating with a constant time period, and an amplitude which
becomes constant in the limit t —> oo. Such a motion is called a limit cycle motion.
Note that while the system is not unstable (i.e. the response does not tend to infinity
in the limit t -> oo), a limit cycle response is undesirable from weapons aiming
and delivery considerations, and also because it may lead to structural fatigue in
the aircraft (or other mechanical systems) thereby causing the wings to come-off.
Figure 4.18 shows a plot of x2(t) against x(t). Such a plot in which the time
derivative of a variable (x2(t) = xlt) is plotted against the variable itself (x(t)) is
called a phase-plane plot. Figure 4.18 shows that the limit cycle motion corresponds
to a limiting outer boundary in the phase-plane plot, indicating that the amplitude
212                            SOLVING THE STATE-EQUATIONS


                            Table 4.8    Listing of the M-file wrock.m

                                        wrock.m
 function xdot=wrock(t,x)
 % nonlinear state-equations for the wing-rock problem;
 % including first order aileron actuator
 % xdot is the time derivative of the state-vector, x.
 % copyright(c)2000 by Ashish Tewari
 a=[-0.05686 0.03254 0.07334 -0.3597 1.4681];
 % pure-rolling mode natural-frequency squared:-
 w=-0.354*a(1);
 % aileron-actuator time-constant:-
 k=1/0.0495;
 % linear aerodynamic coefficients:-
 lbet=-0.02822;lr=0.1517;np=-0.0629;nbet=1.3214;nr=-0.2491;ldelt=1;
 % nonlinear inertial and aerodynamic coefficients:-
 u(1)=0.354*a(2)-0.001;
 u(2)=0.354*a(4);
 b(1)=0.354*a(3);
 b(2)=0.354*a(5);
 % desired aileron deflection as the input, 'f':-
 f=0;
 % the nonlinear state-equations:-
 xdot(1,l)=x(2);
 xdot(2,1) = -w*x(1)+u(1)*x(2)+b(1)*x(2r3+u(2)*x(2)*x(ir2
        +b(2)*x(1)*x(2)"2...+ldelt*x(3)+lbet*x(4)-lr*x(5);
 xdot(3,1)=-k*x(3)+k*f;
 xdot(4,1)=x(5);
 xdot(5,1)=-nbet*x(4)+nr*x(5)-np*x(2);




                     -. 0
                      06        100     200   300 400       500     600   700
                                              Time (s)

 Figure 4.17 Initial response of bank angle, xi (f), for the wing-rock problem of Example 4.13
 showing a limit cycle motion (i.e. constant amplitude oscillation in the limit f —»• oc)
SIMUIATING CONTROL SYSTEM RESPONSE WITH SIMULINK                        213




                         -0.08
                             -0.6   -0.4



  Figure 4.18 Phase-plane plot of X2(f) vs. xi(f) for the wing-rock problem of Example 4.13
  showing the limit cycle boundary


                              x10~ 4
                                                            Limit cycle
                                                            boundary




                             -4     -3     - 2 - 1 0   1



  Figure 4.19 Phase-plane plot of X5(f) vs. xi(f) for the wing-rock problem of Example 4.13
  showing the limit cycle boundary


  of the motion has become constant. Similarly, Figure 4.19 shows the phase-plane
  plot of x5(t) against ^(O, displaying the limit cycle boundary.

4.7 Simulating Control System Response
    with SIMULINK
SIMULINK is very handy in quickly obtaining solutions to linear or nonlinear state-
equations resulting from control systems with many sub-systems, using the ordinary
differential equation solvers of MATLAB. SIMULINK allows the representation of each
214                               SOLVING THE STATE-EQUATIONS


system by a set of linear and nonlinear blocks, and lets inputs and outputs to be modeled as
special blocks called sources and sinks, respectively. A multivariable system can be repre-
sented either using the individual transfer functions between scalar inputs and outputs, or
more conveniently by state-space model blocks. Copying the blocks from the SIMULINK
block library makes simulating a control system very easy. Refer to Appendix B, or
SIMULINK User's Guide [7] for more information on SIMULINK. Since SIMULINK
works seamlessly with MATLAB and the Control System Toolbox (CST), you can draw
upon the functions libraries of MATLAB and CST (and any other toolboxes that you
may happen to have on your computer). The default simulation of SIMULINK uses the
MATLAB function ode45, which is a fifth order, variable time-step Runge-Kutta solver
(see Section 4.6). This allows a simulation of both linear and nonlinear state-equations.


  Example 4.14
  Let us simulate the step response of the flexible bomber aircraft (Example 4.7) using
  SIMULINK. The SIMULINK block diagram and the resulting simulation are shown
  in Figure 4.20. Note the state-space block modeling the aircraft dynamics, which
  requires that the state-coefficient matrices A, B, C, D of the aircraft (Eq. (4.71))
  be available in the MATLAB work-space. The source step input block applies
  simultaneous unit step inputs, u (t) and u2(t), to the aircraft, and the resulting output


                 _ir~
                                        i
                                      ^x=Ax+Bu: ?n                •
                                                                  •       *• '1 '1
                                         y= Cxt- Du               L   Normal acceleratio
                  Step           flexible bomber aircraft                      y
                                          dynamics


                                                                           •r       1        1


                                                                           Pitch rate
                                                                                        >2

                         onrin        I    I     I     I      I   i   I         i            I
                  ;£ 1000
                                          //A~~- - -
                  ^ -1000
                         ?nnn
                                      / y ^
                                           1    1     1       1   1   1         1            1
                                0 1        2   3     4       5 6      7   8              9 1 0
                                                           Time (s)




                             0 1           2   3     4        5 6     7   8              9 1 0
                                                           Time (s)

         Figure 4.20      Simulation of the flexible bomber's step response using SIMULINK
SIMULATING CONTROL SYSTEM RESPONSE WITH SIMULINK                                       215


  vector is split into its two scalar elements, y  ( t ) (normal acceleration), and '2(0
  (pitch-rate), by a demux block. The two simulated outputs are displayed individually
  on the scope blocks, as shown in Figure 4.20. The simulation is run with default
  parameters (variable time-step ode45 solver with relative error tolerance of 0.001
  and absolute tolerance of 10~6 per element).


   A useful feature of SIMULINK is the availability of many nonlinear blocks, such as
dead-zone, backlash, saturation, rate-limiter, switch, relay, coulomb and viscous friction,
etc., which are commonly encountered in modeling many practical control systems. The
following example illustrates the use of SIMULINK for a nonlinear control system.


  Example 4.15
  Let us simulate a nonlinear control system for controlling the roll dynamics of a
  fighter aircraft (Example 2.24). The aileron input, 8(t), to the aircraft is modeled

                                    Aileron actuator           Saturation


                                                                                           Bank angle
                                                                                              (Phi)




                      1.5

                       1

                      0.5

                       0
                            0   1             3        4       5       6                   10
                                                            Time (s)

                       t        I       I      I        I       I       I    I    I    I

                       3
                 CO
                 73
                 (0    2 -                                                                 _
                 CL                 L                                                  -
                       1                                                                _

                                1             I         i       I       I    I    i    I
                       °C)      1      2      3        4       5       6    7    8    9    1
                                                            Time (s)

  Figure 4.21    Simulation of a nonlinear control system for a fighter aircraft's roll dynamics using
  SIMULINK
216                             SOLVING THE STATE-EQUATIONS


  by a first-order actuator with a time-constant of 0.05 s, and a dead-zone in the
  interval —0.05 < t < 0.05. The actuator is saturated at 5(0 = ±0.3 rad. A nonlinear
  feedback control system is devised using a switch which allows a feedback gain
  of 1.9 when the roll-rate, p(t} = </> (1) (r), is greater than or equal to 1 rad/s, and a
  unity feedback otherwise. A nominal cascade compensator gain of 0.1 is used to
  achieve desirable response (which is different from that designed in Example 2.24
  due to the additional actuator dynamics). Figure 4.21 shows the SIMULINK block
  diagram and the resulting step response of the closed-loop system. Note that a zero
  overshoot, a zero steady-state error, zero oscillation, and a settling time of less than
  two seconds have been achieved, despite the nonlinear control system dynamics. A
  maximum roll-rate of about 3 rad/s is observed. This performance is representative
  of modern fighter aircraft, where the ability to achieve a large steady bank angle
  quickly and without any overshoots or oscillations is an important measure of the
  aircraft's dog-fighting maneuverability.


   SIMULINK has many advanced features for simulating a complex control system, such
as the creation of new sub-system blocks and masking blocks through M-files, C programs,
or SIMULINK block diagrams, for effortless integration in your system's model. This
allows an extension of the SIMULINK graphical functions to suit your own needs of
analysis and design. The SIMULINK demos and the User's Guide for SIMULINK [7] are
very helpful in explaining the advanced usage and extension of SIMULINK block library.



Exercises
 4.1. A homogeneous linear, time-invariant system is described by the following state-dynamics
      matrix:

                                               -2 -3         0
                                       A =      0  0         1                           (4.95)
                                                0 -2        -4
      (a) Find the state-transition matrix of the system.
      (b) Find the eigenvalues of the system. Is the system stable?
      (c) Calculate the response, x(f), of the system to the initial condition, x(0) =
          [l;-0.1;0.5] r .

 4.2. For a linear, time-invariant system described by the following state-space representation:




      calculate the response, x(r), if the initial condition is x(0) = [10; 2]T, and the input
      vector is u(r) = [/; ]T .
EXERCISES                                           217

4.3. The lateral dynamics of an aircraft are described by the following state-equation:

          V 1} (0~         "-15  0          -15     0" ~ P(t}~       "25     3 "
            r   (1)
                      (0      0 -0.8          10    0    r(t)          0    -3.5 I" MO "I
            $ (1) (0          0 -1          -0.8    0    P(t)          0     0   I <5tf(OJ        '
          _0(1)(0_            1 0             0     0 _0(0_            0     0
     (a) Determine the step response, x(r) = [/?(/): r(t) /3(t); </>(0] 7 , to the aileron input.
         SA(t) = M,(0-
     (b) Determine the step response, x(0 = [p(t) r(t); fi(t); 0(0] r , to the rudder input,
         8K(t) = u s ( t ) .
     (c) Determine the response, x(0 = [/?(/); r(r); fi(t} 0(01 7 , if the initial condition is
         /HO) = 0.1 rad/s,
         r(0) = 0(0) = 0(0) = 0, and the two inputs are zeros, 8A(t) = 8R(t) = 0.
     (d) Determine the response, y(t) = [p(t); 0(017 > if the initial condition is zero, x(0) = 0,
         and the input vector is u(0 = [8A(t) 8R(t)]T = [0.15(0; -0.1«5(?)]r.

4.4. For the compensated closed-loop chemical plant of Example 2.25 (for which a state-space
     representation was obtained in Exercise 3.9), determine the output, y ( t ) , and the plant
     input, u(t), if the desired output, ya(t), is a unit impulse function, and the initial condition
     is zero.

4.5. For the multivariable closed-loop system of Exercise 2.30 (for which a state-space repre-
     sentation was obtained in Exercise 3.13) with controller parameter K = 1, determine the
     output, y(f), and the plant input, u(t), if the desired output is yd(0 = [us(t); — u s ( t } ] T ,
     and the initial condition is zero.

4.6 A linear time-varying system has the following state-space representation:

                                          -5/13       1               r^/21
                               A(r) =                        ;B(r)                              (4.98)
                                                     -5/13            k'J
     Calculate the response, x(r), if the input is a unit step function and the initial condition is
     x(0) = [-l; l] r .

4.7. For the missile of Example 4.11, compute:
     (a) the step response to a(t) — u x ( t ) .
     (b) the step response to AL(t) = u s ( t ) .
     (c) the initial response, (t), to the initial condition, x(0) = [100; -10; 100; 0; 0; O]7 and
         zero input, u(0 = 0.

4.8. Solve the van der Pol equation (Eq. (2.204)) of Exercise 2.2, if a = 5 and b = 3, and the
     initial condition is given by ;c (1) (0) = —0.1, and x(0) = 0.5.
218                              SOLVING THE STATE-EQUATIONS


 4.9. Solve for the motion of the double-pendulum (Example 4.12) if the initial condition is
      zero, x(0) = 0, and the input torque is a unit step function, u ( t ) = us(t).


4.10. For the wing-rock dynamics of Example 4.13, solve for the bank angle, x(t), and roll-
      rate, X2(t), if the initial condition is zero, x(0) = 0, and the desired aileron input is a unit
      step function, u(t) = us(t).



References
1. Golub, G.H. and van Loan, C.F. Matrix Computation. Johns Hopkins University Press, 1983.
2. Moler, C.B. and van Loan, C.F. Nineteen dubious ways to compute the exponential of a matrix.
   SI AM Review, 20, 801-836, 1979.
3. Control System Toolbox-S.Ofor Use with MATLAB®-User's Guide, The Math Works Inc., Natick,
   MA, USA, 2000.
4. Henrici P., Discrete Variable Methods in Ordinary Differential Equations. John Wiley & Sons.
   New York, 1962.
5. Ralston, A. and Rabinowitz, P. A First Course in Numerical Analysis. McGraw-Hill, New York.
   1988.
6. Tewari, A. Nonlinear optimal control of wing rock including yawing motion. Paper No. AIAA-
   2000-4251, Proceedings ofAlAA Guidance, Navigation, and Controls Conference, Denver, CO.
   August 14-17,2000.
7. SIMULINK-4.0 User's Guide. The Math Works Inc., Natick, MA, USA, 2000.
5
Control System Design
in State-Space

5.1 Design: Classical vs. Modern
A fashion designer tailors the apparel to meet the tastes of fashionable people, keeping
in mind the desired fitting, season and the occasion for which the clothes are to be
worn. Similarly, a control system engineer designs a control system to meet the desired
objectives, keeping in mind issues such as where and how the control system is to be
implemented. We need a control system because we do not like the way a plant behaves,
and by designing a control system we try to modify the behavior of the plant to suit our
needs. Design refers to the process of changing a control system's parameters to meet the
specified stability, performance, and robustness objectives. The design parameters can be
the unknown constants in a controller's transfer function, or its state-space representa-
tion. In Chapter 1 we compared open- and closed-loop control systems, and saw how a
closed-loop control system has a better chance of achieving the desired performance. In
Chapter 2 we saw how the classical transfer function approach can be used to design a
closed-loop control system, i.e. the use of graphical methods such as Bode, Nyquist, and
root-locus plots. Generally, the classical design consists of varying the controller transfer
function until a desired closed-loop performance is achieved. The classical indicators of
the closed-loop performance are the closed-loop frequency response, or the locations of
the closed-loop poles. For a large order system, by varying a limited number of constants
in the controller transfer function, we can vary in a pre-specified manner the locations of
only a few of the closed-loop poles, but not all of them. This is a major limitation of the
classical design approach. The following example illustrates some of the limitations of
the classical design method.

  Example 5.1
  Let us try to design a closed-loop control system for the following plant transfer
  function in order to achieve a zero steady-state error when the desired output is the
  unit step function, us(t):

                         G(s) = (s + l)/[(s - 1)(5 + 2)(5 + 3)]                    (5.1)
220                         CONTROL SYSTEM DESIGN IN STATE-SPACE



   The single-input, single-output plant, G(s), has poles located at s = 1, s = — 2, and
   ^ = —3. Clearly, the plant is unstable due to a pole, s = 1, in the right-half s-plane.
   Also, the plant is of type 0. For achieving a zero steady-state error, we need to do
   two things: make the closed-loop system stable, and make type of the closed-loop
   system at least unity. Selecting a closed-loop arrangement of Figure 2.32, both of
   these requirements are apparently met by the following choice of the controller
   transfer function, H(s):
                                        H(s) = K(s - )/s                                 (5.2)

   Such a controller would apparently cancel the plant's unstable pole at s = 1 by a
   zero at the same location in the closed-loop transfer function, and make the system
   of type 1 by having a pole at 5 = 0 in the open-loop transfer function. The open-loop
   transfer function, G(s)H(s), is then the following:
                           G(s)H(s) = K(s + )/[s(s + 2)(s + 3)]                          (5.3)

   and the closed-loop transfer function is given by
                   Y(s)/Yd(s) = G(s)H(s)/[ + G(s)H(s)]
                                  = K(s + )/[s(s + 2)(5 + 3) + K(s + 1)]                 (5.4)



   From Eq. (5.4), it is apparent that the closed-loop system can be made stable by
selecting those value of the design parameter, K, such that all the closed-loop poles lie in
the left-half s-plane. The root-locus of the closed-loop system is plotted in Figure 5.1 as K

                          u.o       1     1     1       1        1     1     I

                          0.6

                          0.4
                                          +

                    w     0.2
                    Q.                                                 K>0 K<Q
                    S"     0' BOOOOO     O + +-H+Hf                         IMHK   -
                     c
                    'en
                    | -0.2-
                                          O
                         -0.4                                                      -
                                          0
                         -0.6 -          O

                          nQ        1     1     1       1        1     1     1
                           -3.5   -3    -2.5   -2     -1.5      -1   -0.5    0     0.5
                                                    Real part

Figure 5.1 Apparent loci of the closed-loop poles of Example 5.1 as the classical design parameter,
K, is varied from —1 to 1
DESIGN: CLASSICAL VS. MODERN                                221


 is varied from -1 to 1. Apparently, from Figure 5.1, the closed-loop system is stable for
 K > 0 and unstable for K < 0. In Figure 5.1, it appears that the pole s = p^ determines
 the stability of the closed-loop system, since it is the pole which crosses into the right-half
 s-plane for K < 0. This pole is called the dominant pole of the system, because being
 closest to the imaginary axis it dominates the system's response (recall from Chapter 4
 that the smaller the real part magnitude of a pole, the longer its contribution to the
 system's response persists). By choosing an appropriate value of K, we can place only
 the dominant pole, s = p3, at a desired location in the left-half s-plane. The locations
 of the other two poles, s = p and s ~ p^, would then be governed by such a choice
 of K. In other words, by choosing the sole parameter K, the locations of all the three
 poles cannot be chosen independently of each other. Since all the poles contribute to the
 closed-loop performance, the classical design approach may fail to achieve the desired
 performance objectives when only a few poles are being directly affected in the design
 process.
     Furthermore, the chosen design approach of Example 5.1 is misleading, because it
fails to even stabilize the closed-loop system! Note that the closed-loop transfer function
 given by Eq. (5.4) is of third order, whereas we expect that it should be of fourth order,
 because the closed-loop system is obtained by combining a third order plant with a
 first order controller. This discrepancy in the closed-loop transfer function's order has
 happened due to our attempt to cancel a pole with a zero at the same location. Such an
 attempt is, however, doomed to fail as shown by a state-space analysis of the closed-loop
 system.


   Example 5.2
   Let us find a state-space representation of the closed-loop system designed using
   the classical approach in Example 5.1. Since the closed-loop system is of the
   configuration shown in Figure 3.7(c), we can readily obtain its state-space repre-
   sentation using the methods of Chapter 3. The Jordan canonical form of the plant,
        , is given by the following state coefficient matrices:

                                         0  0                   0
                                        -2 0                    1/3
                                         0 -3                 -1/2
                        CP =        1    1]; 1                                         (5.5)

   A state-space representation of the controller, H ( s ) , is the following:

                       Ac=0;       Bc = K-       Cc = -l;    Dc = K                    (5.6)
   Therefore, on substituting Eqs. (5.5) and (5.6) into Eqs. (3.146)-(3.148), we get the
   following state-space representation of the closed-loop system:

                                 x(0=Ax(?)+Byd(0                                       (5.7)
                                                                                       (5.8)
222                        CONTROL SYSTEM DESIGN IN STATE-SPACE


   where
                  1           0         0       0                              0
                -K/3      (-2-K/3)    -K/3    -1/3                            K/3
                                                                      B=
                 K/2         K/2   (-3 + K/2) 1/2                            -K/2
                 -K         -K           is     0                              K
        C= [1 1 1 0];                                                                  (5.9)
   The closed-loop system is of fourth order, as expected. The closed-loop poles are
   the eigenvalues of A, i.e. the solutions of the following characteristic equation:
                                         0                 0              0
                          K/3      (A + 2 + K/3)          K/3            1/3
                         -K/2          -K/2          (A + 3 -K/2)        -1/2
                           K             K                 K              A
                                                                                      (5.10)


   It is evident from Eq. (5.10) that, irrespective of the value of K, one of the eigenvalues
of A is A = 1, which corresponds to a closed-loop pole at 5 = 1. Hence, irrespective of
the design parameter, K, we have an unstable closed-loop system, which means that
the chosen design approach of cancelling an unstable pole with a zero does not work.
More importantly, even though we have an unconditionally unstable closed-loop system,
the closed-loop transfer function given by Eq. (5.4) fools us into believing that we can
stabilize the closed-loop system by selecting an appropriate value for K. Such a system
which remains unstable irrespective of the values of the control design parameters is
called an unstabilizable system. The classical design approach of Example 5.1 gave us
an unstabilizable closed-loop system, and we didn't even know it! Stabilizability of a
system is a consequence of an important property known as controllability, which we
will consider next. (Although we considered a closed-loop system in Example 5.2, the
properties controllability and Stabilizability are more appropriately defined for a plant.)


5.2 Controllability
When as children we sat in the back seat of a car, our collective effort to move the car
by pushing on the front seat always ended in failure. This was because the input we
provided to the car in this manner, no matter how large, did not affect the overall motion
of the car. There was something known as the third law of Newton, which physically
prevented us from achieving our goal. Hence, for us the car was uncontrollable when we
were sitting in the car. The same car could be moved, however, by stepping out and giving
a hefty push to it from the outside; then it became a controllable system for our purposes.
Controllability can be defined as the property of a system when it is possible to take
the system from any initial state, x(r0), to any final state, x(t{), in a finite time, (tf — to).
by means of the input vector, u(t), to < t < tf. It is important to stress the words any
and finite, because it may be possible to move an uncontrollable system from some initial
CONTROLLABILITY                                    223


states to some final states, or take an infinite amount of time in moving the uncontrollable
system, using the input vector, u (?)• Controllability of a system can be easily determined
if we can decouple the state-equations of a system. Each decoupled scalar state-equation
corresponds to a sub-system. If any of the decoupled state-equations of the system is
unaffected by the input vector, then it is not possible to change the corresponding state
variable using the input, and hence, the sub-system is uncontrollable. If any sub-system
is uncontrollable, i.e. if any of the state variables is unaffected by the input vector, then
it follows that the entire system is uncontrollable.

  Example 5.3
   Re-consider the closed-loop system of Example 5.2. The state-equations of the
   closed-loop system (Eqs. (5.7)-(5.9)) can be expressed in scalar form as follows:

                  xl}(t)=X[(t)                                                   (5.1 la)
                      (l)
                  x   2(    t ) = -Kxi(t)/3 - (2 + K/3)x2(t) - Kx3(t)/3
                                                                                  (5. l i b )
                              = Kx{(t)/2 + Kx2(t)/2 + (-3 + K/2)x3(t)
                                +    x4(t)/2-Kyd(t)/2                             (5.1 Ic)
                  x (l t ) = -Kxi(t) - Kx2(t) - Kx3(t) + Kyd(t)                   (5.1 Id)

  On examining Eq. (5.1 la), we find that the equation is decoupled from the other
  state-equations, and does not contain the input to the closed-loop system, y d (t).
  Hence, the state variable, x i ( t ) , is entirely unaffected by the input, yd(t), which
  implies that the system is uncontrollable. Since the uncontrollable sub-system
  described by Eq. (5.11 a) is also unstable (it corresponds to the eigenvalue A = 1),
  there is no way we can stabilize the closed-loop system by changing the controller
  design parameter, K. Hence, the system is unstabilizable. In fact, the plant of this
  system given by the state-space representation of Eq. (5.5) is itself unstabilizable,
  because of the zero in the matrix Bp corresponding to the sub-system having eigen-
  value A = 1. The unstabilizable plant leads to an unstabilizable closed-loop system.

   Example 5.3 shows how a decoupled state-equation indicating an uncontrollable and
unstable sub-system implies an unstabilizable system.

  Example 5.4
  Let us analyze the controllability of the following system:

                                                             0
                                                             0
                                                                                   (5.12)
                                                            -1
                                                             1
224                       CONTROL SYSTEM DESIGN IN STATE-SPACE


   The system is unstable, with four zero eigenvalues. Since the state-equations of the
   system are coupled, we cannot directly deduce controllability. However, some of
   the state-equations can be decoupled by transforming the state-equations using the
   transformation z(f) = Tx(r), where
                                         1   1 0       0
                                         1 - 1 0       0
                                 T=                                                 (5.13)
                                         0 0 1         1
                                         0   0 1 -     1

   The transformed state-equations can be written in the following scalar form:

                                     z™(t)=x'3(t)                                  (5.14a)
                                     z(2t) = x'4(t)                              (5.14b)
                                     4'V)=0                                        (5.14c)
                                                                                  (5.14d)

   Note that the state-equation, Eq. (5.14c) denotes an uncontrollable sub-system in
   which the state variable, zi(t), is unaffected by the input, u(t). Hence, the system
   is uncontrollable. However, since the only uncontrollable sub-system denoted by
   Eq. (5.14c) is stable (its eigenvalue is, A = 0), we can safely ignore this sub-system
   and stabilize the remaining sub-systems denoted by Eqs. (5.14a),(5.14b), and (5.14d),
   using a feedback controller that modifies the control input, u(t). An uncontrol-
   lable system all of whose uncontrollable sub-systems are stable is thus said to be
   stabilizable. The process of stabilizing a stabilizable system consists of ignoring
   all uncontrollable but stable sub-systems, and designing a controller based on the
   remaining (controllable) sub-systems. Such a control system will be successful,
   because each ignored sub-system will be stable.

    In the previous two examples, we could determine controllability, only because certain
state-equations were decoupled from the other state-equations. Since decoupling state-
equations is a cumbersome process, and may not be always possible, we need another
criterion for testing whether a system is controllable. The following algebraic controlla-
bility test theorem provides an easy way to check for controllability.

Theorem
A linear, time-invariant system described by the matrix state-equation, x ( l ) (/) = Ax(/) +
Bu(f) is controllable if and only if the controllability test matrix
                      P = [ B ; AB; A2B; A3B; ...;            A M -'B]

is of rank n, the order of the system.

   (The rank of a matrix, P, is defined as the dimension of the largest non-zero
determinant formed out of the matrix, P (see Appendix B). If P is a square matrix,
CONTROLLABILITY                                        225

the largest determinant formed out of P is |P|. If P is not a square matrix, the largest
determinant formed out of P is either the determinant formed by taking all the rows
and equal number of columns, or all the columns and equal number of rows of P. See
Appendix B for an illustration of the rank of a matrix. Note that for a system of order
n with r inputs, the size of the controllability test matrix, P, is (n x nr). The largest
non-zero determinant of P can be of dimension n. Hence, the rank of P can be either less
than or equal to n.)
   A rigourous proof of the algebraic controllability test theorem can be found in
Friedland [2]. An analogous form of algebraic controllability test theorem can be
obtained for linear, time-varying systems [2]. Alternatively, we can form a time-varying
controllability test matrix as

    P(f)=[B(0;        A(r)B(0;     A 2 (f)B(r);   A 3 (r)B(r);   ...;   An~-](t)E(t)]      (5.15)

and check the rank of P(0 for all times, / > to, for a linear, time-varying system. If at any
instant, t, the rank of P(r) is less than n, the system is uncontrollable. However, we must
use the time-varying controllability test matrix of Eq. (5.15) with great caution, when the
state-coefficient matrices are rapidly changing with time, because the test can be practically
applied at discrete time step - rather than at all possible times (see Chapter 4) - and there
may be some time intervals (smaller than the time steps) in which the system may be
uncontrollable.

  Example 5.5
   Using the controllability test theorem, let us find whether the following system is
   controllable:

                                                     B
                                                         =
   The controllability test matrix is the following:

                              P = [B; AB] = Hu            ~2]                           (5.17)
                                                    L     -' J
   The largest determinant of P is |P| = — 1 ^ 0, Hence the rank of P is equal to 2,
   the order of the system. Thus, by the controllability test theorem, the system is
   controllable.

    Applying the algebraic controllability test involves finding the rank of P, and checking
whether it is equal to n. This involves forming all possible determinants of dimension n
out of the matrix P, by removing some of the columns (if m > 1), and checking whether
all of those determinants are non-zero. By any account, such a process is cumbersome if
performed by hand. However, MATLAB provides us the command rank(P) for finding
the rank of a matrix, P. Moreover, MATLAB 's Control System Toolbox (CST) lets you
directly form the controllability test matrix, P, using the command ctrb as follows:

      »P = ctrb(A, B) <enter>
226                      CONTROL SYSTEM DESIGN IN STATE-SPACE


      or

      »P = ctrb(sys) <enter>


where A and B are the state coefficient matrices of the system whose LTI object is sys.


   Example 5.6
   Let us verify the uncontrollability of the system given in Example 5.4,
   using the controllability test. The controllability test matrix is constructed as
   follows:

   »A=[0 0 1 0; zeros(1,3)1; zeros(2,4)]; B=[0 0 -1 1 ] ' ; P=ctrb(A,B)
    <enter>
   P =

       0 - 1 0 0
       0 1 0 0
      -1 0 0 0
       1 0 0 0

   Then the rank of P is found using the MATLAB command rank:

         »rank(P) <enter>

         ans =

           2

   Since the rank of P is less than 4, the order of the system, it follows from the
   controllability test theorem that the system is uncontrollable.


   What are the causes of uncontrollability? As our childhood attempt of pushing a car
while sitting inside it indicates, whenever we choose an input vector that does not affect
all the state variables physically, we will have an uncontrollable system. An attempt to
cancel a pole of the plant by a zero of the controller may also lead to an uncontrollable
closed-loop system even though the plant itself may be controllable. Whenever you see a
system in which pole-zero cancellations have occurred, the chances are high that such a
system is uncontrollable.

  Example 5.7
  Let us analyze the controllability of the closed-loop system of configuration shown
  in Figure 2.32, in which the controller, H(s), and plant, G(s), are as follows:

                    H(s) = K (s-2)/(s + 1);       G(s) = 3/(s - 2)              (5.18)
CONTROLLABILITY                                                 227


  The closed-loop transfer function in which a pole-zero cancellation has occurred at
  s = 2 is the following:

            Y ( s ) / Y d ( s ) = G ( s ) H ( s ) / [  + G(s}H(s)] = 3K/(s + 3K 4- 1)   (5.19)

  The Jordan canonical form of the plant is the following:

                         Ap = 2;      Bp = 3;            Cp = 1;       Dp = 0            (5.20)

  Note that the plant is controllable (the controllability test matrix for the plant is
  just P = Bp, which is of rank 1). The Jordan canonical form of the controller is the
  following:

                      Ac = —1;       Bc = K',            Cc — —3;        Dc = K          (5.21)

  The closed-loop state-space representation is obtained using Eqs. (3.146)-(3.148)
  as the following:

                                 (2-3/0          -9
                                   -K            -l
                         C = [1 0];         D=0                                          (5.22)

  The controllability test matrix for the closed-loop system is the following:
                                                 ^ If
                                                 ^? M
                                                             {Q W^- '""|i .J iV  1
                                                             I 7 /V
                                                                          "3 ]f / "1     , _   _ _ ,
                        P                    (    r          / a A 2 -(- A ) J
                                                                 ^      , ^/             ^ 5 - 23 )
                                                  A        — (^J

  To see whether P is of rank 2 (i.e. whether P is non-singular) let us find its
  determinant as follows:

                                                  -9AT 3 -3AT 2 + 9*3 + 3ff 2 = 0        (5.24)

  Since |P| = 0, P     is singular, its rank is less than 2. Therefore, the closed-
  loop system is       uncontrollable no matter what value of the controller
  design parameter,      K, is chosen. Hence, a controllable plant has led to
  an uncontrollable     closed-loop system in which a pole-zero cancellation has
  occurred.


   Other causes of uncontrollability could be mathematical, such as using superfluous
state variables (i.e. more state variables than the order of the system) when modeling
a system; the superfluous state variables will be definitely unaffected by the inputs to
the system, causing the state-space representation to be uncontrollable, even though the
system may be physically controllable. A rare cause of uncontrollability is too much
symmetry in the system's mathematical model. Electrical networks containing perfectly
balanced bridges are examples of systems with too much symmetry. However, perfect
symmetry almost never exists in the real world, or in its digital computer model.
228_                      CONTROL SYSTEM DESIGN IN STATE-SPACE                         _


   Now that we know how to determine the controllability of a system, we can avoid
the pitfalls of Examples 5.1 and 5.7, and are ready to design a control system using
state-space methods.


5.3 Pole-Placement Design Using Full-State Feedback
In Section 5.1 we found that it may be required to change a plant's characteristics by using
a closed-loop control system, in which a controller is designed to place the closed-loop
poles at desired locations. Such a design technique is called the pole-placement approach.
We also discussed in Section 5.1 that the classical design approach using a controller
transfer function with a few design parameters is insufficient to place all the closed-loop
poles at desired locations. The state-space approach using full-state feedback provides
sufficient number of controller design parameters to move all the closed-loop poles
independently of each other. Full-state feedback refers to a controller which generates
the input vector, u(0, according to a control-law such as the following:

                       u(r) = K[Xd(r) - x(01 - KdXd(f) - K n x n (»                   (5.25)

where x(0 is the state-vector of the plant, Xd(0 is the desired state-vector, x n (f) is the
noise state- vector and K, K<j and Kn are the controller gain matrices. The desired state-
vector, xj(0, and the noise state- vector, xn(0, are generated by external processes, and
act as inputs to the control system. The task of the controller is to achieve the desired
state-vector in the steady state, while counteracting the affect of the noise. The input
vector, u(f), generated by Eq. (5.25) is applied to the plant described by the following
state and output equations:

                             x (1) (0 = Ax(f) + Bu(r) + Fx n (r)                      (5.26)
                               y(0 = Cx(r) + Du(r) + Ex n (/)                         (5.27)

where F and E are the noise coefficient matrices in the state and output equations,
respectively. Designing a control system using full-state feedback requires that the plant
described by Eq. (5.26) must be controllable, otherwise the control input generated using
Eq. (5.25) will not affect all the state variables of the plant. Furthermore, Eq. (5.25)
requires that the all the state variables of the system must be measurable, and capable of
being fed back to the controller. The controller thus consists of physical sensors, which
measure the state variables, and electrical or mechanical devices, called actuators, which
provide inputs to the plant based on the desired outputs and the control-law of Eq. (5.25).
Modern controllers invariably use digital electronic circuits to implement the control-law
in a hardware. The controller gain matrices, K, Kj, and Kn are the design parameters of
the control system described by Eqs. (5.25)-(5.27). Note that the order of the full-state
feedback closed-loop system is the same as that of the plant. A schematic diagram of the
general control system with full-state feedback is shown in Figure 5.2.
   Let us first consider control systems having Xd(0 =0. A control system in which the
desired state-vector is zero is called a regulator. Furthermore, for simplicity let us assume
that all the measurements are perfect, and that there is no error committed in modeling
POLE-PIACEMENT DESIGN USING FULL-STATE FEEDBACK                        229




Figure 5.2 Schematic diagram of a general full-state feedback control system with desired state,
    )/ and noise, xn(f)


the plant by Eqs. (5.26) and (5.27). These two assumptions imply that all undesirable
inputs to the system in the form of noise, are absent, i.e. n(t) = 0. Consequently, the
control-law of Eq. (5.25) reduces to

                                        u(0 = -Kx(0                                      (5.28)

and the schematic diagram of a noiseless regulator is shown in Figure 5.3.
   On substituting Eq. (5.28) into Eqs. (5.26) and (5.27), we get the closed-loop state and
output equations of the regulator as follows:

                                   x (1) (0 = (A-BK)x(O                                  (5.29)
                                     y(0 = (C - DK)x(r)                                  (5.30)

Equations. (5.29) and (5.30) indicate that the regulator is a homogeneous system,
described by the closed-loop state coefficient matrices ACL = A — BK, BCL = 0> CCL =
C — DK, and DCL = 0. The closed-loop poles are the eigenvalues of ACL- Hence, by
selecting the controller gain matrix, K, we can place the closed-loop poles at desired
locations. For a plant of order n with r inputs, the size of K is (r x h). Thus, we have a
total of r • n scalar design parameters in our hand. For multi-input systems (i.e. r > 1),
the number of design parameters are, therefore, more than sufficient for selecting the
locations of n poles.




Figure 5.3 Schematic diagram of a full-state feedback regulator (i.e. control system with a zero
desired state-vector) without any noise
230_                      CONTROL SYSTEM DESIGN IN STATE-SPACE                      _


   Example 5.8
   Let us design a full-state feedback regulator for the following plant such that the
   closed-loop poles are s = —0.5 ± i:




   The plant, having poles at s = 1 and s = — 2, is unstable. Also, the plant is control-
   lable, because its decoupled state-space representation in Eq. (5.31) has no elements
   of B equal to zero. Hence, we can place closed-loop poles at will using the following
   full-state feedback gain matrix:

                                    K=[ATi;        K2]                            (5.32)

   The closed-loop state-dynamics matrix, ACL = A — BK, is the following:

                                                                                  (5.33)
                                              AI         (-24- K2)

   The closed-loop poles are the eigenvalues of ACL, which are calculated as follows:



                             = (A - 1 +ffiXA.+ 2 - K2) + K} K2 = 0                  (5.34)

   The roots of the characteristic equation (Eq. (5.34)) are the closed-loop eigenvalues
   given by

                        -K2+l)± 0.5(A'1 + K - 2KK2 - 6Kl - 2K2 + 9)
           = -0.5 ± /                                                              (5.35)

   Solving Eq. (5.35) for the unknown parameters, K and K2, we get

                                   Ki = K2 = 13/12                                (5.36)

   Thus, the full-state feedback regulator gain matrix which moves the poles from
   s = l,s = -2tos = -0.5 ± / is K = [13/12; 13/12] .



5.3.1 Pole-placement regulator design for single-input plants

Example 5.8 shows that even for a single-input, second order plant, the calculation for
the required regulator gain matrix, K, by hand is rather involved, and is likely to get out
of hand as the order of the plant increases beyond three. Luckily, if the plant is in the
controller companion form, then such a calculation is greatly simplified for single-input
plants. Consider a single-input plant of order n whose controller companion form is the
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                                      231

following (see Chapter 3):

                      ~-an-         -an-2     -<*n-3         •   ..     -a     -«o~           "i"
                           1           0          0               ..      0       0                 0
                           0           1          0                       0       0                 0
              A =
                           0           0           1              ..      0       0
                                                                                          ; B       0
                                                                                                         (5.37)

                           0          0           0                        1         0           0
                           0          0           0               ..      0          1          _0_

where « o , . . . , an- are the coefficients of the plant's characteristic polynomial s — A| =
s" + an-sn~[ + . . . + d[S 4- flo- The full-state feedback regulator gain matrix is a row
vector of n unknown parameters given by

                                                        K2;                                              (5.38)

   It is desired to place the closed-loop poles such that the closed-loop characteristic
polynomial is the following:

        sl - ACL| = sl - A + BK| = 5"                                         an-2s                     (5.39)

where the closed-loop state dynamics matrix, ACL = A — BK, is the following:
        ~ (—«,,_! — K )   (— 0«-2 — #2)     (—a,, -3 — KT,)           ... (-fll -*„_,)    (-OQ — Kn)-
                1                0                 0                             0              0
                0                1                 0                             0              0
                0                0                  1                            0              0
                                                                                                         (5.40)
ACL -

                0                0                 0                             1              0
                0                0                 0                             0              1
   It is interesting to note that the closed-loop system is also in the controller companion
form! Hence, from Eq. (5.40), the coefficients of the closed-loop characteristic polynomial
must be the following:

                               an-2 =fln-2+                               a — a                         Kn
                                                                                                         (5.41)
or, the unknown regulator parameters are calculated simply as follows:


                                                                                                         (5.42)
In vector form, Eq. (5.42) can be expressed as

                                                                                                         (5.43)

where of = [an- QLn-2 • • •', «i; «o] and a = an-; an-2', • • •', a; a0]. If the state-space
representation of the plant is not in the controller companion form, a state-transformation
232                        CONTROL SYSTEM DESIGN IN STATE-SPACE


can be used to transform the plant to the controller companion form as follows:

                            x'(r) = Tx(f); A' = TAT~'; B' = TB                        (5.44)

where x'(r) is the state-vector of the plant in the controller companion form, x(/) is the
original state-vector, and T is the state-transformation matrix. The single-input regulator's
control-law (Eq. (5.28)) can thus be expressed as follows:
                                                      -!„'/
                                «(0 = -          = -KT~'x'(0                          (5.45)

Since KT l is the regulator gain matrix when the plant is in the controller companion
form, it must be given by Eq. (5.43) as follows:

                                         KT~' = a - a                                 (5.46)

or

                                         K = (a - a)T                                 (5.47)

Let us derive the state-transformation matrix, T, which transforms a plant to its controller
companion form. The controllability test matrix of the plant in its original state-space
representation is given by

                           P = [B; AB; A2B;             ...;    A^B]                  (5.48)

Substitution of inverse transformation, B = T~*B', and A = T~!A'T into Eq. (5.48)
yields


                   A'B';      '2'
                            (A')2B';             (AT~'B'] =                           (5.49)

where P* is the controllability test matrix of the plant in controller companion form. Pre-
multiplying both sides of Eq. (5.49) with T, and then post-multiplying both sides of the
resulting equation with P-1 we get the following expression for T:

                                          T = PI*"1                                   (5.50)

You can easily show that P7 is the following upper triangular matrix (thus called because
all the elements below its main diagonal are zeros):
                           "1    -an-     -fln-2   • .        -a2   ~a
                            0      1       — an-   . •        -03   -a2
                            0      0          1         .      -«4   -a3
                                                                                      (5.51)

                            0      0         0                  1    -an-
                           _0      0         0          .      0       1
POLE-PIACEMENT DESIGN USING FULL-STATE FEEDBACK                                 233

Also note from Eq. (5.51) that the determinant of P' is unity, and that (P') ' is obtained
merely by replacing all the elements above the main diagonal of P' by their negatives.
Substituting Eq. (5.50) into Eq. (5.47), the regulator gain matrix is thus given by
                                           K = (a - a)P'P                                          (5.52)
   Equation (5.52) is called the Ackermann's pole-placement formula. For a single-input
plant considered here, both P and P' are square matrices of size (n x «). Note that if the
plant is uncontrollable, P is singular, thus T = p'p~' does not exist. This confirms our
earlier requirement that for pole-placement, a plant must be controllable.

  Example 5.9
  Let us design a full-state feedback regulator for an inverted pendulum on a moving
  cart (Figure 2.59). A linear state-space representation of the plant is given by
  Eqs. (3.31) and (3.32), of which the state coefficient matrices are the following:

                                 0               0 1 0                           0
                                 0               0 0 1                           0
               A=
                           + m)g/(ML)            0 0 0                      •I/(ML)
                           -mg/M                 0 0 0                         /M
                      1 0 0 0
               C=                                                                              (5.53)
                      0 1 0 0

  The single-input, u(t), is a force applied horizontally to the cart, and the two outputs
  are the angular position of the pendulum, 9 ( t ) , and the horizontal position of the
  cart, x(t). The state-vector of this fourth order plant is x ( t ) = [9(t) x ( t ) ; 0 ( l ) ( t ) ;
  x ( l ) ( t ) ] T . Let us assume the numerical values of the plant's parameters as follows:
  M = 1 kg, m — 0.1 kg, L — 1 m, and g = 9.8 m/s2. Then the matrices A and B
  are the following:

                                    0        0   1   0                  0'
                                    0        0   0   1                  0
                                                                                               (5.54)
                                   10.78     0   0   0                 -1
                                  -0.98      0   0   0                   1

  Let us first determine whether the plant is controllable. This is done by finding the
  controllability test matrix, P, using the MATLAB (CST) command ctrb as follows:

         »P = ctrb(A,B)) <enter>
         P =
        0                   -1.0000              0                   -10.7800
        0                   1.0000               0                   0.9800
        -1.0000             0                    -10.7800            0
        1.0000              0                    0.9800              0
234                      CONTROL SYSTEM DESIGN IN STATE-SPACE


  The determinant of the controllability test matrix is then computed as follows:
        »det(P) <enter>
        ans =
        -96.0400

  Since |P| ^ 0, it implies that the plant is controllable. However, the magnitude of
  |P| depends upon the scaling of matrix P, and is not a good indicator of how far
  away P is from being singular, and thus how strongly the plant is controllable.
  A better way of detecting the measure of controllability is the condition number,
  obtained using the MATLAB function cond as follows:

        »cond(p) <enter>
        ans =
         12.0773
  Since condition number of P is small in magnitude, the plant is strongly controllable.
  Thus, our pole-placement results are expected to be accurate. (Had the condition
  number of P been large in magnitude, it would have indicated a weakly controllable
  plant, and the inversion of P to get the feedback gain matrix would have been
  inaccurate.) The poles of the plant are calculated by finding the eigenvalues of the
  matrix A using the MATLAB command damp as follows:

        »damp(A) <enter>
        Eigenvalue          Damping          Freq. (rad/sec)
         3.2833              -1.0000         3.2833
            0                -1.0000         0
            0               -1.0000          0
        -3.2833             1.0000           3.2833

      The plant is unstable due to a pole with positive real-part (and also due to a
  pair of poles at s = 0). Controlling this unstable plant is like balancing a vertical
  stick on your palm. The task of the regulator is to stabilize the plant. Let us make
  the closed-loop system stable, by selecting the closed-loop poles as s = — 1 ± i ,
  and s = — 5 ± 5i. The coefficients of the plant's characteristic polynomial can be
  calculated using the MATLAB command poly as follows:

       »a=poly(A) <enter>
       a =
                1.0000     0.0000      -10.7800    0 0

  which implies that the characteristic polynomial of the plant is s4 — 10.78s2 = 0.
  Hence, the polynomial coefficient vector, a, is the following:

                             a = [0;    -10.78;    0;   0]                       (5.55)
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                          235


The characteristic polynomial of the closed-loop system can also be calculated using
the command poly as follows:
      »v = [-1+j; - 1 - j ; -5+5*j; -5-5*j]; alpha = poly(v) <enter>
      alpha =
        1 12 72 120 100

which implies that the closed-loop characteristic polynomial is a4 + 2a3 + 72a2 +
120a + 100, and the vector a is thus the following:

                          a = [12;         72;       120;        100]               (5.56)

Note that the MATLAB function poly can be used to compute the characteristic
polynomial either directly from a square matrix, or from the roots of the char-
acteristic polynomial (i.e. the eigenvalues of a square matrix). It now remains to
find the upper triangular matrix, P', by either Eq. (5.49) or Eq. (5.51). Since a
controller companion form is generally ill-conditioned (see Chapter 3), we would
like to avoid using Eq. (5.49) which involves higher powers of the ill-conditioned
matrix, A'. From Eq. (5.51), we get
                                   1   0     10.78           0
                                 0     1         0          10.78
                                                                                    (5.57)
                                 0 0 1                      0
                                 0 0 0                      1
   Finally, the regulator gain matrix is obtained through Eq. (5.52) as follows:
»Pdash=[1 0 10.78 0; 0 1 0 10.78; 0 0 1 0; 0 0 0 1 ] ; a=[0 -10.78 0 0 ] ;
                  alpha=[12 72 120 100]; K = (alpha-a)*Pdash*inv(P) <enter>
K =

-92.9841    -10.2041    -24.2449       -12.2449
  The regulator gain matrix is thus the following:

            K = [-92.9841;      -10.2041;             -24.2449;         -12.2449]   (5.58)

Let us confirm that the eigenvalues of the closed-loop state-dynamics matrix, ACL =
A — BK, are indeed what we set out to achieve as follows:
      »ACL = A-B*K <enter>
      ACL =
       0                0                        1.0000                 0
       0                0                        0                      1.0000
       -82.2041         -10.2041                 -24.2449               -12.2449
       92.0041          10.2041                  24.2449                12.2449
236                       CONTROL SYSTEM DESIGN IN STATE-SPACE


   The closed-loop poles are then evaluated by the command eig as follows:

         »eig(ACL) <enter>

         ans =
            -5.0000+5.00001
            -5.0000-5.0000i
            -1.0000+1.OOOOi
            -1.0000-1.00001

   Hence, the desired locations of the closed-loop poles have been obtained.

   The computational steps of Example 5.9 are programmed in the MATLAB (CST)
function called acker for computing the regulator gain matrix for single-input plants
using the Ackermann's formula (Eq. (5.52). The command acker is used as follows:
      »K = acker(A,B,V) <enter>

where A, B are the state coefficient matrices of the plant, V is a vector containing the
desired closed-loop pole locations, and K is the returned regulator gain matrix. Since
Ackermann's formula is based on transforming the plant into the controller companion
form, which becomes ill-conditioned for large order plants, the computed regulator gain
matrix may be inaccurate when n is greater than, say, 10. The command acker produces
a warning, if the computed closed-loop poles are more than 10% off from their desired
locations. A similar MATLAB (CST) function called place is also available for computing
the pole-placement regulator gain for single-input plants. The function place also provides
an output ndigits, which indicates the number of significant digits to which the closed-
loop poles have been placed. The design of Example 5.9 is simply carried out by using
the command place as follows:
      »V = [ - 1 + j ; - 1 - j ; -5+5*j; - 5 - 5 * j ] ; K = place(A,B,V) <enter>
      place: ndigits= 17
      K =
      -92.9841     -10.2041     -24.2449      -12.2449

The result is identical to that obtained in Example 5.9; ndigits = 17 indicates that the
locations of the closed-loop poles match the desired values up to 17 significant digits.
   The locations of closed-loop poles determine the performance of the regulator, such as
the settling time, maximum overshoot, etc. (see Chapter 2 for performance parameters)
when the system is disturbed by a non-zero initial condition. A design is usually specified
in terms of such performance parameters, rather than the locations of the closed-loop
poles themselves. It is the task of the designer to ensure that the desired performance is
achieved by selecting an appropriate set of closed-loop poles. This is illustrated in the
following example.
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                          237

Example 5.10
For the inverted-pendulum on a moving cart of Example 5.9, let us design a regu-
lator which achieves a 5% maximum overshoot and a settling time less than 1
second for both the outputs, when the cart is initially displaced by 0.01 m. The
state coefficient matrices, A, B, C, and D, of the plant are given in Eq. (5.53). The
initial condition vector has the perturbation to the cart displacement, x(t), as the
only non-zero element; thus, x(0) = [0; 0.01; 0; 0]r. Let us begin by testing whether
the regulator designed in Example 5.9 meets the performance specifications. This
is done by using the MATLAB (CST) function initial to find the initial response as
follows:
»t = 0:0.1:10; sysCL=ss(A-B*K, z e r o s ( 4 , 1 ) , C , D ) ; [ y , t , X ] = initial
 (sysCL,[0 0.01 0 0 ] ' , t ) ; <enter>

where y, X, and t denote the returned output, state, and time vectors and sysCL is
the state-space LTI model of the closed-loop system. The resulting outputs y(f) =
[0(0; x(t)]T are plotted in Figure 5.4.
   In Figure 5.4, both the responses are seen to have acceptably small maximum
overshoots, but settling-times in excess of 5 s, which is unacceptable. In order to
speed-up the closed-loop response, let us move all the poles deeper inside the left-
half plane by decreasing their real parts such that the new desired closed-loop poles
are s = —7.5 ± 7.5i, and s = —10 ± 10z. Then, the new regulator gain matrix, the
closed-loop dynamics matrix, and the initial response are obtained as follows:




                                   Cart's displacement, x(t),
                                   in meters

                                     Pendulum's angular position,
                                     9(t), in radians




                                          4          6                10
                                              Time (s)

Figure 5.4 Closed-loop initial response of the regulated inverted pendulum on a moving cart
to perturbation on cart displacement for the regulator gain matrix, K = [—92.9841; — 10.2041;
-24.2449;-12.2449]
238                          CONTROL SYSTEM DESIGN IN STATE-SPACE


   »V=[-7.5+7.5*j - 7 . 5 - 7 . 5 * j -10+10*j -10-10*]]'; K = place(A,B,V) <enter>

   place: ndigits= 19

   K =

   -2.91926+003   -2.29596+003 -5.7071e+002   -5.3571e+002
   »t = 0:0.01:2; sysCL=ss(A-B*K, zeros(4,1),C,D); [ y , t , X ] = initial(sysCL,
     [0 0.01 0 0]',t); <enter>

   The resulting outputs are plotted in Figure 5.5, which indicates a maximum over-
   shoot of the steady-state values less than 4%, and a settling time of less than 1 s
   for both the responses.


    How did we know that the new pole locations will meet our performance requirements?
We didn't. We tried for several pole configurations, until we hit upon the one that met
our requirements. This is the design approach in a nutshell. On comparing Figures 5.4
and 5.5, we find that by moving the closed-loop poles further inside the left-half plane,
we speeded-up the initial response at the cost of increased maximum overshoot. The
settling time and maximum overshoot are, thus, conflicting requirements. To decrease
one, we have to accept an increase in the other. Such a compromise, called a trade-
off, is a hallmark of control system design. Furthermore, there is another cost associated
with moving the poles deeper inside the left-half plane - that of the control input. Note
that the new regulator gain elements are several times larger than those calculated in
Example 5.9, which implies that the regulator must now apply an input which is much

                      0.04             I            I            I
                                   •Cart's displacement x(t), in meters
                      0.03

                      0.02                 Pendulum's angular position,
                                           0(f), in radians
                      0.01

                         0

                     -0.01

                     -0.02

                     -0.03
                                     0.5          1           1.5
                                               Time (s)

Figure 5.5 Closed-loop initial response of the regulated inverted pendulum on a moving cart to
perturbation on cart displacement for the regulator gain matrix, K = [—2919.2; —2295.9; —570.71;
-535.71]
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                           239


larger in magnitude than that in Example 5.9. The input, u(/) = — Kx(Y), can be calculated
from the previously calculated matrices, K and x, as follows:

      »u = - K * X ' ;     <enter>


   The control inputs for the two values of the regulator gain matrix are compared in
Figure 5.6. The control input, u ( t ) , which is a force applied to the cart, is seen to be more
than 200 times in magnitude for the design of Example 5.10 than that of Example 5.9.
The actuator, which applies the input force to the cart, must be physically able to generate
this force for the design to be successful. The cost of controlling a plant is a function of
the largest control input magnitude expected in actual operating conditions. For example,
if the largest expected initial disturbance in cart displacement were 0.1 m instead of
0.01 m, a ten times larger control input would be required than that in Figure 5.6. The
larger the control input magnitude, the bigger would be the energy spent by the actuator in
generating the control input, and the higher would be the cost of control. It is possible to
minimize the control effort required in controlling a plant by imposing conditions - other
than pole-placement - on the regulator gain matrix, which we will see in Chapter 6.
However, a rough method of ensuring that the performance requirements are met with
the minimum control effort is to ensure that all the closed-loop poles are about the same
distance from the imaginary axis in the left-half plane. The poles in the left-half plane that
are farthest away from the imaginary axis dictate the control input magnitude, while the
speed of response (i.e. the settling time of the transients) is governed by the poles with
the smallest real parts, called the dominant poles. If some closed-loop poles are close to,
and some are very far from the imaginary axis, it implies that too much control energy is
being spent for a given settling time, and thus the design is inefficient. The most efficient
closed-loop configuration thus appears to be the one where all the poles are placed in the

                             ou                          i               
                     1       20 :       K = [-291 9.2; -2295.9; -570.71; -535.71] _

                      <D     10
                      o
                     ,0            
                                 0            ^   ^—
                      Q.
                             m         ^-^                            
                                  0       0.2      0.4     0.6      0.8   1      1.2
                                                         Time (s)

                           0.1
                     S      0.1 h         K = [-92.984;-10.204;-24.245;-12.245] -

                      |B 0.05

                     I                0
                      Q.
                     - -0.05
                                  0       1        2        3       4     5      6
                                                         Time (s)

Figure 5.6 Control inputs of the regulated inverted pendulum on a moving cart for two designs of the
full-state feedback regulator
240                           CONTROL SYSTEM DESIGN IN STATE-SPACE


                               1           i      i     i     i      i       i,
                                                                    X
                             0.8
                                                        o
                             0.6 -

                      •c
                             0.4   - +
                      CO
                      Q.     0.2

                      I
                               0: <-                                     on = 2    -
                      1
                       -0.2                                              + n= 4    "
                                       +
                           -0.4 -
                           -0.6
                                                        0
                           -0.8                                     x
                                           i      i     i     i      i       +
                                                                             r
                               1
                               -1      -0.9     -0.8   -0.7 -0.6 -0.5      -0.4   -0.3
                                                         Real part

         Figure 5.7        Butterworth pattern of poles in the left-half plane for n = 2, 3, and 4


left half plane, roughly the same distance from the imaginary axis. To increase the speed
of the closed-loop response, one has to just increase this distance. One commonly used
closed-loop pole configuration is the Butterworth pattern, in which the poles are placed
on a circle of radius R centered at the origin, and are obtained from the solution of the
following equation:
                                                    2
                                               (s/R)"" = -                                           (5.59)

where n is the number of poles in the left-half plane (usually, we want all the closed-
loop poles in the left-half plane; then n is the order of the system). For n = 1, the
pole in the left-half plane satisfying Eq. (5.59) is s = —R. For n = 2, the poles in the
left-half plane satisfying Eq. (5.59) are the solutions of (s/R)2 + (s/R)V2 + 1 = 0 . The
poles satisfying Eq. (5.59) in the left-half plane for n = 3 are the solutions of (s//?)3 +
2(s/R)2 + 2(s/R) + 1=0. For a given n, we can calculate the poles satisfying Eq. (5.59)
by using the MATLAB function roots, and discard the poles having positive real parts.
The Butterworth pattern for n = 2, 3, and 4 is shown in Figure 5.7. Note, however, that
as n increases, the real part of the two Butterworth poles closest to the imaginary axis
decreases. Thus for large n, it may be required to move these two poles further inside
the left-half plane, in order to meet a given speed of response.

  Example 5.11
  Let us compare the closed-loop initial response and the input for the inverted
  pendulum on a moving cart with those obtained in Example 5.10 when the closed-
  loop poles are in a Butterworth pattern. For n = 4, the poles satisfying Eq. (5.59)
  in the left-half plane are calculated as follows:
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                       241


      »z = r o o t s ( [ 1 0 0 0 0 0 0 0 1 ] ) <enter>



       -0.9239+0.38271
       -0.9239-0.38271
       -0.3827+0.92391
       -0.3827-0.92391
        0.3827+0.92391
        0.3827-0.92391
        0.9239+0.38271
        0.9239-0.38271

   The first four elements of z are the required poles in the left-half plane, i.e. s/R =
-0.9239 ± 0.3827/ and s/R = -0.3827 ± 0.9239*. For obtaining a maximum over-
shoot less than 5% and settling-time less than 1 s for the initial response (the design
requirements of Example 5.10), let us choose R = 15. Then the closed-loop char-
acteristic polynomial are obtained as follows:

»i = find(real(z) < 0); p = poly(15*z(i) ) <enter>


 Columns 1 through 3
 1.00006+000        3.91976+001-3.5527e-015i                7.68206+002-5.68436-0141

 Columns 4 through 5
 8.81936+003-3.18326 -0121             5.06256+004-2.16546 -0111

  Neglecting the small imaginary parts of p, the closed-loop characteristic polyno-
mial is s4 + 39.197s3 + 768.2s2 + 8819.3s + 50625, with the vector a given by

»alpha=real(p(2:5)) <enter>
alpha =
  3.91976+001      7.68206+002     8.81936+003      5.06256+004


                    a =[39.197:       768.2;    8819.3;   50625]                  (5.60)

Then using the values of a, P, and P' calculated in Example 5.9, the regulator gain
matrix is calculated by Eq. (5.52) as follows:

      »K = (alpha-a)*Pdash*inv(P) <enter>

      K =
      -5.94486+003        -5.16580+003         -9.3913e+002      -8.99930+002

and the closed-loop state-dynamics matrix is obtained as
242                       CONTROL SYSTEM DESIGN IN STATE-SPACE


       »ACL=A-B*K <enter>

       ACL =

       0            0            1.OOOOe+000                        0
       0            0            0                                  LOOOOe+000
       -5.9340e+003 -5.16586+003 -9.39136+002                       -8.99936+002
       5.94386+003  5.16586+003  9.39136+002                        8.99936+002

 The closed-loop eigenvalues are calculated as follows:

       »eig(ACL) <enter>

       ans =
       -5.74036+000+1.38586+0011
       -5.74036+000-1.38586+001i
       -1.38586+001+5.74036+OOOi
       -1.38586+001 -5.74036+OOOi

 which are the required closed-loop Butterworth poles for R = 15. The initial
 response of the closed-loop system is calculated as follows, and is plotted in
 Figure 5.8:

 »t = 0 : 1 . 0 7 5 3 6 - 2 : 1 . 2 ; sysCL=ss(ACL,zeros(4,1),C,D); [y,t,X]=initial
  (sysCL,[0 0.01 0 0 ] ' , t ) ; <enter>




                   0.08         l       I       1       I       I
                               s Cart's displacement x(t), in meters
                   0.06
                                        Pendulum's angular position,
                   0.04                 9(t), in radians

                   0.02

                      0

                  -0.02


                  -0.04

                  -0.06
                               0.2    0.4     0.6      0.8             1.2
                                            Time (s)

 Figure 5.8 Initial response of the regulated inverted pendulum on a moving cart, (or the
 closed-loop poles in a Butterworth pattern of radius, R = 15
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                           243


                                          I       i
                               K = [-5944.8; -5165.8; -939.13; -899.93]




                                        0.4     0.6      0.8
                                              Time (s)

Figure 5.9 Control input for the regulated inverted pendulum on a moving cart, for closed-loop
poles in a Butterworth pattern of radius, R = 15


   Note from Figure 5.8 that the maximum overshoot for cart displacement is about
6% for both the outputs, and the settling time is greater than 1 s. The design is
thus unacceptable. The slow closed-loop response is caused by the pair of dominant
poles with real part —5.7403. If we try to increase the real part magnitude of the
dominant poles by increasing R, we will have to pay for the increased speed of
response in terms of increased input magnitude, because the poles furthest from
the imaginary axis (s/R = —0.9239 ± 0.38270 will move still further away. The
control input, w(0, is calculated and plotted in Figure 5.9 as follows:

    »u = -K*X'; plot(t.u) <enter>

   Figure 5.9 shows that the control input magnitude is much larger than that
of the design in Example 5.10. The present pole configuration is unacceptable,
because it does not meet the design specifications, and requires a large control
effort. To reduce the control effort, we will try a Butterworth pattern with R = 8.5.
To increase the speed of the response, we will move the dominant poles further
inside the left-half plane than dictated by the Butterworth pattern, such that all
the closed-loop poles have the same real parts. The selected closed-loop pole
configuration is s - -7.853 ± 3.2528i, and 5 = -7.853 ± 7.853i. The regulator
gain matrix which achieves this pole placement is obtained using MATLAB as
follows:

»format long e <enter>

»v=[-7.853-3.25281 -7.853+3.25281 -7.853-7.8531 -7.853+7.8531]'; K=place
  ( A , B , v ) <enter>

place: ndigits= 18
244                       CONTROL SYSTEM DESIGN IN STATE-SPACE


  K =
 Columns 1 through 3
  -1.3623640503602326+003 -9.0931607952022266+002 -3.4487416675480966+002

 Column 4
  -3.1346216675480896+002


 Note that we have printed out K using the long format, because we will need this
 matrix later. A short format would have introduced unacceptable truncation errors.
 The closed-loop initial response is calculated and plotted in Figure 5.10 as follows:
 »sysCL=ss(A-B*K,zeros(4,1),C,D); [ y , t , X ] = initial(sysCL,
   [0 0.01 0 0]', t); <enter>

                          0.03
                        0.025             Cart's displacement x(f),
                                          in meters
                         0.02
                                           Pendulum's angular position,
                        0.015              0(0, in radians
                         0.01
                        0.005
                               0
                       -0.005
                        -0.01
                       -0.015
                        -0.02
                                    0.2    0.4     0.6    0.8             1.2
                                                 Time (s)

 Figure 5.10 Initial response of the regulated inverted pendulum on a moving cart for the design
 of Example 5.11 with the closed-loop poles at s = -7.853 ± 3.25281, and s = -7.853 ± 7.853i



                                    Design of Example 5.10.
                                    _ Design of Example 5.11, with the
                                      closed-loop poles at s = -7.853 ±
                                      3.25281, and s = -7.853 ± 7.8S3/.




                         -10
                                   0.2    0.4      0.6    0.8             1.2
                                                 Time (s)

 Figure 5.11 Comparison of the control input for the design of Example 5.10 with that of
 Example 5.11 with closed-loop poles at s = -7.853 ± 3.25281, and s = -7.853 ± 7.S53/
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                   245


     Figure 5.10 shows that the closed-loop response has a maximum overshoot
  of about 2.5% and a settling time of 1 s, which is a better performance
  than the design of Example 5.10. The control input of the present design is
  compared with that of Example 5.10 in Figure 5.11, which shows that the former
  is less than half of the latter. Hence, the present design results in a better
  performance, while requiring a much smaller control effort, when compared to
  Example 5.10.


5.3.2 Pole-placement regulator design for multi-input plants

For a plant having more than one input, the full-state feedback regulator gain matrix of
Eq. (5.28) has (r x n) elements, where n is the order of the plant and r is the number
of inputs. Since the number of poles that need to be placed is n, we have more design
parameters than the number of poles. This over-abundance of design parameters allows
us to specify additional design conditions, apart from the location of n poles. What can
be these additional conditions? The answer depends upon the nature of the plant. For
example, it is possible that a particular state variable is not necessary for generating
the control input vector by Eq. (5.28); hence, the column corresponding to that state
variable in K can be chosen as zero, and the pole-placement may yet be possible. Other
conditions on K could be due to physical relationships between the inputs and the state
variables; certain input variables could be more closely related to some state variables,
requiring that the elements of K corresponding to the other state variables should be
zeros. Since the structure of the regulator gain matrix for multi-input systems is system
specific, we cannot derive a general expression for the regulator gain matrix, such as
Eq. (5.52) for the single-input case. The following example illustrates the multi-input
design process.

  Example 5.12
  Let us design a full-state feedback regulator for the following plant:
                           '0 0
                     A =    0 0.01                       0    -1
                            0 0                          0    -2
                            1 0
                     C=               D=                                         (5.61)
                            0 0              0 0
  The plant is unstable due to a pole at s = 0.01. The rank of the controllability test
  matrix of the plant is obtained as follows:

        »rank(ctrb(A, B)) <enter>

        ans =

            3
246                    CONTROL SYSTEM DESIGN IN STATE-SPACE



 Hence, the plant is controllable, and the closed-loop poles can be placed at will.
 The general regulator gain matrix is as follows:

                                                   ^3 I
                                                                                (5.62)
                                       K4          K6 J

 and the closed-loop state dynamics matrix is the following:

                            -K                  -K2
             ACL = A - BK = K4              (0.01 + *5)                         (5.63)
                            2K4                 2K5

 which results in the following closed-loop characteristic equation:


         |5l-AcLl =        -K4      (s - 0.01 - K5)                       =0    (5.64)
                          -2K4           -2K5             (5+0.1 -2K6)
 or
   (s + Ki)[(s - 0.01 - K5)(s + 0.1 - 2K6) - 2K5K6] + K4[K2(s + 0.1 - 2K6)
      + 2K3K5] + 2K4[K2K6 + K3(s - 0.01 - *5)] = 0                              (5.65)

 or
        + (0.09 -Ks- 2K6 + K})s2
         -Kx K5 - 0.001 + 0.02/£6 - 0. 1 K5)s + 0. 1 K2K4 + 0.02/T, K6
                     -QAKiKs- 0.02/^3^4 = 0                                     (5.66)

 Let us choose the closed-loop poles as s = — 1, and s = — 0.045 ±0.5i. Then
 the closed-loop characteristic equation must be (s + )(s +0.045 — Q.5i)(s +
 0.045 + 0.5/) = s3 + 1.09s2 + 0.342s + 0.252 = 0, and comparing with Eq. (5.66),
 it follows that


                                                                K5 = 0.343
          0. K2     0.02K, K6- 0.001 K} - 0.1 K  K5 -Q.       = 0.252         (5.67)

 which is a set of nonlinear algebraic equations to be solved for the regulator design
 parameters - apparently a hopeless task by hand. However, MATLAB (CST) again
 comes to our rescue by providing the function place, which allows placing the poles
 of multi-input plants. The function place employs an eigenstructure assignment
 algorithm [3], which specifies additional conditions to be satisfied by the regulator
 gain elements, provided the multiplicity of each pole to be placed does not exceed
 the number of inputs, and all complex closed-loop poles must appear in conjugate
 pairs. For the present example, the regulator gain matrix is determined using place
 as follows:
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                         247


   »A=[0 0 0;0 0.01 0;0 0 - 0 . 1 ] ; B = [ 1 0;0 - 1 ; 0 - 2 ] ; p = [ - 1 -0.045-0.51
    -0.045+0.51]; K=place(A,B,p) <enter>

   place: ndigits= 16
   K =

    0.9232 0.1570 -0.3052
    0.1780 -2.4595 1.1914

   »eig(A-B*K) <enter>

   ans =
    -1.0000
    -0.0450+0.50001
    -0.0450-0.50001

      You may verify that the computed values of the gain matrix satisfies
   Eq. (5.67).The optimal control methods of Chapter 6 offer an alternative design
   approach for regulators based on multi-input plants.


5.3.3 Poke-placement regulator design for plants with noise
In the previous two sections, we had ignored the presence of disturbances, or noise,
in a plant when designing full-state feedback regulators. Designs that ignore noise in
a plant are likely to fail when implemented in actual conditions where noise exists.
Noise can be divided into two categories: measurement noise, or the noise caused by
imperfections in the sensors that measure the output variables; and the process noise, or
the noise which arises due to ignored dynamics when modeling a plant. Since neither
the sensors nor a plant's mathematical model can be perfect, we should always expect
some noise in a plant. The state-equation of a plant with noise vector, x n ( t ) , is the
following:

                              x (1) (0 = Ax(0 + Bu(0 + Fx M (0                            (5.68)
where F is the noise coefficient matrix. To place the closed-loop poles at desired locations
while counteracting the effect of the noise, a full-state feedback regulator is to be designed
based on the following control-law:

                                  u(0 = -Kx(0 - K w x w (0                                (5.69)
Substituting Eq. (5.69) into Eq. (5.68) yields the following state-equation of the closed-
loop system:
                         x (1) (0 = (A - BK)x(0 + (F - BK w )x w (0                        (5.70)
Note that Eq. (5.70) implies that the noise vector, x M (0, acts as an input vector for
the closed-loop system, whose state-dynamics matrix is ACL = (A — BK). A schematic
diagram of the full-state feedback regulator with noise is shown in Figure 5.12.
248                       CONTROL SYSTEM DESIGN IN STATE-SPACE




        Figure 5.12    Schematic diagram of a full-state feedback regulator with noise, xn(f)


   The regulator feedback gain matrix, K, is selected, as before, to place the closed-
loop poles (eigenvalues of ACL) at desired locations. While we may not know the exact
process by which the noise, n(t), is generated (because it is usually a stochastic process,
as discussed in Chapter 1), we can develop an approximation of how the noise affects the
plant by deriving the noise coefficient matrix, F, from experimental observations. Once
F is known reasonably, the regulator noise gain matrix, K w , can be selected such that the
effect of the noise vector, x n (f), on the closed-loop system is minimized. It would, of
course, be ideal if we can make (F — BK W ) = 0, in which case there would be absolutely
no influence of the noise on the closed-loop system. However, it may not be always
possible to select the (rq) unknown elements of Kn to satisfy the (nq) scalar equations
constituting (F — BKn) = 0, where n is the order of the plant, r is the number of inputs,
and q is the number of noise variables in the noise vector, n(t). When r < n (as it is
usually the case), the number of unknowns in (F — BKn) = 0 is less than the number of
scalar equations, and hence all the equations cannot be satisfied. If r = n, and the matrix
B is non-singular, then we can uniquely determine the regulator noise gain matrix by
Kn = — B~1F. In the rare event of r > n, the number of unknowns exceed the number
of equations, and all the equations, (F - BKn) = 0, can be satisfied by appropriately
selecting the unknowns, though not uniquely.


  Example 5.13
  Consider a fighter aircraft whose state-space description given by Eqs. (5.26) and
  (5.27) has the following coefficient matrices:

               -1.7    50 260"                   -272'                   0.02       0.1
      A =       0.22   -1.4 -32                     0                  -0.0035      0.004
                0       0   -12                    14                    0          0
      C = I;     D = 0;   E=0                                                               (5.71)

      The state variables of the aircraft model are normal acceleration in m/s2, JCi(f),
  pitch-rate in rad/s, *2(/), and elevator deflection in rad, x^(t), while the input, u(t),
  is the desired elevator deflection in rad. (For a graphical description of the system's
  variables, see Figure 4.5.) The poles of the plant are calculated as follows:
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                       249

      »A=[-1.7 50 260; 0.22 -1.4 -32; 0 0 -12]; damp(A) <enter>
      Eigenvalue         Damping              Freq. (rad/sec)
        1.7700           -1.0000        1.7700
       -4.8700           1.0000         4.8700
      -12.0000           1.0000 12.0000
The plant is unstable due to a pole at s = 1.11. To stabilize the closed-loop system,
it is desired to place the closed-loop poles at s = — 1 ± / and 5 = — 1. The following
controllability test reveals a controllable plant, implying that pole-placement is
possible:

      »B=[-272 0 14]'; rank(ctrb(A,B)) <enter>
      ans =

            3

   The regulator feedback gain matrix is thus obtained as follows:
      »v = [ - i - i - i + i - 1 ] ; K = p l a c e ( A , B , v ) <enter>

      place: ndigits= 19
      K =
      0.0006      -0.0244      -0.8519
and the closed-loop state dynamics matrix is the following:

      »ACL=A-B*K <enter>
      ACL =

      -1.5267          43.3608           28.2818
      0.2200           -1.4000           -32.0000
      -0.0089          0.3417            -0.0733
   To determine the remaining regulator matrix, KM = [Kn            Kn2, let us look at
the matrix (F —

                                 '0.02 + 272^1       0.1+272/^2
                  F — BKn =          -0.0035            0.004                     (5.72)
                                     -AKn]

Equation (5.72) tells us that it is impossible to make all the elements of (F — BK n )
zeros, by selecting the two unknown design parameters, Kn and Kn2. The next best
thing to (F — BKn) = 0 is making the largest elements of (F — BK n ) zeros, and
living with the other non-zero elements. This is done by selecting Kn = —0.02/272
and Kni = -0.1/272 which yields the following (F - BKn):

                                          0           0
                        F - BK« =        -0.0035     0.004                        (5.73)
                                          0.00103    0.00515
250                    CONTROL SYSTEM DESIGN IN STATE-SPACE


 With (F — BK,,) given by Eq. (5.73), we are always going to have some effect of
 noise on the closed-loop system, which hopefully, will be small. The most satis-
 fying thing about Eq. (5.73) is that the closed-loop system given by Eq. (5.70) is
 uncontrollable with noise as the input (you can verify this fact by checking the
 rank of ctrb (Act, (F — BK,,)). This means that the noise is not going to affect
 all the state variables of the closed-loop system. Let us see by what extent the
 noise affects our closed-loop design by calculating the system's response with a
 noise vector, n(t) — [1 x 10~5; —2 x 10~6]r sin(lOOr), which acts as an input to
 the closed-loop system given by Eq. (5.70), with zero initial conditions. Such a
 noise model is too simple; actual noise is non-deterministic (or stochastic), and
 consists of a combination of several frequencies, rather than only one frequency
 (100 rad/s) as assumed here. The closed-loop response to noise is calculated by
 using the MATLAB (CST) command Isim as follows:
 »t=0:0.01:5; xn=[1e-5 -2e-6]'*sin(100*t) ; Bn=[0 0;-3.5e-3 0.004;1 .03e-3 5.15e-3];
   <enter>

 »sysCL=ss(ACL,Bn,eye(3),zeros(3,2)) ; [y,t,X]=lsim(sysCL,xn',t') ; plot(t.X) <enter>

    The resulting closed-loop state variables, x(t), *2(0, and x ^ ( t ) , are plotted
 in Figure 5.13, which shows oscillations with very small amplitudes. Since the
 amplitudes are very small, the effect of the noise on the closed-loop system can
 be said to be negligible. Let us see what may happen if we make the closed-
 loop system excessively stable. If the closed-loop poles are placed at s = —100,
 s = — 100±100/, the resulting closed-loop response to the noise is shown in
 Figure 5.14. Note that the closed-loop response has increased by about 300 times in




 Figure 5.13 Closed-loop response of the regulated fighter aircraft to noise, when the
 closed-loop poles are s = — 1, s = — 1 ± /
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                      251


                            x 10"                      x2(t);         x3(0


                        6

                        4

                        2

                        0   ^v^i^^
                       -2

                       -4

                       -6


                                    0.5        1                1.5
                                            Time (s)

   Figure 5.14 Closed-loop response of the regulated fighter aircraft to noise, when the
   closed-loop poles are s = -100, s = -100 ± 100 /


   magnitude, compared with that of Figure 5.13. Therefore, moving the poles too far
   into the left-half plane has the effect of increasing the response of the system due to
   noise, which is undesirable. This kind of amplified noise effect is due to the resulting
   high gain feedback. High gain feedback is to be avoided in the frequency range of
   expected noise. This issue is appropriately dealt with by filters and compensators
   (Chapter 7).


    The conflicting requirements of increasing the speed of response, and decreasing the
effect of noise are met by a pole configuration that is neither too deep inside the left-half
plane, nor too close to the imaginary axis. The optimum pole locations are obtained by
trial and error, if we follow the pole-placement approach. However, the optimal control
methods of Chapters 6 and 7 provide a more effective procedure of meeting both speed
and noise attenuation requirements than the pole-placement approach.


5.3.4 Pole-placement design of tracking systems

Now we are in a position to extend the pole-placement design to tracking systems, which
are systems in which the desired state-vector, x d (r), is non-zero. Schematic diagram
of a tracking system with noise was shown in Figure 5.2, with the plant described by
Eqs. (5.26) and (5.27), and the control-law given by Eq. (5.25). The objective of the
tracking system is to make the error, e(f) = (xd(0 - x(0), zero in the steady-state, while
counteracting the effect of the noise, x w (r). If the process by which the desired state-
vector is generated is linear and time-invariant, it can be represented by the following
252                        CONTROL SYSTEM DESIGN IN STATE-SPACE


state-equation:
                                        /1 
                                                                                          (5.74)

   Note that Eq. (5.74) represents a homogeneous system, because the desired state vector
is unaffected by the input vector, u(/). Subtracting Eq. (5.26) from Eq. (5.74), we can
write the following plant state-equation in terms of the error:

                    xdn(0 - x (1) (0 = A dXd (0 - Ax(0 - Bu(0 - Fxn(0                     (5.75)

or

                     e (1) (0 = Ae(0 + (Ad - A)Xd(r) - Bu(?) - ¥xn(t)                     (5.76)

and the control-law (Eq. (5.25)) can be re- written as follows:

                             u(0 = Ke(0 - KdXdCO - K,,xw(0                               (5.77)

Referring to Figure 5.2, we see that while K is a feedback gain matrix (because it
multiplies the error signal which is generated by the fed back state-vector), Kd and
Kn are feedforward gain matrices, which multiply the desired state- vector and the noise
vector, respectively, and hence feed these two vectors forward into the control system.
Substituting Eq. (5.77) into Eq. (5.76) yields the following state-equation for the tracking
system:

           e (1) (0 = (A - BK)e(r) + (Ad - A + BKd)Xd(0 + (BKn - F)xn(0                    (5.78)

    The design procedure for the tracking system consists of determining the full-state
feedback gain matrix, K, such that the poles of the closed-loop system (i.e. eigenvalues
of ACL = A — BK) are placed at desired locations, and choose the gain matrices, Kd and
K n , such that the error, e(0, is either reduced to zero, or made as small as possible in
the steady-state, in the presence of the noise, x n (0- Of course, the closed-loop system
described by Eq. (5.78) must be asymptotically stable, i.e. all the closed-loop poles must
be in the left-half plane, otherwise the error will not reach a steady-state even in the
absence of noise. Furthermore, as seen in Example 5.13, there may not be enough design
parameters (i.e. elements in Kj and K n ) to make the error zero in the steady-state, in
the presence of noise. If all the closed-loop poles are placed in the left-half plane, the
tracking system is asymptotically stable, and the steady-state condition for the error is
reached (i.e. the error becomes constant in the limit t -> oo). Then the steady state
condition is described by e (1) (0 = 0, and Eq. (5.78) becomes the following in the steady
state:

                  0 = (A - BK)ess + (Ad - A + BK^x^ + (BKn - F)x,ISS                       (5.79)

where e(0 ->• ess (the steady state error vector), Xd(0 -> Xdss, and x w (0 -> xnss as t -»• oo.
From Eq. (5.79), we can write the steady state error vector as follows:

                  ess = (A - BK)-'[(A - BIQ - Ad)XdSS + (F - BK n )x nss ]                 (5.80)
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                         253


Note that the closed-loop state-dynamics matrix, ACL = A — BK, is non-singular, because
all its eigenvalues are in the left-half plane. Hence, (A — BK)"1 exists. For ess to be zero,
irrespective of the values of Xdss and x,,ss, we should have (A — BKd — Ad) = 0 and
(F — BK W ) = 0, by selecting the appropriate gain matrices, Kd and K,,. However, as seen
in Example 5.13, this is seldom possible, owing to the number of inputs to the plant,
r, being usually smaller than the order of the plant, n. Hence, as in Example 5.13, the
best one can usually do is to make some elements of ess zeros, and living with the other
non-zero elements, provided they are small. In the rare case of the plant having as many
inputs as the plant's order, i.e. n = r, we can uniquely determine Kd and K,, as follows,
to make ess — 0:

                             Kd=B-'(A-Ad);            Krt=B'F                           (5.81)


  Example 5.14
   For the fighter aircraft of Example 5.13, let us design a controller which makes the
   aircraft track a target, whose state-dynamics matrix, Ad, is the following:

                                        -2.1    35      150
                                         0.1   -1.1    -21                           (5.82)
                                         0       0      -8

  The eigenvalues of Ad determine the poles of the target, which indicate how rapidly
  the desired state-vector, Xd(0> is changing, and are calculated as follows:

   »Ad = [ - 1 0 . 1 35 150; 0.1 - 1 . 1 -21; 0 0 - 8 ] ; damp(Ad) <enter>

   Eigenvalue      Damping      Freq. (rad/sec)
   -0.7266         1.0000       0.7266
   -8.0000         1.0000       8.0000
   -10.4734        1.0000       10.4734


  The target dynamics is asymptotically stable, with the pole closest to the imaginary
  axis being, s = —0.7266. This pole determines the settling time (or the speed)
  of the target's response. To track the target successfully, the closed-loop tracking
  system must be fast enough, i.e. the poles closest to the imaginary axis must have
  sufficiently small real parts, i.e. smaller than —0.7266. However, if the closed-
  loop dynamics is made too fast by increasing the negative real part magnitudes of
  the poles, there will be an increased effect of the noise on the system, as seen in
  Example 5.13. Also, recall that for an efficient design (i.e. smaller control effort), all
  the closed-loop poles must be about the same distance from the imaginary axis. Let
  us choose a closed-loop pole configuration as s = — 1, s = — 1 ± /. The feedback
  gain matrix for this pole configuration was determined in Example 5.13 to be the
  following:

                         K = [0.0006;      -0.0244;     -0.8519]                     (5.83)
254                     CONTROL SYSTEM DESIGN IN STATE-SPACE


 with the closed-loop state-dynamics matrix given by

                         -1.5267                  43.3608                  28.2818
      ACL = A - BK =       0.2200    -1.4000                 -32.0000
                         -0.0089                   0.3417     -0.0733
                                                                           (5.84)
 The noise gain matrix, K w , was determined in Example 5.13 by making the largest
 elements of (F — BK,,) vanish, to be the following:

                           K,, = [ -0.02/272;      -0.1 /272 ]                     (5.85)

 It remains to find the feedforward gain matrix, K^ = [Kd', K.&I', Kd3 L by
 considering the steady state error, ess, given by Eq. (5.81). Note from Eq. (5.80)
 that, since the target is asymptotically stable, it follows that x<iss = 0, hence Kj will
 not affect the steady state error. However, the transient error, e(/), can be reduced
 by considering elements of the following matrix:

                                272^,)                           110 + 272/^3)
  A - Ad -              0.12               -0.3                   11               (5.86)
                                           -4Kd2                 4 - 4Kd3

 Since by changing Kd we can only affect the first and the third rows of (A — A^—
 BKd), let us select Kj such that the largest elements of (A — A<j — BKj), which are
 in the first row, are minimized. By selecting Kd = —8.4/272, Kdi = —15/272, and
 Kd3 = —110/272, we can make the elements in the first row of (A — Aj — BKj)
 zeros, and the resulting matrix is the following:

                                        0           0         0
                  A - Ad -              0.12      -0.3      -11                    (5.87)
                                        0.432       0.772     1.704

 and the required feedforward gain matrix is given by

                    Kd = [ -8.4/272;      -15/272;      -110/272]                  (5.88)

 The closed-loop error response to target initial condition, Xd(0) = [3; 0; 0]r, and
 noise given by n(t) = [ I x 10~5; -2 x 10~6]r sin(lOOf), can be obtained by
 solving Eq. (5.78) with Xd(f) and x n (f) as the known inputs. The noise vector,
 x,,(f), and the matrix (BKn — F), are calculated for time upto 10 s as follows:

 »t = 0:0.01:10; Xn = [1e-5 -2e-6]'*sin(100*t) ; Bn = - [ 0 0; -3.5e-3
  0.004;1 ,03e-3 5.15e-3]; <enter>

 The desired state- vector, x^(t), is obtained by solving Eq. (5.74) using the MATLAB
 (CST) command initial as follows:

 »sysd=ss(Ad,zeros(3,1),eye(3),zeros(3,1)); [yd.t.Xd,] = initial(sysd,
   [3 0 0]',t); <enter>
POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK                         255




                                                                             10


   Figure 5.15 Closed-loop error and control input response of the fighter aircraft tracking a
   target with initial condition X,j(0) = [3; 0; 0]r


   The closed-loop error dynamics given by Eq. (5.78) can be written as follows:

                                e ( l ) (0 - ACLe(0 + BCLf(0                           (5.89)

   where ACL = A - BK, BCL = [(A d -A 4- BKd); (BK,T-F)], and the input
   vector, f(f) = [Xd(0 7 ; x,,(r) 7 ] r , which are calculated as follows:

   »ACL = A-B*K; BCL = [Ad-A+B*Kd Bn]; f = [Xd X n ' ] ; <enter>

  Finally, using the MATLAB command Isim, the closed-loop error response, e(t), is
  calculated as follows:

   »sysCL=ss(ACL,BCL,eye(3) ,zeros(3,5) ) ; e = lsim(sysCL,f ,t') ; <enter>

  The error, e(f) = [ei(f); ^z(0; e i ( t ) ] T , and control input, u(t) = Ke(f) -
  KdXdCO — K w x n (0, are plotted in Figure 5.15. Note that all the error transients
  decay to zero in about 10 s, with a negligible influence of the noise. The settling
  time of error could be made smaller than 1.0 s, but with a larger control effort and
  increased vulnerability to noise.


   The controller design with gain matrices given by Eqs. (5.83), (5.85), and (5.88) is
the best we can do with pole-placement, because there are not enough design parameters
(controller gain elements) to make the steady state error identically zero. Clearly, this is
a major drawback of the pole-placement method. A better design approach with full-state
feedback is the optimal control method, which will be discussed in Chapters 6 and 7.
256                       CONTROL SYSTEM DESIGN IN STATE-SPACE



5.4 Observers, Observability, and Compensators

 When we designed control systems using full-state feedback in the previous section,
 it was assumed that we can measure and feedback all the state variables of the plant
 using sensors. However, it is rarely possible to measure all the state variables. Some
 state variables are not even physical quantities. Even in such cases where all the state
 variables are physical quantities, accurate sensors may not be available, or may be too
 expensive to construct for measuring all the state variables. Also, some state variable
 measurements can be so noisy that a control system based on such measurements would
 be unsuccessful. Hence, it is invariably required to estimate rather than measure the state-
 vector of a system. How can one estimate the state-vector, if it cannot be measured?
 The answer lies in observing the output of the system for a known input and for a
 finite time interval, and then reconstructing the state-vector from the record of the output.
 The mathematical model of the process by which a state-vector is estimated from the
 measured output and the known input is called an observer (or state estimator). An
 observer is an essential part of modern control systems. When an observer estimates the
entire state-vector, it is called a full-order observer. However, the state variables that
can be measured need not be estimated, and can be directly deduced from the output.
 An observer which estimates only the unmeasurable state variables is called the reduced-
order observer. A reduced-order observer results in a smaller order control system, when
compared to the full-order observer. However, when the measured state variables are
noisy, it is preferable to use a full-order observer to reduce the effect of noise on the
control system. A controller which generates the control input to the plant based on the
estimated state-vector is called a compensator. We will consider the design of observers
and compensators below.
    Before we can design an observer for a plant, the plant must be observable. Observ-
ability is an important property of a system, and can be defined as the property that
makes it possible to determine any initial state, x(fo), of an unforced system (i.e. when
the input vector, u(f), is zero) by using & finite record of the output, y(f). The term finite
record implies that the output is recorded for only a finite time interval beginning at
t = to. In other words, observability is a property which enables us to determine what the
system was doing at some time, to, after measuring its output for a finite time interval
beginning at that time. The term any initial state is significant in the definition of observ-
ability; it may be possible to determine some initial states by recording the output, and
the system may yet be unobservable. Clearly, observability requires that all the state
variables must contribute to the output of the system, otherwise we cannot reconstruct
all possible combinations of state variables (i.e. any initial state-vector) by measuring
the output. The relationship between observability and the output is thus the dual of
that between controllability and the input. For a system to be controllable, all the state
variables must be affected by the input; for a system to be observable, all the state vari-
ables must affect the output. If there are some state variables which do not contribute
to the output, then the system is unobservable. One way of determining observability is
by looking at the decoupled state-equations, and the corresponding output equation of a
system.
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                            257


  Example 5.15
   Consider a system with the following scalar state-equations:


                                                                                      (5.90)


   The scalar output equations of the system are the following:
                              y(t) = x{(t)
                              y2(t) = 2 x 2 ( t ) + x l ( t ) + u ( t )               (5.91)
  Equation (5.90) implies that the state variable, xj(t), is decoupled from the other
  two state variables, x(t) and x2(t). Also, x?,(t) does not affect either of the two
  output variables, y  ( t ) and y2(t). Since the state variable XT,(t), does not contribute
  to the output vector, y(?) = [y(t); y 2 ( t ) ] T , either directly or indirectly through
  jci(f) and x2(t), it follows that the system is unobservable.


   As it is not always possible to decouple the state-equations, we need another way of
testing for observability. Similar to the algebraic controllability test theorem, there is an
algebraic observability test theorem for linear, time-invariant systems stated as follows.

Theorem
The unforced system, x (1) (?) = Ax(f), y(0 = Cx(f), is observable if and only if the rank
of the observability test matrix, N = [C T ; ATCT; (AT)2CT; . . . ; (A T )"~'C T ], is
equal to n, the order of the system.

   The proof of this theorem, given in Friedland [2], follows from the definition of observ-
ability, and recalling from Chapter 4 that the output of an unforced (homogeneous) linear,
time-invariant system is given by y(f) — Cexp{A(f - ?o)}x(?o), where x(f 0 ) is the initial
state-vector.

  Example 5.16

  Let us apply the observability test theorem to the system of Example 5.15. The state
  coefficient matrices, A and C, are the following:
                                       0 0
                                                                     0 0
                        A=            -1 0             c=            1 0
                                                                                      (5.92)
                                       0 5

  The observability test matrix, N, is constructed as follows:
                         0 0                       1 2
                        -1 0           CT =        0 1
                         0 5                       0 0
258                      CONTROL SYSTEM DESIGN IN STATE-SPACE


                                                   1 2
                                                   0 1                            (5.93)
                                                   0 0
   or
                                        1 2 1   2 1 2
                                        0 1 0 - 1 0 1                             (5.94)
                                        0 0 0   0 0 0

      The entire third row of N consists of zeros; hence it is impossible t6 form a
   (3 x 3) sized, non-zero determinant out of the rows and columns of N. Thus rank
   (N) < 3 for this third order system, therefore the system is unobservable.

   Rather than forming the observability test matrix, N, by hand as in Example 5.16,
which could be a tedious process for large order systems, we can use the MATLAB
(CST) command ctrb, noting that N is the controllability test matrix in which A is
replaced by AT and B is replaced by CT. Thus, the command

        »N = ctrb(A',C') <enter>

will give us the observability test matrix.
   The reasons for unobservability of a system are pretty much the same as those for
uncontrollability, namely the use of superfluous state variables in state-space model,
pole-zero cancellation in the system's transfer matrix, too much symmetry, and phys-
ical unobservability (i.e. selection of an output vector which is physically unaffected by
one or more state variables). If the sub-systems which cause unobservability are stable,
we can safely ignore those state variables that do not contribute to the output, and design
an observer based on the remaining state variables (which would constitute an observable
sub-system). Thus a stable, unobservable system is said to be detectable. If an unobserv-
able sub-system is unstable, then the entire system is said to be undetectable, because
an observer cannot be designed by ignoring the unobservable (and unstable) sub-system.
In Example 5.15, the unobservable sub-system corresponding to the decoupled state vari-
able, *3(f), is unstable (it has a pole at s = 5). Hence, the system of Example 5.15 is
undetectable.


5.4.1 Pole-placement design of full-order observers and
      compensators
A full-order observer estimates the entire state-vector of a plant, based on the measured
output and a known input. If the plant for which the observer is required is linear, the
observer's dynamics would also be described by linear state-equations. Consider a noise-
free, linear, time-invariant plant described by the following state and output equations:
                                   l)
                                        (r) = Ax(r) + Bu(f)                         (5.95)
                                   y(r) = Cx(r) + Du(r)                             (5.96)
_                     OBSERVERS, OBSERVABILITY, AND COMPENSATORS_                            259


The linear, time-invariant state-equation which describes the dynamics of a full-order
observer can be expressed as follows:
                             x^Cf) - AoXo(0 + B0u(0 + Ly(r)                               (5.97)
where x 0 (?) is the estimated state-vector, u(?) is the input vector, y(t) is the output
vector, A0, B0 are the state-dynamics and control coefficient matrices of the observer,
and L is the observer gain matrix. The matrices A0, B0, and L must be selected in a
design process such that the estimation error, e 0 (r) = x(r) — x 0 (f), is brought to zero in
the steady state. On subtracting Eq. (5.97) from Eq. (5.95), we get the following error
dynamics state-equation:
                 e^CO - A0e0(?) + (A - A 0 )x(?) + (B - B 0 )u(r) - Ly(r)                   (5.98)
Substitution of Eq. (5.96) into Eq. (5.98) yields
          e^(r) = A0e0(r) + (A - A0)x(?) + (B - B0)u(0 - L[Cx(r) + Du(r)]                   (5.99)
or
              e^(0 = A0e0(0 + (A - A0 - LC)x(0 + (B - B0 - LD)u(f)                         (5.100)
From Eq. (5.100), it is clear that estimation error, e 0 (f), will go to zero in the steady state
irrespective of x(t) and u(t), if all the eigenvalues of A0 are in the left-half plane, and the
coefficient matrices of x(?) and u(?) are zeros, i.e. (A — A0 — LC) = 0, (B — B0 — LD) =
0. The latter requirement leads to the following expressions for A0 and B0:
                               A0 = A - L C ;     B0 = B-LD                              (5.101)
The error dynamics state-equation is thus the following:
                                                           0                             (5.102)
The observer gain matrix, L, must be selected to place all the eigenvalues of A0 (which
are also the poles of the observer) at desired locations in the left-half plane, which
implies that the estimation error dynamics given by Eq. (5.102) is asymptotically stable
(i.e. e0(0 -> 0 as t -> oo). On substituting Eq. (5.101) into Eq. (5.97), we can write the
full-order observer's state-equation as follows:
           x > ( t ) = (A - LC)Xo(0 + (B - LD)u(f) + Ly(0 - Ax 0 (r)
                     + L[y(0 - Cx0(0 - Du(/)J                                            (5.103)
Note that Eq. (5.103) approaches Eq. (5.95) in the steady state if x 0 (r) -> x(r) as t -» oo.
Hence, the observer mirrors the plant dynamics if the error dynamics is asymptotically
stable. The term [y(0 - Cx0(0 - Du(r)j in Eq. (5.103) is called the residual, and can be
expressed as follows:
                   [y(0 - Cxo(r) - Du(f)] = Cx(/) - Cx 0 (r) = Ce0(r)                    (5.104)
From Eq. (5.104), it is clear that the residual is also forced to zero in the steady-state if
the error dynamics is asymptotically stable.
260                       CONTROL SYSTEM DESIGN IN STATE-SPACE


   The observer design process merely consists of selecting L by pole-placement of
the observer. For single-output plants, the pole-placement of the observer is carried
out in a manner similar to the pole-placement of regulators for single-input plants
(see Section 5.3.1). For a plant with the characteristic polynomial written as |sl — A| =
s" +an-is"~~l H       -as + OQ, it can be shown by steps similar to Section 5.3.1 that
the observer gain matrix, L, which places the observer's poles such that the observer's
characteristic polynomial is sl — A0| = sn + pn-s"~l -      h Ps + fa is given by

                                   L = [(/?-a)N'N" 1 ] r                             (5.105)

where 0 = [&_i; fl,_ 2 ; ...; ft; ft], a = [«„_,; a n _ 2 ; ...; ai; a0], N is
the observability test matrix of the plant described by Eqs. (5.95) and (5.96), and N' is the
observability test matrix of the plant when it is in the observer companion form. Since for
single-input, single-output systems, the observer companion form can be obtained from
the controller companion form merely by substituting A by AT, B by CT, and C by BT
(see Chapter 3), you can easily show that N' = F, where F is the controllability test
matrix of the plant when it is in the controller companion form. Thus, we can write

                                   L = [(jff-a)P'N~ 1 ] r                            (5.106)

Recall that Pf is an upper triangular matrix, given by Eq. (5.51).

  Example 5.17
  Let us try to design a full-order observer for the inverted pendulum on a moving
  cart (Example 5.9). A state-space representation of the plant is given by Eq. (5.53),
  with the numerical values of A and B given by Eq. (5.54). For this single-input,
  two-output plant, let us try to design an observer using only one of the outputs. If
  we select the single output to be y(t) = 0(f), the angular position of the inverted
  pendulum, the matrices C and D are the following:
                            C = [l;     0; 0; 0];       D= 0                      (5.107)

  The first thing to do is to check whether the plant is observable with this choice of
  the output. We do so by the following MATLAB command:
        »N = (ctrb(A',C'); rank(N) <enter>
        ans =

  Since the rank of the observability test matrix, N, is 2, i.e. less than 4, the order
  of the plant, the plant is unobservable with the angular position of the pendulum
  as the only output. Hence, we cannot design an observer using y(f) =0(t). If we
  choose y(t) = jc(f), the cart's displacement, then the output coefficient matrices are
  as follows:
                            C = [0;     1; 0; 0];      D= 0                       (5.108)
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                       261


On forming the observability test matrix, N, with this choice of output, and checking
its rank we get

      »N = ( c t r b ( A ' , C ' ) ) ; rank(N) <enter>

      ans =


Since now rank (N) = 4, the order of the plant, the plant is observable with y ( t ) =
x(t), and an observer can be designed based on this choice of the output. Let us
place the observer poles at s = —10 ± 10z, and s = — 20 ± 20/. Then the observer's
characteristic polynomial coefficients vector, ft, is calculated as follows:

»v = [-10-101 -10+101 -20-201 -20+201]'; p = poly(v); beta = p(2:5)
  <enter>
beta =
      60     1800    24000    160000

The plant's characteristic polynomial coefficient vector, a, is calculated as
follows:

      »p = poly(A); a = p ( 2 : 5 ) <enter>

      d
                             0 -10.7800 0 0

and the matrix P' is evaluated using Eq. (5.51) as follows:

»Pdash = [1 - a ( 1 : 3 ) ; 0 1 - a ( 1 : 2 ) ; 0 0 1 - a ( 1 ) ; 0 0 0 1 ] <enter>
Pdash =
            1.0000    0      10.7800         0
            0          1.000 0               10.7800
            0          0     1.0000          0
            0         0      0               1.0000

Finally, the observer gain matrix, L, is calculated using Eq. (5.106) as follows:

      »format long e; L = ( ( b e t a - a ) * P d a s h * i n v ( N ) ) ' <enter>


          -2.5149795918367356+004
           6.0000000000000006+001
          -1.8318388612244906+005
           1.8107800000000006+003

Note that we have printed out L in the long format, since we need to store it for later
calculations. Let us check whether the observer poles have been placed at desired
locations, by calculating the eigenvalues of A0 = (A — LC) as follows:
262                      CONTROL SYSTEM DESIGN IN STATE-SPACE


         »Ao = A-L*C; eig(Ao) <enter>
         ans =
           -20.0000+20.00001
           -20.0000-20.00001
           -10.0000+10.00001
           -10.0000-10.00001

   Hence, observer pole-placement has been accurately achieved.

   Example 5.17 illustrates the ease by which single-output observers can be designed.
However, it is impossible to design single-output observers for those plants which are
unobservable with any single output. When multi-output observers are required, gener-
ally there are more design parameters (i.e. elements in the observer gain matrix, L)
than the observer poles, hence all of these parameters cannot be determined by pole-
placement alone. As in the design of regulators for multi-input plants (Section 5.3.2),
additional conditions are required to be satisfied by multi-output observers, apart from
pole-placement, to determine the observer gain matrix. These additional conditions are
hard to come by, and thus pole-placement is not a good method of designing multi-
output observers. A better design procedure in such cases is the Kalman filter approach
of Chapter 7.
   MATLAB's Control System Toolbox (CST) provides the command estim for
constructing a state-space model, syso, of the observer with the observer gain matrix,
L, and a state-space model, sysp, of the plant, with state coefficient matrices A, B, C, D,
as follows:

      »sysp=ss[A,B,C,D]; sysp = estim(syso,L) <enter>

The input to the observer thus formed is the plant's output, y(/), while output vector of
the observer is [ {Cxo(r)}r; x«(f) r ]T, where Xo(r) is the estimated state-vector.
    Observers (also known as estimators) by themselves are very useful in estimating
the plant dynamics from a limited number of outputs, and are employed in parameter
estimation, fault detection, and other similar applications. The utility of an observer in
a control system lies in feeding the estimated state-vector to a controller for generating
input signals for the plant. The controllers which generate input signals for the plant
based on the estimated state-vector (rather than the actual, fed back state-vector) are
called compensators. However, design of compensators involves a dilemma. The estimated
state-vector is obtained from an observer, which treats the plant's input vector as a known
quantity, while the compensator is yet to generate the input vector based on the estimated
state-vector. It is like the classic chicken and egg problem, since we do not know which
came first: the control input on which the estimated state-vector is based, or the estimated
state-vector on which the input is based! A practical way of breaking this vicious circle
is the separation principle, which states that if we design an observer (assuming known
input vector), and a compensator (assuming known estimated state-vector) separately, and
then combine the two, we will end up with a control system that works. The separation
principle thus allows us to design the observer and the controller independently of each
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                           263


other. The resulting control system can be a regulator or a tracking system, depending
on the desired state-vector being zero or non-zero, respectively.
   Let us consider a tracking system (i.e. a control system with a non-zero desired state-
vector) based on a noise-free plant described by Eqs. (5.95) and (5.96), for which a
full-order observer, given by Eq. (5.103) has been designed. Then a compensator can be
designed to generate the input vector for the plant according to the following control-law:

                                                       - Kdxd(0                        (5.109)

where x0(0 is the estimated state-vector, xd(0 is the desired state-vector, K is the feedback
gain matrix, and Kd is the feedforward gain matrix. On substituting Eq. (5.109) into
Eq. (5.103), the observer state-equation becomes

    x ( V'(0 = (A - LC - BK + LDK)Xo(0 + (B - LD)(K - K d )x d (r) + Ly(?) (5.110)

On substituting the output equation, Eq. (5.96), into Eq. (5.110), and again substituting
Eq. (5.109), we get the following state-equation for the compensator:

                      = (A - LC - BK)o(0 + B(K - K d )x d (0 + LCx(f)                 (5.111)

The plant's state-equation, Eq. (5.95), when the input is given by Eq. (5.109), becomes
the following:

                               = Ax(0 - BKxo(r) + B(K - K d )x d (r)                   (5.112)

Equations. (5.111) and (5.112) are the state-equations of the closed-loop system, and can
be expressed as follows:

                          A          -BK                         ["B(K-
                         LC     (A - LC - BK)                    [B(K-K d )
                                                                                       (5.in)

The closed-loop tracking system is thus of order 2n, where n is the order of the plant. The
input to the closed-loop system is the desired state-vector, Xd(0- A schematic diagram of
the tracking system is shown in Figure 5.16. Note that this control system is essentially


                 Compensator                                 Plant




            Figure 5.16    Closed-loop tracking system with a full-order compensator
264_                       CONTROL SYSTEM DESIGN IN STATE-SPACE                          _


based on the feedback of the output vector, y(r), to the compensator, which generates the
input vector, u(f), for the plant.
   To obtain the state-equation for the estimation error, e 0 (/) = x(0 — Xo(r), let us write
Eq. (5.112) as follows:

                   x (1) (r) - (A - BK)x(r) + BKe0(0 + B(K - Kd)Xd(/)                   (5.1 14)

On subtracting Eq. (5.111) from Eq. (5.114) we get

                                                          /)                           (5.115)

which is the same as Eq. (5.102). The state-equation for the tracking error, e(/) =
x(f), is obtained by subtracting Eq. (5.114) from Eq. (5.74), which results in

                e(1)(0 = (A - BK)c(0 + (Ad - A + BKd)Xd(f) - BKe0(r)                    (5.1 16)

  The tracking system's error dynamics is thus represented by Eqs. (5.1 15) and (5.1 16),
which can be expressed together as follows:

      e<'>(Ol_f(A-BK)             -BK ] [ e(r) ] , F(A d - A + BK,,)
            -     «              (A-LC)(r) +               0         ^O (5.117)

Note that Eq. (5.117) represents the closed-loop tracking system in a decoupled state-space
form. The closed-loop poles must be the eigenvalues of the following closed-loop state-
dynamics matrix, ACL^

                                         ^~BK)          °  1                          ,5118)
                                                                                      (5 118)
                                          0          (A-LC)J                             '

Equation (5.117) implies that the closed-loop poles are the eigenvalues of ACL-
i.e. the roots of the characteristic equation sl — ACL| = 0, which can be written
as |[si - (A - BK)][sI - (A - LC)]| = 0, resulting in sl - (A - BK)| = 0 and sl -
(A —LC)| =0. Hence, the closed-loop poles are the eigenvalues of (A — BK) and
eigenvalues of (A — LC), which are also the poles of the full-state feedback regulator
and the observer, respectively. Note from Eq. (5.117) that for the estimation error, e 0 (/),
to go to zero in the steady state, all the eigenvalues of (A — LC) must be in the left-half
plane. Also, for the tracking error, e(r), to go to zero in the steady state, irrespective of the
desired state-vector, Xd(0, all the eigenvalues of (A — BK) must be in the left-half plane,
and the coefficient matrix multiplying d(0 must be zero, (Ad — A + BKd) = 0. Recall
from Section 5.3 that (A — BK) is the state-dynamics matrix of the full-state feedback
regulator, and from Eq. (5.103) that (A — LC) is the state-dynamics matrix of the full-
order observer. Hence, the compensator design process consists of separately deriving
the feedback gain matrices L and K, by pole-placement of the observer and the full-
state feedback regulator, respectively, and selecting Kd to satisfy (Ad — A + BKd) = 0.
Usually, it is impossible to satisfy (Ad — A + BKd) = 0 by selecting the feedforward gain
matrix, K^. Alternatively, it may be possible to satisfy (Ad — A 4- BKd)x<j(0 = 0 when
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                           265


some elements of Xd(0 are zeros. Hence, the steady state tracking error can generally
be reduced to zero only for some values of the desired state-vector. In the above steps,
we have assumed that the desired state-vector, Xd(0> is available for measurement. In
many cases, it is possible to measure only a desired output, jd(0 = C d Xd(0, rather than
xd(0 itself. In such cases, an observer can be designed to estimate x d (f) based on the
measurement of the desired output. It is left to you as an exercise to derive the state-
equations for the compensator when Xd(?) is not measurable.


  Example 5.18
  Let us design a compensator for the inverted pendulum on a moving cart
  (Example 5.9), when it is desired to move the cart by 1 m, while not letting the
  pendulum fall. Such a tracking system is representative of a robot, which is bringing
  to you an inverted champagne bottle precariously balanced on a finger! The plant
  is clearly unstable (as seen in Example 5.9). The task of the compensator is to
  stabilize the inverted pendulum, while moving the cart by the desired displacement.
  The desired state-vector is thus a constant, consisting of the desired angular position
  of the inverted pendulum, 6&(t) = 0, desired cart displacement, x&(t} = 1 m, desired
  angular velocity of the pendulum, #d t) = 0, and desired cart velocity, x(d t) = 0.
  Hence, xd(0 = [0; 1; 0; O]7. Since xd(0 is constant, it implies that x d '(0 = 0, and
  from Eq. (5.74), Ad = 0. By the separation principle, we can design a tracking
  system assuming full-state feedback, and then combine it with a full-order observer,
  which estimates the plant's state-vector. A full-state feedback regulator has already
  been designed for this plant in Example 5.11, which places the eigenvalues of
  the regulator state-dynamics matrix, (A — BK), at s = -7.853 ± 3.252S/, and
  5 = —7.853 ± 7.853z using the following feedback gain matrix:
  K
    = [-1362.364050360232; -909.3160795202226;   -344.8741667548096;   -313.4621667548089]
                                                                                  (5.119)
  We have also designed a full-order observer for this plant using the cart displace-
  ment, x ( t ) , as the output in Example 5.17. The observer poles, i.e. the eigenvalues
  of (A - LC), were selected to be at s = -10 ± 0i, and 5 - -20 ± 20/, and the
  observer gain matrix which achieved this observer pole configuration was obtained
  to be the following:


      L = [-25149.79591836735;       60.0;   -183183.8861224490;          1810.780]f
                                                                                  (5.120)


   The separation principle allows us to combine the separately designed observer
and regulator into a compensator. However, it remains for us to determine the
feedforward gain matrix, Kd. The design requirement of zero tracking error in the
steady state is satisfied if (Ad - A + BKd)x d (/) = 0 in Eq. (5.117). The elements of
266                             CONTROL SYSTEM DESIGN IN STATE-SPACE


Kd = [ Kd        Kj2      KJT,;     K<J4 ] are thus determined as follows:

                                                                 " 0 "           "0"
                               (Ad — A + BKd)Xd(0 =
                                                                     o      =
                                                                                  o                         (5.121)
                                                                   K-d2
                                                                 _Kd2_            0_

Equation (5.121) is exactly satisfied by selecting Kdi = 0. What about the other elements
of Kd? There are no conditions placed on the other elements of Kd, and thus we can
arbitrarily take them to be zeros. Therefore, by choosing Kd = 0, we are able to meet
the zero tracking error requirement in the steady state. On substituting the designed
values of the gain matrices, K, L, and Kd into Eq. (5.113), we can get the closed-loop
state-equations for the tracking system in terms of the plant's state-vector, x(f), and the
estimated state-vector, Xo(/), and then solve them to get the closed-loop response. This is
done using MATLAB as follows:
»K=[-1362.364050360232 -909.3160795202226 -344.8741667548096 -313.46216675
 48089]; <enter>

»L=[-25149.79591836735 60.0                 -183183.8861224490 1810.780]'; Kd=zeros(1 ,4) ;
 <enter>

»ACL = [A -B*K; L*C ( A - L * C - B * K ) ] ; BCL = [ B * ( K - K d ) ; B * ( K - K d ) ] ; < e n t e r >

  Let us confirm that the eigenvalues of ACL are the poles of the regulator designed in
Example 5.11 and the observer designed in Example 5.17 as follows:
       »eig(ACL) <enter>

       ans =
       -20.0000+20.00001
       -20.0000-20.00001
       -10.0000+10.00001
       -10.0000-10.00001
       -7.8530+7.85301
       -7.8530-7.85301
       -7.8530+3.25281
       -7.8530-3.25281
which indeed they are. Finally, the closed-loop response to the desired state-vector is
calculated as follows:
»t = 0:1.0753e-2:1.2; n=size(t,2); for i=1:n; Xd(i,:) = [ 0 1 0 0 ] ; end
 <enter>
»sysCL=ss(ACL, BCL,[C z e r o s ( 1 , 4 ) ] , z e r o s ( 1 , 4 ) ) ; [ y , t , X ] = lsim(sysCL,Xd,t');
  <enter>
The closed-loop cart's displacement, jc(r), and pendulum's angular position, 0(0. are
plotted in Figure 5.17, as follows:

       »plot(t,X(: > 1:2)) <enter>
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                               267


                          2

                        1.5

                         1
                                            Cart's displacement, x(t), in meters
                        0.5
                                            Pendulum's angular position, 9(t),
                          0                 in radians

                      -0.5

                         -1

                      -1.5

                         _2                             I       |      L
                              0       0.2    0.4       0.6    0.8                1.2
                                                   Time (s)

Figure 5.1 7 Response of the compensator based tracking system for inverted- pendulum on a moving
cart, with desired angular position, 0^(t) = 0, and desired cart's displacement, x^Cr) = 1 m, when the
regulator poles are s = -7.853 ± 3.2S28/, and s = -7.853 ± 7.S53/


   The closed-loop transient response for x ( t ) and 9(t) is seen in Figure 5.17 to settle
to their respective desired values in about 1 s, with maximum overshoots of 1 .65 m
and 1.57rad., respectively. However, an overshoot of 1.57 rad. corresponds to 90°,
which implies that the pendulum has been allowed to fall and then brought back
up to the inverted position, 9(t) = 0°. If the inverted pendulum represents a drink
being brought to you by a robot (approximated by the moving cart), clearly this
compensator design would be unacceptable, and it will be necessary to reduce the
maximum overshoot to an angle less than 90° by suitably modifying the closed-loop
poles. Recall from Example 3.3 that the linearized state-space model of the system
given by Eq. (5.53) is invalid when the pendulum sways by a large angle, 0 ( t ) , and
the results plotted in Figure 5.17 are thus inaccurate. Hence, the regulator design that
was adequate for stabilizing the plant in the presence of a small initial disturbance in
cart displacement, is unsatisfactory for moving the cart by a large displacement. Note
that the location of the regulator poles, i.e. the eigenvalues of (A — BK), governs the
closed-loop response of the plant's state-vector, x(f). By moving the regulator poles
closer to the imaginary axis, it would be possible to reduce the maximum overshoot
at the cost of increased settling time. Let us select the new regulator poles as s =
-0.7853 ± 3.25328* and s = -0.7853 ± 0.7853*. The new feedback gain matrix, K, is
calculated as follows:

»v=[- 0.7853+3. 253281 -0.7853-3.253281 -0.7853+0.78531 -0.7853-0.78531]';
  K=place(A,B,v)
place: ndigits= 16

K =
 -27.0904      -1.4097            -5.1339    -1.9927
268                          CONTROL SYSTEM DESIGN IN STATE-SPACE


                                                I          I             I     I



                         1
                                                 /
                       0.8                       Carf s displacement, x(t), in meters -

                       0.6                  /

                       0.4              /
                                    /           Pendulum's angular position, 0(t), in
                       0.2         /            radians

                         0

                      -0.2 (                    i         i              i    i
                               )                2         4              6    8         1(
                                                              Time (s)

Figure 5. 1 8 Response of the compensator based tracking system for inverted- pendulum on a moving
cart, with desired angular position, Oj(t) = 0, and desired carfs displacement, x^f) = 1 m, when
regulator poles are s = -0.7853 ± 3.2532S/ and s = -0.7853 ± 0.7853/


and the new closed-loop response is plotted in Figure 5.18, which shows that the maximum
overshoots have been reduced to less than l . l m and 0.1 rad. (5.7°) for jc(/) and 0(/),
respectively, but the settling time is increased to about 7 s. Since the pendulum now
sways by small angles, the linearized model of Eq. (5.53) is valid, and the compensator
design is acceptable. However, the robot now takes 7 seconds in bringing your drink
placed 1 m away! You may further refine the design by experimenting with the regulator
pole locations.
   Let us see how well the compensator estimates the state-vector by looking at
the estimation error vector, e 0 (r) = x(r) — XQ(/). The elements of the estimation
error vector, eol(f) = 0d(0 - 0(0, eo2(t) = *d(0 - *(0, *o3(0 = 0dU(0 - 0 (l) (0, and
      = x^(t) — *(1)(0 are plotted in Figure 5.19 as follows:

»plot(tJX(:,1)-X(:>5),t>X(:J2)-X(:,6),t,X(:J3)-X(:,7)>t,X(:>4)-X(:,8))
 <enter>


   Figure 5.19 shows that the largest estimation error magnitude is about 1.5 x 10 9 rad/s
for estimating the pendulum's angular velocity, 0 (1) (0, and about 5 x 10~10 rad. for
estimating the pendulum's angular position, 0(0- Since the observer is based on the
measurement of the cart's displacement, x(t), the estimation error magnitudes of x ( t )
and :t(1)(0 are seen to be negligible in comparison with those of 0(0 and 0 ( 1 ) (f )• All the
estimation errors decay to zero in about 7 s, which is the same time as the settling time
of the closed-loop response for the state-vector, x(r). The observer poles are therefore at
acceptable locations. Note that we can move the observer poles as much inside the left-
half plane as we want, because there is no control input cost associated with the observer.
However, if the measurements of the output are noisy, there will be an increased influence
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                               269


                             x10,-9



                       1.5                            %>(') =

                         1


                       0.5


                         0


                      -0.5



                             0                4              6              10
                                                  Time (s)

Figure 5.19     Estimation errors for the compensator based tracking system for inverted- pendulum on
a moving cart, with desired angular position, #d(f) = 0, and desired carfs displacement, x^f) = 1 m,
when regulator poles are s = -0.7853 ± 3.253281 and s = -0.7853 ± 0.7853/



of noise on the closed-loop system if the observer poles are too far inside the left-half
plane.


5.4.2    Pole-placement design of reduced-order observers and
         compensators

When some of the state variables of a plant can be measured, it is unnecessary
to estimate those state variables. Hence, a reduced-order observer can be designed
which estimates only those state variables that cannot be measured. Suppose
the state-vector of a plant, x(f), can be partitioned into a vector containing
measured state variables, %i(0, and unmeasurable state variables, xi(t), i.e. x(0 =
[xi(0 r ; x 2 (0 r ] 7 - The measured output vector, y(r), may either be equal to
the vector, xi(0 - implying that all the state variables constituting xi(f) can
be directly measured - or it may be equal to a linear combination of the
state variables constituting i(t). Hence, the output equation can be generally
expressed as

                                                                                            (5.122)

where C is a constant, square matrix, indicating that there are as many outputs as the
number of elements in x t (r). When X](f) can be directly measured, C = I. The plant's
state-equation (Eq. (5.95)) can be expressed in terms of the partitioned state-vector,
270                            CONTROL SYSTEM DESIGN IN STATE-SPACE


x(/) — [  i ( t ) T ;   2(t)T]T, as follows:

                               l}(t) = AnXi(r) + Ai 2 x 2 (r) + B!U(/)              (5.123)
                                                      -A 22 x 2 (r) + B 2 u(r)         (5.124)

where
                                       FA,,      A.,1               fR.l
                                                                                      (5.125)

Let the order of the plant be n, and the number of measured state variables (i.e. the
dimension of (t)) be k. Then a reduced-order observer is required to estimate the
vector x2(0, which is of dimension (n — k). Hence, the estimated state- vector is simply
given by


                                                               *o2(')
                                                                                      (5.126)
where x«2(0 is the estimation of the vector x 2 (r). Note that Eq. (5.126) requires that
C should be a non-singular matrix, which implies that the plant should be observable
with the output given by Eq. (5.122). If the plant is unobservable with the output
given by Eq. (5.122), C would be singular, and a reduced-order observer cannot be
designed.
   The observer state-equation should be such that the estimation error, eo2(0 =
x2(0 — x<,2(0, is always brought to zero in the steady state. A possible
observer state-equation would appear to be the extension of the full-order
observer state-equation (Eq. (5.103)) for the reduced-order observer, written as
follows:

                            xiu(0 = Ax0(/) + Bu(/) + L[y(r) - CXCOl                   (5-127)

where the observer gain matrix, L, would determine the estimation error dynamics.
On substituting Eq. (5.126) into Eq. (5.127), and subtracting the resulting state-equation
for Xo2(0 from Eq. (5.124), we can write the estimation error state-equation as
follows:

                                         ei 2 ) (r)=A 22 e o2 (r)                     (5.128)

However, Eq. (5.128) indicates that the estimation error is unaffected by the observer gain
matrix, L, and solely depends upon the plant's sub-matrix, A22. If A22 turns out to be a
matrix having eigenvalues with positive real parts, we will be stuck with an estimation
error that goes to infinity in the steady state! Clearly, the observer state-equation given by
Eq. (5.127) is unacceptable. Let us try the following reduced-order observer dynamics:

                                                 = Ly(f) + z(0                        (5.129)
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                           271


where z(r) is the solution of the following state-equation:

                                                                                       (5.130)

Note that the reduced-order observer gain matrix, L, defined by Eq. (5.129), is of size
[(/? — k) x k], whereas the full-order observer gain matrix would be of size (n x k). On
differentiating Eq. (5.129) with respect to time, subtracting the result from Eq. (5.124),
and substituting z(0 = xo2(0 — Ly(0 = x2(0 — eo2(0 — LCxj(0, the state-equation for
estimation error is written as follows:

      e$(0 = Feo2(0 + (A21 - LCAn + FLC)xi(0 + (A22 - LCA12 - F)x2(0
                + (B2 - LCB! - H)u(0                                                   (5.131)

Equation (5.131) implies that for the estimation error, eo2(0, to go to zero in the steady
state, irrespective of Xi(0, x2(0, and u(0, the coefficient matrices multiplying xi(0, x2(0,
and u(0 must vanish, and F must have all eigenvalues in the left-half plane. Therefore,
it follows that

         - A22 - LCA12;         = B 2 -LCB i ;      G = FL + (A 21 -               ~l (5.132)

The reduced-order observer design consists of selecting the observer gain matrix, L, such
that all the eigenvalues of F are in the left-half plane.

  Example 5.19

  Let us design a reduced-order observer for the inverted pendulum on a
  moving cart (Example 5.9), based on the measurement of the cart displacement,
  x ( t ) . The first step is to partition the state-vector into measurable and
  unmeasurable parts, i.e. x(r) = [xi(0 r ; x2(0r ]T , where xi(0 = x ( t ) , and
                     0 (1) (0; x ( l ) ( t ) ] T . However, in Example 5.9, the state-vector
  was expressed as [0(0; *(0; 0 (1) (0; x ( } } ( t ) ] T . We must therefore rearrange
  the state coefficient matrices (Eq. (5.54)) such that the state-vector is x(0 —
  [,r(0; 0(0; 0 (1) (0; ^ (1) (01 r and partition them as follows:

                                 o         o r                       0
                   A =
                                 0         1 0
                                                           B
                                                                    6
                                  10.78   0    0                   -i
                                 -0.98    0 0                       i               (5.133)

  From Eq. (5.133) it is clear that

             An=0;        Ai2 = [0 0 1];             =0

                                            0
             A2i =             A22 =       10.78    0           B, =               (5.134)
                                          - 0.98    0 0
271                    CONTROL SYSTEM DESIGN IN STATE-SPACE


 Since the measured output is Xi(0 = ;c(f), the output equation is y(f) = Cxi(f),
 where C = 1. We have to select an observer gain-matrix, L, such that the eigenvalues
 of F = (A22 — LCAi2) are in the left-half plane. Let us select the observer poles,
 i.e. the eigenvalues of F, to be s = -20, s = -20 ± 20i. Then L is calculated by
 pole-placement as follows:

 »A12 = [0 0 1]; A22 = [0 1 0; 10.78 0 0; -0.98 0 0]; C = 1; <enter>
 »v = [ - 2 0 -20+20i -20-201]'; L = (place(A22',A12'*C',v))' <enter>
 L =
 -1.64376+003
 -1.69876+004
 6.00006+001

 Therefore, the observer dynamics matrix, F, is calculated as follows:

       »F = A22 - L*C*A12 <enter>

       F =
         0                 1.00006+000      1.64376+003
         1.07806+001       0                1.69876+004
        -9.80006-001       0                -6.00006+001

 Let us verify that the eigenvalues of F are at desired locations:

      »eig(F) <enter>
      ans =
       -2.OOOOe+001+2.OOOOe+001i
       -2.OOOOe+001-2.OOOOe+001i
       -2.00006+001

 which indeed they are. The other observer coefficient matrices, G and H, are
 calculated as follows:

      »A11 = 0; A21 = [00 0]'; B1 = 0; B2 = [0 -1 1]';
        H = B2 - L*C*B1 <enter>

      H =
              0
              -1
              1
      »G = F*L + (A21 - L*C*A11)*inv(C) <enter>
      G =
              8.1633e+004
              1.00156+006
              -1.98926+003
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                      273


   A compensator based on the reduced-order observer can be designed by the separation
principle, in a manner similar to the compensator based on the full-order observer. The
control-law defining the reduced-order compensator for a tracking system can be expressed
as follows, after substituting Eq. (5.126) into Eq. (5.109):

   u(0 = K[Xd(0 - Xo(01 -                 = (K - K d )x d (0            K2xo2(0   (5.135)

where xd(0 is the desired state-vector, Kd is the feedforward gain matrix, and K is the
feedback gain matrix, which can be partitioned into gain matrices that feedback xj(f)
and xo2(0, respectively, as K = [ K j ; K2 ]. A schematic diagram of the reduced-order
compensator is shown in Figure 5.20.
   The estimation error dynamics of the reduced-order compensator is described by the
following state-equation, obtained by substituting Eq. (5.132) into Eq. (5.131):

                                    ^o2    (0 — Feo2(0                            (5.136)

while the state-equation for the tracking error, e(0 = *d(0 — x(0, is obtained by
subtracting Eq. (5.74) from Eq. (5.95), and substituting Eq. (5.135) as follows:

                     - Ae(0 + (Ad - A + BKd)x d (0 - BK[xd(0 - x0(0]              (5. 137)

On substituting for x0(0 from Eq. (5.126), Eq. (5.137) can be written as follows:

              e (1) (0 = (A - BK)e(0 + (Ad - A + BK d )x d (0 - BK2eo2(0            (5.138)

Hence, the dynamics of the tracking system can be described by Eqs. (5.136) and (5.138).
To have the tracking error go to zero in the steady state, irrespective of xd(0, we must
select the feedforward gain matrix, Kd, such that (Ad — A + BK<j)xd(0 = 0, and the
feedback gain matrix, K, such that the eigenvalues of (A — BK) are in the left-half plane.
Since the eigenvalues of (A — BK) are the regulator poles, and eigenvalues of F are


                      Compensator




              Figure 5.20   Tracking system based on reduced-order compensator
274                      CONTROL SYSTEM DESIGN IN STATE-SPACE


the reduced-order observer poles, it follows from Eqs. (5.136) and (5.138) that the poles
of the tracking system are of observer and regulator poles. (Prove this fact by finding
the eigenvalues of the closed-loop system whose state-vector is [e(0r; e<>2(0 r ] r -)
According to the separation principle, the design of regulator and observer can be carried
out separately by pole-placement. Note from Eqs. (5.136) and (5.138) that the order of
the reduced-order tracking system is (2n — k), where k is the number of measurable state-
variables. Recall form the previous sub-section that the order of the full-order tracking
system was 2n. Thus, the more state-variables we can measure, the smaller will be the
order of the tracking system based on reduced-order observer.


  Example 5.20
  Let us re-design the tracking system for the inverted pendulum on a moving cart
  (Example 5.18), using a reduced-order observer. Recall that it is desired to move
  the cart by 1 m, while not letting the pendulum fall. We have already designed
  a reduced-order observer for this plant in Example 5.19, using the measurement
  of the cart's displacement, ;c(r), such that the observer poles are s = —20, s =
  -20±20/. In Example 5.18, we were able to make (Ad - A + BKd)Xd(0 = 0
  with Kd = 0. It remains to select the regulator gain matrix, K, such that the
  eigenvalues of (A — BK) are at desired locations in the left-half plane. As in
  Example 5.18, let us choose the regulator poles to be s = —0.7853 ± 3.2532S/
  and 5 = —0.7853 ± 0.7853/. Note that we cannot directly use the regulator
  gain matrix of Example 5.18, because the state-vector has been re-defined in
  Example 5.19 to be x(/) = [x(t) 0(0; 0 (1) (0; * (1) (0 ] r , as opposed to x(0 =
  [0(0; *(0; 0 (1) (0; *(1)(01r of Example 5.18. The new regulator gain matrix would
  thus be obtained by switching the first and second elements of K calculated in
  Example 5.18, or by repeating pole-placement using the re-arranged state coefficient
  matrices as follows:
  »A = [A11 A12; A21 A22]; B = [B1; B2]; <enter>

  »v= [ - 0.7853+3.253281 - 0.7853 - 3.253281 - 0.7853+0.78531
   -0.7853-0.78531]'; K=place(A,B,v) <enter>

  place: ndigits= 16
  K =
  -1.40976+000     -2.70906+001     -5.13396+000     -1.99276+000

  The partitioning of K results in KI = -1.4097 and K2 = [-27.090; -5.1339;
  — 1.9927]. The closed-loop error dynamics matrix, ACL* is the state-dynamics matrix
  obtained by combining Eqs. (5.136) and (5.138) into a state-equation, with the state-
  vector, [e(0; e02(0 ]r, and is calculated as follows:

        »K2 = K ( 2 : 4 ) ; ACL = [A-B*K -B*K2; zeros(3,4) F]; <enter>
OBSERVERS, OBSERVABILITY, AND COMPENSATORS                           275


The eigenvalues of ACL are calculated as follows:

       »eig(ACL) <enter>
       ans =
       - 7.8530e-001+3.2533e+000i
       -7.8530e-001-3.2533e+000i
       -7.85300-001+7.85306-0011
       -7.85300 -001 - 7.85306 -001i
       - 2.00000+001+2.00006+001i
       -2.00000+001-2.00000+0011
       -2.00000+001

Note that the closed-loop eigenvalues consist of the regulator and observer poles,
as expected. The closed-loop error response (i.e. the solution of Eqs. (5.136) and
(5.138)) to Xd(f) = [1; 0; 0; 0]r is nothing else but the initial response to [e(0)r;
e,,2(0)7]r = [1; 0; 0; 0; 0; 0; O]7", which is computed as follows:

»sysCL=ss(ACL,zeros(7,1) , e y e ( 7 ) , z e r o s ( 7 , 1 ) ) ;
  [ y , t , e ] = initial(sysCL,[1 z e r o s ( 1 , 6 ) ] ) ; <enter>

   The estimation error vector, e02(?) is identically zero for this example, while the
tracking errors, i.e. elements of e(0, are plotted in Figure 5.21. Note in Figure 5.21
that all the error transients decay to zero in about 7 s. The maximum value for the
cart's velocity, x(l)(t), is seen to be about 0.9 m/s, while the angular velocity of the
pendulum, 6> ( 1 ) (/)> reaches a maximum value of 0.25 rad/s. The angular displacement
of the pendulum, 9(t), is always less than 0.1 rad (5.73°) in magnitude, which is
acceptably small for the validity of the linear plant model.




                     -0.5 -




Figure 5.21 Tracking error response of closed-loop system consisting of an inverted pendulum
on a moving cart and a reduced-order compensator (Example 5.20)
276_                      CONTROL SYSTEM DESIGN IN STATE-SPACE                            _


5.4.3    Noise and robustness issues

If noise is present in the plant, the plant's state-space representation is given by Eqs. (5.26)
and (5.27), and the feedback control-law, Eq. (5.109), is modified as follows:

                       u(f) = K[Xd(0 - «o(0] - KdXdCO - K n x n (0                      (5.139)

where x<i(0 and xn(0 are the desired state-vector and the noise vector, respectively, and
Kd and Kn are the feedforward gain matrices. In Eq. (5.139) it is assumed that both
Xd(0 and xn(0 can be measured, and thus need not be estimated by the observer. In
case Xd(0 and xn(0 are unmeasurable, we have to know the state-space model of the
processes by which they are generated, in order to obtain their estimates. While it may
be possible to know the dynamics of the desired state- vector, x<j(r), the noise- vector,
xn(0, is usually generated by a non-deterministic process whose mathematical model is
unknown. In Chapter 7, we will derive observers which include an approximate model for
the stochastic processes that generate noise, and design compensators for such plants. In
Chapter 7 we will also study the robustness of multivariable control systems with respect
to random noise.
   SIMULINK can be used to simulate the response of a control system to noise,
parameter variations, and nonlinearities, thereby giving a direct information about a
system's robustness.


  Example 5.21
  Let us simulate the inverted-pendulum on a moving cart with the control system
  designed in Example 5.18 with a full-order compensator, with the addition of
  measurement noise modeled as a band limited white noise source block of
  SIMULINK. White noise is a statistical model of a special random process that we
  will discuss in Chapter 7. The parameter power of the white noise block representing
  the intensity of the noise is selected as 10~8. A SIMULINK block-diagram of
  the plant with full-order compensator with regulator and observer gains designed
  in Example 5.18 is shown in Figure 5.22. Note the use of matrix gain blocks to
  synthesize the compensator, and a masked subsystem block for the state-space model
  of the plant. The matrix gain blocks are named B = B1 for the matrix B, C = C1
  for the matrix C, L = LI for the observer gain matrix L, and K = Kl = K2 for the
  regulator gain matrix, K. The scope outputs thet, x, thdot and xdot are the state-
  variables 0(0, x(t), 0 ( 1 ) (0> and je (1) (0, respectively, which are demux-ed from the
  state vector of the plant, and are also saved as variables in the MATLAB workspace.
  The resulting simulation of 9(t) and x ( t ) is also shown in Figure 5.22. Note the
  random fluctuations in both 0(0 and x(t) about the desired steady-state values
  of jcd = 1 m and 0<j = 0. The maximum magnitude of 0(0 is limited to 0.1 rad.,
  which is within the range required for linearizing the equations of motion. However,
  if the intensity of the measurement noise is increased, the 0(0 oscillations quickly
  surpass the linear range. The simulation of Figure 5.22 also conforms to our usual
  experience in trying to balance a stick vertically on a finger.
EXERCISES                                                     277


                   K1
                                                   r/txx'n
                                                   [4x1 J      r"i                 r~                             xdot
                                                                        i
                                                    Xd          ;
                                                                                    t
            B1                                                                                            MM
                                                                                            K2                   c1

                                    1                                                                           K*u
                                  s                                          W_             Inverted pendulum
                             Integratorl
                                                                                             on a moving cart
                                        C V 7 KV 7 A



                                                                                                            Band-limited
                                                                                                            white noise




                                                                                                  Subsystem block for
                                                                                                  Inverted pendulum on a
                                                                                                  moving cart




                   0.2          n              i         i          i          i        r
                   0.1

                     °
                  -0.1
                  -0.2          j          i
                         0                                      8              10    12      14      16    18    20
                                                                            Time (s)
                   1.5
                     1
                  0.5
                    0
                 -0.5                                   j       i                             I       I     I
                         0                                                     10    12      14      16    18    20
                                                                            Time (s)

 Figure 5.22    Simulation of the inverted pendulum on a moving cart with a full-order
 compensator and measurement noise with SIMULINK block-diagram



Exercises
5.1. Check the controllability of the plants with the following state-coefficient matrices:


                                               *-[? -i]= -[-? ?]
278                         CONTROL SYSTEM DESIGN IN STATE-SPACE


                                              0 1        0"             "0"
      (b)                              A=    25 0      -1     ;    B=    1                  (5.141)
                                              0 0        0              5


 5.2. As discussed in Section 5.1, an unstable plant is said to be stabilizable if all the
      uncontrollable sub-systems have stable eigenvalues. Check whether the plants given in
      Exercise 5.1 are stabilizable.


5.3. If a plant is stabilizable (see Exercise 5.2), we can safely ignore the uncontrollable sub-
     systems by removing the rows and columns corresponding to the uncontrollable states from
     the state coefficient matrices, A and B. The resulting state-space representation would be
     controllable, and is called a minimal realization. Find the minimal realization of the state
     coefficient matrices, A and B for the plants in Exercise 5.1.


5.4. A distillation column in a chemical plant has the following state-coefficient matrices:

                           "-21             0    0    0"             "6000     0
                              0.1         -5     0    0                  0     0
                        A=    r
                              0
                                            re
                                          -1.5
                                                 n
                                                 0
                                                      X ,:
                                                      0
                                                                  B=
                                                                  B-     "
                                                                         0     "
                                                                               2.3          (5.142)
                              0           -4     0    0                  0     0.1
      (a) Is the plant controllable?
      (b) Suppose we would like to control the plant using only one input at a time. Is the
          plant controllable with only the first input, i.e. with B = [6000; 0; 0; 0]r? Is the plant
          controllable with only the second input, i.e. with B = [0; 0; 2.3; 0.1 ] r ?


5.5. For the aircraft with lateral dynamics given in Eq. (4.97) in Exercise 4.3:
      (a) is the aircraft controllable using both the inputs?
      (b) is the aircraft controllable using only the aileron input, S/^(t)l
      (c) is the aircraft controllable using only the rudder input,


5.6. Consider the longitudinal dynamics of a flexible bomber airplane of Example 4.7, with
     the state-space representation given by Eq. (4.71).
      (a) Is the aircraft controllable using both the inputs, u  ( t ) and «2(0?
      (b) Is the aircraft controllable using only the desired elevator deflection, u(t)l
      (c) Is the aircraft controllable using only the desired canard deflection,

5.7. For the aircraft in Exercise 5.5, can you design a full-state feedback regulator which places
     the closed-loop poles of the aircraft at 51,2 = — 1 ± i; , $3 = — 15, s4 = —0.8 using only one
     of the inputs ? If so, which one, and what is the appropriate gain matrix?

5.8. For the aircraft in Exercise 5.6, design a full-state feedback regulator using both the inputs
     and the MATLAB (CST) command place, such that the closed-loop poles are located
EXERCISES                                          279

      at £ , 2 = — 3 ± 3i, .93,4 = — 1 ± 2i, s5 = -100, st, = -75. Find the maximum overshoots
      and settling time of the closed-loop initial response if the initial condition vector is
      x(0) = [0;0.5;0;0;0;0f.


 5.9. For the distillation column of Exercise 5.4, design a full-state feedback regulator to place
      the closed-loop poles at $1.2 = —0.5 ± 0.5i, .53 = —5, ^4 = —21.


5.10. Repeat Exercise 5.9 for the closed-loop poles in a Butterworth pattern of radius, R — 5.
      Compare the initial response of the first state-variable (i.e. for C = [l;0;0;0] and
      D = [0; 0]) of the resulting closed-loop system with that of Exercise 5.9 for initial
      condition, x(0) = [1; 0; 0; 0]r. Which of the two (present and that of Exercise 5.9)
      regulators requires the larger control input magnitudes for this initial condition?


5.11. Consider the turbo-generator of Example 3.14, with the state-space representation given
      byEq. (3.117).
      (a) Is the plant controllable using both the inputs, u  ( t ) and wi(0?
      (b) Is the plant controllable using only the input, W ] ( f ) ?
      (c) Is the plant controllable using only the input, ui(t)l
      (d) Design a full-state feedback regulator for the plant using only the input, u  ( t ) , such
          that the closed-loop eigenvalues are at 51,2 = —2.5 ± 2.5/, 53.4 = — 1 ± /, s$ = —10,
          ^6 =-15.
      (e) Repeat part (d) using only the input, «2(0-
      (0 Repeat part (d) using both the inputs, u { ( t ) and « 2 (0, and the MATLAB (CST)
         command place for designing the multi-input regulator.
      (g) Re-design the regulators in parts (d)-(f), such that the maximum overshoot and settling
          time for the output, y i ( t ) , are less than 0.3 units and 6 seconds, respectively, if the
          initial condition vector is x(0) = [0.1; 0; 0; 0; 0; O] 7 .
      (h) Re-design the regulators in parts (d)-(f), such that the closed-loop poles are in a
          Butterworth pattern of radius, R — 10, and compare the closed-loop initial responses
          and input magnitudes with those of part (g).


5.12. Check the observability of the plants with the following state coefficient matrices:
                 "-1       0        0
      (a) A =        0.3 -0.1       0.05 ;     C=[0 0          -2]                            (5.143)
                     1     0        0
                     0   0.1        -100       4
                  -250 -7               3     50
      (b) A =
                     0   0            - 3.3    0.06
                                                        ;   C = [0 0 1 0]                     (5.144)
                     2   0              0      0.25

      ,, A
      (C)A=
                "0      0 1-
                               Cr     f   l
                                              °1                                              (5.145)
                 0     -1 '         ~ -2 0
280                        CONTROL SYSTEM DESIGN IN STATE-SPACE


5.13. An unstable plant is said to be detectable if all the unobservable sub-systems have stable
      eigenvalues. Check whether the plants given in Exercise 5.12 are detectable.


5.14. If a plant is detectable (see Exercise 5.13), we can safely ignore the unobservable sub-
      systems by removing the rows and columns corresponding to the unobservable states from
      the state coefficient matrices, A and B. The resulting state-space representation would be
      observable, and is called a minimal realization. Find the minimal realization of the state
      coefficient matrices, A and B for the plants in Exercise 5.12.


5.15. For the distillation column of Exercise 5.4, the matrices C and D are as follows:

                                 „    |~0 0     1 0~|      _     fO 0"|                     ,_,.,.
                                 c=
                                      [ o o o ij ;        D=
                                                               [ o oj                      (5 146)
                                                                                             '
      (a) Is the plant observable?
      (b) Is the plant observable if only the first output was measured, i.e. C = [0; 0; 1; 0],
          D = 0?
      (c) Is the plant observable if only the second output was measured, i.e. C = [0; 0; 0; 1],
          D = 0?


5.16. For the aircraft with lateral dynamics given in Eq. (4.97) in Exercise 4.3:
      (a) is the aircraft observable with the output vector, y(t) = [p(t); r(r)] r ?
      (b) is the aircraft observable with the output vector, y(f) = [p(t) <f>(t)]T1
      (c) is the aircraft observable with the bank-angle, 4>(t), being the only measured output?
      (d) is the aircraft observable with the sideslip-angle, fi(t), being the only measured output?
      (e) design a full-order observer for the aircraft using only one of the state-variables as the
          output, such that the observer poles are placed at s.2 = —2 ± 2/, sj, = —16, 54 = —2.
      (f) design a full-order compensator based on the regulator of Exercise 5.7, and the
          observer designed in part (e). Calculate and plot the initial response, 0(r), of the
          compensated system if the initial condition is x(0) = [0.5; 0; 0; 0]r.


5.17. Consider the longitudinal dynamics of a flexible bomber airplane of Example 4.7.
      (a) Is the aircraft observable using both the outputs, y(t) and >'2(0?
      (b) Is the aircraft observable with only the normal acceleration, y(t), as the measured
          output?
      (c) Is the aircraft observable with only the pitch-rate, y2(t), as the measured output?
      (d) Design a full-order observer for the aircraft using only the normal acceleration output,
          y(t), such that the observer poles are placed at s.2 = — 4 ± 4 / , 534 = — 3 ± 3 / ,
          55 = -100, 56 = -75.
      (e) Design a full-order compensator for the aircraft with the regulator of Exercise 5.8
          and the observer of part (d). Compute the initial response of the compensated system
EXERCISES                                           281


          with the initial condition given by x(0) = [0; 0.5; 0; 0; 0; 0]r, and compare with that
          obtained for the regulated system in Exercise 5.8. Also compare the required inputs
          for the regulated and compensated systems.


5.18. For the distillation column of Exercise 5.15, design a two-output, full-order observer
      using the MATLAB (CST) command place such that the observer poles are placed at
      5i,2 = — 2 ± 2i, 53 = —5, $4 = —21. With the resulting observer and the regulator designed
      in Exercise 5.9, design a full-order compensator and find the initial response of the
      compensated system for the initial condition x(0) = [l;0;0;0] r . What are the control
      inputs required to produce the compensated initial response?


5.19. Consider the turbo-generator of Example 3.14, with the state-space representation given
      by Eq. (3.117).

      (a) Is the plant observable with both the inputs, y  ( t ) and y?(f)?

      (b) Is the plant observable with only the output, y(t)l

      (c) Is the plant observable with only the output, >'2(0'-;

      (d) Design a full-order observer for the plant using only the output, y(t), such that the
          observer poles are placed at 51,2 = —3.5 ± 3.5i, $3,4 = —5 ± 5/, $5 = —10, s^ = —15.

      (e) Repeat part (d) using only the output, >'2(0-

       (f) Repeat part (d) using both the outputs, y { ( t ) and y2(t), and the MATLAB (CST)
           command place for designing the two-output full-order observer.

      (g) Re-design the observers in parts (d)-(f), and combine them with the corresponding
          regulators designed in Exercise 5.1 l(g) to form compensators, such that the maximum
          overshoot and settling time for the compensated initial response, y  ( t ) , are less
          than 0.3 units and 6 seconds, respectively, if the initial condition vector is x(0) =
          [0.1; 0; 0; 0; 0; 0]r. How do the input magnitudes compare with the required inputs
          of the corresponding regulators in Exercise 5.11(g)?


5.20. Design a reduced-order observer for the aircraft of Exercise 5.16 using the bank-angle,
      4>(t), as the only output, such that the observer poles are in a Butterworth pattern of
      radius, R = 16, and combine it with the regulator of Exercise 5.7, to form a reduced-
      order compensator. Compare the initial response, 0(r), and the required inputs of the
      reduced-order compensated system to that of the full-order compensator in Exercise 5.16
      (f) with the initial condition x(0) = [0.5; 0; 0; 0] r .


5.21. Design a reduced-order observer for the aircraft of Exercise 5.17 with normal acceleration,
      y (t), as the only output, such that the observer poles are in a Butterworth pattern of radius,
      R = 100, and combine it with the regulator of Exercise 5.8, to form a reduced-order
      compensator. Compare the initial response and the required inputs of the reduced-order
      compensated system to that of the full-order compensator in Exercise 5.17(e) with the
      initial condition x(0) = [0; 0.5; 0; 0; 0; 0]r.
282                        CONTROL SYSTEM DESIGN IN STATE-SPACE


5.22. For the distillation column of Exercise 5.15, design a two-output, reduced-order observer
      using the MATLAB (CST) command place such that the observer poles are placed in
      Butterworth pattern of radius, R = 21. With the resulting observer and the regulator
      designed in Exercise 5.9, form a reduced-order compensator and compare the initial
      response and required inputs of the compensated system for the initial condition x(0) =
      [1; 0: 0; 0]r, with the corresponding values obtained in Exercise 5.18.


5.23. Using SIMULINK, simulate the tracking system for the inverted pendulum on a
      moving cart with the reduced-order compensator designed in Example 5.20, including
      a measurement white noise of intensity (i.e. power parameter in the band-limited white
      noise block) when the desired plant state is Xj = [0; 1; 0; 0]r.


5.24. Using SIMULINK, test the robustness of the full-order compensator designed (using linear
      plant model) in Example 5.18 in controlling the plant model described by the nonlinear
      state-equations of Eqs. (3.17) and (3.18) when the desired plant state is xj = [0; 1; 0; 0]r.
      (Hint: replace the subsystem block in Figure 5.22 with & function M-file for the nonlinear
      plant dynamics.)


References
1. Kreyszig, E. Advanced Engineering Mathematics. John Wiley & Sons, New York, 1972.
2. Friedland, B. Control System Design -An Introduction to State-Space Methods. McGraw-Hill
   International Edition, Singapore, 1987.
3. Kautsky, J. and Nichols, N.K. Robust Eigenstructure Assignment in State Feedback Control.
   Numerical Analysis Report NA/2/83, School of Mathematical Sciences, Flinders University,
   Australia, 1983.
Linear Optimal Control

6.1 The Optimal Control Problem
After designing control systems by pole-placement in Chapter 5, we naturally ask why
we should need to go any further. Recall that in Chapter 5 we were faced with an over-
abundance of design parameters for multi-input, multi-output systems. For such systems,
we did not quite know how to determine all the design parameters, because only a limited
number of them could be found from the closed-loop pole locations. The MATLAB M-file
place.m imposes additional conditions (apart from closed-loop pole locations) to deter-
mine the design parameters for multi-input regulators, or multi-output observers; thus the
design obtained by place.m cannot be regarded as pole-placement alone. Optimal control
provides an alternative design strategy by which all the control design parameters can
be determined even for multi-input, multi-output systems. Also in Chapter 5, we did not
know a priori which pole locations would produce the desired performance; hence, some
trial and error with pole locations was required before a satisfactory performance could
be achieved. Optimal control allows us to directly formulate the performance objectives
of a control system (provided we know how to do so). More importantly - apart from the
above advantages - optimal control produces the best possible control system for a given
set of performance objectives. What do we mean by the adjective optimal! The answer lies
in the fact that there are many ways of doing a particular thing, but only one way which
requires the least effort, which implies the least expenditure of energy (or money). For
example, we can hire the most expensive lawyer in town to deal with our inconsiderate
neighbor, or we can directly talk to the neighbor to achieve the desired result. Simi-
larly, a control system can be designed to meet the desired performance objectives with
the smallest control energy, i.e. the energy associated with generating the control inputs.
Such a control system which minimizes the cost associated with generating control inputs
is called an optimal control system. In contrast to the pole-placement approach, where
the desired performance is indirectly achieved through the location of closed-loop poles,
the optimal control system directly addresses the desired performance objectives, while
minimizing the control energy. This is done by formulating an objective function which
must be minimized in the design process. However, one must know how the performance
objectives can be precisely translated into the objective function, which usually requires
some experience with a given system.
    If we define a system's transient energy as the total energy of the system when it is
undergoing the transient response, then a successful control system must have a transient
energy which quickly decays to zero. The maximum value of the transient energy indicates
284                               LINEAR OPTIMAL CONTROL


the maximum overshoot, while the time taken by the transient energy to decay to zero
indicates the settling time. By including the transient energy in the objective Junction, we
can specify the values of the acceptable maximum overshoot and settling time. Similarly,
the control energy must also be a part of the objective function that is to be minimized. It
is clear that the total control energy and total transient energy can be found by integrating
the control energy and transient energy, respectively, with respect to time. Therefore, the
objective function for the optimal control problem must be a time integral of the sum of
transient energy and control energy expressed as functions of time.


6.1.1 The general optimal control formulation for regulators
Consider a linear plant described by the following state-equation:

                                                                                         (6.1)

Note that we have deliberately chosen a time-varying plant in Eq. (6.1), because the
optimal control problem is generally formulated for time-varying systems. For simplicity,
suppose we would like to design a full-state feedback regulator for the plant described
by Eq. (6. 1 ) such that the control input vector is given by

                                      u(r) = -K(r)x(0                                    (6.2)

The control law given by Eq. (6.2) is linear. Since the plant is also linear, the closed-loop
control system would be linear. The control energy can be expressed as u T (f)R(Ou(f),
where R(0 is a square, symmetric matrix called the control cost matrix. Such an
expression for control energy is called a quadratic form, because the scalar function,
u T (f)R(?)u(r), contains quadratic functions of the elements of u(r). Similarly, the transient
energy can also be expressed in a quadratic form as xT(f )Q(r)x(r), where Q(f) is a square,
symmetric matrix called the state weighting matrix. The objective Junction can then be
written as follows:

                   J(t,tf)=    / / [x T (T)Q(r)x(r)+u T (r)R(r)u(r)]t/r                  (6.3)

where t and tf are the initial and final times, respectively, for the control to be exercised,
i.e. the control begins at r = t and ends at r = tf, where r is the variable of integration.
The optimal control problem consists of solving for the feedback gain matrix, K(/), such
that the scalar objective function, J(t, tf), given by Eq. (6.3) is minimized. However, the
minimization must be carried out in such a manner that the state-vector, x(f), is the solution
of the plant's state-equation (Eq. (6.1)). Equation (6.1) is called a constraint (because in
its absence, x(r) would be free to assume any value), and the resulting minimization is
said to be a constrained minimization. Hence, we are looking for a regulator gain matrix,
K(f), which minimizes J ( t , t f ) subject to the constraint given by Eq. (6.1). Note that
the transient term, x T (r)Q(r)x(r), in the objective function implies that a departure of
the system's state, x(r), from the final desired state, x(/y) = 0, is to be minimized. In
other words, the design objective is to bring x(r) to a constant value of zero at final
_                                  THE OPTIMAL CONTROL PROBLEM_                               285


time, T = tf. If the final desired state is non-zero, the objective function can be modified
appropriately, as we will see later.
   By substituting Eq. (6.2) into Eq. (6.1), the closed-loop state-equation can be written
as follows:
                                                       f) - AcL(r)x(f)                (6.4)

where ACL(^) — [A(0 — B(t)K(t )], the closed-loop state-dynamics matrix. The solution
to Eq. (6.4) can be written as follows:

                                        x(0 = 4>cL(' , ro)x(fo)                              (6.5)

where 4>ci,(f » ?o) is the state-transition matrix of the time- varying closed-loop system
represented by Eq. (6.4). Since the system is time-varying, 3>cL(t, to), is not the matrix
exponential of ACL(^ ~~ to), but is related in some other way (which we do not know) to
ACL(O- Equation (6.5) indicates that the state at any time, x(t), can be obtained by post-
multiplying the state at some initial time, x(t0), with <I>CL(^ to)- On substituting Eq. (6.5)
into Eq. (6.3), we get the following expression for the objective function:

      J ( t , tf) =    x ( O O L ( r , /)[Q(r) + K(r)R(T)K(r)]cf> C L (T, t)x(t) dr          (6.6)

or, taking the initial state-vector, x(t), outside the integral sign, we can write

                                     J(t,tf) = T(t)M(t,tf)x(t)                             (6.7)
where
               M(f, tf) =          < I > L ( r , r)[Q(r) + K(T)R(r)K(r)]<D C L(r, t)di       (6.8)

Equation (6.7) shows that the objective function is a quadratic function of the initial state,
x(t). Hence, the linear optimal regulator problem posed by Eqs. (6.1)-(6.3) is also called
the linear, quadratic regulator (LQR) problem. You can easily show from Eq. (6.8) that
M(t, tf) is a symmetric matrix, i.e. M T (r, tf) = M(t, tf), because both Q(0 and R(t) are
symmetric. On substituting Eq. (6.5) into Eq. (6.6), we can write the objective function
as follows:
                               tf
                                  x T (r)[Q(r) + K T (T)R(r)K(r)]x(r) dr               (6.9)
                               /
On differentiating Eq. (6.9) partially with respect to the lower limit of integration, t,
according to the Leibniz rule (see a textbook on integral calculus, such as that by
Kreyszig [1]), we get the following:

                      d J ( t , tf)/dt = -xT(0[Q(0 + KT(t)R(t)K(t)]x(t)                     (6.10)

where 9 denotes partial differentiation.         Also, partial differentiation of Eq. (6.7) with
respect to t results in the following:

 dJ(t,tf)/dt     = [x(l)(t)]'M(t,tf)x(t)      +x1(t)[dM(t,tf)/dt]x(t)        +xl(t)M(t,tf)x(l}(t)
                                                                                            (6.11)
286                               UNEAR OPTIMAL CONTROL


On substituting x (1) (0 = AciXOxCO from Eq. (6.4) into Eq. (6.11), we can write

      dJ(t, tf)/dt = x T (0[Aj L (r)M(f, //) + 3M(f, tf)/dt + M(r, r/)ACL(01x(/)       (6.12)

Equations (6.10) and (6.12) are quadratic forms for the same scalar function, 37(r, //)/3/
in terms of the initial state, (t). Equating Eqs. (6.10) and (6.12), we get the following
matrix differential equation to be satisfied by M(f , //):

     -[Q(0 + K T (r)R(r)K(r)] = Aj L (r)M(r, //) + 3M(r, tf)/dt + M(r, r/)A CL (0 (6.13)
or

     -3M(f, //)/3/ = Aj L (OM(r, tf) + M(t, f/)A C L(0 + [Q(0 + K T (f)R(/)K(r)] (6.14)

Equation (6.14) is a first order, matrix partial differential equation in terms of the
initial time, /, whose solution M(t, tf) is given by Eq. (6.8). However, since we do
not know the state transition matrix, 4>cL(^ 0» of the general time-varying, closed-loop
system, Eq. (6.8) is useless to us for determining M (/, //). Hence, the only way to find
the unknown matrix M(r, tf) is by solving the matrix differential equation, Eq. (6.14).
We need only one initial condition to solve the first order matrix differential equation,
Eq. (6.14). The simplest initial condition can be obtained by putting t = tf in Eq. (6.8),
resulting in
                                       M(r/,r/) = 0                                   (6.15)

   The linear optimal control problem is thus posed as finding the optimal regulator
gain matrix, K(t), such that the solution, M(t, tf), to Eq. (6.14) (and hence the objective
function, J(t, tf)) is minimized, subject to the initial condition, Eq. (6.15). The choice of
the matrices Q(f) and R(t) is left to the designer. However, as we will see below, these
two matrices specifying performance objectives and control effort, cannot be arbitrary,
but must obey certain conditions.


6.1.2 Optimal regulator gain matrix and the Riccati equation

Let us denote the optimal feedback gain matrix that minimizes M(t,tf) by K<>(0.
minimum value of M(f, tf) which results from the optimal gain matrix, KO(')> is denoted
by Mo(r, tf), and the minimum value of the objective function is denoted by J0(t, tf). For
simplicity of notation, let us drop the functional arguments for the time being, and denote
M(r, tf) by M, /(/,//) by J , etc. Then, according to Eq. (6.7), the minimum value of
the objective function is the following:

                                     J0 = XT(t)M0(t)                                 (6.16)

Since J0 is the minimum value of J for any initial state, x(/), we can write J0 < 7, or

                                x r (r)M 0 x(r) < T(t)M(t)                          (6.17)
_                             THE OPTIMAL CONTROL PROBLEM_                               287


If we express M as follows:
                                        M = M0 + m                                   (6.18)

and substitute Eq. (6.18) into Eq. (6.17), the following condition must be satisfied:

                        T (/)M0x(f ) < x r (r)MoX(O + T (r)mx(r )                     (6.19)

or
                                        xr(»mx(r)>0                                  (6.20)

A matrix, m, which satisfies Eq. (6.20), is called a positive semi-definite matrix. Since
x(f) is an arbitrary initial state-vector, you can show that according to Eq. (6.20), all
eigenvalues of m must be greater than or equal to zero.
   It now remains to derive an expression for the optimum regulator gain matrix, KO(?)»
such that M is minimized. If M0 is the minimum value of M, then M0 must satisfy
Eq. (6.14) when K(f) = K«,(0, i.e.

         -dM0/dt = A L ( f ) M o + MoAciXO + [Q(0 + K(OR(OKo(0]                      (6.21)

Let us express the gain matrix, K(f), in terms of the optimal gain matrix, K0(0, as
follows:
                                K(0 = Ko(0 + k(r)                            (6.22)

On substituting Eqs. (6.18) and (6.21) into Eq. (6.14), we can write

            -3(Mo + m)/dt = AjL(0(Mo + m) + (M0 + m)ACL(0
                                + [Q(0 + {Ko(0 + k(r)} T R(0{Ko(0 + k(r)}]           (6.23)

On subtracting Eq. (6.21) from Eq. (6.23), we get

                           -dm/dt = Aj L (/)m + mACL(0 + S                           (6.24)

where
                                  T                 T         T
     S - [K(r)R(r) - MoB(0]k(0 + k(0[R(r)K 0 (r) - B(OM 0 ] + k(r)R(r)k(r)
                                                                                      (6.25)
 Comparing Eq. (6.24) with Eq. (6.14), we find that the two equations are of the same
form, with the term [Q(f) + K T (/)R(f)K(0] in Eq. (6.14) replaced by S in Eq. (6.24).
 Since the non-optimal matrix, M, in Eq. (6.14) satisfies Eq. (6.8), it must be true that m
 satisfies the following equation:

                                    f
                      m(t, tf) =        4>J L (r, r)S(r, r/)4>cL(r, 0 dr             (6.26)

Recall from Eq. (6.20) that m must be positive semi-definite. However, Eq. (6.26) requires
that for m to be positive semi-definite, the matrix S given by Eq. (6.25) must be positive
288                               LINEAR OPTIMAL CONTROL


semi-definite. Looking at Eq. (6.25), we find that S can be positive semi-definite if and
only if the linear terms in Eq. (6.25) are zeros, i.e. which implies

                                  Kj(f )R(f ) - MoB(r ) = 0                             (6.27)

or the optimal feedback gain matrix is given by

                                         = R- 1 (r)B T (f)M 0                           (6.28)

Substituting Eq. (6.28) into Eq. (6.21), we get the following differential equation to be
satisfied by the optimal matrix, MQ:

                                                 ~1
        -dM0/dt = A ( r ) M 0 + MoA(r) - M 0 B(OR~(OB(r)M 0 + Q(/)                      (6.29)

Equation (6.29) has a special name: the matrix Riccati equation. The matrix Riccati
equation is special because it's solution, M0, substituted into Eq. (6.28), gives us the
optimal feedback gain matrix, K<,(f). Exact solutions to the Riccati equation are rare,
and in most cases a numerical solution procedure is required. Note that Riccati equation
is a first order, nonlinear differential equation, and can be solved by numerical methods
similar to those discussed in Chapter 4 for solving the nonlinear state-equations, such as
the Runge-Kutta method, or other more convenient methods (such as the one we will
discuss in Section 6.5). However, in contrast to the state-equation, the solution is a matrix
rather than a vector, and the solution procedure has to march backwards in time, since
the initial condition for Riccati equation is specified (Eq. (6.15)) at the final time, t = //,
as follows:
                                        M0(r/,//)=0                                      (6.30)

For this reason, the condition given by Eq. (6.30) is called the terminal condition rather
than initial condition. Note that the solution to Eq. (6.29) is M<,(?, f/) where t < //. Let
us defer the solution to the matrix Riccati equation until Section 6.5.
   In summary, the optimal control procedure using full-state feedback consists of
specifying an objective function by suitably selecting the performance and control cost
weighting matrices, Q(r) and R(r), and solving the Riccati equation subject to the terminal
condition, in order to determine the full-state feedback matrix, K<,(r). In most cases, rather
than solving the general time-varying optimal control problem, certain simplifications can
be made which result in an easier problem, as seen in the following sections.


6.2 Infinite-Time Linear Optimal Regulator Design
A large number of control problems are such that the control interval, (// — t), is infinite.
If we are interested in a specific steady-state behavior of the control system, we are
interested in the response, x(r), when // —>• oo, and hence the control interval is infinite.
The approximation of an infinite control interval results in a simplification in the optimal
control problem, as we will see below. For infinite final time, the quadratic objective
_                     INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN_                       289

function can be expressed as follows:

                                 oo
                                      [x T (r)Q(T)x(r) + u T (T)R(r)u(T)]dr              (6.31)
                             /

where Joo(t) indicates the objective function of the infinite final time (or steady-state)
optimal control problem. For the infinite final time, the backward time integration of
the matrix Riccati equation (Eq. (6.29)), beginning from M0(oo, oo) = 0, would result
in a solution, M0(?, oo), which is either a constant, or does not converge to any limit.
If the numerical solution to the Riccati equation converges to a constant value, then
9M0/3? = 0, and the Riccati equation becomes

                0 - A ( r ) M 0 + MoA(r) - M 0 B(OR~(OB(OM 0 + Q(?)                      (6.32)

Note that Eq. (6.32) is no longer a differential equation, but an algebraic equation. Hence,
Eq. (6.32) is called the algebraic Riccati equation. The feedback gain matrix is given by
Eq. (6.28), in which M0 is the (constant) solution to the algebraic Riccati equation. It is
(relatively) much easier to solve Eq. (6.32) rather that Eq. (6.29). However, a solution to
the algebraic Riccati equation may not always exist.
    What are the conditions for the existence of the positive semi-definite solution to
the algebraic Riccati equation? This question is best answered in a textbook devoted to
optimal control, such as that by Bryson and Ho [2], and involves precise mathematical
conditions, such as stabilizability, detectability, etc., for the existence of solution. Here,
it suffices to say that for all practical purposes, if either the plant is asymptotically
stable, or the plant is controllable and observable with the output, y(0 = C(/)x(0, where
CT(?)C(0 = Q(t), and R(0 is a symmetric, positive definite matrix, then there is a unique,
positive definite solution, M0, to the algebraic Riccati equation. Note that C T (f)C(?) =
Q(0 implies that Q(r) must be a symmetric and positive semi-definite matrix. Furthermore,
the requirement that the control cost matrix, R(0> must be symmetric and positive definite
(i.e. all eigenvalues of R(f) must be positive real numbers) for the solution, M0 to be
positive definite is clear from Eq. (6.25), which implies that S (and hence m) will be
positive definite only if R(/) is positive definite. Note that these are sufficient (but not
necessary) conditions for the existence of a unique solution to the algebraic Riccati
equation, i.e. there may be plants that do not satisfy these conditions, and yet there may
exist a unique, positive definite solution for such plants. A less restrictive set of sufficient
conditions for the existence of a unique, positive definite solution to the algebraic Riccati
equation is that the plant must be stabilizable and detectable with the output, y(t) =
C(f)x(0, where C T (r)C(r) = Q(f), and R(t) is a symmetric, positive definite matrix (see
Bryson and Ho [2] for details).
    While Eq. (6.32) has been derived for linear optimal control of time-varying plants,
its usual application is to time -invariant plants, for which the algebraic Riccati equation
is written as follows:

                         0 = ATM0 + M0A - MoBR-^Mo + Q                                   (6.33)
290                               LINEAR OPTIMAL CONTROL


In Eq. (6.33), all the matrices are constant matrices. MATLAB contains a solver for
the algebraic Riccati equation for time-invariant plants in the M-file named are.m. The
command are is used as follows:

      »x = are(a,b,c) <enter>

where a = A, b = BR-1BT, c = Q, in Eq. (6.33), and the returned solution is x = MQ. For
the existence of a unique, positive definite solution to Eq. (6.33), the sufficient conditions
remains the same, i.e. the plant with coefficient matrices A, B must be controllable, Q
must be symmetric and positive semi-definite, and R must be symmetric and positive
definite. Another MATLAB function, ric, computes the error in solving the algebraic
Riccati equation. Alternatively, MATLAB's Control System Toolbox (CST) provides the
functions Iqr and Iqr2 for the solution of the linear optimal control problem with a
quadratic objective function, using two different numerical schemes. The command Iqr
(or Iqr2) is used as follows:

      »[Ko,Mo,E]= lqr(A,B,Q,R) <enter>

where A, B, Q, R are the same as in Eq. (6.33), Mo = M«, the returned solution of
Eq. (6.33), Ko = KQ= R~ ! B T M 0 the returned optimal regulator gain matrix, and E is the
vector containing the closed-loop eigenvalues (i.e. the eigenvalues of ACL = A — BK<>).
The command Iqr (or Iqr2) is more convenient to use, since it directly works with the
plant's coefficient matrices and the weighting matrices. Let us consider a few examples
of linear optimal control of time-invariant plants, based upon the solution of the algebraic
Riccati equation. (For time-varying plants, the optimal feedback gain matrix can be deter-
mined by solving the algebraic Riccati equation at each instant of time, t, using either Iqr
or Iqr2 in a time-marching procedure.)

  Example 6.1
  Consider the longitudinal motion of a flexible bomber aircraft of Example 4.7. The
  sixth order, two input system is described by the linear, time-invariant, state-space
  representation given by Eq. (4.71). The inputs are the desired elevator deflection
  (rad.), u i (0, and the desired canard deflection (rad.), W2(0> while the outputs are the
  normal acceleration (m/s2), y (t), and the pitch-rate (rad./s), yi(t). Let us design an
  optimal regulator which would produce a maximum overshoot of less than ±2 m/s2
  in the normal-acceleration and less than ±0.03 rad/s in pitch-rate, and a settling
  time less than 5 s, while requiring elevator and canard deflections not exceeding
  ±0.1 rad. (5.73°), if the initial condition is 0.1 rad/s perturbation in the pitch-rate,
  i.e. x(0) = [0;0.1;0:0;0;0] r .
      What Q and R matrices should we choose for this problem? Note that Q is a
  square matrix of size (6 x 6) and R is a square matrix of size (2 x 2). Examining the
  plant model given by Eq. (4.71), we find that while the normal acceleration, yi(f),
  depends upon all the six state variables, the pitch-rate, V2(0, is equal to the second
  state-variable. Since we have to enforce the maximum overshoot limits on y  ( t ) and
        , we must, therefore, impose certain limits on the maximum overshoots of all
INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN                           291


the state variables, which is done by selecting an appropriate state weighting matrix,
Q. Similarly, the maximum overshoot limits on the two input variables, u(t) and
U2(t], must be specified through the control cost matrix, R. The settling time would
be determined by both Q and R. A priori, we do not quite know what values of Q
and R will produce the desired objectives. Hence, some trial and error is required
in selecting the appropriate Q and R. Let us begin by selecting both Q and R as
identity matrices. By doing so, we are specifying that all the six state variables
and the two control inputs are equally important in the objective function, i.e. it is
equally important to bring all the state variables and the control inputs to zero, while
minimizing their overshoots. Note that the existence of a unique, positive definite
solution to the algebraic Riccati equation will be guaranteed if Q and R are positive
semi-definite and positive definite, respectively, and the plant is controllable. Let us
test whether the plant is controllable as follows:

      »rank(ctrb(A,B) ) <enter>

      ans=
        6

Hence, the plant is controllable. By choosing Q = I, and R = I, we are ensuring that
both are positive definite. Therefore, all the sufficient conditions for the existence
of an optimal solution are satisfied. For solving the algebraic Riccati equation, let
us use the MATLAB command Iqr as follows:

»[Ko,Mo,E]=lqr(A,B,eye(6),eye(2)) <enter>
Ko=
 3.3571e+000 -4.25096-001      -6.25386-001   -7.34416-001 2.81906+000      1.57656+000
 3.81816+000 1.02746+000       -5.47276-001   -6.80756-001 2.10206+000      1.85006+000

MO=
 1.74296+000   2 8 7 6 - 001
                .63            1.10596-002    -1.41596-002   4.47616-002    3.81816-002
 2.86736-001   4.14866-001     1.00946-002    -2.15286-003   -5.66796-003   1.02746-002
 1.10596-002   1.00946-002     1.00536+000    4.42176-003    -8.33836-003   -5.47276-003
-1.41596-002   -2.15286-003    4.42176-003    4.90476-003    -9.79216-003   -6.80756-003
 4.47616-002   -5.66796-003    -8.3383e-003   -9.79216-003   3.75866-002    2.10206-002
 3.81816-002   1.02746-002     -5.47276-003   -6.80756-003   2.10206-002    1.85006-002


- 2.21496+002+2.03386+0021
- 2.21496+002 - 2.0338e+002i
-1.25616+002
-1.84836+000+1.33836+0001
-1.84836+000-1.33836+0001
-1.00116+000


   To see whether this design is acceptable, we calculate the initial response of the
closed-loop system as follows:

»sys1=ss(A-B*Ko,zeros(6,2),C,zeros(2,2));<enter>
»[Y1 ,t1 ,X1]=initial(sys1,[0.1 zeros(1,5) ] ' ) ; u1 = -Ko*X1'; <enter>
292                                UNEAR OPTIMAL CONTROL


     Let us try another design with Q = 0.0 II, and R = I. As compared with the
  previous design, we are now specifying that it is 100 times more important to
  minimize the total control energy than minimizing the total transient energy. The
  new regulator gain matrix is determined by re-solving the algebraic Riccati equation
  with Q = 0.011 and R = I as follows:

  »[Ko,Mo,E] = lqr(A,B,0.01*eye(6),eye(2)) <enter>
  Ko=
      1.07806+000 -1.66776-001   -4.69486-002 -7.56186-002 5.98236-001        3.53026-001
      1.37856+000 3.45026-001    -1.31446-002 -6.52606-002 4.70696-001        3.09416-001

  Mo=
   4.19136-001    1.20576-001    9.27286-003    -2.27276-003   1.43736-002    1.37856-002
   1.20576-001    1.03366-001    6.19066-003    -3.91256-004   -2.22366-003   3.45026-003
   9.27286-003    6.19066-003    1.06496-002    9.70836-005    -6.25976-004   -1.31446-004
  -2.27276-003    -3.91256-004   9.70836-005    1.77646-004    -1.00826-003   -6.52606-004
   1.43736-002    -2.22366-003   -6.25976-004   -1.00826-003   796603
                                                                .74-0         476603
                                                                               .09-0
   1.37856-002    3.45026-003    -1.31446-004   -6.52606-004   4.70696-003    3.09416-003

  E =
  -9.18036+001
  - 7.87486+001+5.06256+001i
  -7.87486+001 -5.06256+001 i
  -1.16026+000+1.73286+0001
  -1.16026+000-1.73286+OOOi
  -1.05606+000


  The closed-loop state-space model, closed-loop initial response and the required
  inputs are calculated as follows:

  »sys2=ss(A-B*Ko,zeros(6,2),C,zeros(2,2)); <enter>
  »[Y2,t2,X2] = initial(sys2,[0.1 zeros(1,5) ]'); u2=-Ko*X2'; <enter>

 Note that the closed-loop eigenvalues (contained in the returned matrix E) of the first
 design are further inside the left-half plane than those of the second design, which
 indicates that the first design would have a smaller settling time, and a larger input
 requirement when compared to the second design. The resulting outputs, yi(/) and
 j2(0> for the two regulator designs are compared with the plant's initial response
 to the same initial condition in Figure 6.1.
     The plant's oscillating initial response is seen in Figure 6.1 to have maximum
 overshoots of —20 m/s2 and —0.06 rad/s, for vi(/) and y2(0, respectively, and a
 settling time exceeding 5 s (actually about 10 s). Note in Figure 6.1 that while
 the first design (Q = I, R = I) produces the closed-loop initial response of y2(0,
 i/i(r), and U2(t) within acceptable limits, the response of y(t) displays a maximum
 overshoot of 10 m/s2 (beginning at —15 m/s2 at / = 0, and shooting to —25 m/s2),
 which is unacceptable. The settling time of the first design is about 3 s, while that
 of the second design (Q = 0.011, R = I) is slightly less than 5 s. The second design
 produces a maximum overshoot of yi(r) less than 2 m/s2 and that of yi(t) about
 —0.025 rad/s, which is acceptable. The required control inputs, u  ( t ) and U2(t), for
 the two designs are plotted in Figure 6.2. While the first design requires a maximum
INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN                                                           293


                       20


                        0

                                                                            Open-loop plant
                      -20                                                   Regulator with Q = I, R = I
                                                                            Regulator with Q = 0.011, R = 1

                      -40
                             0                              2                              3
                                                                        Time (s)

                      U. 1
                              V
                     0.05

                        0
                                          ^-*crr^~- _ . - - -
                                                *-   * **                          r»           i *   -*u si   i n   i

                                                                                   Regulator with Q = 0.011, R - 1
                      n *                                   1                              1
                                                            2                              3
                                                                        Time (s)

Figure 6.1 Open and closed-loop initial response of the regulated flexible bomber aircraft, for
two optimal regulator designs



                                                I                   I                  I                I
                                     ;_                                                        Q = I, R = I
                             0.04
                                     r                                                         Q = 0.01I,R =
                             0.02                                                                                    —

                                     ^,
                             n fo        ^^r^^7                                   ,                   i
                                     0         1            2                    3                    4                  5
                                                                        Time (s)

                                                I               I                  I                    I


                        -0.05        ^^
                             -0.1                                                          Q = 6.011, R = |-
                        -0.15                  i            I                      I
                                     )         1            2                      3                   4             5
                                                                    Time (s)

Figure 6.2     Required initial response control inputs of the regulated flexible bomber aircraft,
for two optimal regulator designs



value of elevator deflection, u(t), about 0.045 rad., the second design is seen to
require a maximum value of u (t) less than 0.02 rad. Similarly, the canard deflection,
U2(t), for the second design has a smaller maximum value (—0.04 rad) than that of
the first design (—0.1 rad.). Hence, the second design fulfills all the design objectives.
294                                  LINEAR OPTIMAL CONTROL


    In Example 6.1, we find that the total transient energy is more sensitive to the settling
time, than the maximum overshoot. Recall from Chapter 5 that if we try to reduce the
settling time, we have to accept an increase in the maximum overshoot. Conversely, to
reduce the maximum overshoot of y(t}, which depends upon all the state variables, we
must allow an increase in the settling time, which is achieved in the second design by
reducing the importance of minimizing the transient energy by hundred-fold, as compared
to the first design. Let us now see what effect a measurement noise will have on the closed-
loop initial response. We take the second regulator design (i.e. Q = 0.011, R = I) and
simulate the initial response assuming a random error (i.e. measurement noise) in feeding
back the pitch-rate (the second state-variable of the plant). The simulation is carried out
using SIMULINK block-diagram shown in Figure 6.3, where the measurement noise is
simulated by the band-limited white noise block with a power parameter of 10~4. Note the


                                                Normal
                                                         tion
                                                acceleration     fa Pitch-rate
                                                (yi)             I  I(y2)



                                                            K*Lh>    J
                                                            ^^            Measure
                                                                          Measurement
                                                                            noise in
                                                                           pitch-rate




                         0                      8      10       12   14     16   18     20
                                                    Time (s)
                 0.15

                   0.1

                 0.05

                     0
                -0.05
                                                8      10 12         14    16    18     20
                                                    Time (s)

Figure 6.3 Simulation of initial response of the flexible bomber with a full-state feedback regulator
and measurement noise in the pitch-rate channel
INFINITE-TIME LINEAR OPTIAAAL REGULATOR DESIGN                                295


manner in which the noise is added to the feedback loop through the matrix gain block.
The simulated initial response is also shown in Figure 6.3. Note the random fluctuations in
both normal acceleration, y  ( t ) , and pitch-rate, j2(0- The aircraft crew are likely to have
a rough ride due to large sustained fluctuations (±10 m/s2) in normal acceleration, y  ( t ) ,
resulting from the small measurement noise! The feedback loop results in an amplification
of the measurement noise. If the elements of the feedback gain matrix, K, corresponding
to pitch-rate are reduced in magnitude then the noise due to pitch-rate feedback will
be alleviated. Alternatively, pitch-rate (or any other state-variable that is noisy) can be
removed from state feedback, with the use of an observer based compensator that feeds
back only selected state-variables (see Chapter 5).


   Example 6.2
   Let us design an optimal regulator for the flexible, rotating spacecraft shown in
   Figure 6.4. The spacecraft consists of a rigid hub and four flexible appendages, each
   having a tip mass, with three torque inputs, u(t), U2(t), u^(t), and three angular
   rotation outputs in rad., yi(t), y2(t), yi(t). Due to the flexibility of the appendages,
   the spacecraft is a distributed parameter system (see Chapter 1). However, it is
   approximated by a lumped parameter, linear, time-invariant state-space representa-
   tion using a finite-element model [3]. The order of the spacecraft can be reduced
   to 26 for accuracy in a desired frequency range [4]. The 26th order state- vector,
   x(r), of the spacecraft consists of the angular displacement, y(t), and angular
   velocity of the rigid hub, combined with individual transverse (i.e. perpendicular
   to the appendage) displacements and transverse velocities of three points on each
   appendage. The state-coefficient matrices of the spacecraft are given as follows:

             A                          B
                 =[-M°'K         J]         =[M°'d]

   where M, K, and d are the mass, stiffness, and control influence matrices, given in
   Appendix C.




   Figure 6.4     A rotating, flexible spacecraft with three inputs, ( u ] , u?, ua), and three outputs
   (01,6*2,03)
296                             UNEAR OPTIMAL CONTROL


      The eigenvalues of the spacecraft are the following:

        »damp(A) <enter>

        Eigenvalue                         Damping            Freq.(rad/sec)
        9.42996-013+7.61636+0031           -6.12306-017      7.61636+003
        9.42996-013-7.61636+0031           -6.12306-017      7.61636+003
        8.17126-013+4.75656+0041           -6.12306-017      4.75656+004
        8.17126-013-4.75656+0041           -6.12306-017      4.75656+004
        8.05396-013+2.53666+0031           -2.83276-016      2.53666+003
        8.05396-013-2.53666+0031           -2.83276-016      2.53666+003
        7.48676-013+4.75886+0041           -6.12306-017      4.75886+004
        7.48676-013-4.75886+0041           -6.12306-017      4.75886+004
        7.12766-013+2.59826+0041           -6.12306-017      2.59826+004
        7.12766-013-2.59826+0041           -6.12306-017      2.59826+004
        5.20546-013+1.48716+0041           -6.12306-017      1.48716+004
        5.20546-013-1.48716+0041           -6.12306-017      1.48716+004
        4.81106-013+2.09866+0021           -2.28176-015      2.09866+002
        4.81106-013-2.09866+0021           -2.28176-015      2.09866+002
        4.48126-013+2.60096+0041           -6.12306-017      2.60096+004
        4.48126-013-2.60096+0041           -6.12306-017      2.60096+004
        3.13876-013+7.57836+0031           -6.12306-017      7.57836+003
        3.13876-013-7. 57836+0031          -6.12306-017      7.57836+003
        2.44546-013+3.79526+0021           -7.27366-016      3.79526+002
        2.44546-013-3.79526+0021           -7.27366-016      3.79526+002
             0                             -1.00006+000      0
             0                             -1.OOOOe+000      0
        -9.95046-013+2 .47156+0031         3.82866-016       2.47156+003
        -9.95046-013-2 .47156+0031         3.82866-016       2.47156+003
        -1.17666-012+1 .48926+0041         1.60816-016       1.48926+004
        -1.17666-012-1 .48926+0041         1.60816-016       1.48926+004

 Clearly, the spacecraft is unstable due to a pair of zero eigenvalues (we can
 ignore the negligible, positive real parts of some eigenvalues, and assume that
 those real parts are zeros). The natural frequencies of the spacecraft range from
 0 to 47 588 rad/s. The nonzero natural frequencies denote structural vibration of
 the spacecraft. The control objective is to design a controller which stabilizes
 the spacecraft, and brings the transient response to zero within 5 s, with zero
 maximum overshoot, while requiring input torques not exceeding 0.1 N-m, when the
 spacecraft is initially perturbed by a hub rotation of 0.01 rad. due to the movement
 of astronauts. The initial condition corresponding to the initial perturbation caused
 by the astronauts' movement is x(0) = [0.01; zeros(l,25)]r. Let us see whether the
 spacecraft is controllable:

      »rank(ctrb(A,B)) <enter>

      ans=

        6
INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN                          297


Since the rank of the controllability test matrix is less than 26, the order of the
plant, it follows that the spacecraft is uncontrollable. The uncontrollable modes are
the structural vibration modes, while the unstable mode is the rigid-body rotation
with zero natural frequency. Hence, the spacecraft is stabilizable and an optimal
regulator can be designed for the spacecraft, since stabilizability of the plant is a
sufficient condition for the existence of a unique, positive definite solution to the
algebraic Riccati equation. Let us select Q = 2001, and R = I, noting that the size
of Q is (26 x 26) while that of R is (3 x 3), and solve the Riccati equation using
Iqr as follows:

    » [ K o 5 M o , E ] = l q r ( A , B , 2 0 0 * e y e ( 2 6 ) , e y e ( 3 ) ) ; <enter>

A positive definite solution to the algebraic Riccati equation exists for the present
choice of Q and R, even though the plant is uncontrollable. Due to the size of the
plant, we avoid printing the solution, Mo, and the optimal feedback gain matrix,
Ko, here, but the closed-loop eigenvalues, E, are the following:

      E =
      -1.7321e+003+4.7553e+004i
      -1.73216+003-4.75536+0041
      -1.75026+003+4.75296+0041
      -1.75026+003-4.75296+0041
      -1.89706+003+2.59436+0041
      -1.89706+003 -2.59436+0041
      -1.89916+003+2.59166+0041
      -1.89916+003-2.59166+0041
      -1.80816+003+1.45696+0041
      -1.80816+003 -1.45696+0041
      -1.81476+003+1.45506+0041
      -1.81476+003-1.45506+0041
      -7.37436+002+7.65366+0031
      - 7.37436+002 -7.65366+0031
      - 7.33286+002+7.61426+0031
      - 7.33286+002-7.61426+0031
      -2.67946+002+2.53486+0031
      -2.67946+002-2.53486+0031
      -2.58086+002+2.46986+0031
      -2.58086+002 -2.46986+0031
      -3.91906+001+3.77446+0021
      -3.91906+001-3.77446+0021
      -1.14826+000+4.31656-0011
      -1.14826+000-4.31656-0011
      -1.80666+001+2.09116+0021
      -1.80666+001-2.09116+0021

All the closed-loop eigenvalues (contained in the vector E) have negative real-parts,
indicating that the closed-loop system is asymptotically stable, which is a bonus! Let
us check whether the performance objectives are met by this design by calculating
the closed-loop initial response as follows:
298                                  LINEAR OPTIMAL CONTROL


   »sysCL=ss(A-B*Ko,zeros(26,3),C,D); <enter>
   >>
        ty,t,X] = initial(sysCL, [0.01 zeros(1, 25)]'); u = -Ko*X'; <enter>

   The closed-loop outputs, y(t), y2(t), and j3(/), and the required torque inputs,
   ui(t), U2(t), and ui(t), are plotted in Figure 6.5. We see from Figure 6.5 that all
   the three outputs settle to zero in 5 s, with zero overshoot, and that the input torque
   magnitudes are smaller than 0.1 N-m, as desired. Therefore, our design is successful
   in meeting all the performance objectives and input effort limits.




                        0.05

                           o

                       -0.05        U2(0, "3(0

                   £    -0.1
                               0
                                                   Time (s)

   Figure 6.5 Closed-loop initial response and required inputs of the regulated flexible spacecraft
   for optimal regulator designed with Q = 2001 and R = I



   Examples 6.1 and 6.2 illustrate two practical problems, one with a controllable plant,
and the other with an uncontrollable plant, which are successfully solved using linear
optimal control. Note the ease with which the two multi-input problems are solved
when compared with the pole-placement approach (which, as you will recall, would have
resulted in far too many design parameters than can be fixed by pole-placement). We will
now consider the application of optimal control to more complicated problems.



6.3 Optimal Control of Tracking Systems
Consider a linear, time-varying plant with state-equation given by Eq. (6.1). It is required
to design a tracking system for this plant if the desired state-vector, Xd(/), is the solution
of the following equation:
                                                                                               (6.35)
_                        OPTIMAL CONTROL OF TRACKING SYSTEMS_                             299


Recall from Chapter 5 that the desired state dynamics is described by a homogeneous
state-equation, because Xd(f) it is unaffected by the input, u(0- Subtracting Eq. (6.1) from
Eq. (6.35), we get the following state-equation for the tracking-error, e(0 = xj(/)

                                    0 + [Ad(0 - A(/)]xd(?) - B(f)u(0                   (6.36)

The control objective is to find the control input, u(t), such that the tracking-error, e(f ),
is brought to zero in the steady-state. To achieve this objective by optimal control, we
have to first define the objective function to be minimized. Note that, as opposed to the
regulator problem in which the input u(0 = — K(t)x(t), now the control input will also
depend linearly on the desired state-vector, x d (f). If we express Eqs. (6.1) and (6.35) by
a combined system of which the state-vector is x c (f) = [e(07; Xd(t)T]T, then the control
input must be given by the following linear control-law:

                      u(f) - -Kc(0xc(0 = -K c (?)[e(0 r ; xd(07Y                       (6.37)

where Kc(0 's the combined feedback gain matrix. Note that Eqs. (6.35) and (6.36) can
be expressed as the following combined state-equation:

                             x c (1) (0 = A c (/)x c (0 + B c (0u(r)                   (6.38)

where



Since Eqs. (6.1) and (6.2) are now replaced by Eqs. (6.38) and (6.37), respectively, the
objective function for the combined system can be expressed as an extension of Eq. (6.3)
as follows:
                                 r*f
                 J ( t , t f ) = I [x c T (r)Q c (T)x c (T)+u T (r)R(T)u(r)]</r   (6.40)

   Note that although we desire that the tracking error, e(0 = xd(0 — x(0» be reduced to
zero in the steady-state (i.e. when t -> oo), we cannot pose the tracking system design as
an optimal control problem with infinite control interval (i.e. tf = oo). The reason is that
the desired state-vector, Xd(0 (hence xc(0), may not go to zero in the steady-state, and
thus a non-zero control input, u(t), may be required in the steady-state. Also, note that
the combined system described by Eq. (6.38) is uncontrollable, because the desired state
dynamics given by Eq. (6.35) is unaffected by the input, u(0- Therefore, the combined
system's optimal control problem, represented by Eqs. (6.37)-(6.40) is not guaranteed
to have a unique, positive definite solution. Hence, to have a guaranteed unique, positive
definite solution to the optimal control problem, let us exclude the uncontrollable desired
state-vector from the objective function, by choosing the combined state-weighting matrix
as follows:
300                              UNEAR OPTIMAL CONTROL


which results in the following objective function:

                   7(My) = J / [e T (r)Q(T)e(T) + u T (r)R(r)u(r)]rfr                 (6.42)

which is the same as Eq. (6.3), with the crucial difference that u(r) in Eq. (6.42) is given
by Eq. (6.37), rather than Eq. (6.2). By choosing Q(0 and R(0 to be positive semi-
definite and positive definite, respectively, we satisfy the remaining sufficient conditions
for the existence of a unique, positive definite solution to the optimal control problem.
Note that the optimal feedback gain matrix, Koc(0, is given by the following extension
of Eq. (6.28):
                                  Koc(0 = R"1(r)Bj(r)Moe                              (6-43)
where MOC is the solution to the following Riccati equation:

      -dMw/dt = Aj(f)Moc + MocAc(r) - H^OR ' (OB?(OH* + Qc(0                         (6-44)
subject to the terminal condition, MOC(//, r/) = 0. Since MOC is symmetric (see
Section 6.1), it can be expressed as

                                                       1                              (6.45)

where Moi and Mo2 correspond to the plant and the desired state dynamics, respectively.
Substituting Eqs. (6.45) and (6.39) into Eq. (6.43), we can express the optimal feedback
gain matrix as follows:

                    Koc(0 = -[R~I(OBT(OM0i;          R~1(/)BT(OMo2]                  (6.46)

and the optimal control input is thus obtained by substituting Eq. (6.46) into Eq. (6.37)
as follows:
                 u(0 = R~' (OBT(OMoie(0 + R-1 (OBT(OMo2Xd(0                        <6-47)
   Note that Eq. (6.47) does not require the sub-matrix, M^. The individual matrix differ-
ential equations to be solved for M<>i and M<,2 can be obtained by substituting Eqs. (6.39)
and (6.45) into Eq. (6.44) as follows:

                     = AT(OMoi + MoiA(0 - M0,B(r)R-1 (r)BT(f )Moi+Q(0                (6.48)
                     = MozAdCO + Moi[Ad(r) - A(0]
                       + [AT(/) - M«iB(r)R-1 (OBT(f)]Mo2                             (6.49)

Note that Eq. (6.48) is identical to the matrix Riccati equation, Eq. (6.29), which can be
solved independently of Eq. (6.49), without taking into account the desired state dynamics.
Once the optimal matrix, Moi, is obtained from the solution of Eq. (6.48), it can be
substituted into Eq. (6.49), which can then be solved for M02. Equation (6.49) is a linear,
matrix differential equation, and can be written as follows:

                          = Mo2Ad(/) + Moi[Ad(f) - A(0] + A L (r)M« 2                (6.50)
_                        OPTIMAL CONTROL OF TRACKING SYSTEMS_                            301


where AciXO — A(0 — B(r)R~ 1 (OB T (OM 0 i, the closed-loop state-dynamics matrix. The
solution of the optimal tracking system thus requires the solution of the linear differential
equation, Eq. (6.50), in addition to the solution of the optimal regulator problem given by
Eq. (6.48). The solutions of Eqs. (6.48) and (6.49) are subject to the terminal condition,
Moc(f/» r /) — 0» which results in M 0 i(/y, tf) =0, and Mo20/, //) — 0.
   Often, it is required to track a constant desired state- vector, xd(0 — x^, which implies
Ad(0 = 0. Then the matrices M0i and M02 are both constants in the steady-state (i.e.
tf -> oo), and are the solutions of the following steady-state equations (obtained by
setting dM0i/dt = dMo2/dt = 0 and A d (0 = 0 in Eqs. (6.48) and (6.49)):

              0 = AT(OMol + M«,iA(f) - M 0 iB(OR~ 1 (OB T (f)Moi + Q(f)               (6.51)
              0 = -MoiA(f) + AjL(f )M«2                                               (6.52)

We immediately recognize Eq. (6.51) as the algebraic Riccati equation (Eq. (6.32)) of
the steady-state, optimal regulator problem. From Eq. (6.52), we must have

                                Mo2 = [AjL(0]-1MolA(0                                 (6.53)

where M0i is the solution to the algebraic Riccati equation, Eq. (6.51). Note, however,
that even though M0i and M02 are finite constants in the steady-state, the matrix Moc
is not a finite constant in the steady-state, because as x(r/) tends to a constant desired
state in the limit tf -> oo, the objective function (Eq. (6.42)) becomes infinite, hence a
steady-state solution to Eq. (6.44) does not exist. The only way M^ can not be a finite
constant (when both M0i and M02 are finite constants) is when M03 (the discarded matrix
in Eq. (6.45)) is not a finite constant in the steady-state.
   Substituting Eq. (6.53) into Eq. (6.47), we get the following input for the constant
desired state vector, x^:

         u(f) = R-1(OBT(r)M01e(0 + R- 1 (OB T (/)[Aj L (0]" l M 0 iA(?)x^             (6.54)

Substituting Eq. (6.54) into Eq. (6.36), we get the following closed-loop tracking error
state-equation with Ad(0 = 0 and xd(0 — x£:

     e(1)(0 = ACL(Oe(0 - [A(r) + B(OR-1(?)BT(0{AjL(r)}-1M01A(r)]xd                    (6.55)

From Eq. (6.55), it is clear that the tracking error can go to zero in the steady-state
(i.e. as t -> oo) for any non-zero, constant desired state, x^, if ACL(^) is asymptotically
stable and
                      A(0 + B(OR- 1 (OB T (r){Aj L (0}~ 1 M ol A(0 = 0              (6.56)

or

M01A(0 = -
                                                                                      (6.57)
302                              UNEAR OPTIMAL CONTROL


Equation (6.57) can be expanded to give the following equation to be satisfied by
for the steady-state tracking error to be zero:

                MolA(0 - -AT(f){B(OR~1(OBT(Or' A(f) + M.iA(0                           (6.58)

which implies that A T (0{B(OR~ I (OB T (0}~ I A(0 = 0, or {B(r)R- 1 (r)B T (r)}-'= 0.
Clearly, this is an impossible requirement, because it implies that R(f) = 0. Hence, we
cannot have an optimal tracking system in which the tracking error, e(r), goes to zero
in the steady-state for any constant desired state-vector, xj. As in Chapter 5, the best
we can do is to have e(0 going to zero for some values of x|j. However, if we want
this to happen while satisfying the optimality condition for M02 given by Eq. (6.53), we
will be left with the requirement that [A(0 + B(OR~1(OBT(0{AjL(0}~1M0iA(0]x5= 0
for some non-zero x|j, resulting in {B(r)R~ 1 (OB T (r)}" 1 A(r)Xj = 0, which implies that
{B(OR~1(OBT(0}~1 must be a singular matrix - again, an impossible requirement.
Therefore, the only possible way we can ensure that the tracking error goes to zero for
some desired state is by dropping the optimality condition on Mo2 given by Eq. (6.53).
Then we can write the input vector as follows:

                         u(f) - R- 1 (OB T (r)M ol e(/) - Kd(0*S                      <6-59)
where K<i(0 is the (non-optimal) feedforward gain matrix which would make e(0 zero
in the steady-state for some values of x|j. Substituting Eq. (6.59) into Eq. (6.36) we get
the following state-equation for the tracking error:

                      e (!) (0 = AciXOe(0 - [A(0 - B(r)Kd(f)]«J                       (6-60)
Equation (6.60) implies that for a zero steady-state tracking error, K<i(0 must be selected
such that [A(0 — B(OKd(0]x<i = ®- ^e closed-loop state-dynamics matrix, ACL, in
Eq. (6.60) is an optimal matrix given by ACL(') = A(0 - B(r)R~ I (f)B T (f)M 0 i, where
Moi is the solution to the algebraic Riccati equation, Eq. (6.51). Hence, the design of
a tracking system does not end with finding a unique, positive definite solution, Moi,
to the algebraic Riccati equation (which would make ACL(') asymptotically stable);
we should also find a (non-optimal) feedforward gain matrix, K<j(0> such that [A(0 —
B(OKd(0]xjj = 0 for some values of the constant desired state-vector, x^. Note that if the
plant has as many inputs as there are state variables, then B(r) is a square matrix, and it
would be possible to make e(0 zero in the steady-state for any arbitrary x[j, by choosing
K<i(0 = B~'(OA(0 (provided B(0 is non-singular, i.e. the plant is controllable.)

  Example 6.3
  Consider the amplifier-motor of Example 3.7, with the numerical values given
  as J = 1 kg.m2, R = 1000 ohms, L = 100 henry, a = 0.3 kg.m2/s2/Ampere, and
  KA = 10. Recall from Example 3.7 that the state-vector of the amplifier-motor is
  x(0 = [0(0; 0 (1) (0; i ( t ) ] T , where 0(0 is the angular position of the load on the
  motor, and i(0 is the current supplied to the motor. The input vector is u(0 =
  [i>(0; TKO]7", where v(t) is the input voltage to the amplifier and 7"L(0 is the
  torque applied by the load on the motor. It is desired to design a tracking system
OPTIMAL CONTROL OF TRACKING SYSTEMS                             303


such that the load on the motor moves from an initial angular position, $(0) = 0,
to desired angular position 0$(t} = 0.1 rad. in about six seconds, and comes to
rest at the desired position. The maximum angular velocity of the load, 0 ( l ) ( t ) ,
should not exceed 0.05 rad/s. After the load comes to rest at the desired position,
the current supplied to the motor should be zero. The desired state-vector is thus
x£ = [0.1; 0; O]7. The plant's state coefficient matrices are the following:
                        0      1         0                '0      0
                A=      0     -0.01      0.3       B=      0     -1
                        0    -0.003     -10                0.1    0
                                               0 0
                                               0 0
The eigenvalues of the linear, time-invariant plant are calculated as follows:

      »damp(A) <enter>

      Eigenvalue       Damping     Freq. (rad/sec)
          0            -1.0000     0
      -0.0101          1.0000      0.0101
      -9.9999          1.0000      9.9999

The plant is stable, with an eigenvalue at the origin. Since the plant is time-invariant,
the controller gain matrices must be constants. Let us first find the optimal feedback
gain matrix, K0i = — R~1BTM0i by choosing Q = I and R = I, and solving the
algebraic Riccati equation as follows:

      »[Ko1,Mo1,E] = lqr(A,B,eye(3),eye(2)) <enter>

      Ko1 =
        0.0025      0.0046       0.0051
       -1.0000      -1.7220      -0.0462

      M01 =
       1.7321       1.0000       0.0254
       1.0000       1.7220       0.0462
       0.0254       0.0462       0.0513

      E =
      -10.0004
      -0.8660 + 0.5000i
      -0.8660 - O.SOOOi

The closed-loop eigenvalues are all in the left-half plane, as desired for asymptotic
stability of the tracking error dynamics. Next, we calculate the feedforward gain
matrix, K^, which will make the steady-state tracking error zero for the specified
constant desired state, x|j. This is done by selecting Kd such that Axjj = BKdX^ as
follows:
304                                LINEAR OPTIMAL CONTROL



                                    if. _ f                                                (6.62)
                                          |_



                                               -0.1 Kd4                                    (6.63)


 Therefore, Ax|j = BKdXJj implies that Kd = 0 and Kd4 = 0. We can also choose the
 remaining elements of Kj as zeros, and still satisfy Ax|j = BKdXJj. Hence, K<| = 0,
 and the control input is given by u(f) = Koie(f).
    Let us obtain the tracking error response of the system to the initial tracking
 error, e(0) = x£—x(0) = xjj (since x(0) = 0) as follows:
 »t=0:0.05:6; sysCL=ss(A-B*Ko1, z e r o s ( 3 , 2 ) , C , D ) ; [ y , t , e ]
  = initial(sysCL, [0.1 0 0]'); <enter>

 Then, the state-vector, x(r), of the closed-loop system can be calculated using x(r) =
 Xj — e(0 as follows:
 »n=size(t, 1); for i=1:n; X d ( i , : ) = [ 0 . 1 0 0]; end; X=Xd-e; <enter>

 while the input vector, u(f), is calculated as
      »u = Ko1*e'; <enter>

 The calculated state variables, 0(t), 0(1)(0, i'(^). the input voltage, u(f), and the
 loading torque, Ti(t), are plotted in Figure 6.6. Note that all the state variables
 reach their desired values in about 6 s, with a maximum overshoot in angular




 Figure 6.6 Closed-loop initial response of the tracking system for amplifier-motor, with constant
 desired state, 0(f) = 0.1 rad, 0 ( 1 ) (f) = 0 rad, and i(f) = 0 amperes
OPTIMAL CONTROL OF TRACKING SYSTEMS                                                              305


velocity, 9 ( l ) ( t ) , of about 0.04 rad/s, and the maximum overshoot in current, /(?),
of —12.5 x 10~6 A. The maximum input voltage, v ( t ) , is 2.5 x 10~4 V and the
maximum loading torque is —0.1 N-m.
   Using SIMULINK, let us now investigate the effect of an uncertainty in the
amplifier gain, KA, on the tracking system. A SIMULINK block-diagram of the
closed-loop tracking system is shown in Figure 6.7. The uncertainty in the amplifier
gain, A.KA, affects only the third state-variable, i ( t ) , and is incorporated into the

                                                             Xd

                                      T                                                                 , 1 1
                /
                                                         ^                                              Uiwta
                             i                          <7<*U<                                           1         I
                     r                             1                            1
                     i^-ft                    *                       ,        >l       '             theta dot
                         ^ r*- +                    S                           1           .
                         B           — Amplifier-motor                                          '—>- 1'—1'

           IT        1—1                          [oni]i
                                                   </£
                                                                           /XdelKA

                                                                                     -*-1
                                                                                                          '
                                                                                                     Uncertainty in

                                                              delKA                                               nr
                     —l                                                                               rO
                                                                  1       i<                1
                         V



                20                        I         I                      I                     1            1         1

          <      0
                   f IJfMpflPP If ""fWII'rf WBPf ' W W Pw * nr
                             i      i   i    i       i i i
                                                                                                                            4
               -20
                     )           1        2        3          4            5        6           7            8         9     10
               0.2                        l         l         l            l                     i            l         l


          1 0.1


                 0 ^-^^                   I         l         l            I                    i            l         l
                   J   1                  2         3         4            5        6           7            8         9     10
               0.1                        l         I         l            l                     I            I         I
          E
          i
          2?



               01 /                       l        l          I          I                       i            l         l
               "" 0              1        2        3          4          5     6                7            8         9    1 0
                                                                      Time (s)

Figure 6.7     Simulation of the tracking system for amplifier-motor, with uncertainty in the
amplifier gain, KA
306                              LINEAR OPTIMAL CONTROL


 plant dynamics model using the band-limited white noise block output, A K A , multi-
 plied with the vector [0; 0; i ( t ) ] T , and added to the summing junction, which results
 in the plant dynamics being represented as x (1) (/) = (A + AA)x(r) + Bu(f), where
                                          0 0 0
                                 AA =     0 0 0                                      (6.64)
                                          0 0

 The simulated values of AA^, 6(t), and T^(t) are shown in Figure 6.7. Note that
 despite a random variation in KA between ±10, the tracking system's performance
 is unaffected. This signifies a design which is quite robust to variations in KA.


 Example 6.4
 For a particular set of flight conditions, the lateral dynamics of an aircraft are
 described by a linear, time-invariant state-space representation with the following
 coefficient matrices:
                "-9.75           0    -9.75    0"              20     2.77
                   0           -0.8     8      0               0     -3
            A =                                         B=                           (6.65)
                   0           -1     -0.8     0               0      0
                   1             0      0      0_              0      0

 The state-vector consists of the roll-rate, p ( t ) , yaw-rate, r ( t ) , side-slip angle,
 and bank angle, 0(0, and is written as x(f) = [p(t); r(r); 0(r); 0(f)] r . The input
 vector consists of the aileron deflection angle, 8(t), and rudder deflection angle,
 <$R(J), i.e. u(f) = [SA(t)',8R(t)]T. It is desired to execute a steady turn with a
 constant yaw-rate, r^(t) = 0.05 rad/s, a constant bank angle, <&/(/) = 0.02 rad, and
 zero roll-rate and sideslip angle, pd(t) = 0</(0 = 0. The desired state-vector is thus
 Xj = [0; 0.05; 0; 0.02]7. The desired state must be reached in about two seconds,
 with a maximum roll-rate, p(t), less than 0.1 rad/s and the control inputs (<5A(r)
 and <$R(O) not exceeding 0.3 rad. Let us first select a feedforward gain matrix, K<|,
 which satisfies Axjj = BK<ixjj as follows:

                           Kd=r                                                      (6.66)

                 20(0.05 Kaz             + 2.77(0.05^6 + 0.02A:d8)



                                                                               (6.67)
 Equation (6.67) indicates that, to make Ax|j = BKdXJj, we must have 0.05 KAb +
 0.02tfd8 = 0 and 0.05^2+0.02^4=0, which can be satisfied by selecting Kd=0.
 It now remains for us to calculate the optimal feedback gain matrix, K«i, by solving
 the algebraic Riccati equation. Note that the plant is stable with the following
 eigenvalues:
OPTIMAL CONTROL OF TRACKING SYSTEMS                               307

      »damp(A) <enter>
      Eigenvalue           Damping    Freq. (rad/sec)
          0                     -1.0000      0
      -0.8000 + 2.8284i          0.2722       2.9394
      -0.8000 - 2.8284i          0.2722       2.9394
      -9.7500                    1.0000       9.7500
Let us select R — I. After experimenting with several values of Q, we select the
following which satisfies the desired transient response and input limitations:

                                      20    0 0        0
                                       0    10 0       0
                              Q=       0    0 1    0
                                                                                    (6.68)
                                       0     0 0 200

With this combination of Q and R, the algebraic Riccati equation is solved as
follows:
      »[Ko1,Mo1,E] =                           <enter>
      K01 =
          4.1351      0.3322       -0.2935      14.0420
          0.5229      -2.7651      -1 .1575      1 .6797
      Mo1 =
       0.2068         0.0166       -0.0147      0.7021
       0.0166         0.9370       0.3723       0 . 0884
      -0.0147         0.3723       3.6355       -0.0908
       0.7021         0.0884       -0.0908      65.7890
      C    _


          -90.7740
          -8.4890
          -3.1456
          -1.3872
   The initial response of the tracking error, e(r), to x(0) = 0 is calculated as
follows:
»sysCL=ss(A-B*Ko1,zeros(4,2),eye(4),zeros(4,2)); <enter>
»t=0:0.001:2; [y,t,e]=initial(sysCL,[0 0.05 0 0 . 0 2 ] ' , t ) ; <enter>
and the state-vector and control input vector are then calculated as
»n = size(t,1); for i=1:n; X d ( i , : ) = [0 0.05 0 0.02]; end; X = X d - e ;
 u = -Ko1*e'; <enter>

The calculated state-vector, x(f), and input vector, u(0, are plotted in Figures 6.8
and 6.9, respectively. Note that all the transients settle to their desired values in about
two seconds, with a maximum overshoot in roll-rate, p(t), of less than 0.06 rad/s,
and a small maximum side-slip angle, fi(t). The aileron and rudder deflections are
seen in Figure 6.9 to be less than 0.3 rad. as desired.
308                                     LINEAR OPTIMAL CONTROL


                                                                       l                 I
                                                                               Yaw-rate, r{t) (rad./s)




                                    r—Roll-rate,                p(t) (rad./s)
                                    V
                                    
                                                                          Bank angle, 0(0 (rad-)
                                             s                                                       _
                                                 s           ..--•••             ""
                                                 N   .-••"
                                                 .-V

                                                             Side-slip angle, /?(f) (rad.)



                                                     0.5           1                    1.5
                                                               Time (s)

   Figure 6.8 Response of the tracking system for aircraft lateral dynamics for a desired steady
   turn with turn-rate, r(f) = 0.05 rad. and bank angle, 0(r) = 0.02 rad


                                                       I                   I                 l
                          0.1 *         Rudder input, <5R(f) (rad.)

                         0.05

                            0
                                 V
                        -0.05 T 

                              |~        Aileron input, 5A(f) (rad.)
                        -0.15 L

                         -0.2 h

                        -0.25
                         __n o                        i                i                  i
                                                                Time (s)

   Figure 6.9 Aileron and rudder inputs of the aircraft lateral dynamics tracking system for
   achieving a desired steady turn with turn-rate, r(f) = 0.05 rad. and bank angle, 0(f) = 0.02 rad



6.4 Output Weighted Linear Optimal Control
Many times it is the output, y(t), rather than the state-vector, x(t), which is included in the
objective function for minimization. The reason for this may be either a lack of physical
understanding of some state variables, which makes it difficult to assign weightage to
them, or that the desired performance objectives are better specified in terms of the
measured output; remember that it is the output of the system (rather than the state}
which indicates the performance to an observer (either a person or a mathematical device
_                         OUTPUT WEIGHTED LINEAR OPTIMAL CONTROL_                           309


discussed in Chapter 5). When the output is used to define the performance, the objective
function can be expressed as follows:

                     J(t, tf) = I ' [y T (r)Q(r)y(r) + u T (r)R(r)u(r)l dr                 (6.69)
                               Jt
where Q(t ) is now the output weighting matrix. Substituting the output equation given by

                                  y(0 = C(t)x(t) + D(0u(f )                                (6.70)

into Eq. (6.69), the objective function becomes the following:

     J ( t , t f ) = / >/ [x T (T)C T (r)Q(r)C(r)x(r) +x T (r)C T (T)Q(r)D(r)u(T)
                     Jt
                + u T (r)D T (r)Q(r)C(r)x(r) + u T (r){R(t) + D T (T)Q(r)C(r)}u(r)] dr
                                                                                   (6.71)
or

            J ( t , tf) = I / [x T (T)Q G (r)x(r) + x T (r)S(T)u(r) + u T (r)S T (T)x(T)
                          Jt
                       + u T (r)R G (T)u(r)]fl?r                                           (6.72)

where Q G (r) = C T (r)Q(T)C(r), S(r) = C T (r)Q(r)D(T), and R G (r) = R(T) +
D T (T)Q(r)C(r). You can show, using steps similar to Sections 6.1 and 6.2, that the
optimal regulator gain matrix, K«,(0, which minimizes J ( t , //•) given by Eq. (6.72) can
be expressed as

         Ko(0 = R£1(f)[BT(f)M0 + ST(01 = {R(0 + D T (r)Q(r)C(?)}~ 1 [B T (f)M 0
                  + D T (r)Q(r)C(r)]                                                       (6.73)

where M 0 (f, ?/) is the solution to the following matrix Riccati equation:

                -dM0/dt = Aj(OMo + M 0 A G (r) - M 0 B(OR G 1 a)B T (r)M 0
                              + [Qc(0 - S(OR G -'(OS T (r)]                                (6.74)

where AG(0 = A(f) — E(t)R^l(t)ST(t). Equation (6.74) can be solved numerically in
a manner similar to that for the solution to Eq. (6.29), with the terminal condition
Mo(f/,f/)=0.
   The steady-state optimal control problem (i.e. when tf -» oo) results in the following
algebraic Riccati equation:

   0 = Aj(OM0 + MoAeCO - M0B(ORG1(OBT(r)M0 + [QG(0 - S(ORGV)ST(0]
                                                                                     (6.75)
The sufficient conditions for the existence of a unique, positive definite solution, M0, to
Eq. (6.75) are similar to those for Eq. (6.32), i.e. the system - whose state coefficient
matrices are AG(0 and B(f) - is controllable, [QG(0 — S(?)RG1(?)ST(f)l is a positive
310                                LINEAR OPTIMAL CONTROL


semi-definite matrix, and Rc(0 is a positive definite matrix. However, note that for a
plant with state-equation given by Eq. (6.1), these conditions are more restrictive than
those for the existence of a unique, positive definite solution to Eq. (6.32).
   Solution to the algebraic Riccati equation, Eq. (6.75), can be obtained using the
MATLAB function are or CST function Iqr, by appropriately specifying the coefficient
matrices AG(0 and B(r), and the weighting matrices [Qc(0 - S(OR£!(OST(/)] and
RG(?) at each instant of time, t. However, MATLAB (CST) provides the function Iqry
for solving the output weighted linear, quadratic optimal control problem, which only
needs the plant coefficient matrices A(r), B(0, C(f), and D(r), and the output and control
weighting matrices, Q(r) and R(/X respectively, as follows:

      »[K,Mo,E] = lqry(sys,Q,R) <enter>

where sys is the state-space LTI object of the plant. The Iqry command is thus easier to
use than either are or Iqr for solving the output weighted problem.


  Example 6.5
  Let us design an optimal regulator for the flexible bomber aircraft (Examples 4.7,
  6.1) using output weighting. Recall that the two outputs of this sixth-order, time-
  invariant plant are the normal acceleration in m/s2, yi(f), and the pitch-rate in
  rad./s, y2(0- Our performance objectives remain the same as in Example 6.1, i.e. a
  maximum overshoot of less than ±2 m/s2 in the normal-acceleration and less than
  ±0.03 rad/s in pitch-rate, and a settling time less than 5 s, while requiring elevator
  and canard deflections (the two inputs) not exceeding ±0. 1 rad. (5.73°), if the initial
  condition is 0.1 rad/s perturbation in the pitch-rate (x(0) = [0; 0.1; 0; 0; 0; 0]r).
  After some trial and error, we find that the following weighting matrices satisfy
  the performance requirements:


                                             ?]'     Mi ?]

  which result in the following optimal gain matrix, K«(0, the solution to algebraic
  Riccati equation, M0, and the closed-loop eigenvalue vector, E:

  »sys=ss(A,B,C,D);[Ko,Mo,E] = lqry(sys, [0.0001 0; 0 1 ] , e y e ( 2 ) ) <enter>

  Ko=
   1.25256+001 -2.36156-002 3.35576-001 -3.76726-003 1.04266+001 4.47686+000
   6.66016+000 3.34496-001 1.82386-001 -1.12276-002 5.96906+000 2.60426+000

  Mo=
   1.15576+000 4.6221e-0012.1004e-002 7.22816-003 1.67006-001 6.66016-002
   4.62216-001 1.17156+0001.38596-002 1.29806-002-3.14876-004 3.34496-003
   2.10046-002 1.38596-0027.34556-004 1.98236-004 4.47426-003 1.82386-003
   7.22816-003 1.29806-002 1.98236-004 1.94696-004 -5.02296-005 -1.12276-004
   1.67006-001 -3.14876-0044.47426-003-5.02296-005 1.39026-001 5.96906-002
   6.66016-002 3.34496-003 1.82386-003 -1.12276-004 5.96906-002 2.60426-002
OUTPUT WEIGHTED LINEAR OPTIMAL CONTROL                                            311



   -1.12006+003
   -9.4197e+001
   -1.53856+000+           2.20066+OOOi
   -1.5385e+000-           2.20066+OOOi
   -1.00376+000+           6.2579e-0011
   -1.00376+000-           6.2579e-001i


   The closed-loop initial response and required control inputs are calculated as follows:

   » s y s C L = s s ( A - B * K o , z e r o s ( 6 , 2 ) , C , D ) ; [y, t,   X]=initial(sysCL, [0 0.1 0 0 0 0 ] ' ) ;
      u = -Ko*X'; <enter>


   Figure 6.10 shows the plots of the calculated outputs and inputs. Note that all the
   performance objectives are met, and the maximum control values are —0.035 rad.
   for both desired elevator and canard deflections, u(t) and «2(0» respectively.


                                   5                                                  0.1

                                   0
                                                                                     0.05

                                                                                         0
                               -10

                               -15                                                -0.05
                                       0         2          4                                  2      4
                                                 Time (s)                                      Time (s)

                               0.02
                                           Desired canard deflection, u2(f)

                         S         °
                         DC

                              -0.02


                              -0.04
                                       0                              2              3
                                                                          Time (s)

  Figure 6*10 Closed-loop initial response and required inputs for the flexible bomber aircraft,
  with optimal regulator designed using output weighting



   Let us simulate the closed-loop initial response of the present design with the regulator
designed in Example 6.1 using state-weighting. We use the same SIMULINK block-
diagram as shown in Figure 6.3, with the measurement noise modeled by the band-
limited white noise block of power 10"4. The resulting simulated response is shown
in Figure 6.11. Note that the fluctuations in both y(t) and j2(0 are about an order
of magnitude smaller than those observed in Figure 6.3, which indicates that a better
robustness with respect to measurement noise has been achieved using output-weighted
optimal control.
312                                UNEAR OPTIMAL CONTROL


                         5
                         0
                       -5
                      -10
                      -15                                                        10
                                               4      5       6
                                                   Time (s)


                      0.15


               f(0
               —      0.05
                .w


                     -0.05
                                               4      5       6                  10
                                                   Time (s)

Figure 6. 11 Simulated initial response of the flexible bomber with an output-weighted optimal
regulator including measurement noise in the pitch channel (SIMUUNK block-diagram of Figure 6.3)


6.5 Terminal Time Weighting: Solving the Matrix
    Riccati Equation
Thus far, we have considered the optimal control problems in which the closed-loop
system is brought to a desired state by minimizing the deviation of the transient response
from the desired state. However, sometimes it is also important to minimize the deviation
of the system from the desired state at a specified final time, tf. In other words, it is not
only important to reach the final state, but to reach there in a specified final time, r/, called
the terminal time. By assigning a weightage to the state of the system at the terminal time,
x(f/), in the objective function to be minimized, we can specify the relative importance of
minimizing the deviation from the final state. The objective function with terminal time
weighting can be expressed as follows:

       J ( t , t f ) = /> [x T (r)Q(T)x(r) +u T (r)R(r)u(r)]dr + x T (r / )Vx(f / )       (6.77)
                       Jt
where V is the constant terminal time weighting matrix. For minimizing the objective func-
tion given by Eq. (6.77) for the optimal regulator problem (i.e. when u(t ) = — Ko(f )x(f )),
it can be shown using steps similar to those in Section 6. 1 , that the optimal feedback gain
matrix is given by
                                        = R~ 1 (OB T (f)M 0                            (6.78)
TERMINAL TIME WEIGHTING: SOLVING THE MATRIX RICCATI EQUATION               313


where M0 is the solution to the matrix Riccati equation, Eq. (6.29), repeated here as
follows:
        -BMo/Bt = AT(OM0 + M0A(0 - M 0 B(r)R~ 1 (OB T (r)M 0 + Q(t)                  (6.79)
subject to the following terminal condition:
                                      M 0 (r/,f/) = V                                (6.80)
Hence, the terminal time weighted problem differs from the standard problem of
Section 6.1 only in the non-zero terminal condition for the matrix Riccati equation.
   Note that the terminal time weighted optimal control cannot be simplified in a manner
similar to the infinite time control, which results in an algebraic Riccati equation. In
other words, we cannot avoid taking the bull by the horns anymore; we have to solve
the matrix Riccati equation if we want to solve the terminal time control problem. For
simplicity, let us confine ourselves to time-invariant plants only, (t) = A, B(f) = B,
and Q(t) = Q, R(0 = R, where A, B,Q, and R are constants. Then the matrix Riccati
equation becomes
                   -BMo/Bt = ATM0 + M0A - M0BR~1BTM0 + Q                             (6.81)
which is to be solved with the terminal condition given by Eq. (6.80). We remarked in
Section 6.1 on the difficulty of solving the matrix Riccati equation, owing to its nonlinear
nature. However, if we look carefully at Eq. (6.81), we find that by expressing M0 in the
following manner
                               Mo(r, tf) = E(t, tfW~l(t, tf)                          (6.82)

where E(t, tf) and F(r, tf) are two unknown matrices, we can write Eq. (6.81), as the
following set of coupled, linear differential equations:

                    [ d¥(t, tf)/dt ] r A        -BR-'BT 1 r F<r, tf) -I
                    [dE(t,tf)/dt-[-Q             -AT [E(t,tf)                     (6 83)
                                                                                       '

If we define a matrix H, called the Hamiltonian, as follows


                                H = [_Q ^RAT]                                        (6.84)

then we can write the solution to the homogeneous set of first order, matrix differ-
ential equation, Eq. (6.83), as an extension of the solution given by Eq. (4.16) to the
homogeneous, vector state-equation. Hence, we can write




where exp{H(f — tf)} is a matrix exponential which can be calculated by the methods
of Chapter 4. To satisfy the terminal condition, Eq. (6.80), we can choose E(r/, tf) — V,
and F(f/,r/) = I. Thus, for a given time, t, the matrices E ( t , t f ) and ¥(t,tf) can be
314                                  LINEAR OPTIMAL CONTROL


calculated using Eq. (6.85), where the matrix exponential, exp{H(f — ff)}, is calculated by
an appropriate algorithm, such as expm, expml, expm2, or expmS of MATLAB. However,
care must be taken to select Q and R matrices, such that the calculated matrix F(/, //)
is non-singular, otherwise M0 cannot be computed using Eq. (6.82). A MATLAB M-
file called matricc.m, which solves the matrix Riccati equation for linear, time-invariant
systems using Eq. (6.85) is given in Table 6.1, and can be called as follows:

      »Mo = matricc(A,B,Q,R,V,t,tf ,dt) <enter>

where A, B, Q, R, V, t, and f/(f/) are the same as in Eq. (6.77), dt is the time-step, and
Mo(M0) is the returned solution of the matrix Riccati equation, Eq. (6.81).
   For solving the terminal time weighted optimal control problem, it is clear that
while the matrix Riccati equation is solved by marching backwards in time using
Eq. (6.85) - starting with the terminal condition, Eq. (6.82) - the state-equation of the
closed-loop system must be solved by marching forwards in time using the methods
of Chapter 4, starting with the initial condition, x(r0) = xo. Hence, the solution requires
marching in both forward and backward direction (in time), beginning from the conditions
specified at the two time boundaries, i.e. the terminal time, //, and initial time, ?o- For this
reason, the general optimal control problem is referred to as two-point boundary-value
problem. We can write a computer program combining the solution to the matrix Riccati
equation and the solution to the closed-loop state-equation. Such a program is given
in Table 6.2 as an M-file called tpbvlti.m, which solves the two-point boundary-value


       Table 6.1 Listing of the M-file matricc.m for the solution of the terminal-time weighted,
       linear optimal control problem

                                             matricc.m
      function M=matricc(A J B,Q,R J V,t > tf);
      % Program for solving the Matrix Riccati equation resulting
      % from the terminal-time weighted optimal control problem for
      % linear, time-invariant systems.
      % A = State dynamics matrix of the plant
      % B = Input coefficient matrix of the plant
      % Q = State weighting matrix
      % R = Control weighting matrix
      % V = Terminal state weighting matrix
      % t = present time
      % tf = terminal time
      % M = returned solution of the Matrix Riccati equation
      % Copyright(c)2000 by Ashish Tewari
      %
      % Construct the Hamiltonian matrix:-
      H=[A -B*inv(R)*B';-Q -A'];
      % Solve the Matrix Riccati equation using the matrix exponential:-
      n=size(A,1);
      FE=expm2(H*(t-tf))*[eye(n);V];
      F=FE(1:n,:);E=FE(n+1:2*n,:);
      M=E*inv(F);
_                  TERMINAL TIME WEIGHTING: SOLVING THE MATRIX RICCATI EQUATION_                     315


Table 6.2 Listing of the M-file tpbvlti.m for solving the two-point boundary value problem associated
with the solution of the closed-loop state-equations with a terminal-time weighted, linear time-invariant,
optimal regulator

                                                          tpbvlti.m

function [u,X,t] = tpbvltiCA.B.Q.RjVjtO.tf ,XO)
% Time-marching solution of the two-point boundary-value problem
% resulting from the terminal- time weighted, optimal regulator
% for a linear, time- invariant system.
% A= State dynamics matrix of the plant
% B= Input coefficient matrix of the plant
% Q= State weighting matrix
% R= Control weighting matrix
% V= Terminal state weighting matrix
% tO= initial time; tf= terminal time (tf-tO should be small for
% convergence)
% X0= initial state vector; t= time vector
% u=matrix with the ith input stored in the ith column, and jth row
% corresponding to the jth time point
% X= returned matrix with the ith state variable stored in the ith column,
% and jth row corresponding to the jth time point
% copyright (c)2000 by Ashish Tewari
[w,z]=damp(A) ;
mw=max(w) ;
if mw==0 ;
dt=(tf-tO)/20;
else
dt=1 /max(w) ;
end
t=tO:dt:tf ;
n=size(t,2) ;
% initial condition :-
X(1,:)=XO';
% solution of the matrix Riccati equation for t=tO:-
M=matricc(A,B,Q,R,V,tO,tf ) ;
% calculation of input vector for t=tO:-
u(1 , : )=-X(1, : )*M*B*inv(R);
% beginning of the time-loop: -
for i=1 :n-1
% solution of the matrix Riccati equation : -
M=matricc(A,B,Q,R,V,t(i),tf ) ;
% calculation of the closed-loop state-dynamics matrix
Ac=A-B*inv(R)*B'*M;
% conversion of system from continuous-time to digital
[ad,bd]=c2d(Ac,B,dt);
% solution of digitized closed-loop state-equations
% updating the input vector for time t=t(i):-
u(i+1 , : ) = - X ( i + 1 , : ) * M * B * i n v ( R ) ;
end
316                                UNEAR OPTIMAL CONTROL


problem for a linear, time-invariant plant using matricc.m for the solution of matrix
Riccati equation. This M-file can be used as follows:

      »[u,X,t] = tpbvltMA.B.Q^V.tO.tf ,XO) <enter>

where A, B, Q, R, V, t, and tf(tf) have their usual meanings, fO is the initial time at
which the initial condition vector, xO, is specified, and u, x, and t contain the returned
input, state and time vectors, respectively. However, the usage of this M-file is restricted
to small value of the interval tf — to. For larger time intervals, a time-marching procedure
of Chapter 4 could be used, employing // — IQ as the time step.

  Example 6.6
  Terminal time weighting is very common in problems where two objects are desired
  to be brought together in a specified final time, such as missile guidance to a
  target, a rendezvous (or docking) of two spacecraft, or a rendezvous of an aircraft
  and a tanker aircraft for refuelling. When posing the optimal guidance strategy for
  such problems, usually the state variables are the relative distance between the two
  objects, x(t), and the relative velocity (also called the closure velocity), X2(t). At
  some specified final time, r/, it is desired that the relative distance becomes zero,
  i.e. x(tf) = 0. Whereas in a rendezvous problem, it is also desired that the final
  closure velocity also becomes zero, i.e. *2(//) = 0, such a condition is not imposed
  on guiding a missile to its target. If x (tf) / 0, a miss is said to occur, and the miss
  distance, x(tf), is a measure of the success (or failure) of either the rendezvous or
  the missile intercept. The linear, time-invariant state-equation for a missile guidance
  or a rendezvous problem can be written in terms of the state variables, ATI (t ) and
  X2(0> and single input, u(t} - which is the normal acceleration provided to the
  object - with the following state coefficient matrices:




  When we do not care how the missile (or spacecraft) moves before the intercept
  (or rendezvous) occurs, we may not wish to assign any weightage to the tran-
  sient response by choosing Q = 0, and R = 1 . In such cases, the matrix Riccati
  equation can be solved analytically, and you may refer to Bryson and Ho [2] for
  the resulting exact solutions. However, it is generally desired that the plant adheres
  to certain limitations in its transient response, while proceeding from the initial
  time to the final time, hence Q is appropriately chosen to be non-zero. Let us
  consider a spacecraft docking (rendezvous) problem. The initial relative distance
  and closure velocity between the two spacecraft are 100 m and —10 m/s, respec-
  tively. It is desired to complete the rendezvous in 10 seconds, with the closure
  velocity never exceeding a magnitude of 50 m/s, while requiring a maximum normal
  acceleration input magnitude of less than 50 m/s2. The docking will be considered
  successful if the final magnitudes of relative distance, x  ( t f ) , and relative velocity,
  X2(tf), are less than 0.15 m and 0.5 m/s, respectively. Since both relative distance,
TERMINAL TIME WEIGHTING: SOLVING THE MATRIX RICCATI EQUATION                        317


x (0, and closure velocity, X2(t), are required to be minimized at the terminal time,
the terminal time weighting matrix, V, should assign weightage to both the state
variables. The following choice of Q, R, and V is seen to meet the performance
requirements:

                                  i o                                  10       0
                                                                                         (6.87)
                                                              V =
                                  0 0                                  0        0

and the two-point boundary-value problem is solved using tpbvlti.m as follows:

» [ u , X , t ] = tpbvlti(A,B, [1 0; 0 0 ] , 3 , [ 1 0 0; 0 0 ] , 0 , 1 0 ,
   [100 - 1 0 ] ' ) ; <enter>


The calculated state variables, *i(0 and X2(t), and the input, u(t), are plotted in
Figure 6.12. Note that the performance objectives are met quite successfully. The
calculated values of x(tf) and X2(t/) are not exactly zeros, but —0.1438 m and
0.3610 m/s, respectively; however, these are small enough to be acceptable.


                        100             i            i         i
                                            Relative distance, x^(
                         50

                          0
                                                    Closure velocity, x2(t) (m/s)
                        -50
                              0                     4              6        8       10
                                                        Time (s)




Figure 6.12     Closed-loop docking of spacecraft with terminal time weighted, optimal regulator



Example 6.7
Suppose it is desired to bring both normal acceleration, y(t), and the pitch-rate,
y2(f), of the flexible bomber aircraft (Example 6.5) to zero in exactly 0.2 seconds,
after encountering a perturbation in the pitch-rate of 0.1 rad/s, regardless of the
maximum overshoot and settling time of the transient response. Since we do not care
what happens to the transient response, we can choose Q = 0. Then the choice of
318                                       LINEAR OPTIMAL CONTROL


  R and V matrices that achieves the desired performance is R = 101, and V = 9071,
  and the closed-loop response is calculated using tpbvlti as follows:

  »[u,X,t] = tpbvlti(A,B,zeros(6),10*eye(2),907*eye(6),0,0.2,
   [0 0.1 0 0 0 0 ] ' ) ; y = C*X'; <enter>

 The resulting outputs y(t} and 72(0. and the required inputs, u(t) and 1*2(1), are
 plotted in Figure 8.13. Note that both y(t) and ^(O are minimized in 0.2 seconds,
 as desired. The maximum input magnitudes do not exceed ±0.3 rad.(17°). This
 design has been carried out after experimenting with various values of u, where
 V = vl, and settling with the one (v = 907) that gives the minimum magnitudes of
 y(tf) and V2(f/), which are —0.009 m/s2 and —1.4 x 10~4 rad., respectively.

                     50                                           0.1
                                    Normal                                 Pitch-rate
                                  acceleration
                                                                 0.05
                I
                 ^ -50

                   -100                                        -0.05
                          0             0.1          0.2                      0.1             0.2
                                      Time (s)                              Time (s)

                           0.2
                                                    Desired elevator deflection,

                              0

                          -0.2
                                                     Desired canard deflection,
                          -0.4
                                  0          0.05            0.1        0.15            0.2
                                                           Time (s)

 Figure 6.13 Closed-loop response of the flexible bomber aircraft with terminal-time weighted,
 optimal regulator (tf = 0.2 s)



Exercises
6.1. Design an optimal, full-state feedback regulator for the distillation column whose state-
     space representation is given in Exercises 5.4 and 5.15, using Q = 1 x 10~4I and R = I.
     Determine the initial response of the regulated system to the initial condition, x(0) =
     [1; 0; 0; 0]r. Calculate the inputs required for the closed-loop initial response.

6.2. Re-design the optimal regulator for the distillation column in Exercise 6.1, choosing Q
     and R such that the settling time of the closed-loop initial response to x(0) = [ 1; 0; 0; 0]r
EXERCISES                                            319


      is less than 10 seconds, and the maximum overshoot magnitudes of both the outputs
      are less than 1 x 10"3 units. Calculate the inputs required for the closed-loop initial
      response.


 6.3. For the aircraft lateral dynamics given in Exercise 4.3, design a two-input optimal regulator
      with Q SB I and R = I. Calculate and plot the initial response, p(t), of the regulated system
      if the initial condition is x(0) = [/?(()); r(0); 0(0); 0(0)]r = [0.5; 0; 0; 0]r. What are the
      settling time and the maximum overshoot of the closed-loop initial response? What are
      the largest input magnitudes required for the closed-loop initial response?


 6.4. For the turbo-generator of Example 3.14, with the state-space representation given by
      Eq. (3.117), design a two-input optimal regulator with Q = I and R = I. Calculate
      and plot the initial response of the regulated system if the initial condition is x(0) =
      [0.1; 0; 0; 0; 0; 0]r. What are the settling time and the maximum overshoots of the closed-
      loop initial response? What are the largest control input magnitudes required for the
      closed-loop initial response?


 6.5. Re-design the regulator in Exercise 6.4 using output-weighted optimal control such that
      the maximum overshoot magnitudes of both the outputs in the initial response to x(0) =
      [0.1; 0; 0; 0; 0; 0]r is less than 0.035 units, with a settling time less than 0.6 second, and
      the required input magnitudes of u  ( t } and «a(0 should not exceed 0.05 units and 0.4
      units, respectively.


 6.6. Re-design the regulator for the distillation column to the specifications of Exercise 6.2
      using output weighted optimal control.


 6.7. Repeat Exercise 6.3 using output weighted optimal control with Q = I and R = I. Compare
      the initial response and input magnitudes of the new regulator with that designed in Exer-
      cise 6.3.


 6.8. It is required that the bank-angle, 0(f), of the aircraft in Exercise 6.3 must track a desired
      bank-angle given by <j>d(t) = 0.1 rad. Design an optimal tracking system to achieve the
      desired bank angle in less than 5 seconds with both the input magnitudes less than 0.1 rad.,
      and plot the closed-loop tracking error, (f>d(t) — <p(t), if the initial condition of the airplane
      is zero, i.e. x(0) = 0. Use SIMULINK to investigate the robustness of the tracking system
      to a random measurement noise in feeding back the roll-rate, p(t).


 6.9. Can you design a tracking system for the aircraft in Exercise 6.3 to track a desired constant
      roll-rate, pd(t)l


6.10. Can you design a tracking system for the turbo-generator of Exercise 6.4 such that a
      desired state vector is d(t) = [10; 0; 0; 0; 0; 0]r?
320                                UNEAR OPTIMAL CONTROL


6.11. The angular motion of a tank-gun turret [5] is described by the following state-coefficient
      matrices:

                          "0    1 0         0               0   0 0          0"
                           0    0    1      0               0   0 0          0
                           0 1071 -46  -1071                0   0 0         0
                           0    0 4,7     -94.3             0   0 0         0
                       A=
                           0    0 0        0                0   1 0         0
                           0    0 0        0                0   0 1         0
                           0    0 0        0                0 947 -17.3 -947
                           0    0 0        0                0   0 -7.5 -101
                             " 0    0 "
                               0    0
                               0    0
                              94 3 0
                                                                                             (6.88)
                               0    0
                               0    0
                               0    0
                               0   94.3

      The state-vector is given by x(r) = [x(t); X2(t); • • • ;*s(0]r, where x(t) is the turret
      azimuth angle, X2(t) is the turret azimuth angular rate, x$(t) is the turret azimuth
      angular acceleration, x^(t} is the azimuth control hydraulic servo-valve displacement,
      jcs(0 is the turret elevation angle, X(,(t) is the turret elevation angular rate, Xj(t) is the
      turret elevation angular acceleration, and JCg(f) is the elevation control hydraulic servo-
      valve displacement. The input vector, u(0 = [u(t); U2(t)]T, consists of the input to the
      azimuth control servo-valve, u  ( t ) , and the input to the elevation control servo-valve,
      u2(t). Design an optimal tracking system for achieving a constant desired state-vector,
      x/ = [1.57; 0; 0; 0; 0.5; 0; 0; 0]r, in less than seven seconds, if the initial condition is
      zero, i.e. x(0) = 0, with the control inputs not exceeding five units.
         Plot the initial response and the required control inputs. Using SIMULINK, study the
      robustness of the tracking system with respect to the following:
      (a) measurement noise in the turret azimuth angular acceleration, x$(t), channel.
      (b) measurement noise in the turret elevation angular acceleration, xi(t).
      (c) saturation limits on the two servo-valves, u(t) and U2(t).

6.12. Design a terminal-time weighted optimal regulator for the tank-gun turret if it is desired
      to move the turret to a zero final state in exactly 0.2 seconds, beginning with an initial
      condition of x(0) = [0.05; 0; 0; 0; 0.01; 0; 0; 0]r. Plot the azimuth and elevation angles
      of the turret, x(t), and x2(t), respectively, and the required control inputs. What are the
      maximum control input magnitudes?

6.13. For the turbo-generator of Exercise 6.4, design a terminal-time weighted optimal regulator
      such that the system is brought to a zero final state in exactly 1 second, beginning with
      the initial condition x(0) = [10; 0; 0; 0; 0; 0]r. Plot the outputs and the required control
      inputs.
REFERENCES                                          321

6.14. For the amplifier-motor of Example 6.3, design a terminal-time weighted optimal regulator
      such that the load angle, 6(t), is brought to zero in exactly 0.5 seconds, beginning with
      the initial condition x(0) = [0.1; 0; 0]r. Plot the outputs and the required control inputs.
      What is the maximum overshoot of the angular velocity, 6> (1) (0, and what is the final
      value of 0 (1) (0?



References
1. Kreyszig, E. Advanced Engineering Mathematics. John Wiley & Sons, New York, 1972.
2. Bryson, A.E. and Ho, Y.C. Applied Optimal Control. Hemisphere, New York, 1975.
3. Junkins, J.L. and Kim, Y. Introduction to Dynamics and Control of Flexible Structures. AIAA
   Education Series, American Institute of Aeronautics and Astronautics, Washington, DC, 1993.
4. Tewari, A. Robust model reduction of a flexible spacecraft. J. of Guidance, Control, and
   Dynamics, Vol. 21, No.5, 1998, 809-812.
5. Loh, N.K. Cheok, K.C. and Beck, R.R. Modern control design for gun-turret control system.
   Paper 1/5, Southcon/85 Convention Record, Atlanta, GA, 1983.
This page intentionally left blank
Kalman Filters

7.1 Stochastic Systems
We defined deterministic systems in Chapter 1 as those systems whose governing physical
laws are such that if the state of the system at some time (i.e. the initial condition) is
specified, then one can precisely predict the state at a later time. Most (if not all) natural
processes are non-deterministic systems (i.e. systems that are not deterministic). Non-
deterministic systems can be divided into two categories: stochastic and random systems.
A stochastic (also called probabilistic) system has such governing physical laws that even
if the initial conditions are known precisely, it is impossible to determine the system's
state at a later time. In other words, based upon the stochastic governing laws and the
initial conditions, one could only determine the probability of a state, rather than the state
itself. When we flip a perfect coin, we do not know if head or tail will come up; we
only know that both the possibilities have an equal probability of 50%. The disturbances
encountered by many physical systems - such as atmospheric turbulence and disturbance
due to an uneven ground - are produced by stochastic systems. A random system is one
which has no apparent governing physical laws. While it is a human endeavour to ascribe
physical laws to observed natural phenomena, some natural phenomena are so complex
that it is impossible to pin down the physical laws obeyed by them. The human brain
presently appears to be a random system. Environmental temperature and rainfall are
outputs of a random system. It is very difficult to practically distinguish between random
and stochastic systems. Also, frequently we are unable to practically distinguish between a
non-deterministic (stochastic or random) system, and a deterministic system whose future
state we cannot predict based upon an erroneous measurement of the initial condition. A
double pendulum (Figure 1.5) is a classic example of unpredictable, deterministic systems.
For all practical purposes, we will treat all unpredictable systems - deterministic or non-
deterministic - (stochastic or random) as stochastic systems, since we have to employ
the same statistical methods while studying such systems, regardless of the nature of their
physical governing laws. For the same reason, it is a common practice to use the words
random, stochastic, and unpredictable interchangeably. While we are unable to predict
the state of a random process, we can evolve a strategy to deal with such processes when
they affect a control system in the form of noise. Such a strategy has to be based on a
branch of mathematics dealing with unpredictable systems, called statistics.
    Since the initial state, x(?o), of a stochastic system is insufficient to determine the
future state, x(0, we have to make an educated guess as to what the future state might
be, based upon a statistical analysis of many similar systems, and taking the average of
324                                     KAIMAN FILTERS


their future states at a given time, t. For example, if we want to know how a stray dog
would behave if offered a bone, we will offer N stray dogs N different bones, and record
the state variables of interest, such as intensity of the sound produced by each dog, the
forward acceleration, the angular position of the dog's tail, and, perhaps, the intensity of
the dog's bite, as functions of time. Suppose x/(f) is the recorded state-vector of the /th
dog. Then the mean state-vector is defined as follows:


                                                                                         (7.1)


Note that x m (f) is the state- vector we would expect after studying N similar stochastic
systems. Hence, it is also called the expected value of the state-vector, x(f), and denoted by
xm(0 = £[*(/)]• The expected value operator, £[•], has the following properties (which
are clear from Eq. (7.1)):

(a) E{random signal] = mean of the random signal.
(b) E[deterministic signal] = deterministic signal.
(c) E[x,(r) + x 2 (r)l = £[xi(01 + E[x2(t)].
(d) £[Cx(?)] - CE[x(/)]; C = constant matrix.
(e) £[x(OC] = E[x(0]C; C = constant matrix.
(f) £[x(/)y(0] = E[x(r)]y(r); x(f) = random signal; y(t) = deterministic signal.
(g) E[y(t)(t)] = y(f)£[x(f)]; x(0 = random signal; y(t) = deterministic signal.

We can define another statistical quantity, namely a correlation matrix of the state-vector
as follows:
                                                   N
                              R,(f, r) = ( l / A O x K O x f O r )                      (7.2)


The correlation matrix, R x (f,-r), is a measure of a statistical property called correla-
tion among the different state variables, as well as between the same state variable at
two different times. For two scalar variables, x(t) and *2(r), if the expected value of
*i (0*200 is zero, i.e. E[x(t)x2(r)] = 0, where T is different from t, then x(t) and jt2(0
are said to be uncorrelated. Comparing Eqs. (7.1) and (7.2), it is clear that the correlation
matrix is the expected value of the matrix x,(r)xf (r), or Rx(t, r) = E[x,(r)xf (r)]. When
t = T, the correlation matrix, Rx(t, r) = E[Xj(t)T(t)], is called the covariance matrix.
It is obvious that the covariance matrix, Rx(t, r), is symmetric. If R*(/,r) is a diag-
onal matrix, it implies that all the state variables are uncorrelated, i.e. E[Xi(t)xj(r)] =
0, where i ^ j. You are referred to a textbook on probability and statistics, such as
that by Papoulis [1], for further details on expected values, correlation and covariance
matrices.
    There are special stochastic systems, called stationary systems, for which all the statis-
tical properties, such as the mean value, x m (/), and correlation matrix, R x (r, r), do not
STOCHASTIC SYSTEMS                                     325


change with a translation in time, i.e. when time, t, is replaced by (t + 0). Hence, for a
stationary system, xm(t + 0) = x m (0 — constant, and R x (f + 9, T + 0) = R x (r, r) for all
values of 0. Expressing R x (f, r) — R x (/, t + a) where r = t + a, we can show that for a
stationary system, R x (f — a,t) = R x (f, t + a), which implies that for a stationary system,
the correlation matrix is only a function of the time-shift, a, i.e. Rx(t, t -fa) = R x (a).
Many stochastic systems of interest are assumed to be stationary, which greatly simplifies
the statistical analysis of such systems.
   The expected value, xm(0, and the correlation matrix, R x (£, r), are examples of
ensemble statistical properties, i.e. properties of an ensemble (or group) of N samples.
Clearly, the accuracy by which the expected value, x m (/), approximates the actual state-
vector, x ( t ) , depends upon the number of samples, N. If N is increased, the accuracy is
improved. For a random system, an infinite number of samples are required for predicting
the state-vector, i.e. N = oo. However, we can usually obtain good accuracy with a finite
(but large) number of samples. Of course, the samples must be taken in as many different
situations as possible. For example, if we confined our sample of stray dogs to our own
neighborhood, the accuracy of ensemble properties would suffer. Instead, we should pick
the dogs from many different parts of the town, and repeat our experiment at various
times of the day, month, and year. However, as illustrated by the stray dog example,
one has to go to great lengths merely to collect sufficient data for arriving at an accurate
ensemble average. Finding an ensemble average in some cases may even be impossible,
such as trying to calculate the expected value of annual rainfall in London - which would
require constructing N Londons and taking the ensemble average of the annual rainfall
recorded in all the Londons! However, we can measure annual rainfall in London for many-
years, and take the time average by dividing the total rainfall by the number of years.
Taking a time average is entirely different from taking the ensemble average, especially if
the system is non-stationary. However, there is a sub-class of stationary systems, called
ergodic systems, for which a time average is the same as an ensemble average. For those
stationary systems that are not ergodic, it is inaccurate to substitute a time average for the
ensemble average, but we still do so routinely because there is no other alternative (there
is only one London in the world). Hence, we will substitute time averaged statistics for
ensemble statistics of all stationary systems. For a stationary system, by taking the time
average, we can evaluate the mean, x m , and the correlation matrix, R x (r), over a large
time period, T -» oo, as follows:
                                                 ,772
                                                 /         x(t)dt                        (7.3)
                                                J-T/2

                                                     r/2
                                                 If            T
                                                           x(t)'(t + r) dt              (7.4)
                                                J-T/2

   Note that since the system is stationary, the mean value, xm, is a constant, and the
correlation matrix, R x (r), is only a function of the time-shift, T. For frequency domain
analysis of stochastic systems, it is useful to define a power spectral density matrix, Sx(<w),
as the Fourier transform of the correlation matrix, R x (r), given by

                                                     {i)Q"iandr                          (7.5)
326                                       KALMAN FILTERS


where u> is the frequency of excitation (i.e. the frequency of an oscillatory input applied
to the stochastic system). The power spectral density matrix, Sx(o>), is a measure of how
the power of a random signal, x(f), varies with frequency, a>. The Fourier transform of
the random signal, x(r), is given by

                                 X(ia)) = /_' (t)e-ia"dt
                                   :,-») = I                                                 (7.6)

It can be shown from Eqs. (7.4)-(7.6) that

                                 Sx(o>) = X(ia>)XT(-ia))                                     (7.7)

The correlation matrix, R x (r), can be obtained by calculating the inverse Fourier transform
of the power spectral density matrix, Sx(o>), as follows:

                            R x (r) = (1/27T) I           Sx(a))eia>Tda>                     (7.8)
                                                   J—oc
Comparing Eqs. (7.4) and (7.8), we find that at r = 0, the correlation matrix becomes the
covariance matrix, given by
                                  • r/2
                                    772                                roc
                                          x(t)xT(t)dt = (1/23T) /            S,(w)e"wrrfo>   (7.9)
                                / -r/2
                                  •T/2                                J-x

or

                                £                         = 2nms                            (7.10)

where x^, called the mean-square value of x(f), is the following:
                                              .r/2
                                             /.
                                            /      x(Ox T (r)^                               (7.11)
                                                      -T/2
                                                     J-

   Usually, the state-vector, x(r), is available at discrete time points, rather than as a
continuous function of time. The discrete Fourier transform of a discrete time state-
vector, (j Ar), where A/ is the time step size and j = 1, 2, . . . , N, is calculated by the
following expression:
                                           N




where Aw = 2n/(N&t) is the frequency step size. Similarly, the inverse discrete Fourier
transform can be calculated as follows:
                                               N
                                                                                             (7.13)


When the discrete Fourier transform is used to calculate the power spectral density, the
result must be divided by N, the number of frequency points in X(fcA&>) as follows:
                                                                                             (7.14)
STOCHASTIC SYSTEMS                                      327


The discrete Fourier transform of a signal, x ( t ) , can be calculated by using the MATLAB
command for discrete Fourier transform,^, as follows:

      »X = f f t ( x , n ) <enter>

where x is the returned n-point discrete Fourier transform of x. If n is not specified, an N-
point Fourier transform is calculated, where N is the number of discrete time points in the
matrix x. x has as many rows as there are time points, and as many columns as there are
variables. Thus, each column of x is the Fourier transform of the corresponding column
of x. The inverse discrete Fourier transform is similarly calculated using the MATLAB
command if ft as follows:

      »x = ifft(X,n) <enter>

  Example 7.1

   Consider a scalar random signal, x(t), which is generated using the MATLAB
   command randn as follows:

       »t=0:0.1:10; randn('seed',0); x=randn(size(t)); <enter>
  The command randn generates a random number, according to a special random
  process with a zero mean value, called normal(or Gaussian) probability distribution
  [1]. The 'seed' of the random number generator, randn, is set to zero to initialize
  the generating process to the value when MATLAB is started. The random signal,
  jc(0, is generated in time steps of 0.1 seconds, for 10 seconds - a total of 101 time
  points. The full-order discrete Fourier transform of x(t) is calculated as follows:

       »X=fft(x); <enter>

  The discrete frequencies, a>, at which the Fourier transform of x(t) is calculated are
  calculated and stored in vector w as follows:

       »w = (0: l e n g t h ( X ) - 1 ) ' * 2 * p i / ( 0 . l * l e n g t h ( X ) ) ; <enter>

  The power spectral density, Sx(co), of the discrete random signal, x(t), is calculated
  as follows:

       »S = X . * c o n j ( X ) / l e n g t h ( X ) ; <enter>

  The correlation function, RX(T) is calculated by taking the inverse Fourier transform
  of S(&>) with the help of the MATLAB command iffi as follows:

       »Rx = i f f t ( S ) ; <enter>

  The scalar plots *(?), X(co), Sx(a>), and Rx(t) are shown in Figure 7.1. Note the
  special shape of the Sx (&>) plot - it is symmetrical about the mid-point frequency
  a) = 51 Aw = 31.1 rad/s. This is a characteristic of the normal distribution.
328                                  KALMAN FILTERS




 Figure 7.1 Random signal, x(f), its Fourier transform magnitude, X(co), power spectral
 density, Sx(co), and correlation function, RX(T)


    The mean value of x(t) can be obtained using the MATLAB command mean as
 follows:

       »mean(x) <enter>
       ans =
         0.0708
 which is very close to zero as expected (the mean value of x(t) will be exactly
 zero only if the number of sample points, i.e. the length of x(t), is infinity). The
 covariance, RX(G) can be read from the plot of RX(T} to be approximately 0.9, or
 obtained more precisely using the MATLAB command cov as follows:

       »cov(x) <enter>
       ans =
         0.9006
 The mean-square of jc(f), xms, can be calculated as follows:

      »xms = mean(x.*x) <enter>
      ans =
        0.8967

 Note that xms is equal to the mean value of the power spectral density Sx (&>) plot,
 calculated as follows:

      »mean(S) <enter>
      ans =
        0.8967
FILTERING OF RANDOM SIGNALS                                   329


   You can repeat Example 7.1 using a different MATLAB random number generator
called rand, which follows another stochastic process called uniform probability distribu-
tion. Definition and discussion of probability distributions of random processes is beyond
the scope of this book, but can be found in a textbook on probability, such as that by
Popoulis [1J.


7.2 Filtering of Random Signals
 When random signals are passed through a deterministic system, their statistical properties
 are modified. A deterministic system to which random signals are input, so that the
 output is a random signal with desired statistical properties is called a filter. Filters can
 be linear or nonlinear, time-invariant or time varying. However, for simplicity we will
 usually consider linear, time-invariant filters. Linear, time-invariant filters are commonly
 employed in control systems to reduce the effect of measurement noise on the control
 system. In such systems, the output is usually a superposition of a deterministic signal and
 a random measurement noise. Often, the measurement noise has a predominantly high-
frequency content (i.e. its power spectral density has more peaks at higher frequencies).
 To filter-out the high-frequency noise, a special filter called a low-pass filter is employed,
 which blocks all signal frequencies above a specified cut-off frequency, o>o. The output
 of a low-pass filter thus contains only lower frequencies, i.e. a> < OJQ, which implies
 a smoothening of the input signal fed to the filter. Sometimes, it is desired to block
 both high- and low-frequency contents of a noisy signal. This is achieved by passing
 the signal through a band-pass filter, which allows only a specified band of frequencies,
 a) < a> < a>2, to pass through as the output signal. Similarly, a high-pass filter blocks
 all frequencies below a specified cut-off frequency, COQ, and has an output containing only
 the higher frequencies, i.e. a> > &>(>.
     Since it is impossible for a filter to perfectly block the undesirable signals, it is desired
 that the magnitude of signal above or below a given frequency decays rapidly with
 frequency. Such a decay of signal magnitude with frequency is called attenuation, or
 roll-off. The output of a filter not only has a frequency content different from the input
 signal, but also certain other characteristics of the filter, such as a phase-shift or a change
 in magnitude. In other words, the signal passing through a filter is also distorted by the
 filter, which is undesirable. It is inevitable that a filter would produce an output signal
 based upon its characteristics, described by the transfer-function, frequency response,
 impulse response, or a state-space representation of the filter. However, a filter can be
 designed to achieve a desired set of performance objectives - such as cut-off frequencies,
 desired attenuation (roll-off) of signals above or below the cut-off frequencies, etc., with
 the minimum possible distortion of the signals passing through the filter. Usually, it is
 observed that a greater attenuation of noise also leads to a greater distortion of the filtered
 signal. It is beyond the scope of this book to discuss the many different approaches
 followed in filter design, and you may refer to Parks and Burrus [2] for details. It suffices
 here to state that the numerator and denominator polynomials of the filter's transfer
 function, or coefficient matrices of the filter's state-space model, can be selected by a
design process to achieve the conflicting requirements of maximum noise attenuation and
 minimum signal distortion.
330                                   KAIMAN FILTERS


  Example 7.2
  Consider a single-input, single-output filter with the following transfer function:

                                                    <WO)                            (7.15)

  This is the simplest possible low-pass filter with cut-off frequency, O>Q. Let us pass
  the following signal - which is a deterministic system's output (sin(lOf)) corrupted
  by a normally distributed random noise - through this low-pass filter:

                            u(t) = sin(lOr) + Q.2*randn(t)                          (7.16)

  where randn(t) denotes the random noise generated by the MATLAB random number
  generator with a normal distribution (see Example 7.1). The random input signal is
  generated as follows:

  » t=0: 0.001 :1 ;randn( 'seed' ,0) ;u=sin(10*t)+0.2*randn(size(t) ) ; <enter>

  To block the high-frequency random noise, a cut-off frequency COQ = 10 rad/s is
  initially selected for the low-pass filter, and the Bode plot of the filter is obtained
  as follows:

  » n = 10; d = [1 10]; sys=tf(n,d); [mag, phase.w] = bode(sys); <enter>

 The filter is re-designed with cut-off frequency values, COQ = 40 and 100 rad/s. The
 Bode plots of the low-pass filter with cut-off frequency values WQ = 10, 40, and
  100 rad/s, are plotted in Figure 7.2. Note that the magnitude of the filter decays
 with frequency at a) > COQ, providing noise attenuation for frequencies above (OQ.
 The filter does not totally block the frequencies above the cut-off frequency, but
 decreases the magnitude (attenuates) almost linearly with the logarithmic frequency.
 The ideal roll-off (i.e. slope of decreasing magnitude with frequency) for filtering
 noise is 20 dB per 10 divisions of logarithmic frequency scale in rad/s (called 20 dB
 per decade). The smaller the value of the cut-off frequency, the earlier would noise
 attenuation begin, and smaller will be the noise content of the filtered signal. It can be
 seen in the magnitude plot of Figure 7.2 that the filter with CDQ = 10 rad/s achieves a
 roll-off of 20 dB per decade at frequencies above 20 rad/s, while the other two filters
 achieve the same roll-off at much higher frequencies. The phase plot in Figure 7.2
 shows that the low-pass filter decreases the phase of the input signal. Hence, a first
 order low-pass filter is also said to act as a phase-lag device. However, the phase
 of filter with CDQ — 10 and 40 rad/s begins to change at frequencies below 10 rad/s,
 which implies that the deterministic part of the random input signal, sin(lOr), would
 be appreciably distorted (i.e. changed in wave-form) by these two filters, which is
 undesirable. The phase of the filter with (OQ = 100 rad/s is relatively unchanged until
 10 rad/s, indicating little distortion of the deterministic signal.
    A simulation of the filter's output is obtained using Control System Toolbox
 (CST) function Isim as follows:

      »[y,t,X]=lsim(sys,u,t) ; <enter>
FILTERING OF RANDOM SIGNALS                                   331


                                = 1 0 rad/s    ---         = 40 rad/s            = 1 00 rad/s




                           10                 10                  102
                                              Frequency (rad/s)



               O)
               0)
               T3
                     -50
               CO
               0~

                    -100
                                              10                  102                103
                                              Frequency (rad/s)

Figure 7.2    Bode plots of a first-order, low-pass filter with cut-off frequency, O)Q = 10, 40, and
TOO rad/s




                     CO
                     O)


                    i -1
                    a:
                           _2
                                        0.2          0.4         0.6       0.8
                                                       Time (s)


                                                                            = 40 rad/s
                                                                               X     -



                                                                        = 10 rad/s
                                                                             i
                                        0.2          0.4         0.6       0.8
                                                       Time (s)

Figure 7.3 Raw signal and filtered signals after passing through a first-order, low-pass filter
with cut-off frequency, 1 0, 40, and 1 00 rad/s, respectively


The input, u(t), (i.e. raw signal) and the output, y ( t ) (i.e. the filtered signal) for
o)() = 10, 40, and 100 rad/s are plotted in Figure 7.3. Note in Figure 7.3 that the
filtered signals are smoother than the raw signal, but have an appreciable distortion
in the wave-form, compared to the desired noise-free signal sin(lOO). Among the
332                                  KALMAN FILTERS


 three filter designs, for the filter with <WQ = 10 rad/s the distortion is maximum, but
 the filtered signal is the smoothest. For the filter with COQ = 100 rad/s, the wave-
 form distortion is minimum, but the filtered signal is the roughest indicating that the
 filter has allowed a lot of noise to pass through. An intermediate value of the cut-
 off frequency, COQ = 40 rad/s, provides a good compromise between the conflicting
 requirements of smaller signal distortion and greater noise attenuation.


 Example 7.3
 Let us consider filtering a random signal which consists of a linear superposition of
 a deterministic signal, sin(20r) + sin(50f), with a random noise given by
                      u(t) = sin(20r) + sin(50r) + Q.5*randn(t)                    (7.17)

 where randn(t) denotes the random noise generated by the MATLAB's normal
 distribution random number generator. To filter the noise with least possible distor-
 tion, a sophisticated low-pass filter, called elliptic filter, is used with the following
 state-space representation:
           "-153.34           -94.989                 0    0
               94.989            0         0          0
            -153.34            104940              -62.975   -138.33
                0         0              138.33
           "120"
              0
            120
              0
      C = [-1.2726x 10~5       8.7089 x 10~3      -5.2265 x 10~6     1.0191 x 10~3]
      D = 9.9592 x 10~6

 The Bode plot of the fourth order elliptic filter, shown in Figure 7.4, is obtained as
 follows:

       »sfilt=ss(A,B,C,D); bode(sfilt) <enter>

 Figure 7.4 shows a cut-off frequency of 120 rad/s, a roll-off of about 100 dB per
 decade between the cut-off frequency and 1000 rad/s, and ripples in the magnitude
 for frequency greater than 1000 rad/s. The passband, i.e. the band of frequencies
 which the filter lets pass (<w < 120 rad/s), is seen to be flat in magnitude, which
 implies a negligible magnitude distortion of the deterministic part of the filtered
 signal. The stopband, i.e. the band of frequencies which the filter is supposed to
 block (&»120 rad/s), is seen to have ripples at —100 dB magnitude. As this magni-
 tude is very small, there is expected to be a negligible influence of the ripples on the
 filtered signal. The phase plot shows a gradual 180° phase change in the passband,
 and rapid phase changes in the stopband above 1000 rad/s.
FILTERING OF RANDOM SIGNALS                                 333




                        a    -so -
                            -100 -
                            -150
                                   10                 102               103                   10"
                                                      Frequency (rad/sec)

                             180 c



                        J3 -180 -

                            -360 -
                                                      102               103                   104
                                                     Frequency (rad/sec)

Figure 7.4 Bode plot of a fourth-order, low-pass elliptic filter with cut-off frequency 120 rad/s
(Example 7.3)




                                                          i          1        1
                                         Filtered signal, y(f), by low-pass elliptic filter




                                              Deterministic signal, sin(20t) + sin(50t)




Figure 7.5      Raw random plus deterministic signal, and filtered signal after passing through a
fourth-order, low-pass elliptic filter with cut-off frequency 120 rad/s


   The filter output is simulated using MATLAB command Isim as follows:
     >:>
           [ y j t , X ] = l s i m ( s f i l t , u , t ) ; <enter>

Figure 7.5 shows time-plots of the raw signal, u(t), and the filtered signal, y
compared with the desired deterministic output, sin(20f) + sin(50/). The filtered
signal is seen to be smooth, and with only a phase-lag as the signal distortion, when
compared with the desired deterministic signal.
334                                    KAIMAN FILTERS


7.3 White Noise, and White Noise Filters
 In the previous section, we saw how random signals can be generated using a random
 number generator, such as the MATLAB command randn, which generates random
 numbers with a normal (or Gaussian) probability distribution. If we could theoretically
 use a random number generator to generate an infinite set of random numbers with zero
 mean value and a normal probability distribution, we would have a stationary random
 signal with a constant power spectral density [1]. Such a theoretical random signal with
 zero mean and a constant power spectral density is called a stationary white noise. A
 white noise vector, w(f), has each element as a white noise, and can be regarded as the
 state-vector of a stochastic system called a white noise process. For such a process, we can
 write the mean value, wm = 0, and the power spectral density matrix, S(o>) = W, where
 W is a constant matrix. Since the power spectral density of a white noise is a constant, it
 follows from Eq. (7.9) that the covariance matrix of the white noise is a matrix with all
 elements as .infinities, i.e. R w (0) = oo. Also, from Eq. (7.8) we can write the following
 expression for the correlation matrix of the white noise process (recall that the inverse
 Laplace (or Fourier) transform of a constant is the constant multiplied by the unit impulse
function, 8(t)):
                                                                                       (7.18)

Equation (7.18) re-iterates that the covariance of white noise is infinite, i.e. Rw(0) = oo.
Note that the correlation matrix of white noise is zero, i.e. R w (r) = 0, for r 7^ 0, which
implies that the white noise is uncorrelated in time (there is absolutely no correlation
between w(r) and w(r + r)). Hence, white noise can be regarded as perfectly random.
However, a physical process with constant power spectral density is unknown; all physical
processes have a power spectrum that tends to zero as u> —>• oo. All known physical
processes have a finite bandwidth, i.e. range of frequencies at which the process can
be excited (denoted by peaks in the power spectrum). The white noise, in contrast, has
an infinite bandwidth. Hence, the white noise process appears to be a figment of our
imagination. However, it is a useful figment of imagination, as we have seen in Chapters 5
and 6 that white noise can be used to approximate random disturbances while simulating
the response of control systems.
   Let us see what happens if a linear, time-invariant system is placed in the path of a
white noise. Such a linear system, into which the white noise is input, would be called a
white noise filter. Since the input is a white noise, from the previous section we expect
that the output of the filter would be a random signal. What are the statistical properties
of such a random signal? We can write the following expression for the output, y(t), of a
linear system with transfer matrix, G(s), with a white noise input, w(f), using the matrix
form of the superposition integral of Eq. (2.120), as follows:

                               y(0 = I        g(r-r)w(r)rfr                           (7.19)
                                       J—oc


where g(/) is the impulse response matrix of the filter related to the transfer matrix, G(s).
by the inverse Laplace transform as follows:
WHITE NOISE, AND WHITE NOISE FILTERS                                                335


                                                      g(f) = /         G(s)Gstds                                              (7.20)
                                                             Jo
The lower limit of integration in Eq. (7.19) can be changed to zero if the white noise,
w(/), starts acting on the system at t = 0, and the system is causal, i.e. it starts producing
the output only after receiving the input, but not before that (most physical systems
are causal). Since the input white noise is a stationary process (with mean, wm = 0),
and the filter is time-invariant, we expect that the output, y ( t ) , should be the output of
a stationary process, and we can determine its mean value by taking time average as
follows:

                                           772
                                         fT/2                                      fT/ _
                                                                                   fT/2 2 r ft
                                         /       y(t)dt = imT^OG(]/T)             I               /          g(r — r)w(r) dr  dt
                                       -7/2
                                     J-T/2                                      J-T/2 U-
                                                                                J-T/2  U-oo


      = /       g(r-r)|limr->c»(l/r) /                                w(t)dt]dT = f
        J-oo                         L                         -T/2
                                                              J-T2          J
                                                                            J                 J-
                                                                                  (7.21)
Hence, the mean of the output of a linear system for a white noise input is zero. The
correlation matrix of the output signal, R y (r) can be calculated as follows, using the
properties of the expected value operator, £"[•]:


R y (r) = £[y(OyT(* + T)] = E f                                g(t- a)w(a) da • f                     wT(£)gT(f + r - ft) dft
                                                     .J — CO                           J~ OC


                   *t        rt+r
                             ft+T                                                                        -i

       ~E
                             /           g(r - a)w(a)wT(^)gT(f + T - ft) da dft
                 ' — oo J-oo
                        J—oo                                                                             J


                                                                                                   dft                        (7.22)
              — OO J — OO




Using the fact that £[w(a)w(/3)] = R w (a - ft) = W8(p - a), we can write

         R
             y< T > = /              /           8(? - a)ViS(ft - oc)gT(t + r - ft), da dft
                            J — OO J —OO

                                 t                                                     ft+T

                                     g(t - cOWgT(? + r-a)da= I      g(A)Wg T (A + r) dX                                       (7.23)
                        /        -OO                         J — OC

Since y(t) is the output of a stationary process, we can replace the upper limit of integra-
tion in Eq. (7.23) by oo, provided y(t) reaches a steady-state as r -> oo, i.e. the filter is
asymptotically stable. Therefore, the correlation matrix of the output of an asymptotically
stable system to the white noise can be written as follows:


                                                                                                                              (7.24)
                                                          /     -
336                                              KALMAN FILTERS


The power spectral density matrix, Sy(a)), for the output, y(r), can then be obtained by
taking the Fourier transform of the correlation matrix, R y (r), as follows:
                                       oo r /«oo                           -|
                                             /      g(^)WgT(X + r) d X  e~icaTdT                 (7.25)
                                  /   -oo L''— oo                          J

Inverting the order of integration in Eq. (7.25), we can write
                                       oo            r /-oo                     -i
                                            g(*)W /           gT(A + r)e-imdT        dX           (7.26)
                                  / -oc              _J-oo                     J

The inner integral in Eq. (7.26) can be expressed as follows:
                 oo                                 /*oc
                       gT(X + T)e~ia)Tdr = I               gT($)e-iw(*-»d$ = e /wX G T (io>)      (7.27)
             /   -oc                               J —oo

where G(/o>) is the frequency response matrix of the filter, i.e. G(IOJ) = G(s = iay).
Substituting Eq. (7.27) into Eq. (7.26), we get the following expression for the power
spectral density matrix:

                 Sy(o>) = I I         g(A)e' wX rfX 1 WGT(/o>) = G(-/o>)WGT(/o>)                  (7.28)

Equation (7.28) is an important result for the output of the white noise filter, and shows
that the filtered white noise does not have a constant power spectral density, but one
which depends upon the frequency response, G(/o>), of the filter.

  Example 7.4
  Let us determine the power spectral density of white noise after passing through the
  first order low-pass filter of Eq. (7.15). The frequency response of this single-input,
  single-output filter is the following:
                                        G(i(o) = coQ/(ia) + WQ)                                (7.29)
  Using Eq. (7.28), we can write the power spectral density as follows:
                                                                                (a>2 + a>20)   (7.30)
  Equation (7.30) indicates that the spectrum of the white noise passing through this
  filter is no longer flat, but begins to decay at a) = O)Q. For this reason, the filtered
  white noise is called colored noise whose 'color' is indicated by the frequency,
  o)Q. The correlation function is obtained by taking the inverse Fourier transform of
  Eq. (7.30) as follows:

                          J? V (T) = (1/27T)
                                                                      (r > 0)                  (7.31)
_                      WHITE NOISE, AND WHITE NOISE FILTERS_                           337


Since for a stationary process, RV(—T) = Rv(r), we can write a general expression
for Ry(r) valid for all values of i as follows:

                          Ry(T) = (W« 0 /2) exp(-<oo|r|)                         (7.32)
Finally, the covariance matrix of the filtered white noise, Ry(0), is given by
                                 flv(0) = (Wcov/2)                               (7.33)


Example 7.5
Atmospheric turbulence is a random process, which has been studied extensively. A
semi -empirical model of vertical gust velocity, x(t), caused by atmospheric turbu-
lence is the Dryden spectrum with the following expression for the power spectral
density:

                     Sx(a>) = a2T[ + 3(<yr) 2 ]/[l + (a)T)2]2                   (7.34)

where a and T are constants. The correlation function, RX(T), of the Dryden spec-
trum can be calculated by taking the inverse Fourier transform of Sx (&>) according to
Eq. (7.8), either analytically or using MATLAB. It can be shown that the analytical
expression of Rx(t) is the following:

                         Rx(r) = a2( - 0.5|r|/r)e- |T| / r                      (7.35)

   It is customary to express stochastic systems as filters of white noise. What
is the transfer function of a filter through which white noise must be passed to
get the filtered output as the Dryden turbulence? We can employ Eq. (7.28) for
the relationship between the power spectral density, Sx((o), and the filter transfer
function, G(s), which can be written for the scalar case as follows:

                  Sx(a)) = G(-ia))WG(i(D) = WG(-ia))G(ia))                       (7.36)

Comparing Eqs. (7.34) and (7.36), we see that a factorization of the power spectral
density, Sx(co), given by

    S.,(w) = a2T[ - j3T(i(o)][l + ^/3T(iM)}/{[ - T(ia>}}2[ + T(ico)]2}
           = WG(-ia))G(i(jo)                                                     (7.37)

leads to the following possibilities for G(s):

                    G(s) = a(T/W)l/2( ± ^3Ts)/( ± Ts)2                         (7.38)

Since we want a stable filter (i.e. all poles of G(s) in the left-half plane), we should
have a '+' sign in the denominator of G(s) in Eq. (7.38). Also, we do not want a
zero in the right-half plane, because it leads to an undesirable phase plot of G(iaj),
called non-minimum phase. A stable transfer function with all zeros in the left-half
338                                         KALMAN FILTERS


 plane is called minimum phase. Hence, the following choice of G(s) would yield a
 stable and minimum phase filter:

                           G(s) = a(T/ W0 1/2 (l + 7375)7(1 4- Ts)2                        (7.39)

 Such a method of obtaining the filter's transfer function through a factorization of the
 power spectral density is called spectral factorization, and is commonly employed
 in deriving white noise filter representations of stochastic systems. For W = 1 and
 a = 1, we can obtain a state-space representation of the filter with T = 1 s using
 MATLAB as follows:
 » T=1; n = sqrt(T)*[T*sqrt(3) 1]; d = conv([T 1 ] , [ T 1 ] ) ; sysfilt = tf
  (n,d) <enter>

 Transfer function:
  1.732 s+1

 s"2+2 s+1

 A simulated response of the filter to white noise, representing the vertical gust
 velocity, *(/), due to Dryden turbulence, can be obtained using MATLAB as follows:

 »t=0:0.001:1; u = randn(size(t)); [ x , t , X ] = lsim(sysfilt,u,t);
   <enter>

 Figure 7.6 shows the Dryden turbulence power spectrum, S((o)/a2 plotted against
 coT, the Bode plots of the white noise filter transfer function, G(s), for T = 0.1,

                     1.5



                     0.5


                       10-        10°         102




                CD   -50
                "o
                1
                £ -100
                       10-         10°        102
                                  (rad/s)

 Figure 7.6 Power spectrum, white noise filter Bode plots, and simulated gust vertical velocity of
 the Dryden turbulence model
THE KALMAN FILTER                                     339


    1, and 10 s, and simulated vertical gust velocity, x ( t ) , of the filtered white noise
   with T — 0.1, 1, and 10 s. Note that the maximum value of S(CD) is 1.125a2 which
   occurs near a>T = 1. Note from the Bode plots of the filter with various T values,
   that the white noise filter for Dryden turbulence acts as a low-pass filter with a cut-
   off frequency, 1/T. Consequently, as T increases the filtered output (representing
   turbulence) becomes smoother, because more high-frequency noise is blocked by
   the filter.


7.4 The Kalman Filter
In the previous section we saw how we can represent stochastic systems by passing white
noise through linear systems. Such a representation of stochastic systems is useful for
dealing with a plant which we cannot model accurately using only a deterministic model,
because of the presence of modeling uncertainties (called process noise) and measurement
noise. A noisy plant is thus a stochastic system, which is modeled by passing white noise
through an appropriate linear system. Consider such a plant with the following linear,
time-vary ing state-space representation:
                                                                F(/)v(0                  (7.40)
                                                                z(0                      (7.41)

where v(0 is the process noise vector which may arise due to modeling errors such as
neglecting nonlinear or higher-frequency dynamics, and z(t) is the measurement noise
vector. By assuming (t) and z(t) to be white noises, we will only be extending the
methodology of the previous section for a description of the stochastic plant. However,
since now we are dealing with a time-varying system as the plant, our definition of
white noise has to be modified. For a time-varying stochastic system, the output is a
non-stationary random signal. Hence, the random noises, v(r) and z(0, could in general
be non-stationary white noises. A non-stationary white noise can be obtained by passing
the stationary white noise through an amplifier with a time-varying gain. The correlation
matrices of non-stationary white noises, v(t) and z(/), can be expressed as follows:
                                                            )                            (7.42)
                                                            )                            (7.43)

where V(t) and Z(f) are the time-vary ing power spectral density matrices of v(f) and
z ( t ) , respectively. Note that Eqs. (7.42) and (7.43) yield infinite covariance matrices,
R v (r, t) and R z (?, r), respectively, which can be regarded as a characteristic of white
noise - stationary or non-stationary.
      For designing a control system based on the stochastic plant, we cannot rely on full-state
feedback, because we cannot predict the state-vector, x(f), of the stochastic plant. There-
fore, an observer is required for estimating the state-vector, based upon a measurement of
the output, y(r), given by Eq. (7.41) and a known input, u(t). Using the pole-placement
methods of Chapter 5 we can come up with an observer that has poles at desired loca-
tions. However, such an observer would not take into account the power spectra of the
340                                   KALMAN FILTERS


process and measurement noise. Also, note the difficulty encountered in Chapter 5 for
designing observers for multi-input, multi-output plants, which limits the pole-placement
approach of observer design largely to single-output plants. To take into account the fact
that the measured output, y(f), and state-vector of the plant, x(f), are random vectors,
we need an observer that estimates the state-vector based upon statistical (rather than
deterministic) description of the vector output and plant state. Such an observer is the
Kalman Filter. Rather than being an ordinary observer of Chapter 5, the Kalman filter
is an optimal observer, which minimizes a statistical measure of the estimation error,
e 0 (r) = x(0 — x<,(0, where x«(r) is the estimated state-vector. The state-equation of the
Kalman filter is that of a time-varying observer (similar to Eq. (5.103)), and can be written
as follows:

        x^(0 = A(r)io(r) + B(r)u(r) + L(r)[y(0 - C(f)x 0 (r) - D(r)u(»]               (7.44)
where L(f) is the gain matrix of the Kalman filter (also called the optimal observer gain
matrix). Being an optimal observer, the Kalman filter is a counterpart of the optimal
regulator of Chapter 6. However, while the optimal regulator minimizes an objective
function based on transient and steady-state response and control effort, the Kalman filter
minimizes the covanance of the estimation error, Re(r, 0 = E[e0(r)eo(OL Why is it
useful to minimize the covariance of estimation error? Recall that the state-vector, x(r),
is a random vector. The estimated state, Xo(r), is based on the measurement of the output,
y(0, for a finite time, say T, where t > T. However, a true statistical average (or mean)
of x(0 would require measuring the output for an infinite time (i.e. taking infinite number
of samples), and then finding the expected value of x(r). Hence, the best estimate that the
Kalman filter could obtain for x(0 is not the true mean, but a conditional mean, xm(0,
based on only a finite time record of the output, y ( t ) , for T < t, written as follows:

                              x m (r) = £[x(r) : y(D, T < t]                          (7.45)

There may be a deviation of the estimated state- vector, x«(r), from the conditional mean,
x m (f), and we can write the estimated state- vector as follows:

                                  Xo(0 = Xm(0 + Ax(r)                                 (7.46)

where Ax(r) is the deviation from the conditional mean. The conditional covariance
matrix (i.e. the covariance matrix based on a finite record of the output) of the estimation
error is given by

R.(f , 0 = £[eo(0ej(0 : y(T), T < t] = £[{x(r) - x«(r)}{xT(r) - xj(r)} : y(D, T < t]
                                                                               (7.47)
Equation (7.47) can be simplified using Eq. (7.45) as follows:

                 , 0 = £[x(r)x(r)] - X o O x r ) - x(/)x m (» + Xo(0*(0               (7-48)

Finally, substituting Eq. (7.46) into Eq. (7.48) and simplifying, we get

                  Re(/, 0 = E[x(r)xT(0] - x m (r)xl(f) + Ax(r)Ax T (r)                (7.49)
THE KALMAN FILTER                                     341


From Eq. (7.49) it is clear that the best estimate of state-vector, implying Ax(?) — 0
(i.e. x0(0 = x m (f)), would result in a minimization of the conditional covariance matrix,
R e (r, /). In other words, minimization of R e (f, t) yields the optimal (i.e. the best) observer,
which is the Kalman filter.
    Let us derive the expression for the gain matrix of the Kalrnan filter, L(0, which mini-
mizes Re(t, t), i.e. which makes the estimated state-vector equal to the conditional mean
vector. The optimal estimation error is thus e0(0 = x(t) — x m (0- Subtracting Eq. (7.44)
from Eq. (7.40) and substituting Eq. (7.41), we can write the following state-equation for
the optimal estimation error:

                   ei'Hr) = [A(0 - L(f)C(f)]eo(0 + F(f)v(0 - L(r)z(r)                       (7.50)
Note that since v(f) and z(f) are white noises, the following vector is also a (non-
stationary) white noise
                                                                                            (7.51)

To find the covariance of the estimation error, we must somehow find an expression for the
solution of Eq. (7.50), which is a linear, time-varying system excited by a non-stationary
white noise, w(0- Let us write Eqs. (7.50) and (7.51) as follows:

                                      6^(0 - A0(0eo(0 + w(r)                                (7.52)
where A0(0 = [A(?) — L(/)C(0]- The solution to Eq. (7.52) for a given initial condition,
e0(?oX can be expressed as follows:


                                                    /'
                                                    <> in
                                                                                            (7.53)

where 4>(/, ?o) is the state-transition matrix of the time- varying estimation error state-
equation, Eq. (7.52). Then the conditional covariance of estimation error can be written
as follows (dropping the notation y(!T), T < t, from the expected value for convenience):

           Re(>, 0 - £[e0(r)ej(0] =

                                                                                 e0(?0)

                          ! (                                                               (7.54)
                           tQ
                         JtQ     tQ
                                Jt



or, using the properties of the expected value operator, we can write

                                                               , r
                                                            a (fr)    I

                                                                        to
                                                                      Jtn




                      If                           e«(^o)

                                                                                            (7.55)
342                                        KAIMAN FILTERS


Since the expected value of white noise is zero, i.e. £[w(/)l = 0, and the correlation
matrix of white noise is given by

                                                                     £)                       (7.56)

we can simplify Eq. (7.55) as follows:

          , t) = <D(r , t0)E [eo(fo)eJ(fo)]<l>T(r, r0) +       4>(f , X)W(X)cDT(r . X) rfX (7.57)

If the initial estimation error, e0(fo)> is also a random vector, we can write the initial
conditional covariance matrix as follows:

                                                                                              (7.58)

Substituting Eq. (7.58) into Eq. (7.57), we can write

        Re(f , 0 - 4>(f , r0)R«(fo, r 0 )4> T (r, f 0 ) + f <*>(>, X)W(X)<D T (r , X)   rfx   (7.59)
                                                       •''o


Equation (7.59) describes how the optimal estimation error covariance evolves with time.
However, the state-transition matrix for the time varying system, <!>(/, to), is an unknown
quantity. Fortunately, we have already encountered an integral similar to that in Eq. (7.59)
while deriving the optimal regulator gain in Chapter 6. An equivalent integral for the
optimal control problem is given in Eq. (6.8) for M(f , //). Comparing Eqs. (7.59) and
(6.8) we find that 4>£L(r, r) in Eq. (6.8) is replaced by 4>(/, A) in Eq. (7.59), where r and
X are the variables of integration in Eqs. (6.8) and (7.59), respectively. Furthermore, the
matrix [Q(r) -f K T (r)R(r)K(r)] in Eq. (6.8) is replaced by W(X) in Eq. (7.59). Also,
the direction of integration in time is opposite in Eqs. (6.8) (t —> tf) and (7.59) (fo -> t).
Thus, taking a cue from the similarity (and differences) between Eqs. (6.8) and (7.59),
we can write a differential equation for Re(/, t) similar to that for M(f, //), Eq. (6.14).
as follows:
                          , t)/dt = A 0 (/)R € (r, t) + Re(f , OAj(f ) + W(f )          (7.60)

Note that Eq. (7.60) is an ordinary differential equation, rather than a partial differential
equation (Eq. (6.14)). Also, due to the fact that time progresses in a forward direction
(to —> t) in Eq. (7.60), rather than in a backward direction (tf —>• /) in Eq. (6.14),
the negative sign on the left-hand side of Eq. (6.14) is replaced by a positive sign on
the left-hand side of Eq. (7.60). Equation (7.60) is called the covariance equation for the
Kalman filter, and must be solved with the initial condition given by Eq. (7.58). Note that
we do not need to know the state-transition matrix, $>(r , /o), for solving for the optimal
covariance matrix. Equation (7.60) is the counterpart of the matrix Riccati equation for
the Kalman filter.
    Substituting Eqs. (7.51), (7.42) and (7.43) into Eq. (7.56), and assuming that the two
white noise signals, v(r) and z(r), are uncorrelated with each other, i.e. E[v(/)z T (r)] =
E[z(f)v T (r)] = 0, we can write the following expression relating W(/) to the spectral
THE KAIMAN FILTER                                  343


densities of the two white noise signals, V(f) and Z(0, as follows:
                          W(r) = F(r)V(OF T (0 + L(OZ(f)L T (f)                        (7.61)
Substituting Eq. (7.61) into Eq. (7.60) and substituting A 0 (f) = [A(0 -L(f)CU)], we
can express the co variance equation as follows:
        dRe(t, t)/dt = [A(0 - L(OC(r)]Re(r, 0 + R«(r, r))[A(0 - L(r)C(?)] T
                                                L(r)Z(f)L T (f )                       (7.62)
Comparing Eq. (7.62) with Eq. (6.21) and using the steps similar to those of Section 6.1.2,
we can write the optimal Kalman filter gain, L°(0, as follows:
                                 L°(/) = R°(t, OC T (r)Z-' (t)                         (7.63)
where R°(t, ?) is the optimal Governance matrix satisfying the following matrix Riccati
equation'.
           dR°K(t, t)/dt = A(f)RJ(f , f) + R°e(t, /)A T (0
                                                               r, t) +F(r)V(r)F T (0   (7.64)
We can derive a more general matrix Riccati equation for the Kalman filter when the two
noise signals are correlated with each other with the following cross-correlation matrix:
                                     T
                                £[v(Oz(T)j = V(t)8(t - T)                              (7.65)
where fy(t) is the cross-spectral density matrix between v(/) and z(f). Then the optimal
Kalman filter gain can be shown to be given by
                         L°(r) = [R°e(t, t)CT(t) + ¥(t)^(t)]Z~t)                      (7.66)
where R"(?, t) is the optimal covariance matrix satisfying the following general matrix
Riccati equation'.
          </R°(r, t)/dt = AG(t)R°e(t, t) + Rju, r)Aj(r)
                                                               , 0 + F(f)V G (f)F(0    (7.67)
with
                            A G (0 - A(0 -V(t)V(t)Z-l(t)C(t)                           (7.68)
                            VG(0 - V(0 - *(OZ-1(0*T(0                                  (7-69)
For simplicity of notation, we will use L to denote the optimal gain matrix of the Kalman
filter, rather than L°(0-
    The appearance of matrix Riccati equation for the Kalman filter problem is not
surprising, since the Kalman filter is an optimal observer. Hence, Kalman filter problem
is solved quite similarly to the optimal control problem. Usually, we are interested in a
steady Kalman filter, i.e. the Kalman filter for which the covariance matrix converges to a
constant in the limit t -> oo. Such a Kalman filter results naturally when the plant is time-
invariant and the noise signals are stationary white noises. In such a case, the estimation
344                                    KAIMAN FILTERS


error would also be a stationary white noise with a constant optimal covariance matrix,
R°. For the steady-state time-varying problem with non-stationary white noise signals, or
the time-invariant problem with stationary white noise signals, the following algebraic
Riccati equation results for the optimal covariance matrix, R°:

                      0=                                        FVGFn                   (7.70)

where the matrices on the right-hand side are either constant (time-invariant), or steady-
state values for the time-varying plant. The sufficient conditions for the existence of a
unique, positive definite solution to the algebraic Riccati equation (Eq. (7.70)) are the same
as those stated in Chapter 6: the system with state-dynamics matrix, A, and observation
matrix, C, is detectable, and the system with state-dynamics matrix, A, and controls coef-
ficient matrix, B = FV1/2, is stabilizable (V1/2 denotes the matrix square-root of V, which
satisfies V1/2(V1/2)r = V). These sufficient conditions will be met if the system with state-
dynamics matrix, A, and observation matrix, C, is observable, V is a positive semi-definite
matrix, and Z is a positive definite matrix. We can solve the algebraic Riccati equation for
steady-state Kalman filter using either the MATLAB command are, or more specifically,
the specialized Kalman filter commands Iqe or Iqe2, which are called as follows:

      »[L,P,E] = lqe(A,F,C,V,Z,Psi) <enter>

where A, F, C, are the plant's state coefficient matrices, V is the process noise spectral
density matrix, Z is the measurement noise spectral density matrix, and Psi = 4*, the
cross-spectral density matrix of process and measurement noises. If Psi is not specified
(by having only the first four input arguments in Iqe}, it is assumed that *> = 0. L
is the returned Kalman filter optimal gain, P = R", the returned optimal (conditional)
covariance matrix of the estimation error, and E is a vector containing the eigenvalues
of the Kalman filter (i.e. the eigenvalues of A-LC). The command Iqe2, is used in a
manner similar to Iqe, but utilizes a more numerically robust algorithm for solving the
algebraic Riccati equation than Iqe. A third MATLAB command, Iqew, is also available,
which solves a special Kalman filter problem in which the output equation is y(r) =
C(f)x(f) + D(f)u(f) + G(f)v(r) + z(0, where v(r) is the process noise that affects the
output through the coefficient matrix, G(f), and is uncorrelated with the measurement
noise, z(f).

  Example 7.6
  Let us design a Kalman filter for the fighter aircraft of Example 5.13. It is assumed
  that only the first two of the three state variables are measured. The state coefficient
  matrices for the linear, time-invariant model are as follows:
           -1.7       50        260            -272                    0.02     0.1
            0.22    -1.4       -32      B=                           -0.0035    0.004
            0         0        -12                 14                  0        0
                           D
                               =°                                                   (7.71)
THE KALMAN FILTER                                           345



The third-order plant has a single input, two outputs and two process noise variables.
The process noise spectral density matrix for the bomber is assumed to be V = FTF,
while that for the measurement noise is, Z = 10CCT. Also, assume that the cross-
spectral density of process and measurement noise is zero, i.e. *I> = 0. Then the
Kalman filter gain is calculated using the MATLAB command Iqe as follows:

»A=[-1.7 50 260; 0.22 - 1 . 4                  -32;0 0 - 1 2 ] ; F = [ 0 . 0 2 0.1;-0.0035 0.004;0 0 ] ;
 C=[1 0 0; 0 1 0 ] ; <enter>

»[L,P,E] = l q e ( A , F , C , F ) * F J 1 0 * C * C < ) <enter>
L =
            3.5231                  0.2445
            0.2445                  0.0170
            0                       0

P =
            35.2306                 2.4450                0
            2.4450                  0.1697                0
            0                      0                      0



 -12.0000
 -4.8700
 -1.7700

The Kalman filter is thus stable with eigenvalues at A = —12, A = —4.87, and
A = —1.11. Let us simulate the Kalman filter estimation error with v(/) and z(t)
generated using randn as follows:

»randn('seed',0); t=0:0.01:10; v = randn(size(t,2),2); z = randn(size
  ( t , 2 ) , 2 ) ; w = F * v ' - L * z ' ; <enter>

»[e,X] = l s i m ( A - L * C , e y e ( 3 ) , e y e ( 3 ) , z e r o s ( 3 , 3 ) , w ' , t ) ; <enter>

The simulated white noise, representing an element of v(0 or z(0, and the simulated
estimation error, e0(Y) = [^01(^)^02(0^03(0]7» are plotted in Figure 7.7.
   Note that the third element of the estimation error vector, e0(0> is identically zero
(because the last row of F is zero), while the first two elements are much smoother
and with smaller magnitudes than the noise. The first two elements of the estimation
error are random variables with zero mean values. How accurate is our simulated
estimation error? Not very accurate, because the noise vector we have simulated
does not have exactly the same power spectral density that we have assumed. In
fact, the simulated white noise is far from being a perfect white noise, which we
can verify by calculating the covariance matrices and mean values of (t) and z(/),
as follows:

        »cov(v) <enter>
        ans =
                   1.0621 -0.0307
                   -0.0307                    1.0145
346                                      KAIMAN FILTERS


                           Simulated white noise (an element of v(t) or z(t))




                    -0.5
                                                                            10


 Figure 7.7   Simulated white noise and estimation errors of the Kalman filter for a fighter aircraft


       »cov(z) <enter>
       ans =
               1.0229                0.0527 -0.0133
               0.0527                0.8992         0.0131
               -0.0133               0.0131         0.9467

       »mean(v) <enter>
       ans =
        -0.0139 -0.0047
       »mean(z) <enter>
       ans =
        -0.0125 0.0025 -0.0421
 Recall that a white noise vector must have infinite covariance matrix and a zero
 mean vector. The covariance of the simulated estimation error is the following:

       »cov(e) <enter>
       ans =
             0.0347                   0.0024
             0.0024                   0.0002
             0                        0

 Note that the simulated estimation error's covariance is different from the optimal
 covariance matrix, P, obtained as the solution to the algebraic Riccati equation of the
 Kalman filter. However, the ratios between the elements of P are the same as those
 between the elements of cov(e). Hence, the matrix P must be scaled by a scalar
 constant to represent the covariance of estimation error. To reduce the difference
THE KALMAN FILTER                                                               347


between the covariance matrices of the simulated and optimal estimation error, we
should modify our assumptions of the power spectral densities, or simulate the white
noise more accurately using the random number generator, randn. Since the actual
noise will almost never be a white noise, there is no point in spending the time
to accurately model white noise better on a computer. Instead, we should fine tune
the Kalman filter gain by appropriately selecting the spectral densities V, Z, and *I>.
After some trial and error, by selecting V = FTF, Z = 0.01 CCT, and * = 0, we
get the Kalman filter gain and optimal estimation error covariance as follows:

        »[L,P,E] = l q e ( A , F , C J F ' * F 3 0 . 0 1 * C * C ' ) <enter>

         L =
                    3.5247                        0.2446
                    0.2446                        0.0170
                    0                             0

         P =
                    0.0352                       0.0024                        0
                    0.0024                       0.0002                        0
                    0                            0                             0

         E =
                    -12.0000
                    -4.8708
                    -1.7709

and the simulated estimation error is re-calculated as

»w = F * v ! - L * z ' ; s y s o b = s s ( A - L * C , e y e ( 3 ) , e y e ( 3 ) , z e r o s ( 3 , 3 ) ) ; [ e , t , X ] = Isim
 ( s y s o b , w ' , t ) ; <enter>

with the simulated estimation error's covariance matrix given by

        »cov(e) <enter>
        ans =
                         0.0347                   0.0024                   0
                         0.0024                   0.0002                   0
                         0                        0                        0

which is the same as calculated previously, and quite close to the new optimal
covariance, P. The new Kalman filter gain and eigenvalues are not changed by
much (indicating little change in the estimation error time response), but the scaling
of the optimal covariance of the estimation error is now greatly improved. The mean
estimation error vector, eom, is calculated as follows:

        » mean(e) <enter>
        ans =
                         0.0305                   0.0021                   0
348                                    KAIMAN FILTERS


   which is quite close to zero vector, as desired. The accuracy of the mean value will,
   of course, improve by taking more time points in the simulation, and in the limit
   of infinite number of time points, the mean would become exactly zero.                       I
   The Kalman filter approach provides us with a procedure for designing observers for
multivariable plants. Such an observer is guaranteed to be optimal in the presence of
white noise signals. However, since white noise is rarely encountered, the power spectral
densities used for designing the Kalman filter can be treated as tuning parameters to arrive
at an observer for multivariable plants that has desirable properties, such as performance
and robustness. The linear Kalman filter can also be used to design observers for nonlinear
plants, by treating nonlinearities as process noise with appropriate power spectral density
matrix.

  Example 7.7
  Let us design a Kalman filter to estimate the states of a double-pendulum (Example
  4.12, Figure 1.5). A choice of the state variables for this fourth order system
  is jcj(r) = 6>i(r), x2(t) = 02(t), Jt 3 (f) =6> 1 (1) (r); *4(0 = 02n(0, which results in
  nonlinear state-equations given by Eq. (4.93). The function M-file for evaluating
  the time derivative of the state-vector, x (1) (f), is called doub.m and is tabulated in
  Table 4.7. Thus, M-file assumes a known input torque acting on the pendulum given
  by u(t} = 0.01 sin(5f)Af — m. It is desired to design a linear Kalman filter based
  on the known input, u(t), and measurement of the angular position and angular
  velocity of the mass, m, i.e. y(0 = [0(t) 0 1 (1) (/)] r » with the following linearized
  plant model:




                 *3 (0 = ™2gX2(t) - (mi +                                           (7.72)
                 *4!)(r) = ~[gx2(t) + Lidx3(t)/dt]/L2      + u(t}l(m2L)

  which results in the following linear state coefficient matrices for the plant:

                             0                         0               1   0
                             0                         0               0   1
            A=
                   -(m+m2)gl(mL)                m2gl(mL)          0   0
                    (mi +m 2 )g/(miL 2 )       -                       0   0
                         0
                         0


            c_[i    o o ol                  ro-l                                     (7.73)
                 [o o i o j *               L°J
THE KAIMAN FILTER                                     349


The solution of the exact nonlinear state-equations of the plant with zero initial
condition, i.e. x(0) = 0, is obtained using the MATLAB Runge-Kutta solver ode45
as follows:

      »[t,X] = ode45(@doub,[0 20],zeros(4,1)); <enter>

However, it is assumed that the state-vector, x(0, solved above, is unavailable
for measurement, and only the output, y(t), can be measured, which is calcu-
lated by

      »C = [1 0 0 0; 0 0 1 0 ] ; y = C * X ' ; <enter>

The state coefficient matrices, A and B, of the linearized plant are calculated with
m = 1 kg, m.2 = 2 kg, L = I m, LI = 2 m, and g = 9.8 m/s2 (same values as
those used in doub.m for the nonlinear plant) as follows:

»m1=1;m2=2;L1=1;L2=2;g=9.8; A = [0 0 1 0; 0 0 0 1; -(m1+m2)*g/(m1*L1)
 m2*g/(m1*L1) 0 0; (m1+m2)*g/(m1*L2) - g * ( m 2 / m l + l ) / L 2 0 0] <enter>

A =
 0                       0                       1.0000                0
 0                       0                       0                     1.0000
 -29.4000                19.6000                 0                     0
 14.7000                 -14.7000                0                     0

»B = [ 0 0 0 1/(m2*L2*L2)]' <enter>

B =
     0
     0
     0
  0.1250


Since nonlinearities appear as process noise for all the state variables of the
linear plant model, the process noise coefficient matrix is assumed to be an
identity matrix, i.e. F = I. The linear Kalman filter is to be designed using the
spectral densities of process and measurement noise, V, Z, and VP such that the
exact state-vector, x(f), is accurately estimated. After some trial and error, we
select V =106I, Z = CCT, and * = 0, and calculate the Kalman filter gain as
follows:

       » [ L ) P , E ] = l q e ( A , e y e ( 4 ) , C , 1 e 6 * e y e ( 4 ) , C * C ' ) <enter>
       I


        9.99896+002 -1.38990+001
        1.53036+001 1.02566+003
       -1.38996+001 1.02026+003
        2.16986+001 4.84736+002
350                                       KAIMAN FILTERS




                                                                                theta 1

                                                     1                ,1^ —*•      rn
                                                    s                 T—    i
                                                                       I— theta2
                                                                                   i i
                      Input                       Dserv sr

                                                  VLXC
                                                                                   a
                                                                             —
                                                  Sl*t                     thf >ta 1 c



                                                                              theta 2 dot
                   Measured
                    output


                     0.02

                     0.01

                        0

                   -0.01

                   -0.02                                     -.2
                                                              00
                                    10          20               0            10            20

                                                                     — 02(1)(0; - 0o2(1)(0;
                                                              0.05




                                                             -0.05
                                                                              10            20
                                                                           Time (s)

 Figure 7.8    Actual (simulated) state-vector, x(f) = [0i(f); 02(f); 6»i(1)(r); ^2(1)(0lr, and esti-
 mated state-vector, Xo(f) = [00](t); 002(f); 0    ', e(J^(t)]T, with a linear Kalman filter for the
 nonlinear dynamics of a double pendulum


       P =
        9.9989e+002           1.5303e+001 -1.3899e+001 2.1698e+001
        1.53036+001           5.33716+004 1.02566+0032.60276+004
       -1.38996+001           1.02566+003 1.02026+0034.84736+002
        2.16986+001           2.60276+004 4.84736+002 1.28186+006

       E =
       -1.00006+003+ 1.52026+001i
       -1.00006+003 - 1.52026+001i
       -1.87856+001
       -1.30396+000
_              OPTIMAL (LINEAR, QUADRATIC, GAUSSIAN) COMPENSATORS_                    351


   Finally, we calculate the estimated state- vector, x 0 (0» by solving the Kalman filter
   state-equation (Eq. (7.44) with the known input, u ( t ) , and the measured output
   vector, y(0, using the SIMULINK block-diagram shown in Figure 7.8. The input,
   u ( t ) , is calculated in MATLAB work-space as follows, at the same time points
   previously used for generating the state- vector, x(Y), with ode45:
       »u = 0.01*sin(5*t ' ) ; <enter>

   The actual (i.e. generated by solving nonlinear equations through ode45 ) and esti-
   mated (SIMULINK) state variables are compared in Figure 7.8. Note that the state
   variables 0(t) and #j (1) (0 are almost exactly estimated, as expected, because these
   state variables are directly measured. The estimation errors for ^(0 and $2 (0 are
   appreciable, but reasonable, since we are trying to estimate a nonlinear plant by a
   linear Kalman filter.


7.5 Optimal (Linear/ Quadratic, Gaussian)
    Compensators
In Chapter 5, we had used the separation principle to separately design a regulator and
an observer using pole-placement, and put them together to form a compensator for the
plant whose state-vector was unmeasurable. In Chapter 6, we presented optimal control
techniques for designing linear regulators for multi-input plants that minimized a quadratic
objective function, which included transient, terminal, and control penalties. In the present
chapter, we have introduced the Kalman filter, which is an optimal observer for multi-
output plants in the presence of process and measurement noise, modeled as white noises.
Therefore, using a separation principle similar to that of Chapter 5, we can combine the
optimal regulator of Chapter 6 with the optimal observer (the Kalman filter), and end
up with an optimal compensator for multivariable plants. Since the optimal compensator
is based upon a linear plant, a quadratic objective function, and an assumption of white
noise that has a normal, or Gaussian, probability distribution, the optimal compensator
is popularly called the Linear, Quadratic, Gaussian (or LQG) compensator. In short, the
optimal compensator design process is the following:

(a) Design an optimal regulator for a linear plant assuming full-state feedback (i.e.
    assuming all the state variables are available for measurement) and a quadratic objec-
    tive function (such as that given by Eq. (6.3)). The regulator is designed to generate
    a control input, u(0, based upon the measured state-vector, x(0-
(b) Design a Kalman filter for the plant assuming a known control input, u(0, a measured
    output, y(r), and white noises, (t) and z ( t ) , with known power spectral densities.
    The Kalman filter is designed to provide an optimal estimate of the state-vector, x0(t).
(c) Combine the separately designed optimal regulator and Kalman filter into an optimal
    compensator, which generates the input vector, u(f), based upon the estimated
    state-vector, x 0 (r), rather than the actual state-vector, x(0, and the measured output
    vector, y(/).
352                                  KALMAN FILTERS


    Since the optimal regulator and Kalman filter are designed separately, they can be
selected to have desirable properties that are independent of one another. The closed-
loop eigenvalues consist of the regulator eigenvalues and the Kalman filter eigen-
values, as seen in Chapter 5. The block diagram and state-equations for the closed-
loop system with optimal compensator are the same as those for the pole-placement
compensator designed in Chapter 5, except that now the plant contains process and
measurement noise. The closed-loop system's performance can be obtained as desired
by suitably selecting the optimal regulator's weighting matrices, Q and R, and the
Kalman filter's spectral noise densities, V, Z, and V. Hence, the matrices Q, R,
V, Z, and 4* are the design parameters for the closed-loop system with an optimal
compensator.
   A state-space realization of the optimal compensator for regulating a noisy plant with
state-space representation of Eqs. (7.40) and (7.41) is given by the following state and
output equations:

                    Xo(1)(0 = (A - BK - LC + LDK)Xo(r) + Ly(r)                        (7.74)
                       u(0 = -Kxo(r)                                                (7.75)

where K and L are the optimal regulator and Kalman filter gain matrices, respectively.
For a corresponding optimal tracking system, the state and output equations derived in
Section 5.4.1 should be used with the understanding that K is the optimal feedback gain
matrix and L is the optimal Kalman filter gain matrix.
   Using MATLAB (CST), we can construct a state-space model of the regulating closed-
loop system, sysCL, as follows:

»sysp=ss(A,B,C,D) ; sysc=ss(A-B*K-L*C+L*D*K,L J K,zeros(size(D > ) )) ; <enter>

»sysCL=f eedback ( sysp , sysc ) <enter>

where sysp is the state-space model of the plant, and sysc is the state-space model
of the LQG compensator. The resulting closed-loop system's state- vector is XCL(') =
[xr(0; Xo T (r)] r . Alternatively, MATLAB (CST) provides a readymade command reg to
construct a state-space model of the optimal compensator, given a state-space model of
the plant, sysp, the optimal regulator feedback gain matrix, K, and the Kalman filter gain
matrix, L. This command is used as follows:

       »sysc= reg(sysp,K,L) <enter>

where sysc is the state-space model of the compensator. To find the state-space repre-
sentation of the closed-loop system, sysCL, the command reg should be followed by the
command feedback as shown above.




(
    Example 7.8                                                                         |
    Let us design an optimal compensator for the flexible bomber aircraft (Examples 4.7, I
    6.1, 6.5, 6.7), with the process noise coefficient matrix, F = B. Recall that the |
OPTIMAL (LINEAR, QUADRATIC, GAUSSIAN) COMPENSATORS                         353


sixth order, two input system is described by a linear, time-invariant, state-space
representation given by Eq. (4.71). The inputs are the desired elevator deflection
(rad.), u (f), and the desired canard deflection (rad.), 1*2(1), while the outputs are the
normal acceleration (m/s2), y  ( t ) , and the pitch-rate (rad./s), yi(t). In Example 6.1,
we designed an optimal regulator for this plant to achieve a maximum overshoot of
less than ±2 m/s2 in the normal-acceleration, and less than ±0.03 rad/s in pitch-rate,
and a settling time less than 5 s, while requiring elevator and canard deflections not
exceeding ±0.1 rad. (5.73°), if the initial condition is 0.1 rad/s perturbation in the
pitch-rate, i.e. x(0) = [0; 0.1; 0; 0; 0; 0]T. This was achieved with Q = 0.011 and
R = I, resulting in the following optimal feedback gain matrix:
            [1.0780      -0.16677    -0.046948   -0.0756L8 0.59823 0.35302]
            L 1 - 3785     0.34502   -0.013144   -0.065260 0.47069 0.30941 J '
                                                                                    (7.76)
and the following eigenvalues of the regulator (i.e. eigenvalues of A-BK):

      »eig(A-B*K) <enter>
      ans =
      -7.87486+001+         5.06250+001i
      -7.87486+001 -        5.06256+001i
      -9.18036+001
      -1.16026+000+         1.73286+OOOi
      -1.16026+000 -        1.73286+OOOi
      -1.05606+000

 Note that the dominant regulator pole is at s = — 1.056, which determines the speed
 of response of the full-state feedback control system. Since the closed-loop eigen-
 values of the compensated system are the eigenvalues of the regulator and the
 eigenvalues of the Kalman filter, if we wish to achieve the same performance in
 the compensated system as the full-state feedback system, ideally we must select a
 Kalman filter such that the Kalman filter eigenvalues do not dominate the closed-
 loop system, i.e. they should not be closer to the imaginary axis than the regulator
 eigenvalues. As the Kalman filter does not require a control input, its eigenvalues
 can be pushed deeper into the left-half plane without causing concern of large
 required control effort (as in the case of the regulator). In other words, the Kalman
 filter can have faster dynamics than the regulator, which is achieved free of cost.
 However, as we will see in the present example, it is not always possible to push
 all the Kalman filter poles deeper into the left-half plane than the regulator poles
 by varying the noise spectral densities of the Kalman filter. In such cases, a judi-
 cious choice of Kalman filter spectral densities would yield the best recovery of the
full-state feedback dynamics.
     To design the Kalman filter to recover the full-state feedback performance of
 Example 6.1, the process noise spectral density matrix for the bomber is selected
 after some trial and error to be V = 0.0007BTB, while the spectral density matrix of
 the measurement noise is Z = CCT. We also assume that the process and measure-
 ment noises are uncorrelated, i.e. * = 0. Then the Kalman filter gain is calculated
 using the MATLAB command Iqe as follows:
354                                         KAIMAN FILTERS


 »[L,P,E] = lqe(A,B,C)0.0007*B'*B,C*C') <enter>
  L =
  -1.83706-005    5.18246-001
   9.85326-004    7.0924e+000


  -1.50556-001 -2.61076+001
  -3.12916-002 -6.76946+001
  -3.07796-002 -1.04036+001
  -3.37156-002 1.79546 -001

 P =
  1.23076+000    5.20936-001 -3.94016+001 5.54616+001 -1.8815e-001 2.76556-002
  5.20936-001    6 9 8 6 0 0 -4.06176+000 -6.31126+001 - . 9 8 + 0 5.11636+000
                  .42+0                                 585600
 -3.94016+001    -4.06176+000 2.80636+004 4.7549e+004 -2.74186+002 -2.30696+002
  5.54616+001    -6.31126+001 4.75496+004 6.02816+005 -1.10156+003 -1.79726+003
 -1.88156-001    -5.89586+000 -2.74186+002 -1.10156+003 1.20936+002 -2.47026+001
  2.76556-002    5.11636+000 -2.30696+002 -1.79726+003 -2.47026+001 3.26036+002

 E =
 -1.47006+002
 -8.91126+001
 -7.93276+000
 -1.95486+000+ 4.1212e+000i
 -1.95486+000- 4.1212e+000i
 -5.64536-001


 Note that the Kalman filter's dominant pole is at s = —0.56453, which is closer
 to the imaginary axis than the dominant regulator pole. Thus, the two closed-loop

                     20
                                  -Full-state feedback control system (Example 6.1)
              1       0

                                     • Compensated system with kalman filter
                    -20
                          i

                    0.1               i            i              i       r
                                     Full-state feedback control system
                                     (Example 6.1)
                      0
                                      Compensated system with kalman filter
                   -0.1               i            i              i       i
                          0

                   0.05
                              u
                              i(0         Compensated system with kalman filter

                      0

                  -0.05
                                                  2               3
                                                       Time (s)

 Figure 7.9 Closed-loop system's initial response and control inputs for the flexible bomber with
 optimal (LOG) compensator
OPTIMAL (LINEAR, QUADRATIC, GAUSSIAN) COMPENSATORS                                   355


  poles closest to the imaginary axis are the dominant pole the Kalman filter and that
  of the optimal regulator, and the closed-loop response's speed and overshoots are
  largely determined by these two poles. We can construct a state-space model of the
  closed-loop system as follows:

  »sysp=ss(A,B,C,D); sysc=ss(A-B*K-L*C+L*D*K,L,K,zeros(size ( D ' ) ) ) ;
   <enter>

  »sysCL=feedback(sysp,sysc) <enter>

  You may confirm that the closed-loop eigenvalues are indeed the eigenvalues of
  the regulator and the Kalman filter using damp(sysCL). The initial response of
  the closed-loop system to x(0) — [0; 0.1; 0; 0; 0; O]7 and the required control input
  vector are calculated as follows:

  »[y,t,X]=initial(sysCL ) [0 0.1 z e r o s ( 1 , 1 0 ) ] ' ) ; u=-K* X ( : , 7 : 1 2 ) ' ; <enter>

  The closed-loop responses, y(t) and y2(t), are compared to their corresponding
  values for the full-state feedback control system (Example 6.1) in Figure 7.9.
  Figure 7.9 also contains the plots of the required control inputs, u(t) and «2(0-
  Note that the speed of the response, indicated by the settling time of less than five
  seconds, maximum overshoots, and control input magnitudes are all quite similar
  to those of the full-state feedback system. This is the best recovery of the full-state
  feedback performance obtained by varying the Kalman filter's process noise spectral
  density scaling parameter, p, where V = pBTB.


   In Example 7.8, we saw how the full-state feedback control system's performance
can be recovered by properly designing a Kalman filter to estimate the state-vector
in the compensated system. In other words, the Kalman filter part of the optimal
(LQG) compensator can be designed to yield approximately the same performance as
that of the full-state feedback regulator. Now let us examine the robustness of the
designed LQG compensated closed-loop system with respect to measurement noise
in comparison with the full-state feedback system of Example 6.1. Such a compar-
ison is valid, because both control systems use the same feedback gain matrix, K.
A SIMULINK block-diagram and the simulated initial response of the compensated
closed-loop system are shown in Figure 7.10. The same white noise intensity (power
parameter of 10~8) in the pitch-rate channel is used as in Example 6.1. Comparing
Figure 7.10 with Figure 6.3, we observe that the normal acceleration and pitch-rate
fluctuations are about half the magnitudes and smaller in frequency than those seen
in Figure 6.3. This indicates that the LQG compensated system is more robust with
respect to measurement noise than the full-state feedback system of the same regulator
gain matrix, K.
   We have thus far confined our attention to white noise model of disturbances. How
robust would an LQG compensator be to actual parameter variations and noise which is
not white? This is a crucial question, which is answered in the next section.
356                                     KAIMAN FILTERS



                                                          Normal
                                                          acceleration
                                                          (yi)
                           LOG
                        compensator
                            1
                            s

                                   1'     1'          ^




                                                                              Band-limited
                                                                              white noise




                  -10
                  -15
                  -20
                                               4      5       6                10
                                                   Time (s)

                 0.15

                  0.1
                 0.05

                    0
                -0.05
                                               4      5       6                10
                                                   Time (s)

Figure 7.10 Simulated initial response of the flexible bomber with an optimal (LOG) compensator
and measurement noise in the pitch-rate channel


7.6 Robust Multivariable LOG Control: Loop Transfer
    Recovery
In Chapter 2, we observed that in principle, the closed-loop systems are less sensitive (or
more robust) to variations in the mathematical model of the plant (called process noise
and measurement noise in Section 7.5), when compared to the corresponding open-loop
systems. It was also observed that the robustness of a single-input, single-output feedback
ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY                     357


                                                           p(s)(process noise)

                                                                     Y(s)

                                Compensator          Plant




                                               m(s) (measurement noise)

Figure 7.11 A mulHvariable feedback control system with compensator transfer matrix, H(s), plant
transfer matrix, G(s), process noise, p(s), and measurement noise, rn(s)


control system is related to the return difference, I + G ( s ) H ( s ) , where G(s) and H(s)
are the transfer functions of the plant and controller, respectively. The larger the return
difference of the feedback loop, the greater will be the robustness when compared to the
corresponding open-loop system.
   Consider a linear, time-invariant, multivariable feedback control system with the block-
diagram shown in Figure 7.1 1. The control system consists of a feedback controller with
transfer matrix, H(^), and a plant with transfer matrix, G(s), with desired output, YdCs).
The process noise, p(s), and measurement noise, m(s), are present in the control system
as shown. Using Figure 7.1 1, the output, Y(s), can be expressed as follows:

              Y(J) -                           - [I- {I
                       + {!-[! +               -1 }Yd(s)                                 (7.77)

while the control input, U(s), can be expressed as


                    - [I + H(5)G(,s)]-1H(j)m(j)                                          (7.78)

From Eqs. (7.77) and (7.78), it is clear that the sensitivity of the output with respect
to process and measurement noise depends upon the matrix [I-f-G(s)H(s)]~ l , while
the sensitivity of the input to process and measurement noise depends upon the matrix
[I + H(5)G(5)]~1. The larger the elements of these two matrices, the larger will be the
sensitivity of the output and input to process and measurement noise. Since robustness is
inversely proportional to sensitivity, we can extend the analogy to multivariable systems by
saying that the robustness of the output is measured by the matrix [I + G(s)H(s)], called
the return-difference matrix at the output, and the robustness of the input is measured by
the matrix [I + H(s)G(s)], called the return difference matrix at the plant input. Therefore,
for multivariable control-systems, there are two return difference matrices to be consid-
ered: the return difference at the output, [I + G(s)H(s)], and that at the plant's input,
[I + H(j)G(j)]. Alternatively, we can define the return ratio matrices at the plant's output
and input, as G(s)H(s) and H(5)G(s), respectively, and measure robustness properties in
terms of the return ratios rather than the return differences,
358                                   KAIMAN FILTERS


   Continuing our analogy with single-input, single-output systems, we would like to
assign a scalar measure to robustness, rather than deal with the two return-difference (or
return ratio) matrices. We can define a matrix norm (introduced in Chapter 4) to assign a
scalar measure to a matrix. For a complex matrix, M, with n rows and m columns, one
such norm is the spectral (or Hilbert) norm, given by
                                              = amax                                  (7.79)
where <7max is the positive square-root of the maximum eigenvalue of the matrix M H M if
n > w, or of the matrix MMH if n < m. Here MH denotes the Hermitian of M defined as
the transpose of the complex conjugate of M. In MATLAB, the Hermitian of a complex
matrix, M, is calculated by M', i.e. the same command as used for evaluating the transpose
of real matrices. All positive square-roots of the eigenvalues of MHM if n > m (or MMH
if n < m) are called the singular values of M, and are denoted by a*, k = 1 , 2, .., n, where
n is the size of M. The largest among a* is denoted by crmaA, and the smallest among a*
is denoted by amjn. If M varies with frequency, then each singular value also varies with
frequency.
    A useful algorithm for calculating singular values of a complex matrix, M, of n rows
and m columns is the singular value decomposition, which expresses M as follows:
                                       M = USVH                                       (7.80)
                                                            H              H
where U and V are complex matrices with the property U U = I and V V = I, and S is
a real matrix containing the singular values of M as the diagonal elements of a square
sub-matrix of size (n x n) or (m x m), whichever is smaller. MATLAB also provides
the function svd for computing the singular values by singular value decomposition, and
is used as follows:
      »[U,S,V] = svd(M) <enter>

  Example 7.9
  Find the singular values of the following matrix:
                                    !+/     2 + 2i 3 + /
                                    I-/     2 - 2i 3 - 5i
                            M=                                                    (7.81)
                                     5       4 + i l+2i
                                    7-i        2   3 + 3i

  Using the MATLAB command svd, we get the matrices U, S, V of the singular
  value decomposition (Eq. (7.80)) as follows:

  »[U,S,V] = svd(M) <enter>
  U =
   0.2945+0.06041      0.4008-0.21571       -0.0626-0.23191      -0.5112-0.61921
   0.0836-0.42941      -0.0220-0.70521      0.2569+0.14561       0.4269-0.20361
   0.5256+0.04311      -0.3392-0.04551      -0.4622-0.53461      0.3230+0.03091
   0.6620-0.04251      -0.3236+0.27071      0.5302+0.27281       -0.1615-0.01541
ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY                 359


  S =
    12.1277    0          0
        0      5.5662     0
        0      0          2.2218
        0      0          0


  V =
  0.6739                -0.6043            0.4251
  0.4292-0.13181        -0.0562-0.35731    -0.7604-0.29901
  0.4793-0.33851        0.6930-0.15401     0.2254+0.31761


  Hence, the singular values of M are the diagonal elements of the (3 x 3) sub-
  matrix of S, i.e. <ri(M) = 2.2218, <r2(M) = 5.5662, and or3(M) = 2.1277, with
  the largest singular value, amax(M) = 12.1277 and the smallest singular value,
  crmjn(M) — 2.2218. Alternatively, we can directly use their definition to calculate
  the singular values as follows:

        »sigma= sqrt(eig(M'*M)) <enter>
        sigma =
          12.1277+0.OOOOi
          5.5662+0.OOOOi
          2.2218+0.OOOOi


   The singular values help us analyze the properties of a multivariable feedback (called
a multi-loop) system in a manner quite similar to a single-input, single-output feed-
back (called a single-loop) system. For analyzing robustness, we can treat the largest
and smallest singular values of a return difference (or return ratio) matrix as providing
the upper and lower bounds on the scalar return difference (or return ratio) of an
equivalent single-loop system. For example, to maximize robustness with respect to the
process noise, it is clear from Eq. (7.77) that we should minimize the singular values of
the sensitivity matrix, [I + GCsOHCs)]""1, which implies minimizing the largest singular
value, (Tmax[{I -f G(s)H($)}~'], or maximizing the singular values of the return differ-
ence matrix at the output, i.e. maximizing ormin[I -f G(s)H(.s)]. The latter requirement is
equivalent to maximizing the smallest singular value of the return ratio at the output,
crmin[G(s)H(s)]. Similarly, minimizing the sensitivity to the measurement noise requires
minimizing the largest singular value of the matrix [I — {I + G($)H(s)}~ ] ], which is
equivalent to minimizing the largest singular value of the return ratio at the output,
crmax[G(s)H(s)]. On the other hand, tracking a desired output requires from Eq. (7.77)
that the sensitivity to Yd(s) be maximized, which requires maximizing crmjn[I —• {1 +
GCOHCs)}"1], which is equivalent to maximizing crmin[G(5)H(51)]. Also, it is clear from
Eq. (7.77) and the relationship U(s) = H(s)Y(s) that optimal control (i.e. minimization
of control input magnitudes) requires minimization of crmax[H(,s){I + GCOHCs)}"1], or
alternatively, a minimization of ermax[HCs)]. In summary, the following conditions on the
singular values of the return ratio at output result from robustness, optimal control and
tracking requirements:
360                                   KALMAN FILTERS


(a) For robustness with respect to the process noise, or,nin[G(s)H(s)] should be maximized.
(b) For robustness with respect to the measurement noise, amax[G(s)H(s)] should be
    minimized.
(c) For optimal control, crmax[H(s)] should be minimized.
(d) For tracking a changing desired output, ormjn[G(.s)H(.s)] should be maximized.

Clearly, the second requirement conflicts with the first and the fourth. Also,
since ffmax[G(.s)H(.y)] < o'max[G(5)]crniax[H(5)] (a property of scalar norms), the third
requirement is in conflict with the first and the fourth. However, since measurement noise
usually has a predominantly high-frequency content (i.e. more peaks in the power spectrum
at high frequencies), we achieve a compromise by minimizing ormax[G(.s)H(.s)] (and
<7max[H(s)]) at high frequencies, and maximizing amin[G(5)H(5)] at low frequencies. In
this manner, good robustness properties, optimal control, and tracking system performance
can be obtained throughout a given frequency range.
    The singular values of the return difference matrix at the output in the frequency
domain, cr[I + G(ico)H(ico)], can be used to estimate the gain and phase margins (see
Chapter 2) of a multivariable system. One can make singular value plots against frequency,
to, in a similar manner as the Bode gain plots. The way in which multivariable gain and
phase margins are defined with respect to the singular values is as follows: take the
smallest singular value, a^n, of all the singular values of the return difference matrix at
the output, and find a real constant, a, such that crmiJI + G(/o>)] > a for all frequencies,
co, in the frequency range of interest. Then the gain and phase margins can be defined as
follows:

                              Gain margin = 1/(1 ± a)                                (7.82)
                                                       1
                             Phase margin = ±2 sin" (a/2)                            (7.83)

  Example 7.10
  Figure 7.12 shows the singular values of the rotating flexible spacecraft of
  Example 6.2. We observe that the smallest singular value reaches a minimum of
  —70 dB in the frequency range 0.01-10,000 rad/s at frequency 0.01 rad/s. Hence,
  a = 10-(70/20) = 3.16 x 10~4. Therefore, the gain margins are 1/(1 + a) = 0.9997
  and 1/(1 — a) = 1.0003, and phase margins are ±0.0181° (which are quite small!).
  These margins are quite conservative, because they allow for simultaneous gain
  and phase variations of all the controller transfer functions. The present analysis
  indicates that the control system for the spacecraft cannot tolerate an appreciable
  variation in the phase of the return difference matrix before its eigenvalue cross
  into the right-half s-plane. However, the spacecraft is already unstable due to
  double eigenvalues at s = 0 (see Example 6.2), which the classical measures
  of gain and phase margins do not indicate (recall from Chapter 2 that gain
  and phase margins only indicate poles crossing over into right-half s-plane).
  Hence, gain and phase margins have limited utility for indicating closed-loop
  robustness.
ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY                                               361




                                    0.

                                         _i


                         -20-
                                            /t




                         -60-



                         —00 I i l l in"!    i i i "nil    i i i mill    i ' ' IIM|I   i i 11 ini   i i iiini
                            10-2                    1Q 0          1Q 1          1Q2
                                                                                              103
                                                    Frequency (rad/sec)

   Figure 7.12 Singular value plot of the return difference matrix [I + G(s)H(s)] of the rotating
   spacecraft


   For designing a control system in which the input vector is the least sensitive to process
and measurement noise, we can derive appropriate conditions on the singular values of
the return ratio at the plant's input, H(s)G(s), by considering Eq. (7.78) as follows:

(a) For robustness with respect to the process noise, crmin[H(s)G(s)] should be maximized.
(b) For robustness with respect to the measurement noise, <rmin[H(s)G(s)]                                       should be
    maximized.

Thus, there is no conflict in achieving the robustness of the plant's input to process and
measurement noise. However, Eq. (7.78) indicates that for tracking a changing desired
output, crmax[HCs)GCy)] should be minimum, which conflicts with the robustness require-
ment. This conflict can again be resolved by selecting different frequency ranges for
maximizing and minimizing the singular values.
    The adjustment of the singular values of return ratio matrices to achieve desired
closed-loop robustness and performance is called loop shaping. This term is derived
from single-loop systems where scalar return ratios of a loop are to be adjusted. For
compensated systems based on an observer (i.e. the Kalman filter), generally there is
a loss of robustness, when compared to full-state feedback control systems. To recover
the robustness properties associated with full-state feedback, the Kalman filter must be
designed such that the sensitivity of the plant's input to process and measurement noise
is minimized. As seen above, this requires that the smallest singular value of the return
ratio at plant's input, amin[H(5)G(5')l, should be maximized. Theoretically, this maximum
value of amin[H(5')G(5)] should be equal to that of the return ratio at the plant's input
with full-state feedback. Such a process of designing a Kalman filter based compen-
sator to recover the robustness of full-state feedback is called loop transfer recovery
362                                    KALMAN FILTERS


(LTR). Optimal compensators designed with loop transfer recovery are called LQG/LTR
compensators. The loop transfer recovery can either be conducted at the plant's the input,
as described below, or at the plant's output. The design of optimal (LQG) compensators
for loop transfer recovery at the plant's input can be stated as follows:

1. Design a full-state feedback optimal regulator by selecting Q and R matrices such
   that the desired performance objectives are met, and the singular values of the return
   ratio at the plant's input are maximized. With full-state feedback, the return ratio at
   the plant's input is H(s)G(s) = — K(sl — A)~'B, where A, B are the plant's state
   coefficient matrices and K is the full-state feedback regulator gain matrix.
2. Design a Kalman filter by selecting the noise coefficient matrix, F, and the white noise
   spectral densities, V, Z, and *I>, such that the singular values of the return ratio at
   the plant's input, H(s)G(s), approach the corresponding singular values with full-state
   feedback. Hence, F, V, Z, and W are treated as design parameters of the Kalman
   filter to achieve full-state feedback return ratio at the plant's input, rather than actual
   parameters of process and measurement (white) noises.

   The compensated system's return ratio matrix at plant's input can be obtained by taking
the Laplace transform of Eqs. (7.74) and (7.75), and combining the results as follows:

                               U(s) = -K(sl - A C )-'LY(5)                             (7.84)

where Ac = (A — BK — LC + LDK) is the compensator's state-dynamics matrix, L is
the Kalman filter's gain matrix, and ¥(5) is the plant's output, written as follows:

                                                                                       (7.85)

Substituting Eq. (7.85) into Eq. (7.84), we get the following expression for U(s):

                         = -K(sl - Ac)-'L[C(5l - A)~'B + D]U(s)                        (7.86)

Note that the return ratio matrix at the plant's input is the matrix by which U(s) gets
pre-multiplied in passing around the feedback loop and returning to itself, i.e. U(.s) =
H(s)G(.s) in Figure 7.11 if all other inputs to the control system, Y d (s), p(s), m(^), are
zero. Hence, the return ratio at the compensated plant's input is

                   H(s)G(s) = -K(sl - Acr'L[C(sI - A)~ ] B + D]                        (7.87)

   There is no unique set of Kalman filter design parameters F, V, Z, and 4> to achieve
loop transfer recovery. Specifically, if the plant is square (i.e. it has equal number of
outputs and inputs) and minimum-phase (i.e. the plant's transfer matrix has no zeros
in the right-half plane), then by selecting the noise coefficient matrix of the plant as
F = B, the cross-spectral density as * = 0, the measurement noise spectral density as
Z = I, and the process noise spectral density as V = V0 4- pi, where p is a scaling
parameter, it can be shown from the Kalman filter equations that in the limit p —> oo, the
compensated system's return ratio, given by Eq. (7.87), converges to — K(sl — A)"~'B. the
return ratio of the full-state feedback system at the plant input. In most cases, better loop
ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY                   363


transfer recovery can be obtained by choosing Z = CCT and V = pBTB, and making p
large. However, making p extremely large reduces the roll-off of the closed-loop transfer
function at high frequencies, which is undesirable. Hence, instead of making p very large
to achieve perfect loop transfer recovery at all frequencies, we should choose a value of
p which is sufficiently large to approximately recover the return ratio over a given range
of frequencies.
   MATLAB's Robust Control Toolbox [3] provides the command sigma to calculate
the singular values of a transfer matrix, G(s = ito), as a function of frequency, a>, as
follows:

      »[sv,w] = sigma(sys) <enter>
where sys is an LTI object of G(s) = C(sl — A)~'B -f D, and sv and w contain the
returned singular values and frequency points, respectively. The user can specify the set
of frequencies at which the singular values of G(s) are to be computed by including the
frequency vector, w, as an additional input argument of the command as follows:

      »[sv,w] = sigma(sys,w) <enter>

Also, sigma can calculate the singular values of some commonly encountered functions
of G(/o>) by using the command as follows:

      » [ s v , w ] = sigma(sys,w,type) <enter>

where type = 1, 2, or 3 specify that singular values of G"1 (/&>), I + G(iaj), or I +
G~'(/ct>), respectively, are to be calculated. (Of course, sigma requires that G(ito) should
be a square matrix.) Hence, sigma is a versatile command, and can be easily used to
compute singular values of return ratios, or return difference matrices. If you do not have
the Robust Control Toolbox, you can write your own M-file for calculating the singular
value spectrum using the MATLAB functions svd or eig as discussed above.

  Example 7.11

  Re-consider the flexible bomber airplane of Example 7.8, where we designed an
  optimal compensator using an optimal regulator with Q = 0.011, R = I, and a
  Kalman filter with F = B, V = 0.0007BTB, Z = CCT, and V = 0, to recover the
  performance of the full-state feedback regulator. Let us now see how robust such
  a compensator is by studying the return ratio at the plant's input. Recall that the
  return ratio at the plant's input is H(s)G(.s), which is the transfer matrix of a hypo-
  thetical system formed by placing the plant, G(s), in series with the compensator,
  H(.s) (the plant is followed by the compensator). Hence, we can find a state-space
  representation of H(s)G(s) in terms of the state-space model, sysHG, with plant
  model, sysp, and compensator model, sysc, as follows:

  »sysp=ss(A,B J C,D);sysc=ss(A-B*K-L*C+L*D*K,L,-K,zeros(size(K,1)));
   <enter>
  » sysHG = series(sysp,sysc); <enter>
364                                   KALMAN FILTERS


 The singular value spectrum of the return ratio at the plant's input for frequency
 range lO"2-!^ rad/s is calculated as follows:

 »w = logspace(-2,4) ; [sv,w] = sigma(sysHG,w) ; <enter>

 while the singular value spectrum of the return ratio at plant's input of the full-state
 feedback system is calculated in the same frequency range by

 »sysfs=ss(A,B, -K,zeros(size(K,1            ; [sv1,w1] = sigma(sysfs,w) ;
  <enter>

 The two sets of singular values, sv and svl, are compared in Figure 7.13, which is
 plotted using the following command:

      »semilogx(w,20*log10(sv) , ' : ' ,w1 ,20*log10(sv1 ) ) <enter>

     Note that there is a large difference between the smallest singular values of
 the compensated and full-state feedback systems, indicating that the compensated
 system is much less robust than the full-state feedback system. For recovering the
 full-state feedback robustness at the plant's input, we re-design the Kalman filter
 using V = /oBTB, Z = CCT, and 4> = 0, where p is a scaling parameter for the
 process noise spectral density. As p is increased, say, from 10 to 108, the return
 ratio of the compensated plant approaches that of the full-state feedback system
 over a larger range of frequencies, as seen in the singular value plots of Figure 7.14.
 For p = 10, the smallest singular value of the compensated system's return ratio
 becomes equal to that of the full-state feedback system in the frequency range
 1-100 rad/s, while for p = 108 the range of frequencies (or bandwidth) over which

                        50




                   oy-100
                    c
                   CO             Full-state feedback system
                                  Compensated system
                    -150          with V=0.0007BTB


                    -200
                        10-2   10-1    10°     101     102     103   10"
                                        Frequency (rad/s)

 Figure 7.13 Singular values of the return ratio matrix, H(s)G(s), at the plant's input of
 compensated system and full-state feedback system for the flexible bomber
ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY                             365


                         50

                          0

                        -50

                       -100

                       -150

                  .£   -200         Full-state feedback system
                                    Compensated system with V=10BTB
                       -250
                                    Compensated system with V=108BTB
                       -300
                          10,-2                                               10€
                                             Frequency (rad/s)

Figure 7.14 Comparison of singular values of return ratio matrix at the plant's input of full-state
feedback system and compensated system for loop transfer recovery with process noise spectral
density, V = 10BTB and V = 108BTB (flexible bomber)


the loop transfer recovery occurs increases to 10 2-104 rad/s. At frequencies higher
than the loop transfer recovery bandwidth the return ratio is seen to roll-off at more
than 50dB/decade. Such a roll-off would also be present in the singular values of the
closed-loop transfer matrix, which is good for rejection of noise at high frequen-
cies. However, within the loop transfer recovery bandwidth, the roll-off is only
about 20dB/decade. Therefore, the larger the bandwidth for loop transfer recovery,
the smaller would be the range of frequencies over which high noise attenuation is
provided by the compensator. Hence, the loop transfer recovery bandwidth must not
be chosen to be too large; otherwise high frequency noise (usually the measurement
noise) would get unnecessarily amplified by smaller roll-off provided within the
LTR bandwidth.
   Note that the Kalman filter designed in Example 7.8 with V = 0.0007BTB
recovers the performance of the full-state feedback system (with a loss of
robustness), whereas the re-designed Kalman filter with V = 108BTB recovers the
robustness of the full-state feedback system over a bandwidth of 106 rad/s (with
an expected loss of performance). By choosing a large value of the process noise
spectral density for loop transfer recovery, a pair of Kalman filter poles comes very
close to the imaginary axis and becomes the dominant pole configuration, thereby
playing havoc with the performance. Hence, there is a contradiction in recovering
both performance and robustness with the same Kalman filter, and a compromise
must be made between the two.
   It is interesting to note that Example 7.11 has a non-minimum phase plant, with
a plant zero at s = 2.5034 x 10~7. The loop transfer recovery is not guaranteed for
non-minimum phase plants, because it is pointed out above that H(s)G(s) converges
to —K(sl — A)~*B in the limit of infinite process noise spectral density, provided
366                                   KALMAN FILTERS


  that the plant is square and minimum phase. The reason why LQG/LTR compen-
  sators generally cannot be designed for non-minimum phase plants is that perfect
  loop transfer recovery requires placing some poles of the Kalman filter at the zeros
  of the plant [4]. If the plant is non-minimum phase, it implies that the Kalman
  filter for perfect loop transfer recovery should be unstable. However, if the right-
  half plane zeros of a non-minimum phase plant are very close to the imaginary
  axis (as in Example 7.11), the frequency associated with it lies outside the selected
  bandwidth for loop transfer recovery, and hence loop transfer recovery in a given
  bandwidth is still possible, as seen above.


  Example 7.12
  Let us design an optimal LQG/LTR compensator for the flexible, rotating spacecraft
  of Example 6.2. The spacecraft consists of a rigid hub and four flexible appendages,
  each having a tip mass, with three torque inputs in N-m, u(t), «2(0, "3(0, and
  three angular rotation outputs in rad., y(t), y2(t), yi(t). A linear, time-invariant
  state-space representation of the 26th order spacecraft was given in Example 6.2,
  where it was observed that the spacecraft is unstable and uncontrollable. The natural
  frequencies of the spacecraft, including structural vibration frequencies, range from
  0-47 588 rad/s. The uncontrollable modes are the structural vibration modes, while
  the unstable mode is the rigid-body rotation with zero natural frequency. Hence, the
  spacecraft is stabilizable and an optimal regulator with Q = 2001, and R = I was
  designed in Example 6.2 to stabilize the spacecraft, with a settling time of 5 s, with
  zero maximum overshoots, while requiring input torques not exceeding 0.1 N-m,
  when the spacecraft is initially perturbed by a hub rotation of 0.01 rad. (i.e. the
  initial condition is x(0) = [0.01; zeros(l, 25)]r).
     We would like to combine the optimal regulator already designed in Example 6.2
  with a Kalman filter that recovers the return ratio at the plant's input in the frequency
  range 0-50000 rad/s (approximately the bandwidth of the plant). To do so, we
  select F = B, Z = CCT, W = 0, and V = pBTB, where p is a scaling parameter.
  By comparing the singular values of H(s)G(.s) with those of —K(.sl — A) -1 B, for
  various values of p, we find that loop transfer recovery occurs in the desired band-
  width for p = 1022, for which the Kalman filter gain, covariance, and eigenvalues
  are obtained as follows (only eigenvalues are shown below):

        »[L,P,E] = lqe(A,B,C,1e12*B > *B,C*C') <enter>
        E =
        -1.09776+008+       1.0977e+008i
        -1.09776+008-      1.09776+0081
        -1.09776+008+      1.0977e+008i
        -1.09776+008-      1.09776+0081
        -8.60426+004+      8.60746+0041
        -8.60426+004-      867604
                            .04+01
        -4.60326+000+      4.58766+0041
        -4.60326+000-      4.58766+0041
ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY                                      367


       -8.7040e-001+ 2.31936+0041
       -8.70406-001- 2.31936+0041
       -3.40736-001+ 1.00776+0041
       -3.40736-001- 1.00776+0041
       -3.57586-002+ 3.71216+0031
       -3.57586-002- 3.71216+0031
       -1.09756-002+ 4.03866+0021
       -1.09756 -002 - 4.03866+0021
       -1.27676-004+ 4.58756+0041
       -1.27676 -004- 4.58756+0041
       -9.38676-005+ 3.71216+0031
       -9.38676-005- 3.71216+0031
       -7.41726-005+ 1.00776+0041
       - 7.41726 - 005 - 1.00776+0041
       -5.89666-005+ 2.31936+0041
       -5.89666-005- 2.3193e+004i
       -3.85646-005+ 4.03856+0021
       -3.85646-005- 4.03856+0021

Note that the Kalman filter is stable, bmt has some eigenvalues very close to the
imaginary axis, which is likely to degrade the performance of the closed-loop system.
The singular values of the return ratio at the plant's input, for the compensated
system are calculated as follows, with K obtained in Example 6.2:

»sysp=ss(A,B,C,D);sysc=ss(A-B*K-L*C+L*D*K,L,-K,zeros(size(K,1)));
 <enter>

» sysHG = series(sysp,sysc); <enter>

»w = logspace(-2,6); [sv,w] = sigma(sysHG,w); <enter>

The singular values of the full-state feedback return ratio at the plant's input are
obtained as follows:

» s y s f s = s s ( A , B , - K , z e r o s ( s i z e ( K , 1 ) ) ) ; [sv1,w1] = sigma(sysfs,w); <enter>

The two sets of singular values (full-state feedback and compensated system) are
compared in Figure 7.15. Note that the smallest singular value of the return ratio
is recovered in the range 0-50000 rad/s, as desired, while the other two singular
values are recovered in a larger frequency range. The plant has some zeros very close
to the imaginary axis (largest real part is 3.3 x 10~8) in the right-half plane, hence,
the plant is non-minimum phase and perfect loop transfer recovery is not guaran-
teed. Also, due to this nature of the plant, the function Iqe may yield inaccurate
results.
   Owing to the presence of some Kalman filter poles very close to the imagi-
nary axis, the closed-loop system would have unacceptable performance. Hence, for
improving the closed-loop performance, the loop transfer recovery bandwidth must
be reduced. A good compromise between performance and robustness is achieved by
choosing p = 106. Figure 7.16 shows the spectrum of the smallest singular value of
368                                       KALMAN FILTERS


                             100             i       '     I    '     I     '
                                              Full-state feedback control system
                                             Compensated system
                              50             with V=1022BTB




                             -50
                     CO

                          -100


                          -150
                              10 -2      10°           102          104         106
                                                Frequency (rad/s)

 Figure 7.15 Singular values of the return ratio matrix at the plant's input of the full-state
 feedback system compared with those of the compensated plant with V = 1022BTB for the
 flexible, rotating spacecraft



                                                                           Full-state
                                                                           feedback
                                                                            system
                       -50


                     -100


                     -150                                Compensated
                                                         system with
                                                          V=106BTB
                     -200


                     -250


                      -300 2
                          10-          10°             102           104              106
                                               Frequency (rad/s)

 Figure 7.16 Smallest singular value of H(s)G(s) of the optimal (LOG) compensated system
 with V = 106BTB for the flexible rotating spacecraft, compared with that of the full-state feedback
 system showing loop-transfer recovery in the frequency range 5-500 rad/s


 H(s)G(.s) which indicates a loop transfer recovery bandwidth of 50-500 rad/s. The
 performance of the closed-loop system is determined using a SIMULINK simulation
 of the initial response with x(0) = [0.01; zeros(1, 25)]r) and measurement noise
 in the hub-rotation angle, y (r), as shown in Figure 7.17. A closed-loop settling time
ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY                          369


                                                                Tip               Tip
                                              Hub rotation      rotation          rotation
                                        1   l angle             angle             angle


                             LQG
                          compensator
                               1
                          _n       1'        '
                                                 r     '         Flexible
                                                                spacecraft




                                                                             Band-Limited
                                                                              white noise




                  X10-3



             10

              5

              0

             -5
                                                           3
                                                     Time (s)

Figure 7.17 Simulated initial response of the LQG compensated flexible rotating spacecraft's
hub-rotation angle, y (f), with measurement noise, A/] (f), in the hub-rotation channel


of five seconds, with maximum overshoots less than 1% and a steady-state error
of 0.002 rad, is observed when the measurement error in y(t} is ±3.5 x 10~5 rad.
Comparing with the full-state feedback response with zero noise seen in Figure 6.5,
the performance is fairly robust with respect to measurement noise.
370                                       KALMAN FILTERS


Exercises
 7.1 Repeat Example 7.1 using the MATLAB's random number generator, rand, which is a
     random process with uniform probability distribution [1]. What significant differences, if
     any, do you observe from the normally distributed random process illustrated in Exam-
     ple 7.1?

 7.2. The following deterministic signal, sin(2r), corrupted by a uniformly distributed random
      noise is input to a low-pass filter whose transfer function is given by Eq. (7.15):

                                      u(t) = sin(2/) + Q.5*rand(t)                             (7.88)

      where rand is the MATLAB's uniformly distributed random number generator (see Exer-
      cise 7.1). Determine the filter's cut-off frequency, a>0, such that the noise is attenuated
      without too much distortion of the output, y ( t ) , compared to the noise-free signal, sin(2r).
      Generate the input signal, u(t), from t = 0 to t = 10 seconds, using a time step size
      of 0.01 second, and simulate the filtered output signal, y(r). Draw a Bode plot of the
      filter.


 7.3. Simulate the output to the following noisy signal input to the elliptic filter described in
      Example 7.3:

                              u(t) = sin(lOr) + sin(lOOr) + 0.5*rand(t)                        (7.89)

      How does the filtered signal compare with the desired deterministic signal, sin(lOr) +
      sin(lOOf)? What possible changes are required in the filter's Bode plot such that the
      signal distortion and noise attenuation are both improved?

7.4. For a linear system with a state-space representation given by Eqs. (7.40) and (7.41),
     and the process white noise, (t), as the only input (i.e. u(f) = z(r) = 0), derive the
     differential equation to be satisfied by the covariance matrix of the output, R y (f, /). (Hint:
     use steps similar to those employed in deriving Eq. (7.64) for the covariance matrix of
     the estimation error R<.(r, 0-)

7.5. An interesting non-stationary random process is the Wiener process, w,-(/), defined as the
     time integral of the white noise, w(t), such that

                                             w,- (1) (f) = w(r)                                (7.90)

      Consider the Wiener process as the output, y(f) = w,(/), of a linear system, into which
      white noise, w(0, is input. Using the covariance equation derived in Exercise 7.4, show
      that the covariance matrix of the Wiener process, Rwi(0> grows linearly with time.

7.6. Design a Kalman filter for the distillation column whose state-space representation is given
     in Exercises 5.4 and 5.15, using F = B, Z = CCT, * = 0, and V = 0.01BTB. Where are
     the poles of the Kalman filter in the s-plane?
REFERENCES                                          371


 7.7. Design a Kalman filter for the aircraft lateral dynamics given by Eq. (4.97) in Exercise 4.3
      using F = I, Z = CCT, * = 0, and V = 0.001 FTF. Where are the poles of the Kalman
      filter in the 5-plane?


 7.8. Design a Kalman filter for the turbo-generator of Example 3.14, using F = B, Z = CC1,
      * = 0, and V = 0.0001 BTB. Where are the poles of the Kalman filter in the s-plane?


 7.9. Design a linear Kalman filter to estimate the nonlinear state of wing-rock model described
      in Example 4.13, and programmed in the M-file wrock.m which is listed in Table 4.8. Plot
      the elements of the estimation error vector as functions of time, if the initial condition is
      x(0) = [0.2; 0; 0; 0; 0]r. Which state variables have the largest estimation error, and what
      are the magnitudes of the largest estimation errors?


7.10. Re-design a Kalman filter for the distillation column (Exercise 7.6), such that the LQG
      optimal compensator formed by including the optimal regulator deigned in Exercise 6.2
      has loop-transfer recovery at the plant's input in the frequency range 0.01-10 rad/s. What
      are the largest control input magnitudes required for the resulting LQG/LTR compensator
      if the initial condition is x(0) = [1; 0; 0; 0] r ?


7.11. Re-design a Kalman filter for the aircraft lateral dynamics (Exercise 7.7), such that
      the LQG optimal compensator formed by including the optimal regulator deigned in
      Exercise 6.3 has loop-transfer recovery at the plant's input in the frequency range
      0.1-100 rad/s. What are the largest control input magnitudes required for the resulting
      LQG/LTR compensator if the initial condition is x(0) = [0.5; 0; 0; 0]r? Repeat the
      simulation of the closed-loop initial response using a measurement noise of ±0.01 rad/s
      in the roll-rate, p(t), channel.


7.12. Re-design a Kalman filter for the turbo-generator (Exercise 7.8), such that the LQG optimal
      compensator formed by including the optimal regulator designed in Exercise 6.5 has loop-
      transfer recovery at the plant's input in the frequency range 0-10 rad/s. What are the
      largest control input magnitudes required for the resulting LQG/LTR compensator if the
      initial condition is x(0) = [0.1; 0; 0; 0; 0; 0]r?



References
1. Papoulis, A. Probability, Random Variables and Stochastic Processes. McGraw-Hill, New York,
   1984.
2. Parks, T.W. and Burrus, C.S. Digital Filter Design. Wiley, New York, 1987.
3. Robust Control Toolbox for use with MATLAB, User's Guide. Math Works, Inc., Natick, MA,
   2000.
4. Maciejowski, J.M. Multivariable Feedback Design. Addison-Wesley, New York, 1989.
This page intentionally left blank
8

So far, we have confined our attention to continuous time (or analog) systems, i.e. systems
whose inputs and outputs are continuous functions of time. However, we often have to
deal with systems whose output signals are discontinuous in time. Such systems are
called discrete time (or digital) systems. Where are digital systems encountered? Any
continuous time signal that is processed (or sampled) by either a human being, or by
a machine - mechanical or electrical - becomes a digital signal by the very process of
sampling, because a human being or a machine takes some non-zero time, albeit small,
to evaluate or record the value of the signal at any given time. Over this non-zero time
interval, the current value of the signal is held and analyzed, before the value of the signal
at the next time interval is processed. Hence, by sampling a continuous time signal, we
essentially convert it into a digital signal, and the sampling process is a digital system.
Another type of digital system is the one which produces discontinuous outputs due to
the intrinsic nature of its mechanism. Watches and clocks of any type, tick and tock in
a discontinuous manner (i.e. the needle or electronic display moves in jerks rather than
in a perfectly smooth manner) while trying to simulate a continuous passage of time.
The jerks or discontinuities in the motion of a time-piece can be minimized by choosing
an appropriate mechanism. However, the time interval between two successive ticks,
no matter how small, is non-zero for an atomic clock as well as for a grandfather clock.
Hence, we have to deal with inherently digital systems, as well as digital systems obtained
by sampling continuous time signals. However, if the sampling interval of the output of
a continuous system, or the discontinuity in time of the output of an inherently digital
system, is small in comparison to the time constants (i.e. inverse of natural frequencies)
of the system, then such a signal, even though digital by nature, can be approximated
to be a continuous signal, and we can apply all the methods developed in the previous
chapters to study and design a control system that produces such an output. Interestingly,
the solution of the state-equations for an analog system requires its approximation by a
corresponding digital system, as we saw in Chapter 4!
   Most mechanical and electrical control systems before the advent of the digital
computer had previously been approximated as continuous time (or analog) systems.
Nowadays, control systems are invariably based on the digital computer, which is an
inherently digital system, because it receives and produces electrical impulses, rather
than continuous electrical signals, on which binary arithmetic is based. There are several
advantages in having a digital computer as a part of the control system (usually the
374                                DIGITAL CONTROL SYSTEMS


 feedback controller), namely the ease and versatility of implementing complex control
 laws merely by programming the computer, relative insensitivity to noise, and low cost.
 Hence, modern control systems employ digital computers in almost all applications,
 such as automobiles, pacemakers for heart, aircraft and spacecraft, electronic appliances,
personal computers, robotic manipulators, chemical and nuclear reactors and industrial
processes. Such applications are usually approximated as an analog plant controlled
by a digital computer. However, by having a digital computer in the control system
for controlling an analog plant, we introduce an additional characteristic to the control
system - the sampling rate, i.e. the inverse of the non-zero time interval required by the
digital computer to process the analog output at each instant of time. The sampling rate
can drastically modify the behavior of a control system - such as stability, performance,
and robustness - when compared to an analog control system. In this chapter, we
study how to take into account the sampling rate of digital control systems while
studying stability, performance, and robustness, and how such control systems can be
designed.
    A system into which a continuous time signal is input and from which a digital signal
is output (perhaps due to processing by a digital computer) is called an analog-to-digital
converter (or A/D converter). A system which converts digital inputs to analog outputs is
called a digital-to-analog (or D/A) converter. Since a digital computer processes only
digital input signals and produces digital outputs, while using a digital computer in
a feedback control system for controlling an analog plant, we must have both A/D
and D/A converters, as shown in Figure 8.1. However, whereas D/A conversion is a
simple and continuous time process (where the analog output is a weighted sum of a
set of input impulses), the A/D conversion is a digital process consisting of sampling
and holding the analog input (as pointed out above), and producing an impulse as the
output.
    We discussed in Chapter 4 how a good approximation of an analog system by a digital
system can be obtained if the discrete time step used to solve the digitized state-equations
is appropriately small. Conversely, the sampling rate at which an analog signal is sampled
is crucial for the successful implementation of a digital control system. The sampling
rate must not be smaller than the bandwidth (i.e. the range of frequencies in the power
spectrum) of the analog signal, otherwise a distorted digital output will be produced.
Thus, we may regard the A/D converter as a low-pass filter (see Example 7.2) with
sampling rate as the cut-off frequency. To reduce signal distortion, the cut-off frequency
(sampling rate) should be appreciably larger than the bandwidth of the signal we wish to
pass through the filter. Generally, the sampling rate should be at least twice the bandwidth


             yd(0                                                          yw
                    >*
                    I
                            A/D
                         converter
                                        Digital         D/A         Analog
                                   "*• controller "*" converter "*" plant •*-




Figure 8.1   A block diagram of a negative feedback control system with an analog plant and a digital
controller
A/D CONVERSION AND THE Z-TRANSFORM                                375


(in Hertz) of the analog signal. This minimum value of the sampling rate is known as the
Nyquist sampling rate.
   It is clear from the above discussion that a successful implementation of a digital control
system requires a mathematical model for the A/D converter. Since A/D converter is based
on two distinct processes - sampling and holding - such a model must include separate
models for both of these processes. As with continuous time systems, we can obtain
the mathematical model for A/D converter in either frequency domain (using transform
methods and transfer function), or in the time domain (using a state-space representation).
We begin with the frequency domain modeling and analysis of single-input, single-output
digital systems.


8.2 A/D Conversion and the z-Transform
The simplest model for the sampling process of the A/D converter is a switch which
repeatedly closes for a very short duration, tw, after every T seconds, where l/T is the
sampling rate of the analog input, /(?)• The output of such a switch would consist of
series of pulses separated by T seconds. The width of each pulse is the duration, tw, for
which the switch remains closed. If tw is very small in comparison to 7, we can assume
that f ( t ) remains constant during each pulse (i.e. the pulses are rectangular). Thus, the
height of the &th pulse is the value of the analog input f ( t ) at t = kT, i.e. f ( k T ) . If
tw is very small, the fcth pulse can be approximated by a unit impulse, 8(t — kT), scaled
by the area f(kT}tw. Thus, we can use Eq. (2.35) for approximating /(/) by a series of
impulses (as shown in Figure 2.16) with T — kT and AT = tw, and write the following
expression for the sampled signal, ftw*(t)'-


                                                                                         (8-0
Equation (8.1) denotes the fact that the sampled signal, ftw*(t), is obtained by sampling
f ( t ) at the sampling rate, l/T, with pulses of duration tw. The ideal sampler is regarded
as the sampler which produces a series of impulses, /*(/), weighted by the input value,
f ( k T ) as follows:

                                                                                         (8.2)
                                         k=0

Clearly, the ideal sampler output, f * ( t ) , does not depend upon tw, which is regarded as
a characteristic of the real sampler described by Eq. (8.1). The ideal sampler is thus a
real sampler with tw = 1 second.
   Since the sampling process gives a non-zero value of /*(?) only for the duration
for which the switch remains closed, there are repeated gaps in f * ( t ) of approxi-
mately T seconds, in which /*(?) is zero. The holding process is an interpolation
of the sampled input, /*(?), in each time interval, T, so that the gaps are filled. The
simplest holding process is the zero-order hold (z.o.h.), which holds the input constant
over each time interval, T (i.e. applies a zero-order interpolation to /*(?))• As a result,
376                                DIGITAL CONTROL SYSTEMS


                                 Ideal
                                sampler
                        f(t)                       Zero-order     WO
                                                      hold




Figure 8.2 Schematic diagram and input, sampled, and output signals of an analog-to-digital (A/D)
converter with an ideal sampler and a zero-order hold


the held input, //,(?), has a staircase time plot. A block diagram of the ideal sampling and
holding processes with a zero-order hold, and their input and output signals, are shown
in Figure 8.2.
   Since the input to the z.o.h. is a series of impulses, /*(/), while the output, //,(f), is
a series of steps with amplitude f(kT), it follows that the impulse response, h(t), of the
z.o.h. must be a step that starts at / = 0 and ends at t = T, and is represented as follows:

                                       = us(t) - us(t - T)                                (8.3)

or, taking the Laplace transform of Eq. (8.2), the transfer function of the z.o.h. is given by

                                            -.(l-Q-Ts)/s                                  (8.4)

Note that we have used a special property of the Laplace transform in Eq. (8.3) called the
time-shift property, which is denoted by £[y(t — T)] = e~Ts£[y(t)]. Similarly, taking the
Laplace transform of Eq. (8.2), we can write the Laplace transform of the ideally sampled
signal, F*(s), as follows:
                                             00

                                            ~~           'm                              (8.5)
                                            k=0


   If we define a variable z such that z = e , we can write Eq. (8.5) as follows:


                                                                                           (8.6)
                                             *=0


In Eq. (8.6), F(z) is called the z-transform of f ( k T ) , and is denoted by z{f(kT)}.
The z-transform is more useful in studying digital systems than the Laplace transform,
because the former incorporates the sampling interval, T, which is a characteristic of
digital systems. The expressions for digital transfer functions in terms of the z-transform
are easier to manipulate, as they are free from the time-shift factor, e~Ts, of the Laplace
transform. In a manner similar to the Laplace transform, we can derive z-transforms of
some frequently encountered functions.
A/D CONVERSION AND THE Z-TRANSFORM                                     377


   Example 8.1
   Let us derive the z-transform of f ( k T ) = u s ( k T ) , the unit step function. Using the
   definition of the z-transform, Eq. (8.6), we can write




                               z~)                                                       (8.7)

   or

                                        F(z) = z / ( z ~ l )                             (8.8)

   Thus, the z-transform of the unit step function, us(kT), is z/(z — 1). (Note that
   we have used the binomial series expansion in Eq. (8.7), given by (1 — Jt)~' =
   1 +x + x2 +x3 + ...).

   Example 8.2

   Let us derive the z-transform of the function f ( k T ) = &~akT , where t > 0. Using
   the definition of the z-transform, Eq. (8.6), we can write
                   00                 00

         F(z) =          e-fl*V* -           (zeorr* - 1 + (ze"1)"1 + (ze« r r 2 + • - •
                   k=0                k=()

                 = 1/[1 - (ze^r ] - z/(z - ze-"r)
                                  1
                                                                                         (8.9)

   Thus, zje-^"7"} = z/(z - ze- ar ).

   The z-transforms of other commonly used functions can be similarly obtained by
manipulating series expressions involving z, and are listed in Table 8.1.
   Some important properties of the z-transform are listed below, and may be verified by
using the definition of the z-transform (Eq. (8.6)):
(a) Linearity:
                                      z{af(kT)}=az[f(kT)}                                  (8.10)
                          z{fi(kT) + /2(*r)} = z{/, (*r)J + z{f2(kT}}                      (8.1 1)
(b) Scaling in the z -plane:
                                      z{Q~akrf(kT)} = F(earz)                              (8.12)
(c) Translation in time:
                                z{f(kT + T)} = zF(z) - z/((T)                              (8. 13)
where /(0~) is the initial value of f ( k T ) for k — 0. Note that if f ( k T ) has a jump at
k = 0 (such as f ( k T ) = us(kT)), then /(0~) is understood to be the value of f ( k T )
378                                  DIGITAL CONTROL SYSTEMS


                        Table 8. 1 Some commonly encountered z-transforms
Discrete Time            z-transform, F(z)                                   Laplace Transform of
Function, f ( k T )                                                          Equivalent Analog
                                                                             Function, F(s)
us(kT)                   z/(z - 1)                                           1/5
kT                       rz/(c-l)2                                           I/* 2
e-akT                    z/(z-e-"T)                                          /(s+a)
1 - Q-   akT
                         z(-e-aT)/((z-)(z-e-aT)}                           a/[s(s+a)]
kTe~akT                  Tze-aT/(z-e-"T)2                                    /(s+a)2
kT -(1 -e~akT)/a         Tz/(z -)2-z(- e~aT)/[a(z - l)(z - e~aT)]          a/[s2(s + a)]
sin(akT)                 zsin(aT)/[z2 -2zcos(aT) + 1]                        a/(s2 +a2)
cos(akT)                 z[z - cos(aT)]/[z2 - 2zcos(aT) + 1]                 s/(s2+a2)
e-akT s i n (££7")       ze~aT sin(bT)/[z2 — 2ze~aT cos(bT) — z~2aT]         b/((s+a)2+b2}
e~akT cos(bkT)           [z2 - ze-"T cos(bT)]/[z2 - 2ze~aT cos(bT) - e'^7]   (s + a)/((s+a)2+b2]
(kT)"                    lima^0(-)nd''/da"[z/(z - e-"7")]                   rt!/5" + '



before the jump. Thus, for f ( k T ) = us(kT), /(O ) =0. A negative translation in time
is given by z { f ( k T - T)} = z~l F(z) + z/(0~).
(d) Differentiation with z:
                           z{kTf(kT)}        = -TzdF(z)/dz    =-                             (8.14)
(e) Initial value theorem:
                                                                                             (8.15)

Equation (8.15) holds if and only if the said limit exists. Note that if f ( k T ) has a jump
atk = 0 (such as f ( k T ) = us(kT) then /(0 + ) is understood to be the value of f ( k T )
after the jump. Thus, for f ( k T ) = us(kT), /(0+) = 1.
(f) Final value theorem:
                                                                                             (8.16)
Equation (8.16) holds if and only if the said limit exists. Using Table 8.1, and the prop-
erties of the z-transform, we can evaluate z-transforms of rather complicated functions.

     Example 8.3
     Let us find the z-transform of f ( k T ) = te~akT sin(bkT - 2T). From Table 8.1,
     we know that

                        z{sin(Mr)} = zsin(6r)/[z 2 - 2zcos(fer) -I- 1]                    (8.17)

     Then, using the linearity property of the z-transform given by Eq. (8.10), we can
     write

                      z{10sin(Mr)} =                                                      (8.18)
_        PULSE TRANSFER FUNCTIONS OF SINGLE-INPUT, SINGLE-OUTPUT SYSTEMS                   379


   Furthermore, the scaling in the z-plane given by Eq. (8.12) yields

          z{Qe"~akT sin(bkT)} = ]QzeaT sm(bT)/[z2e2aT - 2zeaT cos(bT) + 1] (8.19)

   Finally, the translation in time given by Eq. (8.13) yields (noting that 10e°
   sin(O) = 0)
             akT
                   sin(bkT - 2T)} = Oz~leaT sin(bT)/[z2e2aT - 2z.eaT cos(bT) + 1 ]
                                                                                         (8.20)


8.3 Pulse Transfer Functions of Single-Input/
    Single-Output Systems
In a manner similar to the transfer function in Laplace domain for a single-input,
single-output analog system, we can define a pulse transfer function for a single-input,
single-output digital system in the z-domain as the z-transform of the output signal
divided by the z-transform of the input signal. Finding the pulse transfer functions of
digital systems in the z-domain is a useful application of the z-transform. However, before
finding the pulse transfer function of a digital system, we must distinguish between an
inherently digital system, and an analog system rendered digital due to the process of data
sampling, as shown in Figure 8.3. It is clear from Figure 8.3 that while an inherently
digital system would always produce a discrete time output, an analog system would
produce a continuous time output, even though the input is a digitally sampled signal
(recall the continuous time outputs to impulse inputs of analog systems calculated in
Chapters 2 and 4).
   Finding an inherently digital system's pulse transfer function is straightforward,
because both input and output are discrete time signals with the same interval, T. On
the other hand, taking the z-transform of the transfer function, G(s), of a sampled-data
analog system - in which the input is discrete with a sampling interval, T, while the
output is a continuous time signal - is quite problematic. However, if we assume that
we are only interested in finding the output of a sampled-data analog system at the same

                                    U(z)


                                             Digital system

                                                        Y(t)           no
                                                           Imaginary
                                           Analog system    sampler
                                            with sampled
                                                input

Figure 8.3 Block diagrams of an inherently digital system and a sampled-data analog system rendered
digital by an imaginary sampler at the output
380                             DIGITAL CONTROL SYSTEMS


discrete time points at which the input is sampled, the difficulty in finding the transfer
function in the z-domain can be removed. By making such an assumption, we would be
disregarding the continuous nature of the output of a sampled-data analog system, and
treat the system as if it's output is sampled by an imaginary sampler. By having such
an imaginary sampler at the output, the sampled-data analog system effectively becomes
an inherently digital system. The ideally sampled input of an analog system is given by
Eq. (8.2) as follows:

                              u*(0 =             u(nT)8(t -nT)                        (8.21)
                                          n=0

The continuous time output, y(t), is given by the discretized convolution integral of
Eq. (2. 11 9) as follows:

                                                                   nT)                (8.22)
                                          n=0

where g(t — nT) is the impulse response of the analog system to a unit impulse applied at
time t = nT. The digitized output, v*(0, resulting from sampling of y(t ) by an imaginary
sampler shown in Figure 8.3, with the same sampling interval, T, as that of the input,
w*(r), can be written as follows:
                                                 00

                        /"(;) = y(kT) = Y^u(nT)g(kT-nT)                               (8.23)
                                                 n=Q


Then, the z-transform of the (imaginary) sampled output, y*(f ) = y(kT), can be written as
                                            00     00

                   Y(z) = z{y(kT)} = Y,Y,»("T)g(kT                       ~ nT)z'k   (8 24)
                                                                                       '
                                           k=0 n=0

or, expressing the double summation as a product of two summations,
                               oc                                 oc
                      K( Z ) = £ g(kT - nT)z~k+n ^ u(nT)z~n                           (8.25)
                              k=0                                 n=0

Since g(kT — nT) = 0 for fc < n, we can begin the first summation in Eq. (8.25) at k = n
instead of k = 0, and defining m = k — n, we can write
                                    oc                      oc
                          Y(z) = ^g(mT)z- ^u(nT)z-n     m
                                                                                      (8.26)
                                    m=0                     n=0

or, recognizing the second summation of Eq. (8.26) as the z-transform of the input,


                                                                                      (8.27)
_           PULSE TRANSFER FUNCTIONS OF SINGLE-INPUT, SINGLE-OUTPUT SYSTEMS             38 1


Comparing Eq. (8.27) with the definition of the pulse transfer function, G(z) — Y(z)/U(z),
we can write the pulse transfer function of a sampled-data analog system as follows:

                                                                                     (8.28)


Equation (8.28) indicates that the pulse transfer function of a sampled-data analog system
is the z-transform of the digitized impulse response, g(mT}. This is an important result,
which shows that although the output, y ( t ) , of a sampled-data analog system is conti-
nuous in time, by having an imaginary sampler at the output (Figure 8.3), the analog
system essentially becomes a digital system with the pulse transfer function, G(z). Since
the impulse response, g(t), of the analog system is the inverse Laplace transform of its
transfer function, G(s), we can directly obtain G(z) from G(s) by using Table 8.1, and
denote G(z) by the convenient notation, G(z) = z{G(s)}.


    Example 8.4
    Let us find the pulse transfer function of the z.o.h. The transfer function of z.o.h
    is given by Eq. (8.4) as G(s) = (1 — Q~TS)/S. We can express G(s) as G(s) =
    l/s — Q~TS/S, and write

                                G(z) = z {  / s ] - z{&"Ts/s]                    (8.29)

    From Table 8.1, we note that

                                    z{l/5} = z / ( z - l )                         (8.30)

    Furthermore, note that o~Ts/s is the Laplace transform of us(t — T). Therefore,
    using the time-shift property of the z-transform given by Eq. (8.13), we can write

               z{e~"A} = z{us(kT - T)} = z- • z{us(kT)} = l/(z - 1)                (8.31)

    Substituting Eqs. (8.30) and (8.31) into Eq. (8.29), we can write the pulse-transfer
    function of the z.o.h as follows:

                  G(z) = z/(z - 1) ~ l/(z - 0 - (z - l)/(z - 1) = 1                   (8.32)
    Thus, the pulse transfer function of the z.o.h is unity.

    Example 8.5
    Let us find the pulse transfer function of a sampled-data analog system obtained by
    placing the z.o.h in series with an analog system with transfer function G(s) =
    s/(s2 + 1). The overall transfer function of the resulting sampled-data analog system
    is written as

                    G(s) = Gl(s)(] -e-Ts)/s = ( - e - 7 ' v ) / ( J 2 + D        (8-33)
382                                 DIGITAL CONTROL SYSTEMS


   For finding the pulse transfer function, G(z), we first express G(s) as follows:

                              G(s) = /(s2 + 1) - e'Ts/(s2 + 1)                             (8.34)

   Note that l/(s 2 +l) is the Laplace transform of sin(kT). Furthermore, e~Ts/(s2
   is the Laplace transform of sin(kT — T). Hence, using the time-shift property of
   the z-transform and Eq. (8.34), we can write

              G(z) = z{sin(*r)} - z- - z{sin(*r)} = (1 - z ~ ) • z{sin(kT)}                (8.35)

   or, using Table 8.1,

                       G(z) = (1 - z~')z sin(r)/[z 2 - 2zcos(D + 1]
                             = (z - 1) sin(r)/[z 2 - 2zcos(r) + 1]                          (8.36)


   Examples 8.4 and 8.5 indicate that we can obtain the pulse transfer function of a
general sampled-data analog system consisting of the z.o.h in series with a system
with proper transfer function, GI(S), by expressing the overall transfer function as
G(s) = (1 — e ~ T s ) [ G i ( s ) / s ] . Then, using the time-shift property of the z-transform, and
noting that s  ( t ) = L~}[G(s}/s] is the step response of the system, G(s), with s(0~) =
0, we can write the pulse transfer function, G(z), as follows:

                   G(z) - (1 - z" 1 ) • z{G,(s)/s} - (1 - z'1) • 2{5,(*r)}                           (8.37)

   In Chapter 2, we learnt how to calculate the step response, s(t), of a proper transfer
function, GI (5), using the partial fraction expansion of G(s)/s, either by hand, or by the
M-file stepresp.m. Note that in the M-file stepresp.m, the step response, s (t), is essentially
computed at discrete time points, with time interval, dt = T. Hence, stepresp.m gives us
the digitized step response, s (kT), which can be thought of as the result of sampling s (t)
by an imaginary sampler (Figure 8.3) with a specified sampling interval, T. If only we
can compute the z-transform of a discrete time signal, s(kT), by an appropriate M-file,
we will have all the necessary tools to compute the pulse transfer function of a general
sampled-data system. For the moment, let us confine ourselves to hand calculation of the
pulse transfer function.

  Example 8.6
  Let us find the pulse transfer function of the sampled-data analog system consisting
  of an A/D converter with z.o.h in closed-loop with an analog plant of transfer
  function, GI(S), as shown in Figure 8.4(a), if GI(S) = (s + l)/[(s + 2)(s + 3)].
     To find the pulse transfer function of the closed-loop sampled-data analog system,
  G(z) = Y(z)/Yd(z), we have to express the block diagram of the system in such
  a way that both y(t) and ya(t) are digital signals. This is done in Figure 8.4(b)
  by moving the sampler at the input of z.o.h to outside the feedback loop before
PULSE TRANSFER FUNCTIONS OF SINGLE-INPUT, SINGLE-OUTPUT SYSTEMS                   383


                 (a)
                 Xd(0                                                  .TW

                         "V-^              l-   p-TSyo
                                                             GI(S)
                         f  Ideal
                           sampler


                                                  z.o.h        Plant
                                                                        yv>    /(f)
                                                     Ts
                                                 (1 e' )/s     GI(S)
                         Ideal                                          i «
                                                                        Imaginary
                       sampler                                           sampler


Figure 8.4 Two equivalent block diagrams of closed-loop sampled-data analog system with
zero-order hold and analog plant, GI (s)


the summing junction, as well as placing an imaginary sampler in the feedback
loop. In doing so, we are not changing the essential characteristic of the closed-loop
system. Hence, the block-diagrams shown in Figures 8.4(a) and (b) are equivalent.
The open-loop transfer function of the system is given by
                                                     .-TV
                                 G 0 (.V) = (1 -                                      (8.38)
The pulse transfer function of the closed-loop system is given by
G(z) = Y(z)/ Yd(z). From the block-diagram of Figure 8.4(b) it is clear that e*(t) —
y^(t) — y*(t), or, taking the z-transform, E(z) = Yd(z) — Y(z). Furthermore, the
open-loop pulse transfer function is z{G0(s)} = G 0 (z) = Y(z)/E(z). Therefore,
the closed-loop pulse transfer function is G(z) = Y(z)/Yd(z) = G 0 (z)/[l + G 0 (z)],
where G 0 (z) is the pulse transfer function of the open-loop system. We can calculate
G 0 (z) by finding the z-transform of G 0 (s) by Eq. (8.37) as follows:
                       G 0 (z) = z{G0(s)} = (1 -z                                     (8.39)

where
        z{G,(s)/s} - z{l/(6s) + /[2(s + 2)] - 2/[3(s + 3)]}
                        - z/[6(z - 1)] + z/[2(z - e~ 27 )] - 2z/[3(z - e-37)]         (8.40)
Substituting Eq. (8.40) into Eq. (8.39) and simplifying, we get

                 G 0 (z) = [z(l + 3e"27 - 4e~ 37 ) + e"57 + 3e~3r
                                     -27
                                                                                      (8.41)

Finally, the pulse transfer function of the closed-loop system is obtained as follows:

     = G 0 (z)/[l + G 0 (z)]


        + z(l + 3e"27 - 4e~ 37 ) + e~57 + 3e~3r - 4e~ 2r ]                            (8.42)
384                              DIGITAL CONTROL SYSTEMS


   Examples 8.5 and 8.6 show that finding the pulse transfer functions of sampled-data
analog systems requires converting the system into an equivalent system in which both
output and input appear to be digital signals by appropriate placement of samplers. In
doing so, care must be exercised that the characteristics of the system are unchanged.
It is clear that the pulse transfer function of a general sampled-data analog system
consisting of several analog sub-systems cannot be handled in the same manner as the
transfer function of an analog system. For example, the pulse transfer function, G(z), of a
sampled-data analog system consisting of two analog sub-systems with transfer functions
G(s) and £2(5) m series cannot be written as G(z) = Gi(z)G 2 (z), but only as G(z) =
z{Gi(s)G2(s)}. This is due to the fact that, generally, z{Gi(.s)G2(s)} ^Gi(z)G 2 (z).
However, if we are dealing with a digital system consisting of digital sub-systems, the
pulse transfer Junctions of the sub-systems are handled in precisely the same manner as
the transfer functions of analog sub-systems systems. For example, the pulse transfer
function of a digital system consisting of two digital sub-systems with pulse transfer
functions GI(Z) and G 2 (z) in series is merely G(z) = Gi(z)G 2 (z). All of this shows
us that we must be extremely careful in deriving the pulse transfer functions. It always
helps to write down the input-output relationships (such as in Example 8.6) of the various
sub-systems as separate equations, and then derive the overall input-output relationship
from those equations.


8.4 Frequency Response of Single-Input, Single-Output
    Digital Systems
In a manner similar to an analog system with transfer function, G(s), whose frequency
response is the value of G(s) when 5 = ico, we can define the frequency response of a
digital system with a pulse transfer function, G(z), as the value of G(z) when z = ela)T,
or G(e' wr ). In so doing, we can plot the gain and phase of the frequency response,
G(e'w7), as functions of the frequency, a>, somewhat like the Bode plots of an analog
system. However, the digital Bode plots crucially depend upon the sampling interval,
 T. For instance, the gain, |G(e /a>r )|, would become infinite for some values of a)T. The
frequency response of a digital system is related to the steady-state response to a harmonic
input, provided the system is stable (i.e. its harmonic response at large time exists and is
finite). The sampling rate of a harmonic output is crucial in obtaining the digital system's
frequency response. If a high-frequency signal is sampled at a rate smaller than the signal
frequency, then a large distortion and ambiguity occur in the sampled data. For example,
if we sample two very different harmonic signals, say sin(0.257Tf/r) and sin(1.757r//r),
with the same sampling interval, T, then the two sampled data would be identical. In other
words, we lose information about the higher frequency signal by sampling it at a lower
rate. This important phenomenon of sampled-data analog systems is known as aliasing.
To avoid aliasing, the sampling rate must be at least twice the signal's bandwidth, a)> (i.e.
the largest frequency contained in the signal). The minimum acceptable sampling rate is
called the Nyquist frequency. The Nyquist frequency in rad/s is thus given by half the
required sampling rate, i.e. 2n/T = 2<«b, orn/T = co^, where T is the sampling interval.
Hence, the frequency response of a digital system with a given sampling interval, T, is
usually calculated only for u> < n/T.
FREQUENCY RESPONSE OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS                     385


  MATLAB's Control System Toolbox (CST) provides the command dbode for
computing the frequency response of a digital system, and is used as follows:

     »[mag,phase,w] = dbode(num,den,T) <enter>
where num. and den are the numerator and denominator polynomials of the system's
pulse transfer function, G(z), in decreasing powers of z, T is the sampling interval, mag
and phase are the returned magnitude and phase (degrees), respectively, of the computed
frequency response, G(eia;7), and w is the vector of discrete frequency points (upto the
Nyquist frequency) at which the frequency response is computed. The user can optionally
specify the desired frequency points as the fourth input argument of the command dbode.
When used without the output arguments on the left-hand side, dbode produces the digital
Bode plots on the screen.

  Example 8.7
  Let us find the frequency response of a digital system with pulse transfer function,
  G(z) = z/(z2 + 2), and sampling interval, T = 0.1 second. To get the magnitude
  and phase of the frequency response, we can use the command dbode as follows:
       »num = [1 0];den = [ 1 0 2];dbode(num,den,0.1) <enter>
  The resulting digital Bode magnitude and phase plots are shown in Figure 8.5.
  Note that the Nyquist frequency is n/T = 31.4159 rad/s, indicated as the highest
  frequency in Figure 8.5 at which the frequency response is plotted. At the Nyquist
  frequency, the phase is seen to approach 180°. There is a peak in the gain plot
  at co = 15.7 rad/s at which the gain is 0 dB and the phase is 90°. A gain of 0 dB




                   o

                       -10
                         10'
                                            Frequency (rad/s)

                       180



                       90 -




                                            Frequency (rad/s)

  Figure 8.5 Digital Bode plot of the pulse transfer function, G(z) = z/(z 2 + 2) with a sampling
  interval, 7 = 0.1 second
386                               DIGITAL CONTROL SYSTEMS


   corresponds to G(eiwT) = 1, or eia>T/(e2iwT + 2)| = 1, which is seen in Figure 8.5
   to occur at coT = 1.5708 = n/2. Thus, the value of z at which to 0 dB and the phase
   is 90° is z = e /7r/2 = i, and the corresponding value of G(z) = G(i') = i. Note that
   both Nyquist frequency, u> = n/T, and the frequency, co = n/(2T), at which the
   gain peaks to 0 dB with phase 90°, will be modified if we change the sampling
   interval, T.



8.5 Stability of Single-Input, Single-Output
    Digital Systems
The non-zero sampling interval, T, of digital systems crucially affects their stability. In
Chapter 2, we saw how the location of poles of an analog system (i.e. roots of the denom-
inator polynomial of transfer function, G(s)) determined the system's stability. If none
of the poles lie in the right-half s-plane, then the system is stable. It would be inter-
esting to find out what is the appropriate location of a digital system's poles - defined
as the roots of the denominator polynomial of the pulse transfer function, G(z) - for
stability. Let us consider a mapping (or transformation) of the Laplace domain on
to the z-plane. Such a mapping is defined by the transformation, z = ers. The region
of instability, namely the right-half s-plane, can be denoted by expressing s = a + ia),
where a > 0. The corresponding region in the z-plane can be obtained by z = e(a+lw)T =
eaTela}T = eaT[cos(a>T) + / sin(&>r)], where a > 0. Note that a line with a = constant
in the s-plane corresponds to a circle z = eaT[cos(a)T) + i sin(o>r)] in the z-plane of
radius eaT centered at z = 0. Thus, a line with or = constant in the right-half s-plane
(a > 0) corresponds to a circle in the z-plane of radius larger than unity (eaT > 1). In
other words, the right-half s-plane corresponds to the region outside a unit circle centered
at the origin in the z-plane. Therefore, stability of a digital system with pulse transfer
function, G(z), is determined by the location of the poles of G(z) with respect to the
unit circle in the z-plane. If any pole of G(z) is located outside the unit circle, then the
system is unstable. If all the poles of G(z) lie inside the unit circle, then the system is
asymptotically stable. If some poles lie on the unit circle, then the system is stable, but not
asymptotically stable. If poles on the unit circle are repeated, then the system is unstable.


  Example 8.8
  Let us analyze the stability of a digital system with pulse transfer function, G(z) =
  z/[(z — e~ r )(z 2 + 1)], if the sampling interval is T = 0.1 second. The poles of G(z)
  are given by z = e"r, and z = ±i. With T = 0.1 s, the poles are z = e~° ' = 0.9048,
  and z = ±i. Since none of the poles of the system lie outside the unit circle centered
  at z = 0, the system is stable. However, the poles z = ±i are on the unit circle.
  Therefore, the system is not asymptotically stable. Even if the sampling interval,
  T, is made very small, the pole at z = e~ r will approach - but remain inside - the
  unit circle. Hence, this system is stable for all possible values of the sampling
  interval, T.
_                  STABILITY OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS_          387


  Example 8.9

   Let us find the range of sampling interval, T, for which the digital system with
   pulse transfer function, G(z) = 100/(z2 - 5e~7 +4), is stable. The poles of G(z)
   are given by the solution of the characteristic equation z2 — 5e~r + 4 = 0, or
   z = ±(5e~r - 4)1/2. If T > 0.51, then |z| > 1.0, indicating instability. Hence, the
   system is stable for T < 0.51 second.

  Example 8.10

   A sampled-data closed-loop system shown in Figure 8.4 has a plant transfer function,
   d(s) = s/(s2 + 1). Let us find the range of sampling interval, 7", for which the
   closed-loop system is stable.
      In Example 8.6, we derived the pulse transfer function of the closed-loop system
   to be the following:

   G(z) = [z(l + 3e~2;r - 4e~3T) + e~5:r + 3e~3;r - 4e~2T]/[6(z - e~27")(z - e~ 3r )
              + z(l + 3e"2r - 4e~37) + e"5r + 3e~3r - 4e~ 2r ]                    (8.43)

   The closed-loop poles are the roots of the following characteristic polynomial:

                     6(z - e~ 27 )(z - e~ 3r ) + z(l + 3e~~2r - 4e~ 3r ) + e~5T
                        + 3e-3r - 4e~2r = 0                                       (8.44)

   or

                   6z2 + z(l - 3e"2r - 10e"3r) + 7e"57 + 3e~3r - 4e~2r = 0        (8.45)

   An easy way of solving Eq. (8.45) is through the MATLAB command roots as
   follows:
   »T=0.0001;z=roots([6 1 -3*exp( -2*T) -10*exp( -3*T) 7*exp( -5*T)+3*exp( -3
    * T ) - 4 * e x p ( - 2 * T ) ] ) <enter>

   7    —

        0 . 9998
        0.9996

  Since the poles of G(z) approach the unit circle only in the limit T -> 0, it is clear
  that the system is stable for all non-zero values of the sampling interval, T.

   In a manner similar to stability analysis of the closed-loop analog, single-input, single-
output system shown in Figure 2.32 using the Nyquist plot of the open-loop transfer
function, G0(s) = G(s)H(s), we can obtain the Nyquist plots of closed-loop digital
systems with an open-loop pulse transfer function, G 0 (z), using the MATLAB (CST)
command dnyquist as follows:
        »dnyquist(num,den,T) <enter>
388                               DIGITAL CONTROL SYSTEMS


where num. and den are the numerator and denominator polynomials of the system's open-
loop pulse transfer function, G0(z), in decreasing powers of z, and T is the sampling
interval. The result is a Nyquist plot (i.e. mapping of the imaginary axis of the Laplace
domain in the G0(z) plane) on the screen. The user can supply a vector of desired
frequency points, w, at which the Nyquist plot is to be obtained, as the fourth input
argument of the command dnyquist. The command dnyquist obtains the Nyquist plot of
the digital system in the G 0 (z) plane. Hence, the stability analysis is carried out in exactly
the same manner as for analog systems, using the Nyquist stability theorem of Chapter 2.
According to the Nyquist stability theorem for digital systems, the closed-loop system
given by the pulse transfer function, G 0 (z)/[l + G0(z)], is stable if the Nyquist plot of
G 0 (z) encircles the point —1 exactly P times in the anti-clockwise direction, where P is
the number of unstable poles of G 0 (z).

  Example 8.11
  Let us use the digital Nyquist plot to analyze the stability of the closed-loop sampled
  data analog system shown in Figure 8.4 with the plant, G(s) — l/[(s(s + 1)]. The
  open-loop transfer function of the system is G0(s) = (1 — e~Ts)/[s2(s + 1)], while
  the open-loop pulse transfer function can be written as follows:
                                                         ~T                  '7"
           G 0 (z) = [z(T - 1 + e-) + 1 - e- - T e ~ ] / ( ( z - l)(z - e ' ) ]          (8.46)

  For a specific value of the sampling interval, such as T = 0. 1 second, the Nyquist
  plot is obtained as follows:

  »T=0.1;num = [T-H-exp(-T) 1 - e x p ( - T ) - T * e x p ( - T ) ] ,den = conv([1
    - 1 ] , [ 1 - e x p ( - T ) ] ) <enter>
   num =
    0 . 0048       0 . 0047
  den =
    1 . 0000      - 1 . 9048   0 . 9048

  The poles of G 0 (z) are obtained as follows:
         »roots(den) <enter>
         ans =
           1.0000
           0 . 9048
  Thus, G 0 (z) does not have any poles outside the unit circle, hence P = 0. The
  digital Nyquist plot is obtained in the frequency range 1-10 rad/s as follows:
       »w=logspace(0, 1 ) ; dnyquist (num,den,T,w) <enter>
  The resulting Nyquist plot is shown in Figure 8.6. Note that the Nyquist plot
  of G 0 (z) does not encircle the point —1 in the G 0 (z) plane. Hence, the closed-
  loop system with pulse transfer function, G 0 (z)/[l + G0(z)], is stable for T = 0.1
STABILITY OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS                         389


                   0.5

                   0.4

                   0.3

                   0.2

             $
             CO
                   0.1

              |    0
             'o>
              | -0.1

                  -0.2

                  -0.3

                  -0.4

                  -0.5         I        I        l        l       I
                      -1.4   -1.2      -1     -0.8     -0.6     -0.4    -0.2      0
                                                Real axis

Figure 8.6 Digital Nyquist plot of open-loop pulse transfer function, G0 (z), for the sampled-data
closed-loop system of Example 8.10 with sampling interval 7 = 0.1 s



second. We can also analyze the stability of the closed-loop system by checking the
closed-loop pole locations as follows:

      »sysp=tf(num,den);sysCL=feedback(sysp,1) <enter>
      Transfer function:
      0.004837Z+0.004679
      Z A 2-1.9Z+0.9095


      »[wn,z,p]=damp(sysCL); wn, p <enter>
      wn =
       0.9537
       0.9537
      p=
       0.9500+0.08381
       0.9500-0.08381

   Note that the returned arguments of the CST command damp denote the closed-
loop poles, p, and the magnitudes of the closed-loop poles, wn. (Caution: z and
wn do not indicate the digital system's damping and natural frequencies, for which
you should use the command ddamp as shown below.) Since wn indicates that both
the closed-loop poles are inside the unit circle, the closed-loop system is stable.
390                                DIGITAL CONTROL SYSTEMS


   In addition to dbode and dnyquist, MATLAB (CST) provides the command dnichols for
drawing the digital Nichols plot. You may refer to the User's Guide for Control Systems
Toolbox [1] for details about this as well as other digital frequency response commands.


8.6 Performance of Single-Input, Single-Output
    Digital Systems
Performance of a digital system can be studied by obtaining the time response to specified
inputs. In a manner similar to the inverse Laplace transform for analog systems, we can
use the definition of the z-transform to find the inverse z-transform of the output, K(z),
denoted by z~l{Y(z)}, to find the discrete time response of a single-input, single-output
digital system with pulse transfer function, G(z), and input, U(z). From Eq. (8.6) it is
clear that the inverse z-transform, z ~ } { Y ( z ) } , yields the discrete time output, y(kT). The
method of finding the inverse z-transform of a function, F(z), is quite similar to that
followed in finding the inverse Laplace transform, and involves expressing F(z) as a
partial fraction expansion in z (there is an alternative method of using power series
expansion in z, but we will not consider it due to its complexity). However, examining
the z-transforms given in Table 8.1, it is clear that z is usually present as a numerator
factor in most z-transforms. Hence, to find the inverse z-transform of F(z), it will be
useful to express F(z) as the following expansion:

                F(z) = *iz/(z - zi) + K2z/(z - z 2 ) + • • • + KHz/(z - z n )                (8.47)

where zi, Z 2 , • • • , zn are the poles of F(z) and K, KI, ..., Kn are the residues of the
following partial fraction expansion:

                  F(z) = ATi/(z - zi) + K2/(z - Z 2 ) + • • • + K*/(z ~ z«)                 (8-48)

(Note that, for simplicity, we have assumed that all the poles of F(z) are distinct. If some
poles are repeated, we can use the more general partial fraction expansion introduced
in Chapter 2.) Taking the inverse z-transform of each term on the right-hand side of
Eq. (8.47), we can write

                             f ( k T ) = KlZ + K2z + ••• + Knzkn                          (8.49)

We can apply the above strategy to find the discrete time output, y(kT), of a digital system,
G(z), with input U(z} and zero initial conditions, by finding the inverse z-transform of
Y(z) = G(z)£/(z).

  Example 8.12
  Let us find the discrete time response of G(z) = z/(z 2 — 0.7z + 0.3) to a unit step
  input, u(kT) = us(kT). The z-transform of us(kT) is z/(z - 1). Hence, Y(z) =
  G(z)t/(z) = z2/[(z - l)(z 2 - 0.7z + 0.3)]. We begin byfindingthe partial fraction
  expansion of F(z)/z as follows by using the MATLAB command residue:
PERFORMANCE OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS                 391


»num = [1 0];den = conv([1                  -0.7 0.3]); [K,z,c] = residue(num,
 den)<enter>
K =
  1 .6667
 -0.8333+0.09891
 -0.8333-0.09891
z =
 1 . 0000
 0.3500+0.42131
 0.3500-0.42131



Hence, the partial fraction expansion of Y(z)/z is the following:

     Y(z)/z = z/((z - l)(z2 - 0.7z + 0.3)]
             = (5/3) /(z - 1) + (-0.8333 + 0.0989/)/[z - (0.3500 + 0.42130]
                + (-0.8333 - 0.0989* )/[z - (0.3500 - 0.42130]                     (8.50)

or

     Y(z) = (5/3)z/(z - 1) + (-0.8333 + 0.0989/)z/[z - (0.3500 + 0.42130]
             + (-0.8333 - 0.0989i)z/[z - (0.3500 - 0.42130]                        (8.51)



                     2
                                                     Digital step response _
                   1.8

                   1.6

                   1.4

                   1.2

                     1

                   0.8

                   0.6

                   0.4

                   0.2

                     0
                         0      0.2       0.4        0.6       0.8
                                                kT

Figure 8.7     Step response of the digital system of Example 8.11 with sampling interval,
7 = 0.1 s
392                                               DIGITAL CONTROL SYSTEMS


   Then, taking the inverse z-transform of each term on the right-hand side of
   Eq. (8.51), we get the discrete time output at the fcth sampling instant as follows:

                      f ( k T ) = 5/3 + (-0.8333 + 0.09890 (0.3500 + 0.42130*
                                      + (-0.8333 - 0.09890(0.3500 - 0.42130*                                                  (8.52)

   The step response, f(kT), calculated by Eq. (8.52) is plotted in Figure 8.7 for
   T = 0.1 seconds using the following MATLAB command:

   »for k = 1 : 1 1 ; f ( k ) = K ( l ) + K ( 2 ) * z ( 2 ) A ( k - 1 ) + K ( 3 ) * z ( 3 ) A ( k - 1 ) ; t ( k ) = 0 . 1 *
     (k-1);end;plot(t,f) <enter>


   Note that the step response has a maximum overshoot of 13% with a steady state value
of about 1.67. The peak time and the settling time are defined for the digital response as
occurring after so many sampling intervals. The peak time occurs for k = 3, while the
settling time occurs for k = 5. With T = 0.1 second, the peak time is 0.3 second, while
the settling time is 0.5 second.
   MATLAB M-files can be written to compute step and impulse responses of digital
systems using the inverse z-transform of partial fraction expansion (such as impresp.m and
stepresp.m for impulse and step responses, respectively, of analog systems in Chapter 2).
   The steady state value of the response, K(z), can be directly obtained using the final-
value theorem given by Eq. (8.16), as follows:
                     >'(oo) = limpid - z ~ l ) Y ( z ) = limpid - z~l)G(z)U(z)                                                  (8.53)
(Of course, the existence of the steady-state limit in Eq. (8,53) translates into the require-
ment that all the poles of G(z)U(z) should lie inside the unit circle.) The steady state
value of the response can thus be found using Eq. (8.53), without having to compute and
plot the response. Let us use Eq. (8.53) to find the steady state value of the step response
of a digital system with pulse transfer function, G(z), as follows:
                     y(oo) = limpid - z~l)Y(z) = limpid - z~l)G(z)U(z)
                                = limpid - z- ! )[z/(z - l)]G(z) = limz_>, G(z)                                                 (8.54)

Thus, the steady state value of the step response of G(z) is given by lim,^! G(z) called
the digital DC gain of G(z). However, instead of having to calculate the limit in Eq. (8.54)
by hand, we can use the MATLAB (CST) command ddcgain to find the digital DC gain
as follows:
       »ddcgain(num,den) <enter>
where num and den are the numerator and denominator polynomials of the pulse transfer
function, G(z), in decreasing powers of z. Let us find the steady state value of the step
response in Example 8.12 using ddcgain as follows:
       »num = [1 0];den = [1 -0.7                                 0.3];ddcgain(num,den) <enter>

      ans =
        1.6667
CLOSED-LOOP COMPENSATION TECHNIQUES                             393


Note that we can find the steady state value of response to an arbitrary input, t/(z), by
calculating the digital DC gain of the pulse transfer function (1 — z~l)G(z)U(z). Also, an
idea about a digital system's response can be obtained from the location of the dominant
poles with respect to the unit circle in the z-domain. The MATLAB command ddamp is
quite useful in determining the natural frequencies and damping ratios associated with
the poles of a digital system, and is used in a manner similar to the command damp
for analog systems, with the difference that the sampling interval, T, is specified as the
second input argument:

      »[mag,wn,z] = ddamp(den,T) <enter>

where den is the denominator polynomial of the system's pulse transfer function, T is the
sampling interval, mag is the magnitude of the pole in the z-domain, wn is the equivalent
natural frequency in the s-plane, and z is the equivalent damping ratio. The command
ddamp used without the sampling interval as the second input argument gives only the
magnitudes of the poles of the system. When used without the output arguments on the
left-hand side, the magnitudes, natural frequencies, and damping ratios are printed on the
screen. Instead of den, you can input the z-plane pole locations as a vector, and get the
returned damping ratios and natural frequencies associated with the poles. Let us determine
the natural frequencies and damping ratios of the digital system of Example 8.12 when
the sampling interval is T = 0.1 second as follows:

 »ddamp([1 - 0 . 7 0 . 3 ] , 0 . 1 ) <enter>

 Eigenvalue       Magnitude Equiv. Damping Equiv. FrEq. (rad/sec)
   0.3500+0.4213i 0.5477    0.5657         10.6421
   0.3500-0.4213i 0.5477    0.5657         10.6421

A damping ratio of £ = 0.5657 indicates a well damped response, as seen in Figure 8.7.
   For systems of order greater than two, we can identify the dominant poles which are
the closest to the unit circle in the z-domain. The performance of such systems is primarily
determined by the location of the dominant poles.


8.7 Closed-Loop Compensation Techniques for
    Single-Input, Single-Output Digital Systems
For improving the performance of digital systems, we can apply closed-loop compensation
techniques similar to analog systems discussed in Section 2.12, by placing a compensator
with pulse-transfer function, //(z), in closed-loop with a digital plant, G(z), as shown in
Figure 8.8. However, we have to be mindful of the dependence of the closed-loop digital
system's properties on the sampling interval, T, and the properties of the z-transform,
while designing compensators in the z-domain. Let us consider an example of closed-loop
digital compensation.
   Just as in continuous systems, we can have the ideal proportional-integral-derivative
(PID) control of digital systems. The digital equivalent of a PID compensator's transfer
394                                  DIGITAL CONTROL SYSTEMS




figure 8.8 A single-input, single-output digital feedback control system with controller pulse transfer
function, H(z), and plant pulse transfer function, G(z)


function is obtained by combining the proportional term with the z-transform of the
derivative term and the z-transform of the integral term. Note that the time deriva-
tive of the error in Figure 8.8, e (1) (f), is approximated by the digital equivalent of a
first order difference as e(1)(0 = [e(kT) — e(kT — T ) ] / T , whose ^-transform is obtained
using the time-shift property of z-transform (Eq. (8.13)) as (1 — z~l)E(z)/T. Thus, the
derivative term of PID compensator has the form K&( — z"1). The z-transform of
the integral term, K/s, is Kz/(z — 1) according to Table 8.1. The PID compensator's
pulse transfer is thus given by H(z) = KP + KD(l - z"1) + Kz/(z - 1), or //(z) =
[(KP + Kn +tfi)z2- (KP - 2KD)z + KD]/(z2 - z).


  Example 8.13
   Consider a digital system with the following pulse-transfer function and a sampling
   interval, T = 0.2 second:
                         G(z) = O.OOOKz - l)/(z 2 + 1.97z + 0.99)                           (8.55)
   The poles, natural frequencies and damping ratios of the system are obtained as
   follows:
   »ddamp([1 1.97 0.99], 0.2) <enter>

   Eigenvalue         Magnitude Equiv. Damping Equiv. FrEq. (rad/sec)
    -0. 9850+0. 1406i 0.9950     0.0017         14.9990
    -0. 9850-0. 1406i 0.9950    0.0017         14.9990

     A damping ratio of £ = 0.0017 indicates a lightly damped response, which is
  unacceptable. It is desired to increase the closed-loop damping to £ = 0.7 while
  keeping the natural frequency unchanged at a)n = 15 rad/s, through a proportional-
  integral (PI) compensator in the closed-loop configuration of Figure 8.8. With
  //(z) = Kp + Kz/(z — 1), the closed-loop pulse-transfer function is given by
       Y(z)/Yd(z) =
                     = 0.0001 [KP(z - 1) + #iz]/[z2 + {1.97 + 0.0001 (tf P +
                       + 0.99- 0.0001 KP]                                                   (8.56)
  The closed-loop poles are the roots of z2 + {1.97 + 0.0001 (KP + K{)}z + 0.99 -
  0.0001 Kp = Q, and must be the same as the desired pole locations z.2 =
CLOSED-LOOP COMPENSATION TECHNIQUES                             395


                                           ± i sin{^r(l - C) 1 / 2 }]. Plugging f =
0.7 and ct>M = 15 rad/s in the desired characteristic polynomial, z2 —
2exp(—t;co n T)cos{a) n T(l — £2)[/2}z + exp(—2^co n T), and comparing the coeffi-
cients with those of the denominator polynomial Eq. (8.56), we get Kp = 9750 and
K — —28 125. Let us check whether the closed-loop poles are at desired locations
as follows:
»Kp=9750;Ki=-28125;sysGH=tf(0.0001*[Kp+Ki-Kp],[1 1.97 0.99]);
  sysCL=feedback(sysGH,1) <enter>
Transfer function:
-1 .838Z-0.975
z~2+0.1325z+0.015

»ddamp([1 0.1325 0.015], 0.2) <enter>

Eigenvalue              Magnitude Equiv. Damping Equiv. Freq. (rad/s)
-6.63e-002+1 .03e-001i 1 .226-001 7.00e-001      1.506+001
-6. 636-002-1. 03e-001i 1.22e-001 7.006-001      1 .506+001
which confirms that the desired closed-loop damping and natural frequency have
been achieved.
   The steady-state error of the stable closed-loop system shown in Figure 8.8 to a
unit step desired output can be obtained from the final value theorem (Eq. (8.16))
as follows:
     e(oo) = lim^a - z ~ l ) E ( z ) = limpid - z~l)Yd(z)/U + G(z}H(z)}
                          + G(z)H(z)]                                          (8.57)
or the steady state error is the digital DC gain of the pulse transfer function 1/[1 +
G(z)H(z)]. For the system of Example 8.13, the steady-state error is computed as
follows:
»num=0.0001*[Kp+Ki -Kp];den=[1 1 .97 0.99] ;a=ddcgain(num,den) ;
  e=1 /(1+a) <enter>

e =
  3.4510

which is very large. The closed-loop steady state error to a step desired output
can be reduced to zero by a compensator which has two poles at z = 1, such
a
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)
[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)

More Related Content

PDF
Easy Learn to Verilog HDL
DOCX
การพัฒนาเกมคอมพิวเตอร์ 3 มิติ
PDF
Zbook
PDF
Quality of Service Configuration for TCP/IP Video Conferencing
PDF
ROBUST UNMIXING OF HYPERSPECTRAL IMAGES: APPLICATION TO MARS
PDF
DCT_TR802
PDF
PDF
Solution Architecture for Mailbox Archiving 5,000 Seat Environment
Easy Learn to Verilog HDL
การพัฒนาเกมคอมพิวเตอร์ 3 มิติ
Zbook
Quality of Service Configuration for TCP/IP Video Conferencing
ROBUST UNMIXING OF HYPERSPECTRAL IMAGES: APPLICATION TO MARS
DCT_TR802
Solution Architecture for Mailbox Archiving 5,000 Seat Environment

Viewers also liked (8)

PDF
Control Systems notes
PDF
8178001772 control
PDF
Control systems engineering. by i.j. nagrath
PDF
Lecture 16 ME 176 7 Root Locus Technique
PDF
Solution of skill Assessment Control Systems Engineering By Norman S.Nise 6t...
PDF
Solutions control system sengineering by normannice 6ed 130502172814-phpapp02
PDF
Control engineering a guide for beginners
PDF
1001.Arabian.Nights.As.Aventuras.De.Sinbad
Control Systems notes
8178001772 control
Control systems engineering. by i.j. nagrath
Lecture 16 ME 176 7 Root Locus Technique
Solution of skill Assessment Control Systems Engineering By Norman S.Nise 6t...
Solutions control system sengineering by normannice 6ed 130502172814-phpapp02
Control engineering a guide for beginners
1001.Arabian.Nights.As.Aventuras.De.Sinbad
Ad

Similar to [Ashish tewari] modern_control_design_with_matlab_(book_fi.org) (20)

PDF
72268096 non-linearity-in-structural-dynamics-detection-identification-and-mo...
PDF
Programming language design_concepts
PDF
Signals & systems
PDF
65487681 60444264-engineering-optimization-theory-and-practice-4th-edition
PDF
Elementary Real Analysis by Andrew M. Bruckner, Judith B. Bruckner, Brian S. ...
PDF
Okotech Catwww3
PDF
Okotech Catwww3
PDF
Computational intelligence an introduction
PDF
Okotech Catwww3
PDF
Brownian motion calculus
PDF
2002073603
PDF
Circiut design and testing
PDF
Control of machines
PDF
Controlofmachines
PDF
Umts.Performance.Measurement
PDF
Dec ''too simple'' digital electronics demystified (mc graw
PDF
0471269832
PDF
71382704 mimo-of dm-wireless-communications-with-matlab-0470825618
PDF
Mimo ofdm wireless communications with matlab
PDF
Table of contents
72268096 non-linearity-in-structural-dynamics-detection-identification-and-mo...
Programming language design_concepts
Signals & systems
65487681 60444264-engineering-optimization-theory-and-practice-4th-edition
Elementary Real Analysis by Andrew M. Bruckner, Judith B. Bruckner, Brian S. ...
Okotech Catwww3
Okotech Catwww3
Computational intelligence an introduction
Okotech Catwww3
Brownian motion calculus
2002073603
Circiut design and testing
Control of machines
Controlofmachines
Umts.Performance.Measurement
Dec ''too simple'' digital electronics demystified (mc graw
0471269832
71382704 mimo-of dm-wireless-communications-with-matlab-0470825618
Mimo ofdm wireless communications with matlab
Table of contents
Ad

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
DOCX
The AUB Centre for AI in Media Proposal.docx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Spectral efficient network and resource selection model in 5G networks
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Building Integrated photovoltaic BIPV_UPV.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx

[Ashish tewari] modern_control_design_with_matlab_(book_fi.org)

  • 2. Modern Control Design With MATLAB and SIMULINK
  • 4. Modern Control Design With MATLAB and SIMULINK Ashish Tewari Indian Institute of Technology, Kanpur, India JOHN WILEY & SONS, LTD
  • 5. Copyright © 2002 by John Wiley & Sons Ltd Baffins Lane, Chichester, West Sussex, PO19 1UD, England National 01243 779777 International (+44) 1243 779777 e-mail (for orders and customer service enquiries): cs-books@wiley.co.uk Visit our Home Page on http://www.wiley.co.uk or http://www.wiley.com All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the terms of the Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licensing Agency, 90 Tottenham Court Road, London, W1P 9HE, UK, without the permission in writing of the Publisher, with the exception of any material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the publication. Neither the authors nor John Wiley & Sons Ltd accept any responsibility or liability for loss or damage occasioned to any person or property through using the material, instructions, methods or ideas contained herein, or acting or refraining from acting as a result of such use. The authors and Publisher expressly disclaim all implied warranties, including merchantability of fitness for any particular purpose. Designations used by companies to distinguish their products are often claimed as trademarks. In all instances where John Wiley & Sons is aware of a claim, the product names appear in initial capital or capital letters. Readers, however, should contact the appropriate companies for more complete information regarding trade- marks and registration. Other Wiley Editorial Offices John Wiley & Sons, Inc., 605 Third Avenue, New York, NY 10158-0012, USA Wiley-VCH Verlag GmbH, Pappelallee 3, D-69469 Weinheim, Germany John Wiley, Australia, Ltd, 33 Park Road, Milton, Queensland 4064, Australia John Wiley & Sons (Canada) Ltd, 22 Worcester Road, Rexdale, Ontario, M9W 1L1, Canada John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809 British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library ISBN 0 471 496790 Typeset in 10/12j pt Times by Laserwords Private Limited, Chennai, India Printed and bound in Great Britain by Biddies Ltd, Guildford and Kings Lynn This book is printed on acid-free paper responsibly manufactured from sustainable forestry, in which at least two trees are planted for each one used for paper production.
  • 6. To the memory of my father, Dr. Kamaleshwar Sahai Tewari. To my wife, Prachi, and daughter, Manya.
  • 8. Contents Preface xiii Introduction 1 1.1 What is Control? 1 1.2 Open-Loop and Closed-Loop Control Systems 2 1.3 Other Classifications of Control Systems 6 1.4 On the Road to Control System Analysis and Design 10 1.5 MATLAB, SIMULINK, and the Control System Toolbox 11 References 12 2. Linear Systems and Classical Control 13 2.1 How Valid is the Assumption of Linearity? 13 2.2 Singularity Functions 22 2.3 Frequency Response 26 2.4 Laplace Transform and the Transfer Function 36 2.5 Response to Singularity Functions 51 2.6 Response to Arbitrary Inputs 58 2.7 Performance 62 2.8 Stability 71 2.9 Root-Locus Method 73 2.10 Nyquist Stability Criterion 77 2.11 Robustness 81 2.12 Closed-Loop Compensation Techniques for Single-Input, Single-Output Systems 87 2.12.1 Proportional-integral-derivative compensation 88 2.12.2 Lag, lead, and lead-lag compensation 96 2.13 Multivariable Systems 105 Exercises 115 References 124 3. State-Space Representation 125 3.1 The State-Space: Why Do I Need It? 125 3.2 Linear Transformation of State-Space Representations 140
  • 9. viii CONTENTS 3.3 System Characteristics from State-Space Representation 146 3.4 Special State-Space Representations: The Canonical Forms 152 3.5 Block Building in Linear, Time-Invariant State-Space 160 Exercises 168 References 170 4. Solving the State-Equations 171 4.1 Solution of the Linear Time Invariant State Equations 171 4.2 Calculation of the State-Transition Matrix 176 4.3 Understanding the Stability Criteria through the State-Transition Matrix 183 4.4 Numerical Solution of Linear Time-Invariant State-Equations 184 4.5 Numerical Solution of Linear Time-Varying State-Equations 198 4.6 Numerical Solution of Nonlinear State-Equations 204 4.7 Simulating Control System Response with SIMUUNK 213 Exercises 216 References 218 5. Control System Design in State-Space 219 5.1 Design: Classical vs. Modern 219 5.2 Controllability 222 5.3 Pole-Placement Design Using Full-State Feedback 228 5.3.1 Pole-placement regulator design (or single-input plants 230 5.3.2 Pole-placement regulator design for multi-input plants 245 5.3.3 Pole-placement regulator design for plants with noise 247 5.3.4 Pole-placement design of tracking systems 251 5.4 Observers, Observability, and Compensators 256 5.4.1 Pole-placement design of full-order observers and compensators 258 5.4.2 Pole-placement design of reduced-order observers and compensators 269 5.4.3 Noise and robustness issues 276 Exercises 277 References 282 6. Linear Optimal Control 283 6.1 The Optimal Control Problem 283 6.1.1 The general optimal control formulation for regulators 284 6.1.2 Optimal regulator gain matrix and the riccati equation 286 6.2 Infinite-Time Linear Optimal Regulator Design 288 6.3 Optimal Control of Tracking Systems 298 6.4 Output Weighted Linear Optimal Control 308 6.5 Terminal Time Weighting: Solving the Matrix Riccati Equation 312 Exercises 318 References 321
  • 10. CONTENTS ix 7. Kalman Filters 323 7.1 Stochastic Systems 323 7.2 Filtering of Random Signals 329 7.3 White Noise, and White Noise Filters 334 7.4 The Kalman Filter 339 7.5 Optimal (Linear, Quadratic, Gaussian) Compensators 351 7.6 Robust Multivariable LOG Control: Loop Transfer Recovery 356 Exercises 370 References 371 8. Digital Control Systems 373 8.1 What are Digital Systems? 373 8.2 A/D Conversion and the z-Transform 375 8.3 Pulse Transfer Functions of Single-Input, Single-Output Systems 379 8.4 Frequency Response of Single-Input, Single-Output Digital Systems 384 8.5 Stability of Single-Input, Single-Output Digital Systems 386 8.6 Performance of Single-Input, Single-Output Digital Systems 390 8.7 Closed-Loop Compensation Techniques for Single-Input, Single-Output Digital Systems 393 8.8 State-Space Modeling of Multivariable Digital Systems 396 8.9 Solution of Linear Digital State-Equations 402 8.10 Design of Multivariable, Digital Control Systems Using Pole-Placement: Regulators, Observers, and Compensators 406 8.11 Linear Optimal Control of Digital Systems 415 8.12 Stochastic Digital Systems, Digital Kalman Filters, and Optimal Digital Compensators 424 Exercises 432 References 436 9. Advanced Topics in Modern Control 437 9.1 Introduction 437 9.2 #00 Robust, Optimal Control 437 9.3 Structured Singular Value Synthesis for Robust Control 442 9.4 Time-Optimal Control with Pre-shaped Inputs 446 9.5 Output-Rate Weighted Linear Optimal Control 453 9.6 Nonlinear Optimal Control 455 Exercises 463 References 465 Appendix A: Introduction to MATLAB, SIMULINK and the Control System Toolbox 467
  • 11. x CONTENTS Appendix B: Review of Matrices and Linear Algebra 481 Appendix C: Mass, Stiffness, and Control Influence Matrices of the Flexible Spacecraft 487 Answers to Selected Exercises 489 Index 495
  • 12. Preface The motivation for writing this book can be ascribed chiefly to the usual struggle of an average reader to understand and utilize controls concepts, without getting lost in the mathematics. Many textbooks are available on modern control, which do a fine job of presenting the control theory. However, an introductory text on modern control usually stops short of the really useful concepts - such as optimal control and Kalman filters - while an advanced text which covers these topics assumes too much mathe- matical background of the reader. Furthermore, the examples and exercises contained in many control theory textbooks are too simple to represent modern control appli- cations, because of the computational complexity involved in solving practical prob- lems. This book aims at introducing the reader to the basic concepts and applications of modern control theory in an easy to read manner, while covering in detail what may be normally considered advanced topics, such as multivariable state-space design, solutions to time-varying and nonlinear state-equations, optimal control, Kalman filters, robust control, and digital control. An effort is made to explain the underlying princi- ples behind many controls concepts. The numerical examples and exercises are chosen to represent practical problems in modern control. Perhaps the greatest distinguishing feature of this book is the ready and extensive use of MATLAB (with its Control System Toolbox) and SIMULINK®, as practical computational tools to solve problems across the spectrum of modern control. MATLAB/SIMULINK combination has become the single most common - and industry-wide standard - software in the analysis and design of modern control systems. In giving the reader a hands-on experience with the MATLAB/SIMULINK and the Control System Toolbox as applied to some practical design problems, the book is useful for a practicing engineer, apart from being an introductory text for the beginner. This book can be used as a textbook in an introductory course on control systems at the third, or fourth year undergraduate level. As stated above, another objective of the book is to make it readable by a practicing engineer without a formal controls back- ground. Many modern control applications are interdisciplinary in nature, and people from a variety of disciplines are interested in applying control theory to solve practical problems in their own respective fields. Bearing this in mind, the examples and exercises are taken to cover as many different areas as possible, such as aerospace, chemical, elec- trical and mechanical applications. Continuity in reading is preserved, without frequently referring to an appendix, or other distractions. At the end of each chapter, readers are ® MATLAB, SIMULINK, and Control System Toolbox are registered trademarks of the Math Works, Inc.
  • 13. xii PREFACE given a number of exercises, in order to consolidate their grasp of the material presented in the chapter. Answers to selected numerical exercises are provided near the end of the book. While the main focus of the material presented in the book is on the state-space methods applied to linear, time-invariant control - which forms a majority of modern control applications - the classical frequency domain control design and analysis is not neglected, and large parts of Chapters 2 and 8 cover classical control. Most of the example problems are solved with MATLAB/SIMULINK, using MATLAB command lines, and SIMULINK block-diagrams immediately followed by their resulting outputs. The reader can directly reproduce the MATLAB statements and SIMULINK blocks presented in the text to obtain the same results. Also presented are a number of computer programs in the form of new MATLAB M-files (i.e. the M-files which are not included with MATLAB, or the Control System Toolbox) to solve a variety of problems ranging from step and impulse responses of single-input, single-output systems, to the solution of the matrix Riccati equation for the terminal-time weighted, multivariable, optimal control design. This is perhaps the only available controls textbook which gives ready computer programs to solve such a wide range of problems. The reader becomes aware of the power of MATLAB/SIMULINK in going through the examples presented in the book, and gets a good exposure to programming in MATLAB/SIMULINK. The numer- ical examples presented require MATLAB 6.0, SIMULINK 4.0, and Control System Toolbox 5.0. Older versions of this software can also be adapted to run the examples and models presented in the book, with some modifications (refer to the respective Users' Manuals). The numerical examples in the book through MATLAB/SIMULINK and the Control System Toolbox have been designed to prevent the use of the software as a black box, or by rote. The theoretical background and numerical techniques behind the software commands are explained in the text, so that readers can write their own programs in MATLAB, or another language. Many of the examples contain instructions on programming. It is also explained how many of the important Control System Toolbox commands can be replaced by a set of intrinsic MATLAB commands. This is to avoid over-dependence on a particular version of the Control System Toolbox, which is frequently updated with new features. After going through the book, readers are better equipped to learn the advanced features of the software for design applications. Readers are introduced to advanced topics such as HOC-robust optimal control, struc- tured singular value synthesis, input shaping, rate-weighted optimal control, and nonlinear control in the final chapter of the book. Since the book is intended to be of introduc- tory rather than exhaustive nature, the reader is referred to other articles that cover these advanced topics in detail. I am grateful to the editorial and production staff at the Wiley college group, Chichester, who diligently worked with many aspects of the book. I would like to specially thank Karen Mossman, Gemma Quilter, Simon Plumtree, Robert Hambrook, Dawn Booth and See Hanson for their encouragement and guidance in the preparation of the manuscript. I found working with Wiley, Chichester, a pleasant experience, and an education into the many aspects of writing and publishing a textbook. I would also like to thank my students and colleagues, who encouraged and inspired me to write this book. I thank all
  • 14. PREFACE xiii the reviewers for finding the errors in the draft manuscript, and for providing many constructive suggestions. Writing this book would have been impossible without the constant support of my wife, Prachi, and my little daughter, Manya, whose total age in months closely followed the number of chapters as they were being written. Ashish Tewari
  • 16. 1 Introduction 1.1 What is Control? When we use the word control in everyday life, we are referring to the act of producing a desired result. By this broad definition, control is seen to cover all artificial processes. The temperature inside a refrigerator is controlled by a thermostat. The picture we see on the television is a result of a controlled beam of electrons made to scan the television screen in a selected pattern. A compact-disc player focuses a fine laser beam at the desired spot on the rotating compact-disc in order to produce the desired music. While driving a car, the driver is controlling the speed and direction of the car so as to reach the destination quickly, without hitting anything on the way. The list is endless. Whether the control is automatic (such as in the refrigerator, television or compact-disc player), or caused by a human being (such as the car driver), it is an integral part of our daily existence. However, control is not confined to artificial processes alone. Imagine living in a world where the temperature is unbearably hot (or cold), without the life-supporting oxygen, water or sunlight. We often do not realize how controlled the natural environment we live in is. The composition, temperature and pressure of the earth's atmosphere are kept stable in their livable state by an intricate set of natural processes. The daily variation of temperature caused by the sun controls the metabolism of all living organisms. Even the simplest life form is sustained by unimaginably complex chemical processes. The ultimate control system is the human body, where the controlling mechanism is so complex that even while sleeping, the brain regulates the heartbeat, body temperature and blood-pressure by countless chemical and electrical impulses per second, in a way not quite understood yet. (You have to wonder who designed that control system!) Hence, control is everywhere we look, and is crucial for the existence of life itself. A study of control involves developing a mathematical model for each component of the control system. We have twice used the word system without defining it. A system is a set of self-contained processes under study. A control system by definition consists of the system to be controlled - called the plant - as well as the system which exercises control over the plant, called the controller. A controller could be either human, or an artificial device. The controller is said to supply a signal to the plant, called the input to the plant (or the control input), in order to produce a desired response from the plant, called the output from the plant. When referring to an isolated system, the terms input and output are used to describe the signal that goes into a system, and the signal that comes out of a system, respectively. Let us take the example of the control system consisting of a car and its driver. If we select the car to be the plant, then the driver becomes the
  • 17. INTRODUCTION controller, who applies an input to the plant in the form of pressing the gas pedal if it is desired to increase the speed of the car. The speed increase can then be the output from the plant. Note that in a control system, what control input can be applied to the plant is determined by the physical processes of the plant (in this case, the car's engine), but the output could be anything that can be directly measured (such as the car's speed or its position). In other words, many different choices of the output can be available at the same time, and the controller can use any number of them, depending upon the application. Say if the driver wants to make sure she is obeying the highway speed limit, she will be focusing on the speedometer. Hence, the speed becomes the plant output. If she wants to stop well before a stop sign, the car's position with respect to the stop sign becomes the plant output. If the driver is overtaking a truck on the highway, both the speed and the position of the car vis-d-vis the truck are the plant outputs. Since the plant output is the same as the output of the control system, it is simply called the output when referring to the control system as a whole. After understanding the basic terminology of the control system, let us now move on to see what different varieties of control systems there are. 1.2 Open-Loop and Closed-Loop Control Systems Let us return to the example of the car driver control system. We have encountered the not so rare breed of drivers who generally boast of their driving skills with the following words: "Oh I am so good that I can drive this car with my eyes closed!" Let us imagine we give such a driver an opportunity to live up to that boast (without riding with her, of course) and apply a blindfold. Now ask the driver to accelerate to a particular speed (assuming that she continues driving in a straight line). While driving in this fashion, the driver has absolutely no idea about what her actual speed is. By pressing the gas pedal (control input) she hopes that the car's speed will come up to the desired value, but has no means of verifying the actual increase in speed. Such a control system, in which the control input is applied without the knowledge of the plant output, is called an open-loop control system. Figure 1.1 shows a block-diagram of an open-loop control system, where the sub-systems (controller and plant) are shown as rectangular blocks, with arrows indicating input and output to each block. By now it must be clear that an open- loop controller is like a rifle shooter who gets only one shot at the target. Hence, open-loop control will be successful only if the controller has a pretty good prior knowledge of the behavior of the plant, which can be defined as the relationship between the control input UBbirtJU uuipui l/UIUIUI IMJJUl (desired (gas pedal (speed) speed) force) Controller Plant (driver) (car) Figure 1.1 An open-loop control system: the controller applies the control input without knowing the plant output
  • 18. OPEN-LOOP AND CLOSED-LOOP CONTROL SYSTEMS and the plant output. If one knows what output a system will produce when a known input is applied to it, one is said to know the system's behavior. Mathematically, the relationship between the output of a linear plant and the control input (the system's behavior) can be described by a transfer function (the concepts of linear systems and transfer functions are explained in Chapter 2). Suppose the driver knows from previous driving experience that, to maintain a speed of 50 kilometers per hour, she needs to apply one kilogram of force on the gas pedal. Then the car's transfer function is said to be 50 km/hr/kg. (This is a very simplified example. The actual car is not going to have such a simple transfer function.} Now, if the driver can accurately control the force exerted on the gas pedal, she can be quite confident of achieving her target speed, even though blindfolded. However, as anybody reasonably experienced with driving knows, there are many uncertainties - such as the condition of the road, tyre pressure, the condition of the engine, or even the uncertainty in gas pedal force actually being applied by the driver - which can cause a change in the car's behavior. If the transfer function in the driver's mind was determined on smooth roads, with properly inflated tyres and a well maintained engine, she is going to get a speed of less than 50 krn/hr with 1 kg force on the gas pedal if, say, the road she is driving on happens to have rough patches. In addition, if a wind happens to be blowing opposite to the car's direction of motion, a further change in the car's behavior will be produced. Such an unknown and undesirable input to the plant, such as road roughness or the head-wind, is called a noise. In the presence of uncertainty about the plant's behavior, or due to a noise (or both), it is clear from the above example that an open-loop control system is unlikely to be successful. Suppose the driver decides to drive the car like a sane person (i.e. with both eyes wide open). Now she can see her actual speed, as measured by the speedometer. In this situation, the driver can adjust the force she applies to the pedal so as to get the desired speed on the speedometer; it may not be a one shot approach, and some trial and error might be required, causing the speed to initially overshoot or undershoot the desired value. However, after some time (depending on the ability of the driver), the target speed can be achieved (if it is within the capability of the car), irrespective of the condition of the road or the presence of a wind. Note that now the driver - instead of applying a pre-determined control input as in the open-loop case - is adjusting the control input according to the actual observed output. Such a control system in which the control input is a function of the plant's output is called a closed-loop system. Since in a closed-loop system the controller is constantly in touch with the actual output, it is likely to succeed in achieving the desired output even in the presence of noise and/or uncertainty in the linear plant's behavior (transfer-function). The mechanism by which the information about the actual output is conveyed to the controller is called feedback. On a block-diagram, the path from the plant output to the controller input is called a feedback-loop. A block-diagram example of a possible closed-loop system is given in Figure 1.2. Comparing Figures 1.1 and 1.2, we find a new element in Figure 1.2 denoted by a circle before the controller block, into which two arrows are leading and out of which one arrow is emerging and leading to the controller. This circle is called a summing junction, which adds the signals leading into it with the appropriate signs which are indicated adjacent to the respective arrowheads. If a sign is omitted, a positive sign is assumed. The output of
  • 19. INTRODUCTION Desired Control input (u) Output (y) output (gas pedal (speed) rorcej Controller Plant (driver) (car) Feedback loop Figure 1.2 Example of a closed-loop control system with feedback; the controller applies a control input based on the plant output the summing junction is the arithmetic sum of its two (or more) inputs. Using the symbols u (control input), y (output), and yd (desired output), we can see in Figure 1.2 that the input to the controller is the error signal (yd — y). In Figure 1.2, the controller itself is a system which produces an output (control input), u, based upon the input it receives in the form of (yd — y)- Hence, the behavior of a linear controller could be mathematically described by its transfer-function, which is the relationship between u and (yd — .v)- Note that Figure 1.2 shows only a popular kind of closed-loop system. In other closed-loop systems, the input to the controller could be different from the error signal (yd — y). The controller transfer-function is the main design parameter in the design of a control system and determines how rapidly - and with what maximum overshoot (i.e. maximum value of | yd — y|) - the actual output, y, will become equal to the desired output, yd- We will see later how the controller transfer-function can be obtained, given a set of design requirements. (However, deriving the transfer-function of a human controller is beyond the present science, as mentioned in the previous section.) When the desired output, yd, is a constant, the resulting controller is called a regulator. If the desired output is changing with time, the corresponding control system is called a tracking system. In any case, the principal task of a closed-loop controller is to make (yd — y) = 0 as quickly as possible. Figure 1.3 shows a possible plot of the actual output of a closed-loop control system. Whereas the desired output yd has been achieved after some time in Figure 1.3, there is a large maximum overshoot which could be unacceptable. A successful closed-loop controller design should achieve both a small maximum overshoot, and a small error magnitude |yd — y| as quickly as possible. In Chapter 4 we will see that the output of a linear system to an arbitrary input consists of a fluctuating sort of response (called the transient response), which begins as soon as the input is applied, and a settled kind of response (called the steady-state response) after a long time has elapsed since the input was initially applied. If the linear system is stable, the transient response would decay to zero after sometime (stability is an important property of a system, and is discussed in Section 2.8), and only the steady-state response would persist for a long time. The transient response of a linear system depends largely upon the characteristics and the initial state of the system, while the steady-state response depends both upon system's characteristics and the input as a function of time, i.e. u(t). The maximum overshoot is a property of the transient response, but the error magnitude | yd — y| at large time (or in the limit t —>• oo) is a property of the steady-state response of the closed-loop system. In
  • 20. OPEN-LOOP AND CLOSED-LOOP CONTROL SYSTEMS Desired output, yd u Time (f) Figure 1.3 Example of a closed-loop control system's response; the desired output is achieved after some time, but there is a large maximum overshoot Figure 1.3 the steady-state response asymptotically approaches a constant yd in the limit t -> oo. Figure 1.3 shows the basic fact that it is impossible to get the desired output imme- diately. The reason why the output of a linear, stable system does not instantaneously settle to its steady-state has to do with the inherent physical characteristics of all prac- tical systems that involve either dissipation or storage of energy supplied by the input. Examples of energy storage devices are a spring in a mechanical system, and a capacitor in an electrical system. Examples of energy dissipation processes are mechanical friction, heat transfer, and electrical resistance. Due to a transfer of energy from the applied input to the energy storage or dissipation elements, there is initially a fluctuation of the total energy of the system, which results in the transient response. As the time passes, the energy contribution of storage/dissipative processes in a stable system declines rapidly, and the total energy (hence, the output) of the system tends to the same function of time as that of the applied input. To better understand this behavior of linear, stable systems, consider a bucket with a small hole in its bottom as the system. The input is the flow rate of water supplied to the bucket, which could be a specific function of time, and the output is the total flow rate of water coming out of the bucket (from the hole, as well as from the overflowing top). Initially, the bucket takes some time to fill due to the hole (dissipative process) and its internal volume (storage device). However, after the bucket is full, the output largely follows the changing input. While the most common closed-loop control system is the feedback control system, as shown in Figure 1.2, there are other possibilities such as the feedforward control system. In a feedforward control system - whose example is shown in Figure 1.4 - in addition to a feedback loop, a feedforward path from the desired output (y^) to the control input is generally employed to counteract the effect of noise, or to reduce a known undesirable plant behavior. The feedforward controller incorporates some a priori knowledge of the plant's behavior, thereby reducing the burden on the feedback controller in controlling
  • 21. INTRODUCTION Disturbance Feedforward controller K + A Control input (u) (engine RPM *J (fuel flow) governor) / Desired- + / Output(y) output (yd)_ + p— Feedback controller (driver + *S^JL-/ r » Plant (car) ( speed) —>- gas pedal) Feedback loop Figure 1.4 A closed-loop control system with a feedforward path; the engine RPM governor takes care of the fuel flow disturbance, leaving the driver free to concentrate on achieving desired speed with gas pedal force the plant. Note that if the feedback controller is removed from Figure 1.4, the resulting control system becomes open-loop type. Hence, a feedforward control system can be regarded as a hybrid of open and closed-loop control systems. In the car driver example, the feedforward controller could be an engine rotational speed governor that keeps the engine's RPM constant in the presence of disturbance (noise) in the fuel flow rate caused by known imperfections in the fuel supply system. This reduces the burden on the driver, who would have been required to apply a rapidly changing gas pedal force to counteract the fuel supply disturbance if there was no feedforward controller. Now the feedback controller consists of the driver and the gas-pedal mechanism, and the control input is the fuel flow into the engine, which is influenced by not only the gas-pedal force, but also by the RPM governor output and the disturbance. It is clear from the present example that many practical control systems can benefit from the feedforward arrangement. In this section, we have seen that a control system can be classified as either open- or closed-loop, depending upon the physical arrangement of its components. However, there are other ways of classifying control systems, as discussed in the next section. 1.3 Other Classifications of Control Systems Apart from being open- or closed-loop, a control system can be classified according to the physical nature of the laws obeyed by the system, and the mathematical nature of the governing differential equations. To understand such classifications, we must define the state of a system, which is the fundamental concept in modern control. The state of a system is any set of physical quantities which need to be specified at a given time in order to completely determine the behavior of the system. This definition is a little confusing, because it introduces another word, determine, which needs further explanation given in the following paragraph. We will return to the concept of state in Chapter 3, but here let us only say that the state is all the information we need about a system to tell what the system is doing at any given time. For example, if one is given information about the speed of a car and the positions of other vehicles on the road relative to the car, then
  • 22. OTHER CLASSIFICATIONS OF CONTROL SYSTEMS one has sufficient information to drive the car safely. Thus, the state of such a system consists of the car's speed and relative positions of other vehicles. However, for the same system one could choose another set of physical quantities to be the system's state, such as velocities of all other vehicles relative to the car, and the position of the car with respect to the road divider. Hence, by definition the state is not a unique set of physical quantities. A control system is said to be deterministic when the set of physical laws governing the system are such that if the state of the system at some time (called the initial conditions) and the input are specified, then one can precisely predict the state at a later time. The laws governing a deterministic system are called deterministic laws. Since the characteristics of a deterministic system can be found merely by studying its response to initial conditions (transient response), we often study such systems by taking the applied input to be zero. A response to initial conditions when the applied input is zero depicts how the system's state evolves from some initial time to that at a later time. Obviously, the evolution of only a deterministic system can be determined. Going back to the definition of state, it is clear that the latter is arrived at keeping a deterministic system in mind, but the concept of state can also be used to describe systems that are not deterministic. A system that is not deterministic is either stochastic, or has no laws governing it. A stochastic (also called probabilistic) system has such governing laws that although the initial conditions (i.e. state of a system at some time) are known in every detail, it is impossible to determine the system's state at a later time. In other words, based upon the stochastic governing laws and the initial conditions, one could only determine the probability of a state, rather than the state itself. When we toss a perfect coin, we are dealing with a stochastic law that states that both the possible outcomes of the toss (head or tail) have an equal probability of 50 percent. We should, however, make a distinction between a physically stochastic- system, and our ability (as humans) to predict the behavior of a deterministic system based upon our measurement of the initial conditions and our understanding of the governing laws. Due to an uncertainty in our knowledge of the governing deterministic laws, as well as errors in measuring the initial conditions, we will frequently be unable to predict the state of a deterministic system at a later time. Such a problem of unpredictability is highlighted by a special class of deterministic systems, namely chaotic systems. A system is called chaotic if even a small change in the initial conditions produces an arbitrarily large change in the system's state at a later time. An example of chaotic control systems is a double pendulum (Figure 1.5). It consists of two masses, m and mi, joined together and suspended from point O by two rigid massless links of lengths LI and L2 as shown. Here, the state of the system can be defined by the angular displacements of the two links, 0(t} and #2(0. as well as their respective angular velocities, 0 t) and #7( }(t). (In this book, the notation used for representing a &th order time derivative of /(r) is f ( k ) ( t ) , i.e. dkf(t)/dtk = f{k}(t). Thus, 0j (1) (0 denotes dO(t)/dt, etc.) Suppose we do not apply an input to the system, and begin observing the system at some time, t = 0, at which the initial conditions are, say, 6*i(0) = 40°, 02(0) = 80°, #, (l) (0) = 0°/s, and 0^1)(0) = 0°/s. Then at a later time, say after 100 s, the system's state will be very much different from what it would have been if the initial conditions were, say, 0j(0) = 40.01°, 6>2(0) = 80°, 6>,(1)(0) = 0°/s, and 0( ^(0) = 0°/s. Figure 1.6 shows the time history of the angle Oi(t) between 85 s and 100 s
  • 23. INTRODUCTION Figure 1.5 A double pendulum is a chaotic system because a small change in its initial conditions produces an arbitrarily large change in the system's state after some time -100 90 95 100 Time (s) Figure 1.6 Time history between 85 s and 100 s of angle QI of a double pendulum with mi = 1 kg, m-i = 2 kg, LI = 1 m, and 1-2 = 2 m for the two sets of initial conditions #1 (0) = 40°, #2(0) = 80°, 0J1)(0) = 0%, 0^(0) = 0% and 0,(0) = 40.01°, 02(0) = 80°, 0,(1|(0) = 0%, 0^(0) =0%. respectively for the two sets of initial conditions, for a double pendulum with m — 1 kg, mi = 2 kg, LI = 1 m, and LI = 2 m. Note that we know the governing laws of this deterministic system, yet we cannot predict its state after a given time, because there will always be some error in measuring the initial conditions. Chaotic systems are so interesting that they have become the subject of specialization at many physics and engineering departments. Any unpredictable system can be mistaken to be a stochastic system. Taking the car driver example of Section 1.2, there may exist deterministic laws that govern the road conditions, wind velocity, etc., but our ignorance about them causes us to treat such phenomena as random noise, i.e. stochastic processes. Another situation when a deterministic system may appear to be stochastic is exemplified by the toss of a coin deliberately loaded to fall every time on one particular side (either head or tail). An
  • 24. OTHER CLASSIFICATIONS OF CONTROL SYSTEMS unwary spectator may believe such a system to be stochastic, when actually it is very much deterministic! When we analyze and design control systems, we try to express their governing physical laws by differential equations. The mathematical nature of the governing differential equations provides another way of classifying control systems. Here we depart from the realm of physics, and delve into mathematics. Depending upon whether the differential equations used to describe a control system are linear or nonlinear in nature, we can call the system either linear or nonlinear. Furthermore, a control system whose description requires partial differential equations is called a distributed parameter system, whereas a system requiring only ordinary differential equations is called a lumped parameter system. A vibrating string, or a membrane is a distributed parameter system, because its properties (mass and stiffness) are distributed in space. A mass suspended by a spring is a lumped parameter system, because its mass and stiffness are concentrated at discrete points in space. (A more common nomenclature of distributed and lumped parameter systems is continuous and discrete systems, respectively, but we avoid this terminology in this book as it might be confused with continuous time and discrete time systems.) A particular system can be treated as linear, or nonlinear, distributed, or lumped parameter, depending upon what aspects of its behavior we are interested in. For example, if we want to study only small angular displacements of a simple pendulum, its differential equation of motion can be treated to be linear; but if large angular displacements are to be studied, the same pendulum is treated as a nonlinear system. Similarly, when we are interested in the motion of a car as a whole, its state can be described by only two quantities: the position and the velocity of the car. Hence, it can be treated as a lumped parameter system whose entire mass is concentrated at one point (the center of mass). However, if we want to take into account how the tyres of the car are deforming as it moves along an uneven road, the car becomes a distributed parameter system whose state is described exactly by an infinite set of quantities (such as deformations of all the points on the tyres, and their time derivatives, in addition to the speed and position of the car). Other classifications based upon the mathematical nature of governing differential equations will be discussed in Chapter 2. Yet another way of classifying control systems is whether their outputs are contin- uous or discontinuous in time. If one can express the system's state (which is obtained by solving the system's differential equations) as a continuous function of time, the system is called continuous in time (or analog system). However, a majority of modern control systems produce outputs that 'jump' (or are discontinuous) in time. Such control systems are called discrete in time (or digital systems). Note that in the limit of very small time steps, a digital system can be approximated as an analog system. In this book, we will make this assumption quite often. If the time steps chosen to sample the discontin- uous output are relatively large, then a digital system can have a significantly different behaviour from that of a corresponding analog system. In modern applications, even analog controllers are implemented on a digital processor, which can introduce digital characteristics to the control system. Chapter 8 is devoted to the study of digital systems. There are other minor classifications of control systems based upon the systems' char- acteristics, such as stability, controllability, observability, etc., which we will take up in subsequent chapters. Frequently, control systems are also classified based upon the
  • 25. 10 INTRODUCTION number of inputs and outputs of the system, such as single-input, single-output system, or two-input, three-output system, etc. In classical control (an object of Chapter 2) the distinction between single-input, single-output (SISO) and multi-input, multi-output (MIMO) systems is crucial. 1.4 On the Road to Control System Analysis and Design When we find an unidentified object on the street, the first thing we may do is prod or poke it with a stick, pick it up and shake it, or even hit it with a hammer and hear the sound it makes, in order to find out something about it. We treat an unknown control system in a similar fashion, i.e. we apply some well known inputs to it and carefully observe how it responds to those inputs. This has been an age old method of analyzing a system. Some of the well known inputs applied to study a system are the singularity functions, thus called due to their peculiar nature of being singular in the mathematical sense (their time derivative tends to infinity at some time). Two prominent members of this zoo are the unit step function and the unit impulse function. In Chapter 2, useful computer programs are presented to enable you to find the response to impulse and step inputs - as well as the response to an arbitrary input - of a single-input, single-output control system. Chapter 2 also discusses important properties of a control system, namely, performance, stability, and robustness, and presents the analysis and design of linear control systems using the classical approach of frequency response, and transform methods. Chapter 3 introduces the state-space modeling for linear control systems, covering various applications from all walks of engineering. The solution of a linear system's governing equations using the state-space method is discussed in Chapter 4. In this chapter, many new computer programs are presented to help you solve the state-equations for linear or nonlinear systems. The design of modern control systems using the state-space approach is introduced in Chapter 5, which also discusses two important properties of a plant, namely its controlla- bility and observability. In this chapter, it is first assumed that all the quantities defining the state of a plant (called state variables) are available for exact measurement. However, this assumption is not always practical, since some of the state variables may not be measurable. Hence, we need a procedure for estimating the unmeasurable state variables from the information provided by those variables that we can measure. Later sections of Chapter 5 contains material about how this process of state estimation is carried out by an observer, and how such an estimation can be incorporated into the control system in the form of a compensator. Chapter 6 introduces the procedure of designing an optimal control system, which means a control system meeting all the design requirements in the most efficient manner. Chapter 6 also provides new computer programs for solving important optimal control problems. Chapter 7 introduces the treatment of random signals generated by stochastic systems, and extends the philosophy of state estimation to plants with noise, which is treated as a random signal. Here we also learn how an optimal state estimation can be carried out, and how a control system can be made robust with respect to measurement and process noise. Chapter 8 presents the design and analysis of
  • 26. MATLAB, SIMULINK, AND THE CONTROL SYSTEM TOOLBOX digital control systems (also called discrete time systems), and covers many modern digital control applications. Finally, Chapter 9 introduces various advanced topics in modern control, such as advanced robust control techniques, nonlinear control, etc. Some of the topics contained in Chapter 9, such as input shaping control and rate-weighted optimal control, are representative of the latest control techniques. At the end of each chapter (except Chapter 1), you will find exercises that help you grasp the essential concepts presented in the chapter. These exercises range from analytical to numerical, and are designed to make you think, rather than apply ready-made formulas for their solution. At the end of the book, answers to some numerical exercises are provided to let you check the accuracy of your solutions. Modern control design and analysis requires a lot of linear algebra (matrix multipli- cation, inversion, calculation of eigenvalues and eigenvectors, etc.) which is not very easy to perform manually. Try to remember the last time you attempted to invert a 4 x 4 matrix by hand! It can be a tedious process for any matrix whose size is greater than 3 x 3 . The repetitive linear algebraic operations required in modern control design and analysis are, however, easily implemented on a computer with the use of standard programming techniques. A useful high-level programming language available for such tasks is the MATLAB®, which not only provides the tools for carrying out the matrix operations, but also contains several other features, such as the time-step integration of linear or nonlinear governing differential equations, which are invaluable in modern control analysis and design. For example, in Figure 1.6 the time-history of a double- pendulum has been obtained by solving the coupled governing nonlinear differential equations using MATLAB. Many of the numerical examples contained in this book have been solved using MATLAB. Although not required for doing the exercises at the end of each chapter, it is recommended that you familiarize yourself with this useful language with the help of Appendix A, which contains information about the commonly used MATLAB operators in modern control applications. Many people, who shied away from modern control courses because of their dread of linear algebra, began taking interest in the subject when MATLAB became handy. Nowadays, personal computer versions of MATLAB are commonly applied to practical problems across the board, including control of aerospace vehicles, magnetically levitated trains, and even stock-market applications. You may find MATLAB available at your university's or organization's computer center. While Appendix A contains useful information about MATLAB which will help you in solving most of the modern control problems, it is recommended that you check with the MATLAB user's guide [1] at your computer center for further details that may be required for advanced applications. SIMULINK® is a very useful Graphical Users Interface (GUI) tool for modeling control systems, and simulating their time response to specified inputs. It lets you work directly with the block-diagrams (rather than mathematical equations) for designing and analyzing ® MATLAB, SIMULINK and Control System Toolbox are registered trademarks of MathWorks, Inc.
  • 27. 12 INTRODUCTION control systems. For this purpose, numerous linear and nonlinear blocks, input sources, and output devices are available, so that you can easily put together almost any practical control system. Another advantage of using SIMULINK is that it works seamlessly with MATLAB, and can draw upon the vast programming features and function library of MATLAB. A SIMULINK block-diagram can be converted into a MATLAB program (called M-file). In other words, a SIMULINK block-diagram does all the programming for you, so that you are free to worry about other practical aspects of a control system's design and implementation. With advanced features (such as the Real Time Workshop for C-code generation, and specialized block-sets) one can also use SIMULINK for practical implementation of control systems [2]. We will be using SIMULINK as a design and analysis tool, especially in simulating the response of a control system designed with MATLAB. For solving many problems in control, you will find the Control System Toolbox® [3] for MATLAB very useful. It contains a set of MATLAB M-files of numerical procedures that are commonly used to design and analyze modern control systems. The Control System Toolbox is available at a small extra cost when you purchase MATLAB, and is likely to be installed at your computer center if it has MATLAB. Many solved examples presented in this book require the Control System Toolbox. In the solved examples, effort has been made to ensure that the application of MATLAB is clear and direct. This is done by directly presenting the MATLAB line commands - and some MATLAB M- files - followed by the numerical values resulting after executing those commands. Since the commands are presented exactly as they would appear in a MATLAB workspace, the reader can easily reproduce all the computations presented in the book. Again, take some time to familiarize yourself with MATLAB, SIMULINK and the Control System Toolbox by reading Appendix A. References 1. MATLAB® 6.0 - User's Guide, The Math Works Inc., Natick, MA, USA, 2000. 2. SIMULINK® 4.0 - User's Guide, The Math Works Inc., Natick, MA, USA, 2000. 3. Control System Toolbox 5.0 for Use with MATLAB® - User's Guide, The Math Works Inc. Natick, MA, USA, 2000.
  • 28. 2 It was mentioned in Chapter 1 that we need differential equations to describe the behavior of a system, and that the mathematical nature of the governing differential equations is another way of classifying control systems. In a large class of engineering applications, the governing differential equations can be assumed to be linear. The concept of linearity is one of the most important assumptions often employed in studying control systems. However, the following questions naturally arise: what is this assumption and how valid is it anyway? To answer these questions, let us consider lumped parameter systems for simplicity, even though all the arguments presented below are equally applicable to distributed systems. (Recall that lumped parameter systems are those systems whose behavior can be described by ordinary differential equations.) Furthermore, we shall confine our attention (until Section 2.13) to single-input, single-output (SISO) systems. For a general lumped parameter, SISO system (Figure 2.1) with input u(t} and output y ( t ) , the governing ordinary differential equation can be written as M ( 0 , um-(t), . . . , « ( r ) , i«(0, 0 (2.1) where y(k} denotes the &th derivative of y(t) with respect to time, t, e.g. v (n) = dny/dt", y(n~l) = d"~ly/dt"~l, and u(k) denotes the fcth time derivative of u(t). This notation for derivatives of a function will be used throughout the book. In Eq. (2.1), /() denotes a function of all the time derivatives of y ( t ) of order (n — 1) and less, as well as the time derivatives of u(t) of order m and less, and time, t. For most systems m < n, and such systems are said to be proper. Since n is the order of the highest time derivative of y(f) in Eq. (2.1), the system is said to be of order n. To determine the output y ( t ) , Eq. (2.1) must be somehow integrated in time, with u(t) known and for specific initial conditions j(0), j (1) (0), .y(2)(0), . . . , y("-l)(G). Suppose we are capable of solving Eq. (2.1), given any time varying input, u(t), and the initial conditions. For simplicity, let us assume that the initial conditions are zero, and we apply an input, u(t), which is a linear combination of two different inputs, u(t), and U2(t), given by U(t) = CU(t) +C2«2(0 (2.2)
  • 29. 14 UNEAR SYSTEMS AND CLASSICAL CONTROL Input u(t) Lumped parameter Output y(t) system Figure 2.1 A general lumped parameter system with input, u(f), and output, y(f) where c and c2 are constants. If the resulting output, y(t ), can be written as c2y2(t) (2.3) where y ( t ) is the output when u(t) is the input, and y2(t) is the output when 1*2(1) is the input, then the system is said to be linear, otherwise it is called nonlinear. In short, a linear system is said to obey the superposition principle, which states that the output of a linear system to an input consisting of linear combination of two different inputs (Eq. (2.2)) can be obtained by linearly superposing the outputs to the respective inputs (Eq. (2.3)). (The superposition principle is also applicable for non-zero initial conditions, if the initial conditions on y(t ) and its time derivatives are linear combinations of the initial conditions on y(t) and y2(t), and their corresponding time derivatives, with the constants c and c2.) Since linearity is a mathematical property of the governing differential equations, it is possible to say merely by inspecting the differential equation whether a system is linear. If the function /() in Eq. (2.1) contains no powers (other than one) of y(t) and its derivatives, or the mixed products of y ( t ) , its derivatives, and u(t) and its derivatives, or transcendental functions of j(0 and u(t), then the system will obey the superposition principle, and its linear differential equation can be written as any(n)(t) + an-iy(n-])(t) + • • • + aiy™(t) + a*y(t) (2-4) Note that even though the coefficients OQ, a , . . . , an and bo,b , . . . ,bm (called the parameters of a system) in Eq. (2.4) may be varying with time, the system given by Eq. (2.4) is still linear. A system with time-varying parameters is called a time-varying system, while a system whose parameters are constant with time is called time-invariant system. In the present chapter, we will be dealing only with linear, time-invariant systems. It is possible to express Eq. (2.4) as a set of lower order differential equations, whose individual orders add up to n. Hence, the order of a system is the sum of orders of all the differential equations needed to describe its behavior. Example 2.1 For an electrical network shown in Figure 2.2, the governing differential equations are the following: 3) + e(t)/(RC) (2.5a) l v2 t) = ui(0/(C 2 /? 3 ) - (W2(0/C 2 )(1//J 2 + l/*3) + e(t)/(R2C2) (2.5b)
  • 30. HOW VALID IS THE ASSUMPTION OF LINEARITY? 15 e(t) Figure 2.2 Electrical network for Example 2.1 where v(t) and i>2(0 are the voltages of the two capacitors, C and €2, e(t) is the applied voltage, and R, R2, and R^ are the three resistances as shown. On inspection of Eq. (2.5), we can see that the system is described by two first order, ordinary differential equations. Therefore, the system is of second order. Upon the substitution of Eq. (2.5b) into Eq. (2.5a), and by eliminating v2, we get the following second order differential equation: 1 + (Ci/C2)(R3/R2 + l/R3)(R3/Ri + 1) - l/R3]vi(t) l/R3)e(t)/C2 + (R3/Ri) (2.6) Assuming y(t) = v(t) and u(t) — e(t), and comparing Eq. (2.6) with Eq. (2.4), we can see that there are no higher powers, transcendental functions, or mixed products of the output, input, and their time derivatives. Hence, the system is linear. Suppose we do not have an input, u(t), applied to the system in Figure 2.1. Such a system is called an unforced system. Substituting u(t) = u ( l ) ( t ) = u(2)(t) — . . . = u(m}(t) = 0 into Eq. (2.1) we can obtain the following governing differential equation for the unforced system: yW(t) = f ( y ( n ~ l ) ( t ) , y("-2)(t), ..., y ( 1 ) (/), v(/), 0, 0, . . . , 0, 0, t) (2.7) In general, the solution, y ( t ) , to Eq. (2.7) for a given set of initial conditions is a function of time. However, there may also exist special solutions to Eq. (2.7) which are constant. Such constant solutions for an unforced system are called its equilibrium points, because the system continues to be at rest when it is already at such points. A large majority of control systems are designed for keeping a plant at one of its equilibrium points, such as the cruise-control system of a car and the autopilot of an airplane or missile, which keep the vehicle moving at a constant velocity. When a control system is designed for maintaining the plant at an equilibrium point, then only small deviations from the equilibrium point need to be considered for evaluating the performance of such a control system. Under such circumstances, the time behavior of the plant and the resulting control system can generally be assumed to be governed by linear differential equations, even though
  • 31. 16 LINEAR SYSTEMS AND CLASSICAL CONTROL the governing differential equations of the plant and the control system may be nonlinear. The following examples demonstrate how a nonlinear system can be linearized near its equilibrium points. Also included is an example which illustrates that such a linearization may not always be possible. Example 2.2 Consider a simple pendulum (Figure 2.3) consisting of a point mass, m, suspended from hinge at point O by a rigid massless link of length L. The equation of motion of the simple pendulum in the absence of an externally applied torque about point O in terms of the angular displacement, 0(t), can be written as L0(2)(» + g.sin(6>(/))=0 (2.8) This governing equation indicates a second-order system. Due to the presence of sin(#) - a transcendental function of 6 - Eq. (2.8) is nonlinear. From our everyday experience with a simple pendulum, it is clear that it can be brought to rest at only two positions, namely 0 = 0 and 9 = n rad. (180°). Therefore, these two positions are the equilibrium points of the system given by Eq. (2.8). Let us examine the behavior of the system near each of these equilibrium points. Since the only nonlinear term in Eq. (2.8) is sin(0), if we can show that sin(0) can be approximated by a linear term, then Eq. (2.8) can be linearized. Expanding sin(0) about the equilibrium point 0 = 0, we get the following Taylor's series expansion: sin(6>) =8- 03/3! + 05/5l - B1 /1 + • • • (2.9) If we assume that motion of the pendulum about 0=0 consists of small angular displacements (say 0 < 10°), then sin(0) ^ 0, and Eq. (2.8) becomes 0 (2.10) e =o Figure 2.3 A simple pendulum of length L and mass m
  • 32. HOW VALID IS THE ASSUMPTION OF LINEARITY? 17 Similarly, expanding sin(#) about the other equilibrium point, 0 = n, by assuming small angular displacement, 0, such that B — n — 0, and noting that sin(0) = — sin(0) % —0, we can write Eq. (2.8) as (2.11) We can see that both Eqs. (2.10) and (2.11) are linear. Hence, the nonlinear system given by Eq. (2.8) has been linearized about both of its equilibrium points. Second order linear ordinary differential equations (especially the homogeneous ones like Eqs. (2.10) and (2.11)) can be be solved analytically. It is well known (and you may verify) that the solution to Eq. (2.10) is of the form 9(t) = A. sin(f (g/L) 1/2 + B.cos(t(g/L)1/2), where the constants A and B are determined from the initial conditions, $(0) and <9(1)(0). This solution implies that 9(t) oscillates about the equilibrium point 0=0. However, the solution to Eq. (2.11) is of the form 0(0 = C. exp(?(g/L)'/ 2 ), where C is a constant, which indicates an exponentially increasing 0(0 if </>(0) ^ 0. (This nature of the equilibrium point at 9 = JT can be experimen- tally verified by anybody trying to stand on one's head for any length of time!) The comparison of the solutions to the linearized governing equations close to the equilibrium points (Figure 2.4) brings us to an important property of an equilibrium point, called stability. 2.5 2 /Solution to Eq. (2.11) with 0(0) 1.5 1 Solution to Eq. (2.10) with 6(0) = 0.2 0.5 0 -0.5 —1 0.2 0.4 0.6 0.8 Time (s) Figure 2.4 Solutions to the governing differential equation linearized about the two equilibrium points (9 = 0 and 9 = rt) Stability is defined as the ability of a system to approach one of its equilibrium points once displaced from it. We will discuss stability in detail later. Here, suffice it to say that the pendulum is stable about the equilibrium point 9 = 0, but unstable about the equilibrium point 9 = n. While Example 2.2 showed how a nonlinear system can be
  • 33. 18 LINEAR SYSTEMS AND CLASSICAL CONTROL linearized close to its equilibrium points, the following example illustrates how a nonlinear system's description can be transformed into a linear system description through a clever change of coordinates. Example 2.3 Consider a satellite of mass m in an orbit about a planet of mass M (Figure 2.5). The distance of the satellite from the center of the planet is denoted r(r), while its orientation with respect to the planet's equatorial plane is indicated by the angle 0(t), as shown. Assuming there are no gravitational anomalies that cause a departure from Newton's inverse-square law of gravitation, the governing equation of motion of the satellite can be written as r (2) (0 - h2/r(t)3 + k2/r(t)2 = 0 (2.12) where h is the constant angular momentum, given by h = r(f) 2 0 (1) (f) = constant (2.13) and k — GM, with G being the universal gravitational constant. Equation (2.12) represents a nonlinear, second order system. However, since we are usually interested in the path (or the shape of the orbit) of the satellite, given by r(0), rather than its distance from the planet's center as a function of time, r(t), we can transform Eq. (2.12) to the following linear differential equation by using the co-ordinate transformation u(9) = l/r(0): u(2e) + u(0)-k2/h2 = 0 (2.14) Being a linear, second order ordinary differential equation (similar to Eq. (2.10)), Eq. (2.14) is easily solved for w(0), and the solution transformed back to r(0) Figure 2.5 A satellite of mass m in orbit around a planet of mass M at a distance r(f) from the planefs center, and azimuth angle 6(t) from the equatorial plane
  • 34. HOW VALID IS THE ASSUMPTION OF LINEARITY? 19 given by r(6») = (h2/k A(h2 / k2) cos((9 - B)] (2.15) where the constants A and B are determined from r(6} and r ( l ) ( 9 ) specified at given values of 9. Such specifications are called boundary conditions, because they refer to points in space, as opposed to initial conditions when quantities at given instants of time are specified. Equation (2.15) can represent a circle, an ellipse, a parabola, or a hyperbola, depending upon the magnitude of A(h2/k2) (called the eccentricity of the orbit). Note that we could also have linearized Eq. (2.12) about one of its equilibrium points, as we did in Example 2.2. One such equilibrium point is given by r(t) = constant, which represents a circular orbit. Many practical orbit control applications consist of minimizing deviations from a given circular orbit using rocket thrusters to provide radial acceleration (i.e. acceleration along the line joining the satellite and the planet) as an input, u(t), which is based upon the measured deviation from the circular path fed back to an onboard controller, as shown in Figure 2.6. In such a case, the governing differential equation is no longer homogeneous as Eq. (2.12), but has a non-homogeneous forcing term on the right-hand side given by r ( 2 ) (f) - h2/r(t)3 + k2/r(t)2 = u(t] (2.16) Since the deviations from a given circular orbit are usually small, Eq. (2.16) can be suitably linearized about the equilibrium point r(t) = C. (This linearization is left as an exercise for you at the end of the chapter.) Desired Thruster circular Measured radial Acti orbit deviation acceleration ort r(t) = Cf r(t) - C u(t) r(t Orbit Satellite controller _ ' i Figure 2.6 On orbit feedback control system for maintaining a circular orbit of a satellite around a planet Examples 2.2 and 2.3 illustrated how a nonlinear system can be linearized for practical control applications. However, as pointed out earlier, it is not always possible to do so. If a nonlinear system has to be moved from one equilibrium point to another (such as changing the speed or altitude of a cruising airplane), the assumption of linearity that is possible in the close neighborhood of each equilibrium point disappears as we cross the nonlinear region between the equilibrium points. Also, if the motion of a nonlinear system consists of large deviations from an equilibrium point, again the concept of linearity is not valid. Lastly, the characteristics of a nonlinear system may be such that it does not have any equilibrium point about which it can be linearized. The following missile guidance example illustrates such a nonlinear system.
  • 35. 20 LINEAR SYSTEMS AND CLASSICAL CONTROL Example 2.4 Radar or laser-guided missiles used in modern warfare employ a special guidance scheme which aims at flying the missile along a radar or laser beam that is illumi- nating a moving target. The guidance strategy is such that a correcting command signal (input) is provided to the missile if its flight path deviates from the moving beam. For simplicity, let us assume that both the missile and the target are moving in the same plane (Figure 2.7). Although the distance from the beam source to the target, Ri(t), is not known, it is assumed that the angles made by the missile and the target with respect to the beam source, #M(?) and #r(0, are available for precise measurement. In addition, the distance of the missile from the beam source, /?M(0, is also known at each instant. A guidance law provides the following normal acceleration command signal, ac(t), to the missile (2.17) As the missile is usually faster than the target, if the angular deviation #M(O] is made small enough, the missile will intercept the target. The feedback guidance scheme of Eq. (2.17) is called beam-rider guidance, and is shown in Figure 2.8. Altitude " aT(0 * Target Radar or laser ,/ ac(0 beam/ awc(0 Missile Beam Horizon source Figure 2.7 Beam guided missile follows a beam that continuously illuminates a moving target located at distance Rf(f) from the beam source Target's Normal Mi<jsile's angular Angular acceleration angular position deviation command DO sition Guidance ac(0 oM(') ~N to law Missile —»- i Eq.(2.17) Figure 2.8 Beam-rider closed-loop guidance for a missile
  • 36. HOW VALID IS THE ASSUMPTION OF LINEARITY? 21 The beam-rider guidance can be significantly improved in performance if we can measure the angular velocity, 0| t), and the angular acceleration, 0£ (?), of the target. Then the beam's normal acceleration can be determined from the following equation: In such a case, along with ac(t) given by Eq. (2.17), an additional command signal (input) can be provided to the missile in the form of missile's acceleration perpendicular to the beam, a^c(t), given by Since the final objective is to make the missile intercept the target, it must be id), i(2), ensured that 0^(0 = 0r';(0 and 0^(0 = 9?t), even though [0j(0 - 0M(01 may not be exactly zero. (To understand this philosophy, remember how we catch up with a friend's car so that we can chat with her. We accelerate (or decelerate) until our velocity (and acceleration) become identical with our friend's car, then we can talk with her; although the two cars are abreast, they are not exactly in the same position.) Hence, the following command signal for missile's normal acceleration perpendicular to the beam must be provided: The guidance law given by Eq. (2.20) is called command line-of-sight guidance, and its implementation along with the beam-rider guidance is shown in the block diagram of Figure 2.9. It can be seen in Figure 2.9 that while 0r(0 is being fed back, the angular velocity and acceleration of the target, 0| t), and 0j t), respec- tively, are being fed forward to the controller. Hence, similar to the control system of Figure 1.4, additional information about the target is being provided by a feedfor- ward loop to improve the closed-loop performance of the missile guidance system. .(2) Missile's Acceleration angular commands position ac(0, aMc(f) Target's angular position, Figure 2.9 Beam-rider and command line-of-sight guidance for a missile Note that both Eq. (2.17) and Eq. (2.20) are nonlinear in nature, and generally cannot be linearized about an equilibrium point. This example shows that the concept of linearity
  • 37. 22 UNEAR SYSTEMS AND CLASSICAL CONTROL is not always valid. For more information on missile guidance strategies, you may refer to the excellent book by Zarchan [1]. 2.2 Singularity Functions It was mentioned briefly in Chapter 1 that some peculiar, well known input functions are generally applied to test the behavior of an unknown system. A set of such test functions is called singularity Junctions. The singularity functions are important because they can be used as building blocks to construct any arbitrary input function and, by the superposition principle (Eq. (2.3)), the response of a linear system to any arbitrary input can be easily obtained as the linear superposition of responses to singularity functions. The two distinct singularity functions commonly used for determining an unknown system's behavior are the unit impulse and unit step functions. A common property of these functions is that they are continuous in time, except at a given time. Another interesting fact about the singularity functions is that they can be derived from each other by differentiation or integration in time. The unit impulse function (also called the Dime delta function), 8(t — a), is seen in Figure 2.10 to be a very large spike occurring for a very small duration, applied at time t = a, such that the total area under the curve (shaded region) is unity. A unit impulse function can be multiplied by a constant to give a general impulse function (whose area under the curve is not unity). From this description, we recognize an impulse function to be the force one feels when hit by a car - and in all other kinds of impacts. The height of the rectangular pulse in Figure 2.10 is 1/e, whereas its width is s seconds, e being a very small number. In the limit e —> 0, the unit impulse function tends to infinity (i.e. 8(t — a) —>• oo). The unit impulse function shown in Figure 2.10 is an idealization of the actual impulse whose shape is not rectangular, because it takes some time to reach the maximum value, unlike the unit impulse function (which becomes very large instan- taneously). Mathematically, the unit impulse function can be described by the following equations: S(t - a) = 0, foTt (2.21) oo 8(t -a)dt = 1 (2.22) / -00 ls(t-a)dt=l a a+e Figure 2.10 The unit impulse function; a pulse of infinitesimal duration (s) and very large magni- tude (1/e) such that its total area is unity
  • 38. SINGULARITY FUNCTIONS 23 Note that 8(t — a) is discontinuous at t = a. Furthermore, since the unit impulse function is non-zero only in the period a < t < a + e, we can also express Eqs. (2.21) and (2.22) by 8(t -a)dt = 1 (2.23) However, when utilizing the unit impulse function for control applications, Eq. (2.22) is much more useful. In fact, if <$(/ — a) appears inside an integral with infinite integra- tion limits, then such an integral is very easily carried out with the use of Eqs. (2.21) and (2.22). For example, if /(?) is a continuous function, then the well known Mean Value Theorem of integral calculus can be applied to show that / f(t)8(t-a)dt = f ( a ) I 8(t - d)dt = f ( a ) (2.24) JT JT where T < a < T^. Equation (2.24) indicates an important property of the unit impulse function called the sampling property, which allows the time integral of any continuous function f ( t ) weighted by 8(t — a) to be simply equal to the function /(?) evaluated at t = a, provided the limits of integration bracket the time t = a. The unit step function, us(t — a), is shown in Figure 2.11 to be a jump of unit magni- tude at time t = a. It is aptly named, because it resembles a step of a staircase. Like the unit impulse function, the unit step function is also a mathematical idealization, because it is impossible to apply a non-zero input instantaneously. Mathematically, the unit step function can be defined as follows: 0 for t < a 1 for t > a It is clear that us(t — a) is discontinuous at t = a, and its time derivative at t — a is infinite. Recalling from Figure 2.10 that in the limit e -* 0, the unit impulse function tends to infinity (i.e. 8(t — a) -» oo), we can express the unit impulse function, 8(t — a), as the time derivative of the unit step function, us(t — a), at time t = a. Also, since the time derivative of us(t — a) is zero at all times, except at t = a (where it is infinite), we can write 8(t-a)=dus(t-a)/dt (2.26) 1- 0 a t Figure 2.11 The unit step function, us(t — a); a jump of unit magnitude at time t = a
  • 39. 24 UNEAR SYSTEMS AND CLASSICAL CONTROL r(t-a) 0 a Figure 2.12 The unit ramp function; a ramp of unit slope applied at time t = a Or, conversely, the unit step function is the time integral of the unit impulse function, given by us(t-a)=f 8(T-a)dr (2.27) J-oc A useful function related to the unit step function is the unit ramp function, r(t — a ) , which is seen in Figure 2.12 to be a ramp of unit slope applied at time t = a. It is like an upslope of 45° angle you suddenly encounter while driving down a perfectly flat highway at t = a. Mathematically, r(t — a) is given by r(t - a) = ; v . "" ' — (2.28) [ ( t -a) for t > a Note that r(t — a) is continuous everywhere, but its slope is discontinuous at t = a. Comparing Eq. (2.28) with Eq. (2.25), it is clear that r(t - a) = (t - a)us(t - a) (2.29) or r(t-a)=S us(r-a)dT (2.30) J-oc Thus, the unit ramp function is the time integral of the unit step function, or conversely, the unit step function is the time derivative of the unit ramp function, given by us(t-a} =dr(t~a)/dt (2.31) The basic singularity functions (unit impulse and step), and their relatives (unit ramp function) can be used to synthesize more complicated functions, as illustrated by the following examples. Example 2.5 The rectangular pulse function, f(t), shown in Figure 2.13, can be expressed by subtracting one step function from another as /(O = fo(us(t + 772) - us(t - 7/2)1 (2.32)
  • 40. SINGULARITY FUNCTIONS 25 -t -TI2 0 -772 t Figure 2.13 The rectangular pulse function of magnitude f0 Example 2.6 The decaying exponential function, /(/) (Figure 2.14) is zero before t = 0, and decays exponentially from a magnitude of f0 at t = 0. It can be expressed by multiplying the unit step function with f() and a decaying exponential term, given by = f0e~t/rus(t) (2.33) -t 0 t Figure 2.14 The decaying exponential function of magnitude f0 Example 2.7 The sawtooth pulse function, f ( t ) , shown in Figure 2.15, can be expressed in terms of the unit step and unit ramp functions as follows: /(f) - (fo/T)[r(t) - r(t - f0us(t - T) (2.34) fn- Slope = 0 T t Figure 2.15 The sawtooth pulse of height f0 and width T After going through Examples 2.5-2.7, and with a little practice, you can decide merely by looking at a given function how to synthesize it using the singularity functions. The unit impulse function has a special place among the singularity functions, because it can be
  • 41. 26 LINEAR SYSTEMS AND CLASSICAL CONTROL f(r)- Area = f (r)Ar Figure 2.16 Any arbitrary function, f(t), can be represented by summing up unit impulse functions, 8(t — T) applied at t = r and multiplied by the area f(r) Ar for all values of r from —oo to t used to describe any arbitrary shaped function as a sum of suitably scaled unit impulses, S(t — a), applied at appropriate time, t = a. This fact is illustrated in Figure 2.16, where the function f ( t ) is represented by - r) (2.35) or, in the limit Ar —>• 0, =/: f(r)S(t-r)dr Equation (2.36) is one of the most important equations of modern control theory, (2.36) because it lets us evaluate the response of a linear system to any arbitrary input, /(/), by the use of the superposition principle. We will see how this is done when we discuss the response to singularity functions in Section 2.5. While the singularity functions and their relatives are useful as test inputs for studying the behavior of control systems, we can also apply some well known continuous time functions as inputs to a control system. Examples of continuous time test functions are the harmonic functions sin(o>f) and cos(<wf)» where o) is a frequency, called the excitation frequency. As an alternative to singularity inputs (which are often difficult to apply in practical cases), measuring the output of a linear system to harmonic inputs gives essential information about the system's behavior, which can be used to construct a model of the system that will be useful in designing a control system. We shall study next how such a model can be obtained. 2.3 Frequency Response Frequency response is related to the steady-state response of a system when a harmonic junction is applied as the input. Recall from Section 1.2 that steady-state response is the linear system's output after the transient response has decayed to zero. Of course, the requirement that the transient response should have decayed to zero after some time calls for the linear system to be stable. (An unstable system will have a transient response shooting to infinite magnitudes, irrespective of what input is applied.) The steady-state
  • 42. FREQUENCY RESPONSE 27 response of a linear system is generally of the same shape as that of the applied input, e.g. a step input applied to a linear, stable system yields a steady-state output which is also a step function. Similarly, the steady-state response of a linear, stable system to a harmonic input is also harmonic. Studying a linear system's characteristics based upon the steady-state response to harmonic inputs constitutes a range of classical control methods called the frequency response methods. Such methods formed the backbone of the classical control theory developed between 1 900-60, because the modern state-space methods (to be discussed in Chapter 3) were unavailable then to give the response of a linear system to any arbitrary input directly in the time domain (i.e. as a function of time). Modern control techniques still employ frequency response methods to shed light on some important characteristics of an unknown control system, such as the robustness of multi-variable (i.e. multi-input, multi-output) systems. For these reasons, we will discuss frequency response methods here. A simple choice of the harmonic input, u(t can be u(t) = u()cos(cot) or u(t) = u0sin(a)t) (2.37) where u0 is the constant amplitude and CD is the frequency of excitation (sometimes called the driving frequency). If we choose to write the input (and output) of a linear system as complex functions, the governing differential equation can be replaced by complex algebraic equations. This is an advantage, because complex algebra is easier to deal with than differential equations. Furthermore, there is a vast factory of analytical machinery for dealing with complex functions, as we will sample later in this chapter. For these powerful reasons, let us express the harmonic input in the complex space as u(t) = u(!Qlwt (2.38) where / — /^T (a purely imaginary quantity), and e/a" = cos(a>f ) 4- i sin (art) (2.39) Equation (2.39) is a complex representation in which cos(a>t ) is called the real part of Ql(at and sin(cot) is called the imaginary part of &laj! (because it is multiplied by the imaginary number i). The complex space representation of the harmonic input given by Eq. (2.38) is shown in Figure 2.17. The two axes of the complex plane are called the real Imaginary axis u0 cos(o>0 Real axis Figure 2.17 Complex space representation of a harmonic input, u(0
  • 43. 28_ LINEAR SYSTEMS AND CLASSICAL CONTROL _ and imaginary axis, respectively, as shown. Hence, complex space representation of a harmonic function is a device of representing both the possibilities of a simple harmonic input, namely M O COS(<W/) and M 0 sin(<wf), respectively, in one expression. By obtaining a steady-state response to the complex input given by Eq. (2.38), we will be obtaining simultaneously the steady-state responses of a linear, stable system to M O COS(O>/) and When you studied solution to ordinary differential equations, you learnt that their solu- tion consists of two parts - the complimentary solution (or the solution to the unforced differential equation (Eq. (2.7)), and a particular solution which depends upon the input. While the transient response of a linear, stable system is largely described by the compli- mentary solution, the steady-state response is the same as the particular solution at large times. The particular solution is of the same form as the input, and must by itself satisfy the differential equation. Hence, you can verify that the steady-state responses to u(t) = u0cos(a)t) and u(t) = M 0 sin(<wr), are given by v J5 (r) = y0cos(a>t) and yss(t) = y0 sin(<wr), respectively (where y0 is the amplitude of the resulting harmonic, steady-state output, yss(t)} by plugging the corresponding expressions of u(t) and yjs(0 into Eq. (2.4), which represents a general linear system. You will see that the equation is satisfied in each case. In the complex space, we can write the steady-state response to harmonic input as follows: (2.40) Here, the steady-state response amplitude, v0, is a complex function of the frequency of excitation, a). We will shortly see the implications of a complex response amplitude. Consider a linear, lumped parameter, control system governed by Eq. (2.4) which can be re-written as follows D}{yss(t)} = D2{u(t)} (2.41) where £>i{-} and D2{-} are differential operators (i.e. they operate on the steady-state output, y55(0, and the input, u(t}, respectively, by differentiating them), given by (2.42) and D2{-} = bmdm/dtm + bm-idm-l/dtm-* + ••• + bid/dt + bo (2.43) Then noting that ' = [(ia>Yandn/dtn + (ia>)n-lan-id"-} /dtn~l +••• + (ico)aid/dt (2.44) and ' wf ) = [(iw}mbmdm/dtm + (ia>r~lbm-idm-*/dtm-1 +••• + (ia>)bd/dt + b0]eia>l (2.45) we can write, using Eq. (2.41), y0(ia)) = G(ia>)u0 (2.46)
  • 44. FREQUENCY RESPONSE 29 where G(ia>) is called the frequency response of the system, and is given by G(ia>) = [(ico)mbm + (/W~X-i + • • • + (iw)fci + b0]/[(ia))nan + (ic0)n-lan-i +••• + (ico)a{ + a(>] (2,47) Needless to say, the frequency response G(ia>) is also a complex quantity, consisting of both real and imaginary parts. Equations (2.46) and (2.47) describe how the steady-state output of a linear system is related to its input through the frequency response, G(ico). Instead of the real and imaginary parts, an alternative description of a complex quantity is in terms of its magnitude and the phase, which can be thought of as a vector's length and direction, respectively. Representation of a complex quantity as a vector in the complex space is called a phasor. The length of the phasor in the complex space is called its magnitude, while the angle made by the phasor with the real axis is called its phase. The magnitude of a phasor represents the amplitude of a harmonic function, while the phase determines the value of the function at t = 0. The phasor description of the steady-state output amplitude is given by y0(ia>) = ya(ia>)eia(ta> (2.48) where y0(ico) is the magnitude and ct(a)) is the phase of y()(ico). It is easy to see that y0(ia)) = [real {y0(ico)}2 + imag {y0(ia))}2]l/2; a(co} = tan"1 [imag {y«(M}/real [y0(ia))}] (2.49) where real{-} and imag{-} denote the real and imaginary parts of a complex number. We can also express the frequency response, G(ia>), in terms of its magnitude, |G (/&>)), and phase, 0(o>), as follows: |G(/a>)|e' 0M (2.50) Substituting Eqs. (2.48) and (2.50) into Eq. (2.46), it is clear that y0(ia)) = G(ia))u(/ and a(a>) = <^>(co). Hence, the steady-state response of a linear system excited by a harmonic input of amplitude u0 and zero phase (u0 = wf,e'°) is given through Eq. (2.40) by yss(t) = y0(ia>)eia>t = G(io))u0ei<t>(w)Qi(at = G(ico)u0ei[ct>t+ct>{w)] (2.51) Thus, the steady-state response to a zero phase harmonic input acquires its phase from the frequency response, which is purely a characteristic of the linear system. You can easily show that if the harmonic input has a non-zero phase, then the phase of the steady-state response is the sum of the input phase and the phase of the frequency response, 0(co). The phasor representation of the steady-state response amplitude is depicted in Figure 2.18. From Eq. (2.51), it is clear that the steady-state response is governed by the amplitude of the harmonic input, u0, and magnitude and phase of the frequency response, G (/&>), which represent the characteristics of the system, and are functions of the frequency of excitation. If we excite the system at various frequencies, and measure the magnitude and phase of the steady-state response, we could obtain G(ito) using Eq. (2.51), and conse- quently, crucial information about the system's characteristics (such as the coefficients a/,
  • 45. 30 LINEAR SYSTEMS AND CLASSICAL CONTROL Imaginary ,, axis Figure 2.18 Phaser representations of a harmonic input, u(f), with zero phase and amplitude UQ, and steady-state response amplitude, yo(/<w), °f a linear system with frequency response, G(ia>) and bk, in Eq. (2.47)). In general, we would require G(ico) at as many frequencies as are the number of unknowns, ak and bk, in Eq. (2.47). Conversely, if we know a system's parameters, we can study some of its properties, such as stability and robustness, using frequency response plots (as discussed later in this chapter). Therefore, plots of magnitude and phase of G(/w) with frequency, CD, serve as important tools in the analysis and design of control systems. Alternatively, we could derive the same information as obtained from the magnitude and phase plots of G(i(o) from the path traced by the tip of the frequency response phasor in the complex space as the frequency of excitation is varied. Such a plot of G(ico) in the complex space is called a polar plot (since it represents G(ico) in terms of the polar coordinates, G(ico) and 0(<w)). Polar plots have an advantage over the frequency plots of magnitude and phase in that both magnitude and phase can be seen in one (rather than two) plots. Referring to Figure 2.18, it is easily seen that a phase (j)(u>} = 0° corresponds to the real part of G(/&>), while the phase 0(o>) = 90° corresponds to the imaginary part of G (/&>). When talking about stability and robustness properties, we will refer again to the polar plot. Since the range of frequencies required to study a linear system is usually very large, it is often useful to plot the magnitude, |G(i<w)|, and phase, <J>(co), with respect to the frequency, co, on a logarithmic scale of frequency, called Bode plots. In Bode plots, the magnitude is usually converted to gain in decibels (dB) by taking the logarithm of |G(i<w)| to the base 10, and multiplying the result with 20 as follows: = 201og, 0 |G(ia>)| (2.52) As we will see later in this chapter, important information about a linear, single-input, single-output system's behavior (such as stability and robustness) can be obtained from the Bode plots, which serve as a cornerstone of classical control design techniques. Factoring the polynomials in G(/<w) (Eq. (2.47)) just produces addition of terms in Iog10 G(ico), which enables us to construct Bode plots by log-paper and pencil. Despite this, Bode plots are cumbersome to construct by hand. With the availability of personal computers and software with mathematical functions and graphics capability - such as MATLAB - Bode plots can be plotted quite easily. In MATLAB, all you have to do is
  • 46. FREQUENCY RESPONSE 31 specify a set of frequencies, a), at which the gain and phase plots are desired, and use the intrinsic functions abs and angle which calculate the magnitude and phase (in radians), respectively, of a complex number. If you have the MATLAB's Control System Toolbox (CST), the task of obtaining a Bode plot becomes even simpler through the use of the command bode as follows: »G=tf(num,den); bode(G,w) <enter> %a Bode plot will appear on the screen Here » is the MATLAB prompt, <enter> denotes the pressing of the 'enter' (or 'return') key, and the % sign indicates that everything to its right is a comment. In the bode command, w is the specified frequency vector consisting of equally spaced frequency values at which the gain and phase are desired, G is the name given to the frequency response of the linear, time-invariant system created using the CST LTI object function tf which requires num. and den as the vectors containing the coefficients of numerator and denominator polynomials, respectively, of G(/o>) in (Eq. (2.47)) in decreasing powers of s. These coefficients should be be specified as follows, before using the tf and bode commands: »num=[bm b m _i ... bol; den=[a n a n -i ... a 0 ] ; <enter> By using the MATLAB command logspace, the w vector can also be pre-specified as follows: »w=logspace(-2,3); <enter> %w consists of equally spaced frequencies in the range 0.01-1000 rad/s. (Using a semicolon after a MATLAB command suppresses the print-out of the result on the screen.) Obviously, u; must be specified before you use the bode command. If you don't specify w, MATLAB will automatically generate an appropriate w vector, and create the plot. Instead of plotting the Bode plot, you may like to store the magnitude (mag), G(ico), and the phase, <£(&>), at given set of frequencies, w, for further processing by using the following MATLAB command: » [ m a g , p h a s e j w ] = b o d e ( n u m , d e n , w ) ; <enter> For more information about Bode plots, do the following: »help bode <enter> The same procedure can be used to get help on any other MATLAB command. The example given below will illustrate what Bode plots look like. Before we do that, let us try to understand in physical terms what a frequency response (given by the Bode plot) is. Musical notes produced by a guitar are related to its frequency response. The guitar player makes each string vibrate at a particular frequency, and the notes produced by the various strings are the measure of whether the guitar is being played well or not. Each string of the guitar is capable of being excited at many frequencies, depending upon where
  • 47. 32 UNEAR SYSTEMS AND CLASSICAL CONTROL the string is struck, and where it is held. Just like the guitar, any system can be excited at a set of frequencies. When we use the word excited, it is quite in the literal sense, because it denotes the condition (called resonance) when the magnitude of the frequency response, |G(/o>)|, becomes very large, or infinite. The frequencies at which a system can be excited are called its natural (or resonant) frequencies. High pitched voice of many a diva has shattered the opera-house window panes while accidently singing at one of the natural frequencies of the window! If a system contains energy dissipative processes (called damping), the frequency response magnitude at natural frequencies is large, but finite. An undamped system, however, has infinite response at each natural frequency. A natural frequency is indicated by a peak in the gain plot, or as the frequency where the phase changes by 180°. A practical limitation of Bode plots is that they show only an inter- polation of the gain and phase through selected frequency points. The frequencies where G(i(o) becomes zero or infinite are excluded from the gain plot (since logarithm of zero is undefined, and an infinite gain cannot be shown on any scale). Instead, only frequency points located close to the zero magnitude frequency and the infinite gain frequencies of the system can be used in the gain plot. Thus, the Bode gain plot for a guitar will consist of several peaks, corresponding to the natural frequencies of the notes being struck. One could determine from the peaks the approximate values of the natural frequencies. Example 2.8 Consider the electrical network shown in Figure 2.19 consisting of three resistances, /?i, /?2, and /?3, a capacitor, C, and an inductor, L, connected to a voltage source, e(t), and a switch, 5. When the switch, 5, is closed at time t = 0, the current passing through the resistance R is i'i(f), and that passing through the inductor, L, is /2(0- The input to the system is the applied voltage, e(t), and the output is the current, /2(0- The two governing equations of the network are - 12(01 (2.53) 0 = #2*2(0 + #3[*2(0 - i'i(01 + Li + (I/O f: (r)dr i2 (2.54) Jo :± e(f) Figure 2.19 Electrical network for Example 2.8
  • 48. FREQUENCY RESPONSE 33 Differentiating Eq. (2.54) and eliminating i ( t ) , we can write L/f(t) + [(R{R3 + fl,/?2 + /?2 "(0 (2.55) Comparing Eq. (2.55) with Eq. (2.4) we find that the system is linear and of second order, with y(t) = i 2 ( t ) , u(t) = e(t), aQ = l/C, a = (R[R3 + RR2 + R2R3)/(R} + R3), bo - 0, and b - R3/(R + R3). Hence, from Eq. (2.47), the frequency response of the system is given by For RI = R3 = 10 ohms, R2 = 25 ohms, L = 1 henry, and C = 10~6 farad, the frequency response is the following: x""1 /* G(i(jo) = (j.5(i(t))/[(i(jL>) / A C / * /F/ * 2 + 30(jco) + 10 I i O f f ' t 1 /~D T (2.57) / ^ £5 ""7 Bode gain and phase plots of frequency response given by Eq. (2.57) can be plotted in Figure 2.20 using the following MATLAB commands: »w=logspace(-1,4); <enter> (This command produces equally spaced frequency points on logarithmic scale from 0.1 to 10000 rad/s, and stores them in the vector w.) »G=i*w*0.5. / ( - w . *w+30*i*w+1e6); <enter> CO 10 102 103 104 Frequency (rad/sec) 90 -90 101 102 103 104 Frequency (rad/sec) Figure 2.20 Bode plot for the electrical network in Example 2.8; a peak in the gain plot and the corresponding phase change of 180° denotes the natural frequency of the system
  • 49. 34 LINEAR SYSTEMS AND CLASSICAL CONTROL (This command calculates the value of G(/o>) by Eq. (2.57) at each of the speci- fied frequency points in w, and stores them in the vector G. Note the MATLAB operations.* and ./ which allow element by element multiplication and division, respectively, of two arrays (see Appendix B).) »gain=20*loglO(abs(G)) ; phase=180*angle(G)/pi; <enter> (This command calculates the gain and phase of G(io>) at each frequency point in w using the MATLAB intrinsic functions abs, angle, and loglO, and stores them in the vectors gain and phase, respectively. We are assuming, however, that G does not become zero or infinite at any of the frequencies contained in if.) »subplot(211 ) , semilogx(w,gain) , grid, subplot(212) , semilogx(w,phase) , grid <enter> (This command produces gain and phase Bode plots as two (unlabeled) subplots, as shown in Figure 2.20. Labels for the axes can be added using the MATLAB commands xlabel and y label.) The Bode plots shown in Figure 2.20 are obtained much more easily through the Control System Toolbox (CST) command bode as follows: »num=[0.5 0]; den=[1 30 Ie6]; g=tf (num,den) , bode(g,w) <enter> Note the peak in the gain plot of Figure 2.20 at the frequency, o> = 1000 rad/s. At the same frequency the phase changes by 180°. Hence, u> = 1000 rad/s is the system's natural frequency. To verify whether this is the exact natural frequency, we can rationalize the denominator in Eq. (2.57) (i.e. make it a real number by multiplying both numerator and denominator by a suitable complex factor - in this case (— a>2 + 106) — 30/o> and express the magnitude and phase as follows: G(ia>) = [225o>4 + 0.25w2(-ft>2 + 106)2]1/2/[(-^2 + 106)2 0(o>) = tan~' (-(o2 + 106)/(30co) (2.58) From Eq. (2.58), it is clear that |G(/<w)| has a maximum value (0.0167 or -35.547 dB) - and </>(<*>) jumps by 180° - at co = 1000 rad/s. Hence, the natural frequency is exactly 1000 rad/s. Figure 2.20 also shows that the gain at CD = 0.1 rad/s is -150 dB, which corresponds to |G(0.1/)| = 10~75 = 3.1623 x 10~8, a small number. Equation (2.58) indicates that |G(0)| =0. Hence, CD = 0.1 rad/s approximates quite well the zero-frequency gain (called the DC gain) of the system. The frequency response is used to define a linear system's property called bandwidth defined as the range of frequencies from zero up to the frequency, <Wb, where |G(/o>b)| = 0.707|G(0)|. Examining the numerator of |G(/w)| in Eq. (2.58), we see that |G(/o>)| vanishes at CD = 0 and a> = 1999 100 rad/s (the numerator roots can be obtained using the MATLAB intrinsic function roots). Since |G(0)| =0, the present system's bandwidth is 0% = 1999 100 rad/s (which lies beyond the frequency range of Figure 2.20). Since the degree of the denominator polynomial of G(iu>) in Eq. (2.47) is greater than that of the numerator polynomial, it follows
  • 50. FREQUENCY RESPONSE 35 that G(ico) -> 0 as a> -> oo. Linear systems with G(ico) having a higher degree denominator polynomial (than the numerator polynomial) in Eq. (2.47) are called strictly proper systems. Equation (2.58) also shows that 0(<w) -» 90° as co —> 0, and 0(<w) —> —90° as co —> oo. For a general system, $(&>) -> —£90° as a> -> oo, where k is the number by which the degree of the denominator polynomial of G(ico) exceeds that of the numerator polynomial (in the present example, k = 1). Let us now draw a polar plot of G(ico) as follows (note that we need more frequency points close to the natural frequency for a smooth polar plot, because of the 180° phase jump at the natural frequency): »w=[logspace(-1,2.5) 350:2:1500 logspace(3.18,5)]; <enter> (This command creates a frequency vector, w, with more frequency points close to 1000 rad/s.) »G=i*w*0.5. / ( - w . *w+30*i*w+1e6); <enter> »polar(angle(G), a b s ( G ) ) ; <enter> (This command for generating a polar plot requires phase angles in radians, but the plot shows the phase in degrees.) The resulting polar plot is shown in Figure 2.21. The plot is in polar coordinates, G(ia)) and 0(&>), with circles of constant radius, G(i(o), and radial lines of constant 0 (&>) overlaid on the plot. Conventionally, polar plots show either all posi- tive, or all negative phase angles. In the present plot, the negative phase angles have been shown as positive angles using the transformation 0 -> (<p + 360°), which is acceptable since both sine and cosine functions are invariant under this transfor- mation for 4> < 0 (e.g. 0 = —90° is the same as 0 = 270°). Note that the 0° and 120°.,- | ' =0.018 180 210 240°"--- ! •• 300° 270° Figure 2.21 Polar plot of the frequency response, G(/&>), of the electrical system of Example 2.8
  • 51. 36 LINEAR SYSTEMS AND CLASSICAL CONTROL 90° radial lines represent the real and imaginary parts, respectively, of G(ico). The polar curve is seen in Figure 2.21 to be a circle of radius 0.00835 centered at the point 0.00835 on the real axis. The direction of increasing CD is shown by arrows on the polar curve. The shape and direction (with increasing o>) of a polar plot gives valuable insight about a linear system's stability, which will be seen in Section 2.10. 2,4 Laplace Transform and the Transfer Function In the previous section we had confined our attention to the steady-state response of a linear system to harmonic inputs. Here we would like to consider the total response (both transient and steady-state) of a linear, single-input, single-output system when the applied input is some arbitrary function of time. We saw how the representation of a harmonic input by a complex function transformed the governing differential equations into a complex algebraic expression for the frequency response. For a general input, a similar complex expression can be obtained by applying the Laplace transformation (denoted by £) to the input, u(t), defined as -L = £u(t)= I e~stu(t)dt where 5 denotes the Laplace variable (a complex number), and U(s) is called the Laplace (2.59) transform of u(t). The Laplace transform of a function u(t) is defined only if the infinite integral in Eq. (2.59) exists, and converges to a functional form, U(s). However, if U(s) exists, then it is unique. The convergence of the Laplace integral depends solely upon the shape of the function, u(t). It can be shown rigourously that the Laplace integral converges only if u(t) is piecewise continuous (i.e. any time interval, however large, can be broken up into a finite number of sub-intervals over each of which u(t) is continuous, and at the ends of each sub-interval, u(t) is finite) and bounded by an exponential (i.e. there exists a constant a such that e~atu(t) is bounded at all times). The term bounded implies that a function's value lies between two finite limits. Most of the commonly used input functions are Laplace transformable. For example, if u(t), is discontinuous (i.e. it has a jump) at t = 0, such as u(t) = 8(t) or u(t) = us(t), we can obtain its Laplace transform. In such a case, the lower limit of integration in Eq. (2.59) is understood to be just before t = 0, i.e. just prior to the discontinuity in u(t). Some important properties of the Laplace transform are stated below, and you may verify each of them using the definition given by Eq. (2.59): (a) Linearity: If a is a constant (or independent of s and f) and £ f ( t ) = F(s), then £{af(t)} = a£f(t) = aF(s) (2.60) Also, if £fi(t) = F,(s) and £/2(0 = F2(s), then F2(s) (2.61)
  • 52. _ LAPLACE TRANSFORM AND THE TRANSFER FUNCTION_ 37 (b) Complex differentiation: If £ f ( t ) = F ( s ) , then £{tf(t)} = -dF(s)/ds (2.62) (c) Complex integration: If £ f ( t ) = F(s), and if lirn^o f ( t ) / t exists as t = 0 is approached from the positive side, then CO F(s)ds (2.63) / (d) Translation in time: If £ f ( t ) = F ( s ) , and a is a positive, real number such that f ( t — a) = 0 for 0 < t < a, then £f(t -a) = e-asF(s) (2.64) (e) Translation in Laplace domain: If £ f ( t ) = F(s), and a is a complex number, then (2.65) (f) Real differentiation: If £ f ( t ) = F(s), and if /(1)(0 is Laplace transformable, then £f([)(t)=sF(s)-f(0+) (2.66) where /(0 + ) denotes the value of f ( t ) in the limit t —> 0, approaching t = 0 from the positive side. If we apply the real differentiation property successively to the higher order time derivatives of f ( t ) (assuming they are Laplace transformable), we can write the Laplace transform of the kth derivative, f ^ k ) ( t ) , as follows: £f(kt} = skF(s) - sk~]f(0+) - j*-2/(1)(0+) ----- /(*-1}(0+) (2.67) (g) Real integration: If £ f ( t ) — F(s), and the indefinite integral f f ( t ) d t is Laplace transformable, then I f(t)dt=F(s)/s +( l / s } { f(t)dt (2.68) I-/ J -oc Note that the integral term on the right-hand side of Eq. (2.68) is zero if /(/) = 0 for t < 0. (h) Initial value theorem: If £ f ( t ) = F ( s ) , /(1)(0 is Laplace transformable, and lirn^oosFCs1) exists, then /(0 + )=lim s ^ 0 0 5F(5) (2.69) (i) Final value theorem: If £f(t) = F(s), /(1)(0 is Laplace transformable, and lim^oo/X/) = /(oo) exists, then (2.70)
  • 53. 38_ UNEAR SYSTEMS AND CLASSICAL CONTROL _ Since we are usually dealing with positive values of time, we will replace 0+ by 0 in all relevant applications of the Laplace transform. It is easy to see that if the input, n(r ), and its time derivatives are Laplace transformable, then the differential equation (Eq. (2.4)) of a linear, time-invariant system is Laplace transformable, which implies that the output, y(t), is also Laplace transformable, whose Laplace transform is Y(s). For simplicity, we assume that all initial conditions for the input, u ( t ) , and its derivatives and the output, y(t), and its derivatives are zeros. Then, using Eq. (2.67) we can transform the governing equation of the system (Eq. (2.4)) to the Laplace domain as follows: (snan + s^On-i + • • • + sai + a0)Y(s) = (smbm + ^'X-i + • • • + sb, + b0)U(s) (2.71) Equation (2.71) brings us to one of the most important concepts in control theory, namely the transfer Junction, G(s), which is defined as the ratio of the Laplace transform of the output, Y(s), and that of the input, U(s), given by G(5) = Y(s)/U(s) (2.72) Substituting Eq. (2.71) into (2.72), we obtain the following expression for the transfer function of a linear, single-input, single-output system: G(s) = (smbm + sm-bm-i + • • • + sfci + b0)l(snan + s"-an-i + • • • + sai + a0) (2.73) As we saw in Chapter 1, the transfer function, G(s), represents how an input, U(s), is transferred to the output, Y(s), or, in other words, the relationship between the input and output, when the initial conditions are zero. The transfer function representation of a system is widely used in block diagrams, such as Figure 2.22, and is very useful for even such systems for which the governing differential equations are not available. For such unknown systems, the transfer function is like a black-box defining the system's characteristics. By applying known inputs (such as the singularity functions or harmonic signals) and measuring the output, one can determine an unknown system's transfer function experimentally. To do so, we have to see what are the relationships between the transfer function and the responses to singularity functions, and between the transfer function and the frequency response. The latter relationship is easily obtained by comparing Eq. (2.73) defining the transfer function, G(s), with Eq. (2.47), which defines the frequency response, G(itw). We see that the two quantities can be obtained from one another by using the relationship s = ia> (that is the reason why we knowingly used the same symbol, G(-), for both transfer function and the frequency response). A special transform, called the Fourier transform, can be defined by substituting s = ia) in the definition of the Laplace transform (Eq. (2.59). Fourier transform is widely used as a method of calculating the Input, U(s) Output, Y(s) Transfer function G(s) = Y(s)/U(s) Figure 2.22 Transfer function representation of a single-input, single-output system
  • 54. LAPLACE TRANSFORM AND THE TRANSFER FUNCTION 39 response of linear systems to arbitrary inputs by transforming an arbitrary input, u(t), to its frequency domain counterpart, U(ico) as follows: U(ico) = f e~ia"u(t)dt (2.74) k (The lower limit of integration in Eq. (2.74) is replaced by —oo if u(t) ^ 0 for t < 0.) Then, from Eq. (2.72), we can determine the resulting output (assuming zero initial conditions) in the frequency domain as Y(iu>) = G(ia))U(ia)) (where G(ico) is the pre- determined frequency response), and apply the inverse Fourier transform to obtain the output in the time-domain as follows: y ( t ) = I/(27i) I ziMlY(io))dto (2.75) Note that in Eqs. (2.74) and (2.75), the Fourier transforms of the input and the output, U(iaj) and Y(ia>), do not have any physical significance, and in this respect they are similar to the Laplace transforms, U(s) and Y(s). However, the frequency response, G(/&>), is related to the steady-state response to harmonic input (as seen in Section 2.3), and can be experimentally measured. The transfer function, G(s), however, is a useful mathematical abstraction, and cannot be experimentally measured in the Laplace domain. The Laplace variable, s, is a complex quantity, s = a ± ico, whose real part, a, denotes whether the amplitude of the input (or output) is increasing or decreasing with time. We can grasp this fact by applying the inverse Laplace transform, £~l (i.e. going from the Laplace domain to the time domain) to Eq. (2.59) /' Ja~ Y(s)estds (2.76) where the integral is performed along an infinitely long line, parallel to the imaginary axis with a constant real part, a (Figure 2.23). Note that inverse Laplace transform- is possible, because Y(s) (if it exists) is unique. Imaginary axis S = (7+1(0 Real axis Figure 2.23 The Laplace domain
  • 55. 40 UNEAR SYSTEMS AND CLASSICAL CONTROL From Eq. (2.76) we can see that a general output, y(t), will consist of such terms as yoe4' (where yo is a constant}, which can be expressed as >>oea'e±lco'. The latter term indicates a periodically changing quantity of frequency, CD, whose amplitude is a function of time given by y$zat. When dealing with non-harmonic inputs and outputs, the use of the Laplace transform and the transfer function, G(s), is more rewarding than working with the Fourier transform and the frequency response, G(/o>), because the resulting algebraic expressions are much simpler through the use of s rather than (ico). However, use of G(s) involves interpreting system characteristics from complex (rather than purely imaginary) numbers. The roots of the numerator and denominator polynomials of the transfer function, G(s), given by Eq. (2.73) represent the characteristics of the linear, time-invariant system. The denominator polynomial of the transfer function, G(s), equated to zero is called the characteristic equation of the system, given by s"an+sn-[an-i+--- + sal+OQ = Q (2.77) The roots of the characteristic equation are called the poles of the system. The roots of the numerator polynomial of G(s) equated to zero are called the zeros of the transfer function, given by smbm + s m ~X-i + • • • + sb} + b0 = 0 (2.78) In terms of its poles and zeros, a transfer function can be represented as a ratio of factorized numerator and denominator polynomials, given by the following rational expression: G(s) = K(s - z ) ( s - z 2 ) . . . (s - zm)/[(s - p ) ( s - p2)... (s - p,,)] m n = K Y[(s - z/)/ Y[(s - PJ) (2.79) i=i j=i where K is a constant (sometimes referred to as the gain), zi(i = 1, 2 , . . . , m) and pj(j = 1, 2 , . . . , n) are the zeros and poles of the system, respectively, and n is a short-hand notation denoting a product of many terms (in the same manner as I! denotes a summation of many terms). Equation (2.79) is also called zero-pole-gain description of a linear, time- invariant system, which can be modeled by the MATLAB Control System Toolbox's (CST) LTI object, zpk. As in Eq. (2.1), we repeat that for most linear, time-invariant systems m < n. Such systems are said to be proper. If m < n, the system is said to be strictly proper. Also, note that some zeros, z,, and poles, PJ, may be repeated (i.e. two or more poles (or zeros) having identical values). Such a pole (or zero) is said to be multiple, and its degree of multiplicity is defined as the number of times it occurs. Finally, it may happen for some systems that a pole has the same value as a zero (i.e. PJ = Zj for some pair (1,7)). Then the transfer function representation of Eq. (2.79) will not contain those poles and zeros, because they have canceled each other out. Pole-zero cancelations have a great impact on a system's controllabilty or observability (which will be studied in Chapter 5).
  • 56. LAPLACE TRANSFORM AND THE TRANSFER FUNCTION 41_ Example 2.9 Revisiting the electrical network of Example 2.8, we can write the system's transfer function as G(s) = 0.5s/(s2 + 305 + 106) (2.80) which indicates a zero at the origin (z — 0), and the two complex poles given by the solution of the following quadratic characteristic equation: s2 + 30s + 106 = 0 (2.81) To get a better insight into the characteristics of a system, we can express each quadratic factor (such as that on the left-hand side of Eq. (2.81)) of the denominator polynomial as s2 + 2ga>ns + to2, where a>n is a natural frequency of the system (see Section 2.3), and g is called the damping ratio. The damping ratio, g, governs how rapidly the magnitude of the response of an unforced system decays with time. For a mechanical or electrical system, damping is the property which converts a part of the unforced system's energy to heat, thereby causing the system's energy - and consequently the output - to dissipate with time. Examples of damping are resis- tances in electrical circuits and friction in mechanical systems. From the discussion following Eq. (2.76), it can be seen that g is closely related to the real part, a, of a complex root of the characteristic equation (pole) given by s = a ± icu. The roots of the characteristic equation (or, in other words, the poles of the system) expressed as s2 + 2go)ns +a)2n=0 (2.82) are s = pi= -$un - io>n(g2 - D 1/2 (2.83) and s = P2 = -$*>„ + icon(s2 - l) l / 2 (2.84) Note that the real part of each pole is a — —gu>n, while the imaginary parts are ±o> = ±a)n(g2 — 1)1/2. For the present example, the poles are found by solving Eq. (2.81) to be p^ = —15 ± 999.9*, which implies that the natural frequency and damping-ratio are, u>n = 1000 rad/s and $ = 0.015, respectively. These numbers could also have been obtained by comparing Eq. (2.81) and Eq. (2.82). The natural frequency agrees with our calculation in Example 2.8, which was also observed as a peak in the Bode gain plot of Figure 2.20. The positive damping-ratio (or the negative real part of the complex poles) indicates that the amplitude of the response to any input will decay with time due to the presence of terms such as yQeate±ta)t in the expression for the output, y ( t ) . One can see the dependence of the response, y ( t ) , on the damping-ratio, g, in Figure 2.24, which is a plot of a typical initial response of an unforced second order system, g = 1 is the limiting case, called critical damping, because it denotes the boundary between oscillatory and exponentially decaying response. For 0 < g < 1,
  • 57. 42 LINEAR SYSTEMS AND CLASSICAL CONTROL £ = 1 (critically damped) < 0 (unstable) £ > 1 (overdamped) 0 < £ < 1 (underdamped) Time (0 Figure 2.24 Dependence of the response of a second order system on the damping-ratio, <; the response is oscillatory with amplitude decreasing with time (called the under- damped case}, while for g > 1, the response decays exponentially (called the over- damped case). Clearly, the larger the value of the damping-ratio, g, the faster the response decays to zero. The case for which g < 0 denotes a response with expo- nentially increasing amplitude. A response, y(r), whose limit as t -> oo, either does not exist or is infinite, is called an unbounded response. Clearly, g < 0 case has an unbounded response. As soon as we see a linear system producing an unbounded response to a bounded input (i.e. an input whose finite limit exists as t —* oo) and finite initial conditions, we call the system unstable. A further discussion of stability follows a little later. Locations of poles and zeros in the Laplace domain determine the characteristics of a linear, time-invariant system. Some indication of the locations of a poles and zeros can be obtained from the frequency response, G(icu). Let us go back to Figure 2.20, showing the Bode plots of the electrical system of Examples 2.8 and 2.9. Due to the presence of a zero at the origin (see Eq. (2.80)), there is a phase of 90° and a non-zero (dB) gain at co = 0. The presence of a complex conjugate pair of poles is indicated by a peak in the gain plot and a phase change of 180°. The difference between the number of zeros and poles in a system affects the phase and the slope of the Bode gain plot with frequency (in units of dB per decade of frequency), when the frequency is very large (i.e. in the limit to -> oo). From Eq. (2.79), we can say the following about gain-slope and phase in the high-frequency limit: J{201og10 G(ia))}/da) % 20(w - «) dB/decade I" (m - n)90° if K > 0 <2-85) (m - n)90° - 180° if K < 0
  • 58. LAPLACE TRANSFORM AND THE TRANSFER FUNCTION 43 Note that the expressions in Eq. (2.85) are only approximate. For example, the transfer function in Eq. (2.80) has K = 0.5, m = 1, and n = 2, which implies that the gain-slope and phase in the limit o> -> oo should be —20 dB/decade and —90°, respectively. These values are very good estimates (the phase is exactly —90°) of the frequency response plotted in Figure 2.20. Example 2.10 Consider a linear model describing the longitudinal dynamics of an aircraft (Figure 2.25). Three different output variables (in the Laplace domain) are of interest when the aircraft is displaced from the equilibrium point (defined by a constant angle of attack, O.Q, a constant longitudinal velocity, DO, and a constant pitch-angle, OQ): the change in airspeed, v(s), the change in the angle of attack, a (s), and the change in pitch angle, 0(s). The input variable in the Laplace domain is the elevator angle, d(s). The three transfer functions separately defining the relationship between the input, 5(5), and the three respective outputs, v(s), a(s), and 0(s), are as follows: v(s)/8(s) = -0.0005(5 - 70) (j + 0.5)/[(52 + 0.005s + 0.006)(s2 + s + 1.4)] (2.86) a(s)/8(s) = -0.02(5 + 80) (s2 + 0.0065s + 0.006)/ [(s2 + 0.005s + 0.006)(52 + 5 + 1 .4)] (2.87) 2 2 9(s)/8(s) - -1.4(5 + 0.02) (5 + 0.4)/[(5 + 0.005s + 0.006) (5 + 5 + 1.4)] (2.88) It should be noted that all three transfer functions have the same denominator polynomial, (52 + 0.005s + 0.006) (52 + s + 1.4). Since we know that the denomi- nator polynomial equated to zero denotes the characteristic equation of the system, we can write the characteristic equation for the aircraft's longitudinal dynamics as (52 + 0.005s + 0.006) (s2 + 5 + 1.4) = 0 (2.89) Aircraft's longitudinal Figure 2.25 Longitudinal dynamics of an airplane, with outputs a, 9, and v denoting small changes in angle of attack, pitch angle, and velocity component along longitudinal axis, respec- tively, and input, elevator deflection, S. The equilibrium condition is denoted bya = ^ = v = 5 = 0
  • 59. 44 UNEAR SYSTEMS AND CLASSICAL CONTROL Equation (2.89) indicates that the systems complex poles are given by two quadratic factors (s2 + 0.005s + 0.006) and (s2 + s + 1.4). Comparing the result with that of Example 2.9, where the quadratic factor in the characteristic polynomial was expressed as s2 + 2ga)ns + co2, we can see that here we should expect two values of the natural frequency, &>„, and the damping-ratio, g, i.e. one set of values for each of the two quadratic factors. These values are the following: (a) g = 0.4226; a)n = 1.1832 rad/s (short-period mode) (b) g = 0.0323; atn = 0.0775 rad/s (long-period, or phugoid mode) Using MATLAB's Control System Toolbox (CST) command damp, the damping- ratio and natural frequency associated with each quadratic factor in the characteristic equation can be easily obtained as follows: »a=[1 0.005 0.006]; damp(a) % first quadratic factor <enter> Eigenvalue Damping Freq. (rad/sec) -0.0025+0.0774i 0.0323 0.0775 -0.0025-0.07741 0.0323 0.0775 »b=[1 1 1.4]; damp(b) % second quadratic factor <enter> Eigenvalue Damping Freq. (rad/sec) -0.5000+1.0724i 0.4226 1.1832 -0.5000-1.0724i 0.4226 1.1832 Note that the CST command damp also lists the eigenvalues, which are nothing but the roots of the characteristic polynomial (same as the poles of the system). We will discuss the eigenvalues in Chapter 3. (Alternatively, we could have used the intrinsic MATLAB function roots to get the pole locations as the roots of each quadratic factor.) As expected, the poles for each quadratic factor in the characteristic equation are complex conjugates. Instead of calculating the roots of each quadratic factor separately, we can multiply the two quadratic factors of Eq. (2.89) using the intrinsic MATLAB command conv, and then directly compute the roots of the characteristic polynomial as follows: »damp(conv(a,b))% roots of the characteristic polynomial <enter> Eigenvalue Damping Freq. (rad/sec) -0.0025+0.0774i 0.0323 0.0775 -0.0025-0.0774i 0.0323 0.0775 -0.5000+1.0724i 0.4226 1.1832 -0.5000-1.0724i 0.4226 1.1832 The pair of natural frequencies and damping-ratios denote two natural modes of the system, i.e. the two ways in which one can excite the system. The first mode is highly damped, with a larger natural frequency (1.1832 rad/s), and is called the short-period mode (because the time-period of the oscillation, T = 2n/a),, is
  • 60. LAPIACE TRANSFORM AND THE TRANSFER FUNCTION 45 smaller for this mode). The second characteristic mode is very lightly damped with a smaller natural frequency (0.0775 rad/s) - hence, a longer time-period - and is called the long-period (or phugoid} mode. While an arbitrary input will excite a response containing both of these modes, it is sometimes instructive to study the two modes separately. There are special elevator inputs, 8 (s), which largely excite either one or the other mode at a time. (You may refer to Blakelock [3] for details of longitudinal dynamics and control of aircraft and missiles.) We now examine the Bode plots of each of the three transfer functions, v(s)/8(s), a(s)/8(s), and 6(s)/S(s), respectively, to see how much is each output variable influenced by each of the two characteristic modes. Figures 2.26, 2.27, and 2.28 show the gain and phase Bode plots for the three transfer functions in the limit s = ico (they are the frequency responses of the concerned output variable). Using Control Systems Toolbox (CST), these plots are directly obtained by the command bode, after constructing each transfer function using the LTI object tf. Bode plot of transfer function v ( s ) / B ( s ) (Figure 2.26) is generated using the following MATLAB statements: »a=[1 - 7 0 ] ; b=[1 0 . 5 ] ; num=-0.0005*conv(a,b) <enter> num = -0.0005 0.0348 0.0175 »a=[1 0.005 0.006]; b=[1 1 1.4]; den=conv(a,b) <enter> den = 1.0000 1.0050 1.4110 0.0130 0.0084 Phugoid mode Short-period mode Bode plot of v(s)/6(s) 100 -200 10 10 10° 101 10* 103 Frequency (rad/sec) 180 F CD 8 -180 r -360 I 10 10° 101 102 103 Frequency (rad/sec) Figure 2.26 Bode plot of the aircraft's transfer function v(s)/<5(s) with s = io
  • 61. 46 UNEAR SYSTEMS AND CLASSICAL CONTROL Phugoid mode Short-period mode Bode plot of a(s)/8(s) £• 50 0 "irnit 1 -50 -100 10~2 10° 101 102 103 Frequency (rad/sec) 10-2 10-1 10° 101 102 103 Frequency (rad/sec) Figure 2.27 Bode plot of the aircraft's transfer function a(s)/<5(s) with s = ico Bode plot of 6{s)/S(s) Phugoid mode Short-period mode m T3, c 'eo CD -50 10 10-2 10"1 10° Frequency (rad/sec) 9-180 <D TO_ 8 -270 (0 a. -360 10r-3 10-2 1Q-1 10° Frequency (rad/sec) Figure 2.28 Bode plot of the aircraft's transfer function 0(s)/8(s) with s =
  • 62. LAPLACE TRANSFORM AND THE TRANSFER FUNCTION 47 »vdelta = tf(num,den) <enter> Transfer function: -0.0005 8*2+0.03475 S+0.0175 SA4+1.005 SA3+1.411 SA2+0.013 S+0.0084 »bode(vdelta) % Figure 2.26 <enter> The Bode plot of transfer function a(s)/S(s) (Figure 2.27) is generated using the following MATLAB statements: »a=[1 80];b=[1 0.0065 0.006]; num=-0.02*conv(a,b) <enter> num = -0.0200 -1.6001 -0.0105 -0.0096 »alphadelta = tf(num,den) <enter> Transfer function: -0.02 s A 3-1.6 s"2-0.01052 s-0.0096 SA4+1.005 SA3+1.411 SA2+0.013 S+0.0084 »bode(alphadelta) % Figure 2.27 <enter> (Note that the denominator polynomial, den, of a(s)/8(s) is same as that of t;($)/<$($), and does not have to be re-calculated.) Finally, the Bode plot of transfer function 9(s)/8(s) (Figure 2.28) is generated using the following MATLAB statements: »a=[1 0.02]; b=[1 0 . 4 ] ; num=-1.4*conv(a,b) <enter> num = -1.4000 -0.5880 -0.0112 »thetadelta = tf(num,den) <enter> Transfer function: -1 .4 SA2-0.588 S-0.0112 SA4+1.005 SA3+1.411 SA2+0.013 S+0.0084 »bode(thetadelta) % Figure 2.28 <enter> From the Bode plots (Figures 2.26-2.28), we can note the natural frequencies of the phugoid and the short period modes, respectively, as either the peaks or changes of slope (called breaks) in the respective gain plots. The peaks due to complex poles sometimes disappear due to the presence of zeros in the vicinity of the poles. As expected, the natural frequencies agree with the values already
  • 63. 48 LINEAR SYSTEMS AND CLASSICAL CONTROL calculated from the characteristic polynomial, because all the three transfer func- tions have the same characteristic (denominator) polynomial. Figure 2.26 shows that the magnitude (gain) of v(ia))/8(ia)) at the short period natural frequency is very small, which indicates that the short period mode oscillation is characterized by very small changes in forward velocity, v(iw), which can be neglected (i.e. v(ia)) % 0) to obtain a short period approximation. As expected, near each natural frequency the phase changes by 180°, except for the phugoid mode in a(ia))/8(ia>) (Figure 2.27). The latter strange behavior of the phugoid mode is due to the fact that in the transfer function a(ia))/8(i(o), one of the numerator quadratics (i.e. a pair of complex zeros) almost cancels out the quadratic corresponding to the phugoid mode in the denominator polynomial (i.e. a pair of complex poles), indicating that there is essentially no change in the angle-of-attack, «(/&>), in the phugoid mode. Also, the magnitude (gain) of a(i(o)/8(ico) at the phugoid natural frequency is seen to be very small in Figure 2.27 as compared to the gain at the same frequency in Figures 2.26 and 2.28. The fact that the phugoid oscillation does not involve an appreciable change in the angle-of-attack, «(/&>), forms the basis of the phugoid approximation in which a(ico) % 0. However, Figure 2.28 shows that considerable magnitude (gain) of 9(ia))/8(i(o) exists at both short period and the phugoid natural frequencies. Hence, both modes essentially consist of oscillations in the pitch angle, 9 (ia)). The present example shows how one can obtain an insight into a system's behavior just by analyzing the frequency response of its transfer function(s). Note from Figures 2.26-2.28 that the gains of all three transfer functions decay rapidly with frequency at high frequencies. Such a decay in the gain at high frequencies is a desirable feature, called roll-off, and provides attenuation of high frequency noise arising due to unmodeled dynamics in the system. We will define sensitivity (or robustness) of a system to transfer function variations later in this chapter, and formally study the effects of noise in Chapter 7. Using Eq. (2.85), we can estimate the high-frequency gain-slope and phase of the three transfer functions given by Eqs. (2.86)-(2.88). For v(s)/S(s), K < 0, m = 2, and n = 4, which implies a gain-slope (or roll-off) of —40 dB/decade and a phase of —360° (or 0°) in the limit a> -> oo, which are confirmed in Figure 2.26. For a ( s ) / 8 ( s ) , K < 0, m = 3, and n = 4, which implies a roll-off of —20 dB/decade and a phase of —270° (or 90°) in the limit CD -> oo, which are evident in Figure 2.27. Finally, for 0(s)/8(s), K < 0, m = 2, and n = 4, which implies a gain-slope (or roll-off) of —40 dB/decade and a phase of —360° (or 0°) in the limit o> -> oo, which are also seen in Figure 2.28. The transfer function v(s)/8(s} has a peculiarity which is absent in the other two transfer functions - namely, a zero at 5 = 70. A system with transfer function having poles or zeros in the right-half s-plane is called a non-minimum phase system, while a system with all the poles and zeros in the left-half s-plane, or on the imaginary axis is called a minimum phase system. We will see below that systems which have poles in the right-half s-plane are unstable. Hence, stable non-minimum phase systems have only zeros in the right-half 5-plane, such as the system denoted by v(s)/8(s). Stable non-minimum phase systems have a markedly different phase in the limit a> —> oo (we may have to add or subtract 360° to find non-minimum phase
  • 64. LAPLACE TRANSFORM AND THE TRANSFER FUNCTION 49 from Eq. (2.85)), when compared to a corresponding minimum phase system (i.e. a similar system with no zeros in the right-half s-plane). This usually results in an unacceptable transient response. A non-minimum phase system with only one right- half plane zero (such as v(s)/8(s)) results in a transient response which is of opposite sign when compared to the input. Popular examples of such systems are aircraft or missiles controlled by forces applied aft of the center of mass. For this reason, a right-half plane zero in an aircraft (or missile) transfer function is called 'tail-wags- the-dog zero'. Control of non-minimum phase systems requires special attention. Before we can apply the transfer function approach to a general system, we must know how to derive Laplace transform (and inverse Laplace transform) of some frequently encountered functions. This information is tabulated in Table 2.1, using the definitions and properties of the Laplace transform (Eqs. (2.59)-(2.70)). Note that Table 2.1 gives the Laplace transform of some commonly encountered functions, f ( t ) , which are defined for t > 0. At t = 0, f ( t } can have a discontinuity, such as /(r) = us(t} or f ( t ) = 8(t). It is interesting to see in Table 2.1 that the Laplace transform of the unit impulse function, 8(t), is unity, while that of the unit step function, us(t), is l/s. Since dus(t)/dt = 8(t), the Laplace transforms of these two singularity functions agree with the properties given by Eqs. (2.66) and (2.68). Table 2.1 Laplace transforms of some common functions s. f(t) FW = £/w = re -., /(/)rfr No. (t > 0) 1 e-<" 1/Gv+a) 2 e- fl '/(0 F(j+a) 3 f" w!/s" +l 4 Unit Step l/s Function, M^(/) 5 sin(w?) co/(s2 + to2) 6 cos(ct)/) 5/(5 2 + O)2) 7 / (Ar) (0 skF(s) - sk~lf(0) - s ~ f (0) k 2 w /(*-1)(0) 8 I -oo f ( t ) d t F(s)/s + ( } / s ) f ^ x f ( t ) d t 9 Unit Impulse I Function, 8(t) Example 2.11 Consider a system with the following transfer function: G(s) = (s + 3)/[(s + l)(s + 2)] (2.90) The second order system (denominator polynomial is of degree 2) has a zero, z = —3, and two poles, p = — 1 and p2 = —2. Let us assume that the system has the
  • 65. 50 LINEAR SYSTEMS AND CLASSICAL CONTROL input, w(0, and initial conditions as follows: u(t) =0,y(0) = y0, y(1)(0) =0 (2.91) Since G(s) = Y(s)/U(s) when the initial conditions are zero (which is not the case here), we cannot directly use the transfer function to determine the system's response, y(0, for t > 0. Let us first derive the system's governing differential equation by applying inverse Laplace transform to the transfer function (with zero initial conditions, because that is how a transfer function is defined) as follows: (s + 1)(5 + 2)K(5) = (s + 3)17(5) (2.92) or s2Y(s) + 3sY(s) + 2Y(s) = sU(s) + 3U(s) (2.93) and £Tl[s2Y(s) + 3sY(s) + 2Y(s)] = £~l[sU(s) + 317(5)] (2.94) which, using the real differentiation property (Eq. (2.67)) with zero initial conditions for both input, u(t), and output, y(0, yields the following differential equation: y (2) (0 + 3y(1)(0 + 2y(0 = "(1)(0 + 3a(f) (2.95) Now, we can apply the Laplace transform to this governing differential equation using real differentiation property with the input and the initial conditions given by Eq. (2.91) as (r) + 3 y ) ( 0 + 2y(01 = H n ( ( 0 + 3«(0] (2.96) or s2Y(s) - sy0 + 3sY(s) - 3y0 + 2Y(s) = 0 (2.97) and it follows that Y(s) = (s + 3)y0/[(5 + 1)(5 + 2)] (2.98) We can express Y(s) as Y(s) = y0[2/(s + 1) - l/(s + 2)] (2.99) Equation (2.99) is called the partial fraction expansion of Eq. (2.98), where the contribution of each pole is expressed separately as a fraction and added up. In Eq. (2.99) the two numerator coefficients, 2 and —1, corresponding to the two fractions are called the residues. The output, y(t ), of the system can then be obtained by applying inverse Laplace transform to Eq. (2.99) for t > 0 as y(t) = yo{£-l[2/(s + 1)] + £-'[-l/(s + 2)]} (2.100)
  • 66. _ RESPONSE TO SINGULARITY FUNCTIONS_ _51 or, using the translation in Laplace domain property given by Eq. 2.65, we can write the output finally as y ( t ) = 2y(}z-< - y()e~-2r; (t > 0) (2, 101) In Example 2.11 we have seen how we can evaluate a single-input, single-output system's response if we know its transfer function, applied input and initial conditions, by using a partial fraction expansion of Y (s). For a system with complex poles (such as Example 2.8), finding partial fraction expansion can be very difficult. Fortunately, the MATLAB intrinsic command residue makes finding partial fraction expansion a simple affair. All one has to do is to specify the numerator and denominator polynomials of the rational function in s - such as Eq. (2.98) - for which a partial fraction expansion is desired. For example, if the rational function is N(s)/D(s), then the coefficients of the polynomials N(s) and D(s) in decreasing powers of s are specified in two vectors, say, n and d. Then the residue command is used as follows to give the terms of the partial fraction expansion: » [ k , p 5 c ] = residue(n,d) <enter> where p is a vector containing the poles of N(s)/D(s), k is a vector containing the corresponding residues, and c is the direct constant. In terms of the elements of p and k, the partial fraction expansion is given by N ( s ) / D ( s ) = c + *i/(s - pi) + • • •+kn/(s - pn) (2.102) where all the poles, PJ, are distinct (i.e. they appear only once - as in Example 2.1 1). If a pole, say pm , is repeated q times, then the partial fraction expansion obtained from the residue command is given by N(s)/D(s) = c + k}/(s - Pl) + • • • + km/(s - pm) + km+{/(s - pm)2 + km+2/(s ~ pmf H ----- h km+q-/(s - pm)q H ----- h kn/(s - pn) (2.103) Now we are well equipped to talk about a linear system's response to singularity functions. 2.5 Response to Singularity Functions In the previous two sections, we saw how frequency response, Laplace transform, and transfer function can be used to evaluate a linear system's characteristics, and its response to initial conditions (Example 2.11). Here we will apply a similar approach to find out a linear system's response to singularity functions, and extend the method for the case of arbitrary inputs. We had ended Section 2.2 with a remark on the special place held by the unit impulse function in control theory. To understand why this is so, let us define impulse response, g(t), as the response of a system to a unit impulse, 8(t), applied as input at time t = 0. Furthermore, it is assumed that the system is at rest at t — 0, i.e. all
  • 67. 52_ LINEAR SYSTEMS AND CLASSICAL CONTROL _ initial conditions (in terms of the output, y ( t ) , and its time derivatives) are zero. We know from Table 2.1 that the Laplace transform of 5(0 is unity. Also, from the definition of the transfer function for a single-input, single-output system (Eq. (2.72)) Y(s) = G(s)U(s). Since, in this case, y(t) = g(0 and Laplace transform of the input, U(s)=l, it implies that the following must be true: g(t) = L~lY(s) = £-'[0(5)17(5)] = £-!0(5) (2.104) Equation (2.104) denotes a very important property of the impulse response, namely that the impulse response of a linear, time-invariant system with zero initial conditions is equal to the inverse Laplace transform of the system's transfer Junction. Hence, the symbol g(t) for the impulse response! One can thus obtain G(s) from g(t) by applying the Laplace transform, or g(t) from G(s) by applying the inverse Laplace transform. Since the transfer function contains information about a linear system's characteristics, we can now understand why impulse response (and the unit impulse function) deserve a special place in control theory. In a manner similar to the impulse response, we can define the step response, s(t), as a linear, time-invariant system's response to unit step input, us(t), applied at time t = 0 with zero initial conditions. Again, using Table 2.1, we note that Laplace transform of the unit step function is given by U(s) = 1/5, and the step response can be expressed as 5(0 = £-![G(5)l/(5)] = £-'[0(5)75] (2.105) which shows that the step response is also intimately related with a system's transfer function, and hence with its characteristics. Example 2.12 Let us revisit the second order system consisting of the electrical network of Examples 2.8 and 2.9, and evaluate the impulse response, g(r), and step response, 5(0, for this system with zero initial conditions. Equation (2.80), gives the system's transfer function as G(s) = 0.5s /(s2 + 30s + 106). Using the partial fractions ex- pansion of G(s), we can write 0(5) = *i/(5 - p i ) + k2/(s - P2} (2.106) where p and pi are the two poles (roots of the denominator polynomial of and the residues k and ki are evaluated as follows: ]|JS=p, = 0.5p,/(p, - P2) (2.107) *2 - [(s - P2)G(S)]S=P2 = 0.5p2/(p2 - Pi) (2.108) Again, from Example 2.9 we know that p = — 15 — 999.9i and p2 = — 15 + 999.9i. Then from Eqs. (2.107) and (2.108), fc, = 0.25 - 0.00375/ and k2 = 0.25 + 0.00375/. The residues can be verified by using the MATLAB intrinsic command residue as follows: »N=[0.5 0]; D=[1 30 1e6]; [k,p,c]=residue(N,D) <enter>
  • 68. RESPONSE TO SINGULARITY FUNCTIONS 53 k = 0.25000000000000+0.003750421946201 0.25000000000000-0.003750421946201 P = 1.Oe+002* -0.15000000000000+9.998874936711631 -0.15000000000000-9.998874936711631 Taking the inverse Laplace transform of Eq. (2.106) with the use of Table 2.1, we get the following expression for the impulse response, g(t): g(t) = k exp(pjO + & 2 exp(/7 2 0; (t > 0) (2.109) Using the fact that p and p2 are complex conjugates (and k and ki are also complex conjugates), we can simplify Eq. (2.109) to give g(t) = e~'5/[0.5cos(999.90 - 0.0075 sin (999.901; (t > 0) (2.110) Note that the impulse response, g ( t ) , given by Eq. (2.110) has an amplitude which decreases exponentially with time due to the term e~ 15r . This is a characteristic of a underdamped, stable system, as seen in Figure 2.24. Since the poles can also be represented in terms of their natural frequency, a)n , and damping-ratio, g, as p2. = —gojn ± io)n(g2 — l) l / 2 , (see Eqs. (2.83) and (2.84)) we can also write g(t) = y0ep(-ga>nt)sm[a>nt (1 - g2)l/2 + 0]/(l - <T 2 ) 1/2 ; (t > 0) (2.111) where 9 = cos""1^) and yo = 2*,[(1 - < r 2 ) I / 2 ]/e /(0 - 7r / 2) = 2*2[(1 - ? 2 )'/ 2 ]/ e - | '^- 3r / 2 > (2.1 12) You can verify Eqs. (2.1 11) and (2.1 12) using complex algebra, but don't worry if you don't feel like doing so, because Eq. (2.109) can be directly obtained using MATLAB to get the impulse response, g ( t ) , as follows: »p1=-15-999.9i; p2=conj(p1); k1=0. 25-0. 003751; k2=conj(k1); <enter> »t=0:0. 001:1; g=k1*exp(p1*t)+k2*exp(p2*t) ; plot(t,g), xlabel( 'Time ( s ) ' ) , ylabel( ' g ( t ) ' ) <enter> Here conj( ) is the intrinsic MATLAB operator that calculates the complex conju- gate, exp( ) is the exponential function, and plot(x,y) is the MATLAB command for plotting the vector x against the vector y. Note that both t and g are vectors of the same size. Also, note the ease by which complex vector calculations have been made using MATLAB. The same computation in a low-level language - such as
  • 69. 54_ LINEAR SYSTEMS AND CLASSICAL CONTROL _ Fortran, Basic, or C - would require many lines of programming. For more infor- mation on the usage of a MATLAB command type help < name of command> <enter> at the MATLAB prompt. We know from Example 2.9 that for the example electrical network, the natural frequency and damping-ratio are, con = 1000 rad/s and g = 0.015, respectively. Substituting these numerical values in Eq. (2.1 12), we get y0 = 0.5 amperes. We can also evaluate the step response, s(t ), of the electrical network by taking the inverse Laplace transform of G(s)/s as follows: s(t) = £Tl[G(s)/s] = £~}[0.5/(s2 + 30s + 106)] = £-'[2.5 x KT 4 //(j - p i ) - 2.5 x I0~4i/(s - p2)] (2.113) or s(t) = 2.5 x 10~ 4 i[exp(pif) - exp(p2')l = 5 x 10" V15' sin(999.9f); (t > 0) (2.114) Note that 5(0 given by Eq. (2.114) also indicates a stable system due to the oscil- latory step response with a decaying amplitude of 5 x 10~4e~15'. The calculation of step and impulse responses can be generalized by using the partial fraction expansion of G(s)/s and G(s), respectively. Taking the inverse Laplace transform of Eq. (2.104), we can express the impulse response for a unit impulse input applied at t = 0 as follows: g(t) = cS(t) + k exp(pif) H ----- h km exp(p m f) + km+lt exp(p m r) + km+2t2 ep(pmt)/2 + • • • + km+q.itt'-1 ep(pmt)/(q - 1)! + ---+knep(pnt) (f>0) (2.115) Note that in deriving Eq. (2.1 15), we have used the translation in Laplace domain property of the Laplace transform (Eq. (2.65)), and have written the inverse Laplace transform of l/(s - p)k as tk~lep'/(k - 1)!. If the impulse is applied at t = tQ, the time t in Eq. (2.1 15) should be replaced by (/ — to), since the Laplace transform of g(t — /o) is G(s) exp(— sto). If the system is strictly proper (i.e. the degree of the numerator polynomial of the transfer function, G(s), is less than that of the denominator polynomial), then the direct constant, c, in the partial fraction expansion of G(s) is zero, and the impulse response does not go to infinity at t = 0 (Eq. (2.1 15)). Hence, for strictly proper transfer functions, we can write a computer program using MATLAB to evaluate the impulse response using Eq. (2.1 15) with c = 0. Such a program is the M-file named impresp.m, which is listed in Table 2.2, and can be called as follows: >> [ 9 > t ] = impresp(num,den,tO,dt,tf ) <enter>
  • 70. _ RESPONSE TO SINGULARITY FUNCTIONS _ 55 Table 2.2 Listing of the M-file impresp. m, which calculates the impulse response of a strictly proper, single-input, single-output system impresp . m function [y,t]=impresp(num,den,tO,dt,tf ) ; %Program for calculation of impulse response of strictly proper SISO systems %num = numerator polynomial coefficients of transfer function %den = denominator polynomial coefficients of transfer function %(Coeff icients of 'num' and 'den' are specified as a row vector, in %decreasing powers of 's') %tO = time at which unit impulse input is applied %dt = time-step (should be smaller than 1/ (largest natural freq.)) %tf = final time for impulse response calculation %y = impulse response; t= vector of time points %copyright(c)2000 by Ashish Tewari % %Find a partial fraction expansion of num/ (den) :- [r,p,k]=residue(num,den) ; %Calculate the time points for impulse response : - t=tO:dt:tf ; %Find the multiplicity of each pole, p(j):- for j=1 :size(p) n=1; for i=1 :size(p) if p(j)==p(i) n=n+1 ; end end end mult( : ,j )=n; end %Calculate the impulse response by inverse Laplace transform of %partial-f raction expansion :- y=zeros(size(t) ) ; j=1; while j<=size(p,1) for i=1 :mult( : ,j ) y=y+r(j+i-1)*((t-tO) . A (i-1)) . *exp(p(j )*(t-tO) ) /factorial (i-1 ); end ]=]+i; end where num and den are row vectors containing numerator and denominator polynomial coefficients, respectively, of the transfer function, G(s), in decreasing powers of s, tO is the time at which the unit impulse input is applied, dt is the time-step size, tf is the final time for the response, g is the returned impulse response, and t is the returned vector of time points at which g(t) is calculated. Instead of having to do inverse Laplace transformation by hand, we can easily use impresp to quickly get the impulse response of a strictly proper
  • 71. 56 UNEAR SYSTEMS AND CLASSICAL CONTROL Table 2.3 Listing of the M-file stepresp.m, which calculates the step response of a proper, single-input, single-output system stepresp.m function [y,t]=stepresp(num>den,tOJdt)tf); %Program for calculation of step response of proper SISO systems %num = numerator polynomial coefficients of transfer function %den = denominator polynomial coefficients of transfer function %(Coefficients of 'num' and 'den' are specified as a row vector, in %decreasing powers of 's') %tO = time at which unit step input is applied %dt = time-step (should be smaller than 1/(largest natural freq.)) %tf = final time for step response calculation %y = step response; t= vector of time points %copyright(c)2000 by Ashish Tewari % %Find a partial fraction expansion of num/(den.s):- [r,p,k]=residue(num,conv(den,[1 0])); %Calculate the time points for step response:- t=tO:dt:tf; %Find the multiplicity of each pole, p ( j ) : - for j=1:size(p) n=1; for i=1:size(p) if p(j)==p(i) if(i~=i) n=n+1; end end end mult(:,j)=n; end %Calculate the step response by inverse Laplace transform of %partial-fraction expansion:- y=zeros(size(t)); j=1; while j<=size(p,1) for i=1:mult(:,j) y=y+r(j+i-1)*((t-tO).*(i-1)).*exp(p(j)*(t-tO))/factorial(i-l); end i = i + i; end plant. The M-file impresp.m uses only the intrinsic MATLAB functions, and is useful for those who do not have Control System Toolbox (CST). Usage of CST command impulse yields the same result. (We postpone the discussion of the CST command impulse until Chapter 4, as it uses a state-space model of the system to calculate impulse response.) Note the programming steps required in impresp to identify the multiplicity of each pole of G(s). For increased accuracy, the time-step, dt, should be as small as possible, and, in any case, should not exceed the reciprocal of the largest natural frequency of the system. In a manner similar to the impulse response, the step response calculation can be generalized by taking the inverse Laplace transform of the partial fraction expansion of
  • 72. _ RESPONSE TO SINGULARITY FUNCTIONS_ 57 G(s)/s as follows: s(t) = k+k2 exp(/?20 H ----- -km exp(/7 m r) + km+it ep(pmt) + km+2t2exp(pmt)/2 H ---- + km+q^~{ exp(pmt)/(q - 1)! )(f > 0 ) (2.116) where k[ is the residue corresponding to the pole at s = 0, i.e. p = 0, and ^2 ... kn are the residues corresponding to the poles of G(s), p . . . pn, in the partial fraction expansion of G(s)/s. Note that if G(s) is a proper transfer function (i.e. numerator polynomial is of lesser or equal degree than the denominator polynomial), then G(s)/s is strictly proper, and the direct term, c, is zero in the partial fraction expansion of G(s)/s. Thus, we can evaluate the step response of a proper system using Eq. (2.1 16), which should be modified for a unit step input applied at t = to by replacing t in Eq. (2.1 16) by (t — to). A MATLAB program called stepresp.m, which evaluates the step response of proper system by Eq. (2.116), is listed in Table 2.3, and can be used as follows: »[s,t] = stepresp(num,den,tO,dt ,tf ) <enter> where num. and den are row vectors containing numerator and denominator polynomial coefficients, respectively, of the transfer function, G(s), in decreasing powers of s, tO is the time at which the unit step input is applied, dt is the time-step size, // is the final time for the response, s is the returned step response, and t is a vector containing time points at which s(t) is calculated. The M-file stepresp.m uses only intrinsic MATLAB functions, and is useful in case you do not have access to Control System Toolbox (CST). The CST command step is a quick way of calculating the step response. The GUI tool associated with the command step also lets you get the values of s(t) and t at any point on the step response curve by merely clicking at that point. Example 2,13 Let us compute and plot the step and impulse responses of the aircraft transfer function, 6(s)/8(s), of Example 2.10, given by Eq. (2.88). We must begin with the specification of the transfer function as follows: »a=[1 0.02]; b=[1 0 . 4 ] ; num=-1 .4*conv(a,b) <enter> num = -1.4000 -0.5880 -0.0112 »a=[l 0.005 0.006]; b=[1 1 1.4]; den=conv(a,b) <enter> den = 1.0000 1.0050 1.4110 0.0130 0.0084 Note that the transfer function is strictly proper (the numerator polynomial is of second degree, while the denominator polynomial is of fourth degree). Hence, we can use impresp.m to compute the impulse response, g(t), and plot the result as follows: »[g,t] = impresp(num, den, 0,0. 5,250) ; plot(t,g) <enter>
  • 73. 58 LINEAR SYSTEMS AND CLASSICAL CONTROL Note that the time-step for calculating the impulse response is smaller than inverse of the largest natural frequency of the system (1.18 rad/s). Similarly, the step response, s ( t ) , is computed using stepresp and plotted as follows: »[s,t] = stepresp(num,den,0,0.5,250); plot(t,s) <enter> The resulting plots of impulse and step responses are shown in Figure 2.29. Note that the plot of the impulse response clearly shows an initial, well damped oscillation of high-frequency (short-period mode) and a lightly damped, long-period oscillation (phugoid mode). This behavior meets our expectation from the natural frequencies and damping-ratios of the two modes calculated in Example 2.10 (recall that the natural frequency and damping of the short-period mode are more than 10 times those of the phugoid mode). It is also clear that the impulse response excites both the modes, while the step response is dominated by the phugoid mode. The time taken by the phugoid mode to decay to zero is an indicator of the sluggishness of the longitudinal dynamics of the airplane. The non-minimum phase character of the transfer function due to the zero at s = 70 is evident in the large initial undershoot in the impulse response. 0.5 "o> -0.5 Short-period mode Phugoid mode 50 100 150 200 250 Time (s) ~5f -5 50 100 150 200 250 Time (s) Figure 2.29 Impulse response, g(t), and step response, s(f), for the aircraft transfer function, 9(s)/S(s) (Example 2.13) 2.6 Response to Arbitrary Inputs After learning how to find step and impulse responses of a given linear system, the next logical step is to find the response to an arbitrary input, u(t), which is applied to a linear
  • 74. RESPONSE TO ARBITRARY INPUTS 59 system with zero initial conditions. At the end of Section 2.2 (Figure 2.16), we saw how an arbitrary function can be expressed as a sum (or integral) of the suitably scaled impulse functions, S(t — a), as given by Eq. (2.36). Since we know how to find the response of a linear, time-invariant system to a unit impulse input for zero initial conditions, we can apply the superposition principle to get the linear system's response, y(/% to an arbitrary input, «(?), which is expressed as OO u(t) - V u(T)&T8(t-T) (2.117) and the response to the impulse input «(r)Ar<5(r — r) applied at t = r is given by ) = M(r)Arg(f - T) (2.118) where g(t — T) is the impulse response to unit impulse, S(t — r), applied at t = i. Then by the superposition principle (Eq. (2.36)), the response to a linear combination of impulses (given by Eq. (2.35)) is nothing else but a linear combination of individual impulse responses, g(t — r), each multiplied by the corresponding factor, «(r)Ar. Hence, we can write the response, y ( t ) , as y(t)= M(r)AT£(r - T) (2.119) T = — OO or, in the limit AT —»• 0, OO U (T)g(t-T)dT (2.120) / -00 Equation (2.120) is one of the most important equations in control theory, since it lets us determine a linear system's response to an arbitrary input. The integral on the right- hand side of Eq. (2.120) is called the superposition integral (or convolution integral). Note that we can apply a change of integration variable, and show that the convolution integral is symmetric with respect to u(t) and g(t) as follows: oc /»oo y(t) U(l)g(t - T)dl = U(t- T)g(T)dT (2.121) / -oc J—oc Most commonly, the input, u(t), is non-zero only for t > 0. Also, since g(t — r) = 0 for r > t, we can change the upper limit of the convolution integral to t. Hence, the convolution integral becomes the following: y(t)= u(T)g(t-T)dT== ( U(t-T)g(T)dT (2.122) Jo Jo ./o We could have obtained Eq. (2.122) alternatively by applying inverse Laplace trans- form to Y(s) = G(s)U(s) (since G(s) is the Laplace transform of g(t)).
  • 75. 60 LINEAR SYSTEMS AND CLASSICAL CONTROL Example 2.14 We can use the convolution integral to obtain the step response, s(t), of the second order system of Example 2.12 as follows: 5(0= / = / us(t - Us(t-T)g(T)dT (2.123) Jo where us(t) is the unit step function and the impulse response, g(0, is given by Eq. (2.110). Substituting Eq. (2.110) into Eq. (2.123), and noting that us(t - r) = 1 for T < t and us(t — T) = 0 for T > r, we get the following expression for the step response: f 5(0 =/ e~15r[0.5 cos(999.9r)- 0.0075 sin(999.9r)]rfr (2.124) Carrying out the integration in Eq. (2.124) by parts, we get the same expression for s(t) as we obtained in Eq. (2.114), i.e. s(t) = 5 x 10"4 e~15' sin(999.9/) for t > 0. The use of convolution integral of Eq. (2.120) can get difficult to evaluate by hand if the input u(t) is a more complicated function than the unit step function. Hence, for a really arbitrary input, it is advisable to use a numerical approximation of the convo- lution integral as a summation over a large number of finite time-steps, Ar. Such an Table 2.4 Listing of the M-file response.m, which calculates the response of a strictly proper, single-input, single-output system to an arbitrary input response.//? function y=response(num,den,t,u); %Program for calculation of the response of strictly proper SISO systems %to arbitrary input by the convolution integral. %num = numerator polynomial coefficients of transfer function %den = denominator polynomial coefficients of transfer function %(Coefficients of 'num' and 'den' are specified as a row vector, in %decreasing powers of 's') %t = row vector of time points (specified by the user) %u = vector of input values at the time points contained in t. %y = calculated response %copyright(c)2000 by Ashish Tewari % %Calculate the time-step:- dt=t(2)-t(l); m=size(t,2) tf=t(m); %Calculate the convolution integral:- y=zeros(size(t)); G=y; [g,T]=impresp(num,den,t(1),dt,tf); for i=1:m y=y+dt*u(i)*[G(1:i-1) g(1:m-i+1)]; end
  • 76. RESPONSE TO ARBITRARY INPUTS 61 approximation of an integral by a summation is called quadrature, and there are many numerical techniques available of varying efficiency for carrying out quadrature. The simplest numerical integration (or quadrature) is the assumption that the integrand is constant in each time interval, AT, which is the same as Eq. (2.119). Hence, we can use Eq. (2.119) with a finite number of time steps, AT, to evaluate the convolution integral, and the response to an arbitrary input, u(t). Such a numerical evaluation of the convolu- tion integral is performed by the M-file, called response.m, listed in Table 2.4. Note that response calls impresp.m internally to evaluate the impulse response, g(t — T), for each time interval, AT. The M-file response.m is called as follows: »y = response(num,den,t,u) <enter> where num, den are the numerator and denominator polynomial coefficients of the transfer function, G(s), (same as in impresp and stepresp), t is the row vector containing time points at which the response, v, is desired, and M is a vector containing values of the applied arbitrary input at the time points contained in t. Example 2.15 Let us determine the pitch response, 0(t), of the aircraft transfer function, 9(s)/8(s), (Examples 2.10, 2.13) if the applied input is 8(t) = 0.01?.sin(1.30, beginning at t = 0. We first specify the time vector, t, and input vector, u, as follows: »t=0:0.1:20; u=0.01*t.*sin(1.3*t); <enter> 0.25 0.2 0.15 0.1 0.05 0 -0.05 -0.1 -0.15 -0.2 0 10 15 20 Time (s) Figure 2.30 Response of the pitch angle, 0(t), for the aircraft when the elevator deflection is S(t) = O.OU.sin(1.3f) radians
  • 77. 62 LINEAR SYSTEMS AND CLASSICAL CONTROL Then the response is calculated using the M-file response.m as follows: »y = r e s p o n s e ( n u m , d e n , t , u ) ; <enter> where num and den were specified in Example 2.13. The calculated response is plotted in Figure 2.30. Note the ease with which response.m calculates the response to a complicated input function. A more general method of evaluating response of even multi-input, multi-output systems based on the state-space approach will be given in Chapter 4. MATLAB (CST) functions use the state-space approach for calculating step, impulse, and arbitrary input responses; hence, discussion of these functions will be postponed until Chapter 4. There are three properties which determine whether a control system is good or bad, namely its performance, stability, and robustness. We briefly discussed the implications of each of these in Chapter 1 using the car-driver example. Now we are well equipped to define each of these three properties precisely. Let us first consider the performance of a control system. 2.7 Performance Performance is all about how successfully a control system meets its desired objectives. Figure 1.3 showed an example of a closed-loop system's performance in terms of the maximum overshoot of the actual output, y ( t ) , from the desired constant output, v<y. More generally, the desired output may be a specific function of time, Vd(0- In such a case, the difference between the actual output and the desired output, called error, e(t) = yd(t) — y(0, is an important measure of the control system's performance. If the error, e(t), becomes zero very rapidly, the control system is said to perform very well. However, the error of certain control systems may not exactly reach zero for even very large times. For such systems, another performance parameter is considered important, namely the steady-state error, ess, defined as the value of the error, e(t), in the limit t —>• oo. The smaller the magnitude of the steady-state error, ess, the better a control system is said to perform. There are some performance parameters that indicate the speed of a control system's response, such as the rise time, TT, defined as the time taken by the output, y ( t ) , to first reach within a specified band, ±e, of the steady-state value, v(oo), the peak time, Tp, defined as the time taken to reach the first peak (or maximum overshoot), and the settling time, 7S, defined as the time taken until the output, y ( t ) , finally settles (or comes closer) to within a specified band, ±e, of its steady-state value, v(oo). The performance parameters are usually defined for the step response, s ( t ) , of a system, which implies a constant value of the desired output, y^. Figure 2.31 shows a typical step response for a control system, indicating the various performance parameters. Obviously, we assume that the control system reaches a steady-state value in the limit / -> oo. Not all systems have this property, called asymptotic stability, which we will discuss in the next section.
  • 78. PERFORMANCE 63 0 Tr Tc Figure 2.31 Step response, s(0, defining a control system's performance Note that while the swiftness, or alacrity, with which a system responds to a given input is described by the rise time, TT, the peak time, Tp, and the settling time, Ts, the departure of the output from its steady-state value is measured by the maximum overshoot, or the first peak value, Mp, and the accuracy of the control system in reaching a final desired value, yd, is indicated by the steady-state error, ess. For a second order system (such as the one considered in Example 2.12) with damping-ratio, g, and natural frequency, &>„, we can find simple expressions for many of the performance parameters when a unit step input is applied, given by (2.125) (2.126) and (2.127) Equations (2.125)-(2.127) can be obtained from the step response, s(t), of a second- order system, using Eq. (2.116). Note that when a successful second order control system reaches its steady-state value asymptotically in the limit t -> oo, then for large times, it behaves in a manner quite similar to a first order control system with a pole at 5 = — ga)n, whose output can be expressed as y(t) = j(oo)[l — ep{—ga)nt}]. Then the settling time can be determined as the time taken when the y(t) settles to within 2 percent of y(oo), or 0.02 = Qp{-ga)nTs}, which gives Ts = -log(0.02)/(s"wn), or Ts = 4/(gcon), which is the same as Eq. (2.125). In other words, the output, y(t), reaches within 2 percent of
  • 79. 64 LINEAR SYSTEMS AND CLASSICAL CONTROL the steady-state value, y(oo) (i.e. e = 0.02) after four leaps of the time-constant, l{ga)n). Equation (2.127) can be obtained by using the fact that at the maximum overshoot, or the first peak value, Mp, the slope of the step response, ds(t)/dt, is zero. Note that the performance parameters are intimately related to the damping-ratio, g, and natural frequency, a>n, of a second order control system. If g > 1, a second order system behaves like a first order system, with an exponentially decaying step response (see Figure 2.24). Also, you can see from Eqs. (2.125)-(2.127) that the performance parameters determining the swiftness of response (such as the peak time, Tp) and those determining the deviation of the response from the desired steady-state value (such as peak value, Mp) are contradictory. In other words, if we try to increase the swiftness of the response by suitably adjusting a control system's characteristics (which are given by £ and con for a second order system), we will have to accept larger overshoots from the steady-state value, y(oo), and vice versa. How the control system characteristics are modified to achieve a desired set of performance parameters is an essential part of the control system design. The performance of a control system is determined by the locations of its poles in the Laplace domain. Generally, the poles of a control system may be such that there are a few poles very close to the imaginary axis, and some poles far away from the imaginary axis. As may be clear from examining expressions for step or impulse response, such as Eqs. (2.115) and (2.116), a control system's response is largely dictated by those poles that are the closest to the imaginary axis, i.e. the poles that have the smallest real part magnitudes. Such poles that dominate the control system's performance are called the dominant poles. Many times, it is possible to identify a single pole, or a pair of poles, as the dominant poles. In such cases, a fair idea of the control system's performance can be obtained from the damping and natural frequency of the dominant poles, by using Eqs. (2.125)-(2.127). The steady-state error, ess, to an arbitrary input is an important measure of control system performance. Consider a general single-input, single-output closed-loop system shown in Figure 2.32, where G(s) and H(s) are the transfer-functions of the plant and the controller (also called compensator), respectively. Such a closed-loop control system is said to have the controller, H ( s ) , in cascade (or series) with the plant, G(s). (Another closed-loop configuration is also possible in which H(s) is placed in the feedback path of (or in parallel with) G(s).) The controller applies an input, U(s), to the plant based upon the error, E(s) = Y^(s) — Y(s). We saw in Chapter 1 an example of how a controller performs the task of controlling a plant in a closed-loop system by ensuring that the plant output, y ( t ) , becomes as close as possible to the desired output, d(t), as quickly v^ E(s) H(s) U(s) G(s) Y(s) Figure 2.32 A single-input, single-output feedback control system with controller transfer function, H(s), and plant transfer function, G(s)
  • 80. PERFORMANCE 65 as possible. In any case, a successful control system must bring y(t} very close to yd(t) when time t becomes very large, i.e. in the limit that time tends to infinity (t —> oo). Such a system is called a tracking system, because its output, y(t), continuously tracks a changing desired output, yd(t). Examples of tracking systems are a telescope tracking a comet, an antenna tracking a satellite, a missile tracking an aircraft, a rifle-shooter tracking a pigeon, etc. The error (e(t) = yd(t) — y(t)) which persists in the limit t -» oo is called the steady-state error, ess. Obviously, the closed-loop system should first be able to reach a steady -state (i.e. its response, y ( t ) , must be finite and constant in the limit / —>• oo) before its steady-state error can be defined (it is like saying you should first be able to stand, before I can measure your height). An unstable system cannot reach a steady-state; therefore, there is no point in talking about steady-state error of unstable systems. We will discuss later what are the precise requirements for stability, but at present let us confine our discussion to stable closed-loop systems, which we tentatively define here as those systems in which a bounded yd(t) leads to a bounded y ( t ) , for all values of t. Going back to Figure 2.32, we can see that the Laplace transforms of the output, y ( t ) , desired output, yd(t), input, u(t), and error, e(t), are given by Y(s), Yd(s), U(s), and E(s), respectively. Then the steady-state error is expressed as ess = lim^oo e(;) = lim^oo-C- 1 (£(*)) (2.128) However, we can avoid evaluating the inverse Laplace transform of E(s) to calculate the steady-state error if we can utilize an important property of the Laplace transform, namely the final value theorem given by Eq. (2.70), which yields the following result: ess = lim^oc e(t) = im^()sE(s) (2.129) Of course, Eq. (2.129) requires that the limit of e(t) when t -> oo (or of sE(s) when s -> 0) must exist. Looking at the block-diagram of Figure 2.32, we can express E(s) as follows: E(s) - Yd(s) - Y(s) = Yd(s) - G(s)U(s) = Yd(s) - G(s)H(s)E(s) (2.130) Thus, we can write E(s) = Yd(s)/[l + G(s)H(s)} (2.131) On substituting Eq. (2.131) into Eq. (2.129), we get ] (2.132) Equation (2.132) implies that the steady-state error, ess, depends not only upon the two transfer functions, G(s) and //C$0, but also on the desired output, Yd(s).
  • 81. 66_ LINEAR SYSTEMS AND CLASSICAL CONTROL _ Example 2.16 Consider the closed-loop system of Figure 2.32 with G(s) - (2s2 + 5s + l)/(s 2 + 2^ + 3) and H(s) = K, where AT is a constant. Let us determine the steady-state error of this system if the desired output, y^(t) is (a) a unit step function, us(t), and (b) a unit ramp function, r(t) = t • us(t). If yd(t) = us(t) then yd(s) = /s (see Table 2.1). Hence, the steady-state error is given by Eq. (2.132) as = lims^0s Yd(s)/[ + G(s)H(s)] = linw 0 *OA)/[l + KG(s)] = !/[! + jriinwoG(s)] (2.133) where linis_).oG:(5) is called the DC gain of G(5), because it is a property of the system in the limit 5 —>• 0, or frequency of oscillation, a) —> 0, in the frequency response G(ico) - something like the direct current which is the limiting case of alternating current in the limit w —>• 0. Here ims-^oG(s) = 1/3. Therefore, the steady-state error to unit step function is ess - 1/(1 + AT/3) - 3/(3 + AT) (2.134) The CST of MATLAB provides a useful command called dcgain for calculating the DC gain of a transfer function, which is used as follows: »sys= tf(num,den); dcgain(sys) <enter> where sys is the name of the system's transfer function calculated using the LTI object sys, and num and den are the numerator and denominator polynomial coef- ficients (in decreasing powers of 5), respectively, of the system's transfer function. This command is quite useful when the transfer function is too complicated to be easily manipulated by hand. Note that the DC gain of the closed-loop transfer function in Figure 2.32, G ( s ) H ( s ) / [ + G(s)H(s)], is also the steady-state value of the output, y ( t ) , when the desired output is a unit step function. Hence, the steady-state error to a step desired output is nothing but £ss = 1 — DC gain of the closed-loop transfer function. The steady-state error given by Eq. (2.134) can be decreased by making the controller gain, K, large. However, for any finite value of AT, we will be left with a non-zero steady-state error. Also, there is a physical limit upto which K (and the resulting input, U(s)) can be increased; the larger the value of AT, the greater will be the control input, U(s), which increases the cost of controlling the system. Hence, this closed-loop system is not very attractive for tracking a desired output which changes by a step. If yd(t) = r(t), then noting that r(t) is the time-integral of us(t), we can get the Laplace transform, Yd(s) from the real integration property (Eq. (2.68)) as follows: /s2 (2.135)
  • 82. PERFORMANCE 67 Hence, the steady-state error is given by e,. = ims^sYd(s)/[ + G(s)H(s)] = im^Qs(l/s2)/(l + KG(s)] = /[lims^Qs + sKG(s)] = oo (2.136) Thus, the steady-state error of the present closed-loop system is infinite when the desired output is a ramp function, which is clearly unacceptable. An example of tracking systems whose desired output is a ramp function is an antenna which is required to track an object moving at a constant velocity. This calls for the antenna to move at a constant angular velocity, c. Then the desired output of the antenna is v d (r) -c-r(t). Let us see what can be done to reduce the steady-state error of system in Example 2.16 when the desired output is either a unit step or a ramp function. Example 2.17 In a control system, we can change the controller transfer function, H(s), to meet the desired objectives. This process is called control system design. From Example 2.16, it is clear that H(s) = K is a bad design for a closed-loop tracking system when the desired output is changing like a step, or like a ramp. If we can make the steady-state error to a ramp function finite by somehow changing the system, the steady-state error to a step function will automatically become zero (this fact is obvious from Eqs. (2.133) and (2.136)). Let us see what kind of controller transfer function, H(s), will make the steady-state error to a ramp function finite (or possibly zero). For Yd(s) = l/s2, the steady-state error is + G(s)H(s)] 3)/s[s2 + 2s + 3 + (2s2 + 5s 4- l)H(s)] (2-137) If we choose H(s) = K/s, then Eq. (2.137) implies that ess = 3/K, which is a finite quantity. If H(s) = K/s2 then ess = 0 from Eq. (2.137). For both the choices of H(s), the steady-state error is zero when yd(t) = us(t). The choice H(s) = K/s2 thus makes the steady-state error zero for both step and ramp functions. Note that for the closed-loop system of Figure 2.32, the closed-loop transfer function, Y(s)/Yd(s), can be derived using Eq. (2.131) as follows: Y(s) = G(s)H(S)E(s) = G(s)H(s)Yd(s)/[l + G(s)H(s)] (2.138) or Y(s)/Yd(s) = G(s)H(s)/[l + G(s)H(s)] (2.139)
  • 83. 68 LINEAR SYSTEMS AND CLASSICAL CONTROL For single-input, single-output systems such as that shown in Figure 2.32, we can calculate the closed-loop response, y(t), to a specified function, yd(t), applying the inverse Laplace transform to Eq. (2.139). Example 2.18 Let us calculate the response of the closed-loop system in Example 2.17 to a unit ramp function, yd(t) = r(t) and zero initial conditions, when (a) H(s) = 1/5, and (b) H(s) = l/s2. Using Eq. (2.139) for H(s) = l/s we can write Y ( s ) / Y d ( s ) = [(2s2 + 5s + l)/(5 2 + 2s [1 + {(2s2 + 5s+ l)/(5 2 + 2s = (2s2 + 55 + l)/(53 + 4s2 + 85 4- 1) (2.140) or F(5) = (2s2 + 55 + l)yd(s)/(s3 + 4s2 + 8s + 1) = (2s2 + 5s + l)(l/5 2 )/(5 3 + 4s2 + 85 + 1) (2.141) Equation (2.141) can be expressed in a partial fraction expansion as follows: Y(s) = ki/(s - />,) + k2/(s - P2) + k3/(s - p3) + *4/s + ks/s2 (2.142) where p, p2, and p^ are the poles of the closed-loop transfer function, (252 + 55 + l)/(53 + 452 + 85 + !), and k, ki, and ^3 are the corresponding residues. &4 and £5 are the residues due to the ramp function, Yd(s) = /s2. We know that the poles of the closed-loop transfer function are distinct (i.e. not repeated) because we used the Control System Toolbox (CST) command damp to get the poles as follows: »damp([1 481]) <enter> Eigenvalue Damping Freq. (rad/sec) -0.1336 1.0000 0.1336 -1.9332+1.9355i 0.7067 2.7356 -1.9332-1.9355i 0.7067 2.7356 Note that the closed-loop system has a real pole, —0.1336, and a pair of complex conjugate poles, -1.9332 + 1.9355/, and -1.9332 - 1.9355/. The residues of the partial fraction expansion (Eq. (2.142)) can be calculated using MATLAB intrinsic command residue as follows: »num=[2 51]; den=conv([1 0 0],[1 4 8 1]); <enter> »[k,p,c]=residue(num,den) <enter>
  • 84. PERFORMANCE 69 k = -0.0265-0.13011 -0.0265+0.13011 -2.9470 3.0000 0 P = -1.9332+1.93551 -1.9332-1.93551 -0.1336 0 0 c = The roots of the denominator polynomial of Eq. (2.141) are contained in the vector p, while the vector k contains the corresponding residues of Eq. (2.142). The direct term c is a null vector, because the numerator polynomial is of a degree smaller than the denominator polynomial in Eq. (2.141). Taking the inverse Laplace transform of Eq. (2.142), we can express y(r) as follows: y(t) = k exp(/? 3 r) kst; (t > 0) (2.143) The error e(t} = y^(t) — y(t), where y^r) = r(t), and y ( t ) is given by Eq. (2.143) is plotted in Figure 2.33 using MATLAB as follows (we could also have 2.5 - H(s) = 1/S 2 - 1.5 - 0.5 H(s) = 1/S2 0 J L 0 5 10 15 20 25 30 35 40 f(s) Figure 2.33 Error, e(f) =/d(0 -y(0/ for the closed-loop systems of Example 2.18 when yd(0 = r(0
  • 85. 70 LINEAR SYSTEMS AND CLASSICAL CONTROL obtained y(t) directly by using the M-file response.m listed in Table 2.4 by speci- fying a ramp input): »t=0:0.4:40; y = k ( 1 ) * e x p ( p ( 1 ) * t ) + k ( 2 ) * e x p ( p ( 2 ) * t ) + k ( 3 ) * e x p ( p ( 3 ) * t ) +k(4)+k(5)*t; e=t-y <enter> »plot(t,e) Similarly, when H(s) = 1/5 , the closed-loop transfer function is Y(s)/YA(s) - (2s2 + 5s + l)/(5 4 + 253 + 5s2 + 55 + 1) (2.144) and the inverse Laplace transform applied to Y(s) with Y^(s) = l/s2 yields (you may verify using MATLAB) y(t) = ki exp(pif) + fc2exp(/?20 + fc3exp(p3f) + fc4exp(p40 + *5 + k6t; (t > 0) (2.145) where Pl = -0.3686+ 1.9158/, P2 = -0.3686 - 1.9158/, p3 = -1.0, p4 = -0.2627, ki = -0.1352 - 0.1252/, k2 = -0.1352 + 0.1252/, *3 = -0.6667, k4 = 0.9371, k5 = 0, k6 = 0. The error, e(t) = yd(t) - y(t), for H(s) = l/s2 is also plotted in Figure 2.33. Note that ess = 3 for H(s) = l/s, and ess = 0 for H (s) = l/s2, as expected from Example 2.17. We have seen in Examples 2.16-2.18 that for a plant transfer function, G(5), of a particular form, the controller transfer function, H(s), must have either one or two poles at the origin (s = 0) in order to reduce the closed-loop error due to ramp function. Precisely how many poles H(s) should have to reduce the steady-state error of a closed- loop system to a particular desired output, yd(t), depends upon the plant transfer function, G(s), and yd(t). When yd(t) is a ramp function, Eq. (2.132) implies that G(s)H(s)] = l/[lim 5 ^ 0 U + sG(s)H(s))] )] (2.146) Clearly, if we want zero steady-state error when desired output is a ramp function, then Eq. (2.144) requires that lims^osG(s)H(s) = oo, which is possible only if the transfer function G(s)H(s) has two or more poles at the origin, 5 = 0 . Since G(s) in Examples 2.17 had no poles at the origin, we had to choose H(s) with two poles at the origin (i.e. H(s) = l/s2) to make es& = 0 when jd(0 = r(t). Classical control assigns a type to a closed-loop system of Figure 2.32 according to how many poles the transfer function, G(s)H(s), has at the origin. Thus, a type 1 system has exactly one pole of G(s)H(s) at origin, a type 2 system has exactly two poles of G(s)H(s) at the origin, and so on. The transfer function, G(s)H(s), is called the open-loop transfer function of the system in Figure 2.32, because Y ( s ) / Y d ( s ) = G(s)H(s) if the feedback loop is broken (or opened). We know from the real integration property of the Laplace transform (Eq. (2.68)) that a pole at the origin results from a time-integration. Hence, it is said in
  • 86. STABILITY 7J[ Table 2.5 Steady-state error according to system type for selected desired outputs Desired Type 0 Type 1 Type 2 Output, Steady-State Error Steady-State Error Steady-State Error Vd(0 Unit step, w s ( t ) 1/[1 + HnWo G(s)H(s)] 0 0 Unit ramp, oo l/lims^0sG(s)H(s) 0 t • « s (0 Unit parabola, oo oo l/lim.^o t2-us(t)/2 classical control parlance that the system type is equal to the number of pure integra- tions in the open-loop transfer function, G(s)H(s). The system of Example 2.16 with H(s) = K is of type 0, while the system with the same plant, G(s), in Example 2.17 becomes of type 1 with H(s) = l/s, and of type 2 with H(s) = /s2, Based on our experience with Examples 2.16-2.18, we can tabulate (and you may verify) the steady-state errors of stable closed-loop systems, according to their type and the desired output in Table 2.5. In Table 2.5 we have introduced a new animal called the unit parabolic function, given by t2 • w s (r)/2 (also t • r(t}/2). An example of y^(t) as a parabolic function is when it is desired to track an object moving with a constant acceleration (recall that y^(t) = r(t) represented an object moving with a constant velocity}. From Table 2.5, it is evident that to track an object moving with constant acceleration, the closed-loop system must be at least of type 2. 2.8 Stability As stated previously, one of the most important qualities of a control system is its stability. In Example 2.2 we saw that an inverted pendulum is unstable about the equilibrium point 9 = n. In addition, while discussing the transfer function in Section 2.4, we saw that a second order system whose poles have negative real parts (or positive damping-ratio, g > 0) exhibits step and impulse responses with exponentially decaying amplitudes, and we called such a system stable. While discussing steady-state error, we required that a closed-loop system must be stable before its steady-state error can be calculated, and defined stability tentatively as the property which results in a bounded output if the applied input is bounded. From Examples 2.2 and 2.12, we have a rough idea about stability, i.e. the tendency of a system (either linear, or nonlinear) to regain its equilibrium point once displaced from it. While nonlinear systems can have more than one equilibrium points, their stability must be examined about each equilibrium point. Hence, for nonlinear systems stability is a property of the equilibrium point. The pendulum in Example 2.2 has two equilibrium points, one of which is unstable while the other is stable. We can now define stability (and instability) more precisely for linear systems. For simplicity, we will focus on the initial response of a system (i.e. response to initial conditions when the applied input is zero), and by looking at it, try to determine whether a linear system is
  • 87. 72 LINEAR SYSTEMS AND CLASSICAL CONTROL stable. In this manner, we avoid having to classify the stability of a system according to the nature of the applied input, since stability is an intrinsic property of the linear system, independent of the input. There are the following three categories under which all linear control systems fall in terms of stability: 1. If the real parts of all the poles (roots of the denominator polynomial of the transfer function) are negative, then the initial response to finite initial conditions tends to a finite steady-state value in the limit t —* oo. Such linear systems are said to be asymptotically stable. The aircraft of Example 2.10 is asymptotically stable, because all four poles have negative real parts. 2. If any pole of the linear system has a positive real part, then its initial response to finite initial conditions will be infinite in magnitude in the limit t —> oo. Such a system is said to be unstable. 3. If all the poles of a system have real parts less than or equal to zero, and all the poles which have zero real parts are simple, i.e. they are not repeated (or multiple) poles (recall the discussion following Eq. (2.79)), the initial response of the system to finite initial conditions will keep on oscillating with a finite amplitude in the limit t -> oo. Such a system is said to be stable but not asymptotically stable (because the response does not tend to an infinite magnitude, but also does not approach a constant steady-state value in the limit / —> oo). However, if the poles having zero real part are repeated (i.e. they are multiple poles with the same imaginary part) the initial response of the system to finite initial conditions tends to infinity in the limit t —> oo, and such a system is said to be unstable. In physical systems, complex poles occur in conjugate pairs (see Examples 2.10, 2.12). Thus, the only physical possibility of two (or more) repeated poles having zero real parts is that all such poles should be at the origin (i.e. their imaginary parts should also be zero). We can summarize the stability criteria 1-3 by saying that if either the real part of any one pole is positive, or any one repeated pole has zero real part then the linear system is unstable. Otherwise, it is stable. A stable linear system having all poles with negative real parts is asymptotically stable. Using MATLAB you can easily obtain a location of the poles (and zeros) of a system in the Laplace domain with either the intrinsic command roots(num) and roots(den), or the Control System Toolbox (CST) commands pole(sys), zero(sys), or pzmap(sys), where sys is the transfer function LTI object of the system. From such a plot, it can be seen whether the system is asymptotically stable, stable (but not asymptotically stable), or unstable, from the above stated stability criteria. Another MATLAB (CST) command available for determining the poles of a system is damp(den) (see Example 2.10 for use of damp). Since the poles of a transfer function can be directly computed using MATLAB, one does not have to perform such mental calisthenics as the Routh-Hurwitz stability criteria (D'Azzo and Houpis [2]), which is a method for predicting the number of poles in the left and right half planes from the coefficients of the denominator polynomial by laboriously constructing a Routh array (see D'Azzo and Houpis [2] for details on Routh-Hurwitz stability criteria). Tabular methods such as Routh-Hurwitz were indispensible before the availability of digital computers
  • 88. ROOT-LOCUS METHOD 73 and software such as MATLAB, which can directly solve the characteristic equation and give the location of the poles, rather than their number in the left and right half planes. We shall further discuss stability from the viewpoint of state-space methods (as opposed to the classical frequency and Laplace domain methods) in Chapter 3. Before the advent of state-space methods, it was customary to employ graphical methods in the Laplace or the frequency domain for determining whether a closed-loop system was stable. The Bode plot is a graphical method that we have already seen. However, we are yet to discuss Bode plots from the stability viewpoint. Other graphical methods are the root-locus, the Nyquist plot, and the Nichols plot. Design using graphical methods is an instructive process for single-input, single-output, linear, time-invariant systems. Also, sometimes the graphical methods help in visualizing the results of a multi-variable state-space design (Chapters 5-7), and in that sense they have an important place in the modern control system design. 2.9 Root-Locus Method To understand the root-locus method of stability analysis, reconsider the single-input, single-output feedback control system of Figure 2.32. The closed-loop transfer func- tion, Y(s)/Yd(s), given by Eq. (2.139) is said to have a return difference function, 1 + G(s)H(s), which is the same as the characteristic polynomial of the closed-loop system. The return difference is a property of the feedback loop, and comes from the fact that if Fd(s) — 0, then Y(s) = G(s)U(s) and U(s) — ~H(s)Y(s); combining these two equations we can write Y(s) — —G(s)H(s)Y(s), i.e. Y(s) has returned to itself, or [1 + G(s)H(s)]Y(s) = 0. (The function G(s)H(s) is called the return ratio.) The root- locus method determine stability simply by investigating whether the return difference becomes zero for any value of s in the right half of the Laplace domain (i.e. values of s with positive real parts). If 1 + G(s)H(s) — 0 for some s in the right-half plane, it implies that there must be a closed-loop pole with positive real part, thus (according to stability criteria 2) the closed-loop system must be unstable. By drawing a locus of the each of the roots of the return difference function, 1 + G(s)H(s), as a design parameter is varied, we can find those values of the design parameter for which the system is stable (i.e. for which the loci do not enter the right half s -plane). How far away the locus closest to the imaginary axis is from crossing over into the right half 5-plane also indicates how far away the system is from being unstable - in other words, the stability margin of the closed-loop system. A pole on the imaginary axis indicates zero stability margin, which we called the case of stable but not asymptotically stable system in stability criteria 3. By the same criteria, more than one pole at the origin indicates instability. If we see the loci of one (or more) poles crossing into the right-half s-plane, or the loci of two (or more) poles simultaneously approaching the origin, we should realize that the closed-loop system is heading towards instability. Constructing a root-locus plot by hand is difficult, and standard classical controls textbooks, such as D'Azzo and Houpis [2], contain information about doing so. However, by using either the intrinsic MATLAB command roots repeatedly for each value of the
  • 89. 74 LINEAR SYSTEMS AND CLASSICAL CONTROL design parameter, or the Control System Toolbox (CST) command rlocus the root-locus plot is very easily constructed. In the CST command rlocus(sys), sys is the LTI object of the open-loop transfer function, G(s)H(s). The rlocus program utilizes the MATLAB roots command repeatedly to plot the roots of 1 -I- KG (s) H (s) as a design parameter, K, is varied automatically. The design parameter, K, is thus a scaling factor for the controller transfer function, H(s), and the root-locus shows what happens to the closed-loop poles as the controller transfer function is scaled to KH(s). The user can also specify a vector k containing all the values of K for which the roots are to be computed by entering rlocus(sys,k) at the MATLAB prompt. Example 2.19 For the closed-loop system of Figure 2.32 with plant, G(s) = (2s2 + 5s + l)/Cs 2 + 2s + 3), and controller, H(s) = 1, the root-locus is plotted in Figure 2.34 using the MATLAB command rlocus when the design parameter, AT, is varied from —0.4 to 0.4 as follows: »num=[2 5 1]; den=[1 2 3]; k=-0.4:0.02:0.4; GH=tf(num.den); p= rlocus(GH,k); <enter> »plot(p(1,:),'o'); hold on; p l o t ( p ( 2 , : ) , ' x ' ) <enter> It is clear from Figure 2.34 that both the poles of the closed-loop system have real part zero when K = —0.4, and then move towards the left as K is increased. 4 i l l i l i 0 3 o ° *-^ - o o OO ° ^^- K increasing 2 •c 1 _ f^ <C Q. 1 0 - K=OA c 8* I -1 -V -2 X X xx ^^ K increasing x X X „ -3 X x K=-OA ~ X _d I l I I l I -1.2 -1 -0.8 -0.6 -0.4 -0.2 0.2 Real part Figure 2.34 Root-locus plot of the closed-loop system of Example 2.19, as the design param- eter, K, is varied from —0.4 to 0.4
  • 90. ROOT-LOCUS METHOD 75 For K = —0.4, the two loci are on the verge of crossing into the right half plane. Hence the closed-loop system is stable for A' > —0.4 and unstable for K < —0.4. The value of K for which both the poles are on the imaginary axis (i.e. real part = 0) can be calculated by hand for this second order system by finding the characteristic equation as follows: 1 + KG(s)H(s) = 1 + K(2s2 + 5s + )/(s2 + 2s + 3) = Q (2.147) or (1 + 2K)s2 + (2 + 5K)s + (3 + A) = 0 (2.148) Note that Eq. (2.148) is the second order characteristic equation, which can be expressed in terms of the natural frequency, a>n, and damping-ratio, £, as Eq. (2.82). The poles with zero real part correspond to a damping-ratio, £ = 0. Comparing Eq. (2.131) with Eq. (2.82) and putting £ = 0, we get (2 + 5A") = 0, or K = -0.4, for which a>n = [(3 + K)/( + 2K)]l/2 = 3.606 rad/s, and the corresponding pole locations are p^ = ±iajn = ±3.606/, which are the same as the pole locations in Figure 2.34 for K = -0.4. We can find the values of the design parameter K for specific pole locations along the root-loci using the CST command rlocfind as follows: »[k,poles]=rlocfind(sys,p) <enter> where p is the specified vector containing the pole locations for which values of K (returned in the vector k) are desired. You can get the value of gain, K, the pole loca- tion, associated damping, natural frequency, and maximum overshoot of step response by clicking at any point on the root-locus generated by the command rlocus(sys). Similarly, the command rlocfind(sys) lets you move a cross-hair along the root-loci with the mouse to a desired pole location, and then returns the corresponding value of K when you click the left mouse button. To do this you must first plot a root-locus, and then use rlocfind on the same plot as follows: »rlocus(sys); hold on; rlocfind(sys) <enter> The CST command rlocus is of limited utility in the stability analysis of closed-loop system, because it merely scales the controller transfer function, H(s), by a factor K. For the root-locus plot of more general systems, we should use the MATLAB command roots, as shown in Example 2.20. Example 2.20 Consider a closed-loop system shown in Figure 2.35. Note that this system is different from the one shown in Figure 2.32, because the controller, H ( s ) , is in the feedback path whereas the controller was placed in the forward path, in series (or
  • 91. 76 UNEAR SYSTEMS AND CLASSICAL CONTROL U(s) o Y(s) Figure 2.35 A closed-loop system with plant, G(s), and feedback controller, H(s) cascade) with the plant, G(s), in Figure 2.32. You can show that both the systems have the same closed-loop transfer function, Y(s)/Yd(s), if Z(s) = H(s)Yd(s). The closed-loop transfer function, Y(s)/U(s), for the system in Figure 2.35 is derived in the following steps: Y(s) = (2.149) where Z(s) = H(s)Y(s) (2.150) Substituting Eq. (2.150) into Eq. (2.149), we get the following expression for Y(s): Y(s) = G(s)U(s) - G(s)H(s)Y(s) (2.151) or Y(s)/U(s) = G(s)H(s)] (2.152) Note that the characteristic equation is still given by 1 + G(s)H(s) = 0. For the present example, let us take G(s) = (2s2 + 5s + l)/(s2 -2s+ 3) and H(s) = If (Ks + 1). This choice of H(s) allows introducing a pole of G(s)H(s) at a location that can be varied by changing the design parameter, K. (Introduction of poles and zeros in the open-loop transfer function, G(s)H(s), through a suitable H(s) to achieved desired closed-loop performance is called compensation, and will be studied in Section 2.12.) Let us plot the root-locus of the closed-loop system as the controller design parameter, AT, is varied. Then the closed-loop characteristic equation is given by Ks3 + (3 - 2K)s2 + (3 + 3K)s + 4 = (2.153) Since //(s) is not merely scaled by K (which was the case in Example 2.19), we cannot use the MATLAB CST command rlocus to get the root-locus. Instead, the intrinsic MATLAB command roots is used repeatedly to plot the root-locus as K is varied from 1.0 to 1.3 as follows: »i=1; for k=1:0.02:1.3; r=roots([k 3-2*k 3+3*k 4 ] ) ; R(i,:)=r'; i=i+1; end; p l o t ( R , ' x ' ) <enter>
  • 92. NYQUIST STABILITY CRITERION 77 Note that the matrix R is used to store the roots in its rows. The resulting plot is shown in Figure 2.36. The complex conjugate roots are seen to cross into the right half plane for K = 1.15. Hence, the system is stable for 1 < K < 1.15 and unstable for K > 1.15. 2 1.5 K" increasing 1 « Gi- 0.5 K increasing ro 0 - X X X X X X X X XXX88MBK ^c | -0.5 -1 K increasing -1.5 __2 -2.5 i i -7 -6 -5 -4 -3 -2 -1 0 1 Real part Figure 2.36 Root-locus of the closed-loop system of Example 2.20 as K varies from 0.3 to 1.3 2.10 Nyquist Stability Criterion The Nyquist criterion determines a closed-loop system's stability using the complex-variable theory. It employs a polar plot (see Section 2.4) of the open-loop frequency response, G(ia))H(ico), as a) increases from — oo to oo. Such a polar plot is called a Nyquist plot. In the 5-plane, the imaginary axis denotes an increase of CD from —oo to oo. Hence, the Nyquist plot of G(ia>)H(ia)), as a> increases from —oo to oo is said to be a mapping in the G(s)H(s) plane (i.e. the plane defined by real and imaginary parts of G(s)H(s)) of all the points on the imaginary axis in the s-plane. The direction of the Nyquist plot indi- cates the direction of increasing co. A polar plot is usually restricted to u> between 0 and oo. However, note that a polar plot of G(ia))H(ito} drawn for negative frequencies is the complex conjugate of the polar plot of G (ico) H (ico) drawn for positive frequencies. In other words, the Nyquist plot is symmetrical about the real axis. Hence, the practical technique of plotting Nyquist plot is to first make the polar plot for co increasing from 0 to oo, and then draw a mirror image of the polar plot (about the real axis) to represent the other half of the Nyquist plot (i.e. the frequency range —oo < a> < 0). The direction of the mirror- image polar plot would be clear from the CD =• 0 point location on the original polar plot, where the two plots should necessarily meet. The two mirror images should also meet at co —> oo and co -> — oo, respectively. Hence, to —> ±00 is a single point on the Nyquist
  • 93. 78 LINEAR SYSTEMS AND CLASSICAL CONTROL plot, and the positive and negative frequency branches of a Nyquist plot form a closed contour. It is quite possible that the two polar plots for positive and negative frequencies of some functions may overlap. Figure 2.21 showed the polar plot for positive frequencies. You may verify that a polar plot of the same frequency response for negative frequencies overlaps the curve shown in Figure 2.21, but has an opposite direction for increasing a>. Since the Nyquist plot of G(s)H(s) is a closed contour for s = ia) when —oo < to < oo, whose direction is indicated by increasing CD, the only possibility of the positive and negative frequency branches meeting at co —>• ±00 is that the Laplace variable, s, must traverse an infinite semi-circle in the right-half s-plane. In other words, the region enclosed by the Nyquist plot in the G(s)H(s) plane is a mapping of the entire right half s-plane. This fact is depicted in Figure 2.37. The direction of the curves in Figure 2.37 indicate the direction in which the frequency, co is increasing. The point G(s)H(s) = —1 has a special significance in the Nyquist plot, since it denotes the closed-loop characteristic equation, 1 + G(s)H(s) = 0. The application of Nyquist stability criteria is restricted to linear, time-invariant control systems with a proper open-loop transfer function, G(s)H(s). Since G(s)H(s) of a linear, time-invariant control system is a rational function of s, a point in the .s-plane corresponds to only one point in the G(s}H(s} plane (such a mapping is called one-to-one mapping). Since G(s)H(s) is proper, it implies that lim,-,^ G(s)H(s) must be either zero, or a non-zero constant. A one-to-one mapping from s-plane to the G(s)H(s)-pane in which Imaginary axis (s = k Real axis (S=a) Imaginary part of G(s)H(s) Nyquist plot Real part of G(s)H(s) Figure 2.37 The mapping of right-half s-plane into a region enclosed by the Nyquist plot in the G(s)H(s) plane
  • 94. NYQUIST STABILITY CRITERION 79 the limit lim^oo G(s)H(s) exists and is finite is called a conformal mapping. The Nyquist stability criterion is based on a fundamental principle of complex algebra, called Cauchy's theorem, which states that if a closed contour with an anti-clockwise direction in the s-plane, which encloses P poles and Z zeros of I -f- G(s)H(s), and which does not pass through any poles or zeros of 1 + G(s)H(s), is conformally mapped into a closed contour (i.e. Nyquist plot) in the G(s)H(s) plane, then the latter will encircle the point G(s)H(s) = — 1 exactly N times in an anti-clockwise direction, where N = P — Z. An anti-clockwise encirclement of G(s)H(s) — — 1 is considered positive, while a clockwise encirclement is considered negative. Hence, N could be either positive, negative, or zero. The proof of Cauchy's theorem is beyond the scope of this book, but can be found in D'Azzo and Houpis [2], or in a textbook on complex variables. Applying Cauchy's theorem to the contour enclosing the entire right-half s-plane (shown in Figure 2.37), we find that for closed-loop stability we must have no zeros of the closed-loop characteristic polynomial, 1 + G(s)H(s), in the right-half .v-plane (i.e. Z = 0 must hold), and thus N = P, which implies that for close-loop stability we must have exactly as many anti- clockwise encirclements of the point G(s)H(s) = — 1 as the number poles of G(s}H(s) in the right-half s-plane. (The Nyquist plot shown in Figure 2.37 contains one anti-clockwise encirclement of — 1, i.e. N = . The system shown in Figure 2.37 would be stable if there is exactly one pole of G(s)H(s) in the right-half .v-plane.) Note that Cauchy's theorem does not allow the presence of poles of G(s)H(s) any- where on the imaginary axis of .s-plane. If G(s)H(s) has poles on the imaginary axis, the closed contour in the s-plane (Figure 2.37) should be modified such that it passes just around the poles on the imaginary axis. Hence, the closed contour should have loops of infinitesimal radius passing around the poles of G(s)H(s) on the imaginary axis, and the Nyquist plot would be a conformal mapping of such a contour in the G(s)H(s) plane. Studying the effect of each detour around imaginary axis poles on the Nyquist plot is necessary, and could be a tedious process by hand [2J. You can make the Nyquist plot using the polar plot of G(ia))H(ia>) drawn for positive frequencies and its complex conjugate for negative frequencies, using the intrinsic MATLAB command polar (see Example 2.8). The abscissa of the polar plot must be modified to locate the point G(s)H(s) = — 1 on the negative real axis (i.e. the radial line corresponding to 0 = 180° in Figure 2.21). (Actually, the polar plot for negative frequencies is not required, since the number of encirclements can be determined from the shape of the polar plot of G (ico) H (ia>) drawn for positive frequencies near the point — 1, and the fact that the negative frequency plot is the mirror image of the positive frequency plot.) An easier way of making the Nyquist plot is by the MATLAB Control System Toolbox (CST) command nyquist(sys), where sys denotes the LTI object of the open-loop transfer function, G(s)H(s). Example 2.21 The Nyquist plot of the open-loop transfer function, G(s)H(s) of the system in Figure 2.32 with G(s) = (2s2 + 5s + l ) / ( s 2 - 2s + 3), and H(s) = 1 is obtained in Figure 2.38, using the following MATLAB command: »num=[2 5 1 ] ; den=[1 -2 3 ] ; GH=tf(num,den); nyquist(GH) <enter>
  • 95. 80 UNEAR SYSTEMS AND CLASSICAL CONTROL G(s)H(s)-plane X'' -1 -2 -3 -2 -1 0 Real part Figure 2.38 Nyquist plot of tfie closed-loop system in Example 2.21 It is clear from the Nyquist plot in Figure 2.38 that the point — 1 is encircled in the anticlockwise direction exactly twice. Hence, N = 2. The open-loop transfer function G(s)H(s) has two poles with positive real parts (i.e. P = 2), which is seen by using the MATLAB CST command damp as follows: »damp(den) <enter> Eigenvalue Damping Freq. (rad/sec) 1.0000+1.41421 -0.5774 1.7321 1.0000-1.41421 -0.5774 1.7321 Since N = P = 2, Cauchy's theorem dictates that the number of zeros of 1 + G(s)H(s) in the right-half plane is Z = P — N = 0, which implies that the closed- loop transfer function has no poles in the right half plane. Hence by the Nyquist stability criterion, the closed-loop system is stable. You can verify that the closed- loop characteristic equation is 1 + G(s)H(s) = 0, or 3s2 + 35 + 4 = 0, resulting in the closed-loop poles -0.5 ± 1.0408/. A major limitation of the Nyquist stability criterion is that it does not give any indi- cation about the presence of multiple zeros of 1 + G(s)H(s) at 5=0, which cause closed-loop instability due to stability criterion 3 of Section 2.8. Another limitation of the Nyquist stability criterion is that it cannot be applied in cases where the Nyquist plot of G(s)H(s) passes through the point G(s)H(s) = — 1, because in that case the number of encirclements of — 1 point are indeterminate.
  • 96. ROBUSTNESS 81 2.11 Robustness Robustness of a control system is related to its sensitivity to unmodeled dynamics, i.e. part of the behavior of an actual control system which is not included in the mathematical model of the control system (governing differential equations, transfer function, etc.). Since we have to deal with actual control systems in which it is impossible (or difficult) to mathematically model all physical processes, we are always left with the question: will the control system based upon a mathematical model really work? In Chapter 1, we saw that disturbances (or noise) such as road roughness, tyre condition, wind velocity, etc., cannot be mathematically modeled when discussing a control system for the car driver example. If a control system meets its performance and stability objectives in the presence of all kinds of expected noises (whose mathematical models are uncertain), then the control system is said to be robust. Hence, robustness is a desirable property that dictates whether a control system is immune to uncertainties in its mathematical model. More specifically, robustness can be subdivided into stability robustness and performance robustness, depending upon whether we are looking at the robustness of the stability of a system (determined by the location of the system's poles), or that of its performance objectives (such as peak overshoot, settling time, etc.). We intuitively felt in Chapter 1 that a closed-loop system is more robust than an open-loop system. We are now in a position to mathematically compare the sensitivities of open and closed-loop systems, representatives of which are shown in Figure 2.39. For simplicity, it is assumed that for both open and closed loop systems, the controller transfer function is a constant, given by K, while the plant transfer function is G(.9).The transfer function of the open-loop control-system, F0(s), is given by (2.154) while that of the closed-loop system (Fc(s)) is given by Eq. (2.124) FcCs) = Y(s)/Yd(s) = KG(s)/[l + KG(s)] (2.155) (a) Vd(s) U(s) Y(s) K G(s) U(S) Y(s) K G(s) Figure 2.39 Single-input, single-output open-loop (a) and closed-loop (b) control systems with controller transfer function K and plant transfer function G(s)
  • 97. 82 LINEAR SYSTEMS AND CLASSICAL CONTROL Since the controller transfer function, K, is derived based on some mathematical model of G(s), we can determine each control system's robustness by calculating the sensitivity of the overall transfer function, Y ( s ) / Y d ( s ) , to variation in K. Mathematically, the sensi- tivity of either open-loop, or closed-loop system to variation in controller gain, AT, can be expressed as S(s) = [Yd(s)/Y(s)]3[Y(s)/Yd(s)]/dK (2.156) where d[Y(s)/Yd(s)]/dK denotes the change in the transfer function due to a change in K. Then the sensitivities of the open and closed-loop systems to variation in K are given by S0(s) = [/F0(s)]dF0(s)/dK = /K (2.157) and Sc(s) = [/Fc(s)]3Fc(s)/3K = /[K( + KG(s))] (2.158) The ratio of the open-loop sensitivity to the closed-loop sensitivity S0(s)/Sc(s) is thus S0(s)/Sc(s) = [1 + KG(s)] (2.159) which is nothing else but our well known acquaintance, the return difference function (or the closed-loop characteristic polynomial)! The magnitude of the return difference, 11 + AT G(s)|, is greater than 1, which confirms that an open-loop system is more sensitive (or less robust) when compared to the closed-loop system to variations in controller gain. The greater the value of the return difference, the larger is the robustness of a closed- loop system (Eq. (2.158)). Hence, one can measure a closed-loop system's robustness by determining the return difference function in the frequency domain, s = ico, for a range of frequencies, u>. We need not confine ourselves to closed-loop systems with a constant controller transfer function when talking about robustness; let us consider a cascade closed-loop system (Figure 2.32) with a controller transfer function, H(s). Either the Bode plot of G(ia))H(ia>), or the Nyquist plot of G(s)H(s) can be utilized to convey information about a system's stability robustness (i.e. how robust is the stability of the system with respect to variations in the system's model). The Nyquist plot is more intuitive for analyzing stability robustness. From Nyquist stability theorem, we know that the closed- loop system's stability is determined from the encirclements by the locus of G(s)H(s) of the point —1 in the G(s)H(s) plane. Therefore, a measure of stability robustness can be how far away the locus of G(s)H(s) is to the point —1, which indicates how far the system is from being unstable. The farther away the G(s)H(s) locus is from —1, the greater is its stability robustness, which is also called the margin of stability. The closest distance of G(s)H(s) from —1 can be defined in the complex G(s )//($) plane by two quantities, called the gain margin and the phase margin, which are illustrated in Figure 2.40 depicting a typical Nyquist diagram for a stable closed-loop system. A circle of unit radius is overlaid on the Nyquist plot. The closest distance of the Nyquist plot of G(s)H(s) to —1 is indicated by two points A and B. Point A denotes the intersection of G(s)H(s) with the negative real axis nearest to the point —7, while point B denotes the intersection of G(s)H(s) with the unit circle. Point A is situated at a distance a from
  • 98. ROBUSTNESS 83 Imaginary axis Real axis Unit circle Gain margin = 20 Iog10(1/a) (dB) Phase margin = ft = 180° + 0 Figure 2.40 The Nyquist plot of G(s)H(s) showing the gain and phase margins the origin, while point B is located on the unit circle at an angle 0 from the positive real axis. It is clear that the gain of G(s)H(s) at point B is unity, while its phase at the same point is 9. The gain margin is defined as the factor by which the gain of G(s)H(s) can be increased before the locus of G(s)H(s) hits the point — 1. From Figure 2.40, it is evident that the gain margin is equal to I/a, or in dB it is given by Gain Margin in dB = 20 log ]0 (l/o;) (2.160) A negative gain margin indicates that the system is unstable. The phase margin is defined as the difference between the phase of G(s)H(s) at point B, 0, and the phase of the negative real axis, —180° (on which the point —1 is located). Thus, phase margin is given by the angle ft in Figure 2.40: Phase Margin = 0 = 9- (-180°) = 9 + 180C (2.161) The gain margin indicates how far away the gain of G(s)H(s) is from 1 (i.e. the gain of the point —1) when its phase is —180° (point A). Similarly, the phase margin indicates how far away the phase of G(s)H(s) is from —180° (i.e. the phase of the point — 1 ) when the gain of G(s)H(s) is 1 (point B). Since the Bode plot is a plot of gain and phase in frequency domain (i.e. when s = iw), we can use the Bode plot of G(s)H(s) to determine the gain and phase margins. In the Bode gain plot, the unit circle of the Nyquist plot (Figure 2.40) translates into the line for or zero dB gain (i.e. unit magnitude, |G(/o>)//(/co)|), while the negative real axis of the Nyquist plot transforms into the line for — 180° phase in the Bode phase plot. Therefore, the gain margin is simply the gain of G(io)}H(ia)) when its phase crosses the —180° phase line, and the phase margin is the difference between the phase of G(ia))H(ico) and — 180° when the gain of G(ico)H(io)) crosses the 0 dB line. The frequency for which the phase of G(ia))H(ico) crosses the —180° line is called the phase crossover frequency, a>p,
  • 99. 84 LINEAR SYSTEMS AND CLASSICAL CONTROL while the frequency at which the gain of G(ia>)H(ia>) crosses the 0 dB line is called the gain crossover frequency, O)Q. Example 2.22 Consider the closed-loop system of Figure 2.32, with G(s) = (2s2 + 5s + l ) / ( s 2 + 2s + 3) and H(s) = /s2. Figure 2.41 shows the Bode plot of G(ia>)H(ia>) which is obtained by the following MATLAB CST command: »num=[2 5 1 ] ; den=conv([1 2 3 ] , [ 1 0 0 ] ) ; G=tf(num.den); bode(G) <enter> Figure 2.41 shows that the phase crosses the —180° line at the phase crossover frequency, o>p = 3.606 rad/s. The gain present at this frequency is —14.32 dB. Hence, the gain margin is 14.32 dB, indicating that the gain of G(s)H(s) can be increased by 14.32 dB before its Nyquist locus hits the point —1. In Figure 2.41, we can see that the 0 dB gain line is crossed at gain crossover frequency, CDQ = 1.691 rad/s, for which the corresponding phase angle is —148.47°. Therefore, the phase margin is -148.47° + 180° = 31.53°. The numerical values of gain margin, phase margin, gain crossover frequency, and phase crossover frequency, can be directly obtained using the MATLAB CST command margin(sys), or margin(mag,phase,w), where mag,phase,w are the magnitude, phase, and frequency vectors obtained using the command [mag,phase,w] = bode(sys,w). For a system having a frequency response, G(ia>)H(ico), which is changing rapidly with frequency (such as in the present a>G = 1.691 rad/s 100 co O 10° 101 Frequency (rad/sec) -120 o> -150 i? <o s™ eu " ol -180 10- 10'1 10° * 101 o>P = 3.606 rad/s Frequency (rad/sec) Figure 2.41 Bode plot of G(s)H(s) for the closed-loop system of Example 2.22
  • 100. ROBUSTNESS 85 example), the command margin(sys) may yield inaccurate results. Therefore, it is advisable to use the command margin(mag,phase,w), with the magnitude and phase generated at a large number of frequencies in the range where the frequency response is changing rapidly. This is done by using the command w = logspace(a, b, n), which generates n equally space frequencies between 10a and 10b rad/s, and stores them in vector w. Then the command [mag,phase,w] — bode(sys,v) will give the desired magnitude and phase vectors from which the gain and phase margins can be calculated. This procedure is illustrated for the present example by the following commands: »num=[2 5 1]; den=conv([1 2 3 ] , [ 1 0 0 ] ) ; w=logspace(-2,1,1000); G=tf(num.den); »[mag,phase,w]=bode(G); <enter> »margin(mag,phase,w) <enter> A Bode plot results, with computed gain and phase margins and the corresponding crossover frequencies indicated at the top of the figure (Figure 2.42). Another way of obtaining gain and phase margins is from the Nichols plot, which is a plot of the gain of the open-loop frequency response, G(ia))H(ico), against its phase. The gain and phase margins can be directly read from the resulting plot in which the point —1 of the Nyquist plot corresponds to the point 0 dB, —180°. Gm= 14.32 dB,(w= 3.606) = 1.691) 100 50 CO U n 0 -50 10—2 0~1 10° Frequency (rad/sec) u 1 ' ' -90 - - -180 ^ -270 - - Qfin 10~1 10° 101 Frequency (rad/sec) Figure 2.42 Gain and phase margins and crossover frequencies for the system of Example 2.22 obtained using the MATLAB Control System Toolbox command margin
  • 101. 86 UNEAR SYSTEMS AND CLASSICAL CONTROL In addition to the open-loop gain and phase, the Nichols plot shows contours of constant closed-loop magnitude and phase, Y(ia))/Yd(ico), and 0(<w), given by Y(io))/Yd(ia)) = G(ito)H(ia>)/[ (2.162) It can be shown that the closed-loop gain and phase are related to the open-loop gain and phase G(ia)}H(ia>} and 0, respectively, by the following equations: Y(ia>)/Yd(ia)) = 1/[1 + l/G(ia>)H(ia) + 2cos(0)/|G(i<y)#(i«|] l/2 (2.163) G(ia>)H(ia>]} (2.164) where G(iu>)H(ia)) = G(ia))H(ia>zl9 . Seeing the formidable nature of Eqs. (2.163) and (2.164), plotting the contours of constant closed-loop gain and phase by hand appears impossible. However, MATLAB again comes to our rescue by providing the Control System Toolbox (CST) command nichols(sys) for plotting the open-loop gain and phase, and the command ngrid for plotting the contours of the closed-loop gain and phase. Here sys denotes the LTI object of the open-loop transfer function, G(s)H(s). Figure 2.43 shows the Nichols plot of the system in Example 2.22 obtained using the following MATLAB commands: »num=[2 5 1 ] ; den=conv([1 0 0],[1 2 3 ] ) ; G=tf (num.den) ; ngrid('new'); nichols(G) <enter> -40 40 db -360 -270 -180 -90 Open-loop phase (deg) Figure 2.43 Nichols plot for the system of Example 2.22
  • 102. CLOSED-LOOP COMPENSATION TECHNIQUES 87 The gain and phase margins are directly read from Figure 2.43 as shown. However, the crossover frequencies cannot be obtained from the Nichols plot. Apart from giving the gain and phase margins, the Nichols plot can be used to design and analyze the closed-loop frequency response of the system. The intersection of the G(ia))H(io)) Nichols plot with the closed-loop gain contours give the closed-loop gain frequency response, Y(ico)/Yd(i(o). The frequencies at the intersection points can be obtained from a Bode gain plot of G(ia))H(ia)). However, such a procedure is fairly complicated, and it is easier to get the closed-loop frequency response directly from the Bode plot of Y(io})/'Y&(ico). We have seen how the stability robustness of a closed-loop control system is defined by the gain and phase margins determined from the open-loop transfer function, G(s}H(s), We have considered variations in the overall transfer function, Y(s)/Y&(s~), for defining robustness, and shown that closed-loop systems are more robust to such variations than open-loop systems. Variations in the overall transfer function are called process noise. However, closed-loop systems are susceptible to another form of noise, which is absent in open-loop systems, and which arises due to errors in measuring (and feeding back) the output, Y(s). Such a noise is called measurement noise. Invariably, the measurement noise is caused by imperfections in the sensors used to measure the output, and usually occurs at higher frequencies than the natural frequencies of the closed-loop system. To reduce the sensitivity of a closed-loop system to measurement noise (or to make the system robust with respect to measurement noise), the frequency response of the closed-loop system must have smaller gains at higher frequencies. This requirement results in the magnitude Bode plot of the closed-loop system decaying rapidly (or rolling-off) with frequency, at high frequencies. Hence, a controller transfer function must be selected to provide not only good gain and phase margins, which indicate the closed-loop system's robustness to process noise, but also a large decay (or roll-off) of the gain at high frequencies, indicating robustness due to the measurement noise. While designing a closed-loop system, one is not only interested in stability in the presence of modeling uncertainties (such as process and measurement noise), but also in maintaining a desired level of performance, i.e. one would like to achieve perfor- mance robustness as well. It can be appreciated that for achieving performance robust- ness, we should first achieve stability robustness (i.e. there is no point in talking about the performance of an unstable control system). Criteria for achieving stability and performance robustness of multivariable systems are more generally expressed with the use of modern state-space methods (rather than the classical single-input, single-output, frequency domain procedures), as discussed in Chapter 7. 2.12 Closed-Loop Compensation Techniques for Single-Input, Single-Output Systems We have seen in the previous sections how the steady-state error, stability, and gain and phase margins can be affected by changing the controller transfer function, H ( s ) , in a
  • 103. 88 UNEAR SYSTEMS AND CLASSICAL CONTROL typical single-input, single-output closed-loop system of Figure 2.32. Since we can use H(s) to compensate for the poor characteristics of a plant, G(s), such a controller, H(s), is called a compensator, and the procedure of selecting a controller, H(s), in order to remove the deficiencies of the plant, G(s), (such as improving stability, performance, and robustness), is called closed-loop compensation. Classical control techniques of designing single-input, single-output control systems based upon their frequency response charac- teristics largely rely upon closed-loop compensation. We will consider some commonly employed closed-loop compensation techniques. Closed-loop compensation is generally of two types: cascade (or series) compensation in which H(s) is placed in series with the plant (Figure 2.32), and feedback (or parallel) compensation in which H(s) is placed in the feedback path of G(s) (Figure 2.35). Cascade and feedback compensation represent two alternatives for achieving the same closed-loop characteristics. Where we insert the compensator in the control system depends largely upon the physical aspects of imple- mentation. We study only cascade compensation techniques here, which can be easily extended to feedback compensation. 2.12.1 Proportional-integral-derivative compensation A popularly used compensator with the transfer function, H(s) = (K&s2 + Kps + K)/s, where K&, Kp, and K are constants, is called the proportional plus integral plus derivative (PID) compensator, because its transfer function can be expressed as H(s) = Kp + K&s + KI/S, signifying that the output of the controller, U(s), is a sum of its input, E(s), multiplied by constant Kp, the integral of the input times K, and the derivative of the input times K&, i-e. U(s) = KpE(s) + KE(s)/s + KosE(s) (recall that E(s)/s is the Laplace transform of the integral of the function, e(t), and sE(s) is the Laplace transform of the derivative of e(t) if the initial conditions are zero). PID compensators are very common in industrial applications due to their good robustness over a wide frequency range. The presence of the integral term, K/s, in H(s) increases the type of the closed-loop system due to the pole at the origin, thereby reducing the steady-state error. The derivative term, KQS, and the proportional term, Kp, can be used to place two zeros of H(s) at suitable locations, to change the phase characteristics of the closed-loop system. Let us consider an example of PID compensation. Example 2.23 Consider a hard-disk read/write head positioning system with the following transfer function: Y(s)/U(s) = G(s) = 700/(s2 + 155 + 100000) (2.165) The output, Y(s), is the angular position of the head in radians, while the input, U(s), is the current in milli-Amperes (mA) supplied to the head positioning solenoid. The poles, natural frequencies, and damping-ratios for this second order plant are as follows:
  • 104. CLOSED-LOOP COMPENSATION TECHNIQUES 89 »num=700; den = [1 15 1e5]; damp(den) <enter> Eigenvalue Damping Freq. (rad/sec) -7.50006+000+3.1614e+002i 2.3717e-002 3.1623e+002 -7.50006+000-3.1614e+002i 2.37176-002 3.16236+002 Note that the damping is very small, and hence the head positioning system, will oscillate a lot before coming to a steady-state. Since the plant is of type 0, the steady-state error due to a step input will be non-zero. To make the steady- state error zero for a step input, we initially choose a PID compensator with KD = 0, Kp = 1, and K = 1100, which makes the controller transfer function the following: H(s)-(s + 1100)/s (2.166) Since H(s) has no derivative term, it is essentially a. proportional-plus-integral (PI) compensator, with a zero at s = —1100 and a pole at s = 0. Connecting H(s) and G(s) in series, and then closing the feedback loop as shown in Figure 2.32, we get the following closed-loop transfer function: Y ( s ) / Y d ( s ) = (700s + 770000)/(s3 + 15s2 + 1 00700s + 770000) (2.167) The Bode plots of the plant, G(s), the compensator, H(s), and the closed-loop system are obtained as follows, and are shown in Figure 2.44: »G=tf(num,den); w=logspace(-l,4); [magi,phase1,w]=bode(G,w); % Bode plot of the plant <enter> IUU _ _ i i i imi| i i imii| 1 1 llllll| 1 1 "" - - . . _ . .Com aensator Closed-loop sytem S" n 2, Plant "u^-x c 'to 0 -100 ^-_ il i i i I mil i 1 1 1 1 ml i i 1 1 Hill 1 1 1 Mill -200 1 1Cr 10° io1 io2 103 1( Frequency (rad/s) 0 Compensator ""••- 1 ^ -100 - D) CD _Plant ? -200 Closedrloop sytem 1 1 1 1 1 1 1 III 1 ! 1 1 ! Illl 1 1 1 1 1 Mil 1 1 1 1 1 Illl 1 1 1 1 1 1 II 10~1 10° 101 102 103 1( Frequency (rad/s) Figure 2.44 Bode plots of the plant, PI compensator, and closed-loop system for the hard-disk read/write head
  • 105. 90 UNEAR SYSTEMS AND CLASSICAL CONTROL 1 1100]; d1 = M 0] ;H=tf (n1 ,d1); [mag2,phase2,w]=bode(H,w); % Bode plot of the compensator <enter> »nCL=[700 770 000]; dCL=[1 15 100 700 770 000]; GCL=tf(nCL.dCL); <enter> »[mag3,phase3,w]=bode(GCL J w); % Bode plot of the closed-loop system <enter> Note from Figure 2.44 that the PI compensator increases the gain, while decreasing the phase at low frequencies, and leaves the high frequency gain unaffected. The DC gain of the closed-loop system is brought to 0 dB, indicating that the step response will have a zero steady-state error. There is a reduction in the gain margin of the closed-loop system due to the increased gain at low frequencies, when compared to that of the plant, indicating a loss of robustness. The plant's natural frequency of 316.23 rad/s is visible as a peak in the gain plot. The closed-loop poles are the following: »damp(dCL) <enter> Eigenvalue Damping Freq. (rad/sec) -3.67466+000+3.1722e+002i 1.15836-002 3.17246+002 -3.67466+000-3.1722e+002i 1.1583e-002 3.17246+002 -7.65076-1-000 1.00006+000 7.6507e+000 Note that the closed-loop damping near plant's natural frequency is slightly reduced, while another pole is placed at s = —7.6507. How does this closed-loop pole config- uration affect the step response of the system? This question is best answered by comparing the plant's step response with that of the closed-loop system. The step responses are calculated using the M-file stepresp.m of Table 2.3 as follows: »[s1,t] = stepresp(num,den,0,0.01,1); % step response of the plant <enter> »[s2,t] = stepresp(nCL,dCL,0,0.01,1); % step response of the closed-loop system <enter> The two step responses are compared in Figure 2.45. Note that while the closed- loop steady-state error is brought to zero, the settling time and the large number of oscillations of the plant are unaffected. Furthermore, let us compare the gain and phase margins of the closed-loop system with those of the plant, to see how the stability robustness is affected. The gain and phase margins of the plant, with the respective crossover frequencies, are calculated using the command margin as follows: »[gm,pm,wg,wp]=margin(G) <enter> gm = Inf
  • 106. CLOSED-LOOP COMPENSATION TECHNIQUES 91 0.4 0.6 Time (s) Step response of the closed-loop system 0.2 0.4 0.6 0.8 Figure 2.45 Step responses of the plant and the PI compensated closed-loop system for the hard-disk read/write head pm = Inf wg = NaN wp = NaN where inf denotes oo, and NaN stands for 'not a number', i.e. an undefined quantity. The plant thus has infinite gain and phase margins, and the corresponding crossover frequencies are thus undefined. The margins for the closed-loop system are the following: »[gmCL,pmCL,wgCLJwpCL] = margin(GCL) <enter> gmCL = 0.9750 pmCL = -3.8267 wgCL = 318.4062 wpCL = 318.6843 Both gain and phase margins of the closed-loop system have been drastically reduced to only 0.975 (-0.22 dB) and -3.8267°, respectively, with the gain and phase crossover frequencies quite close together at 318.7 rad/s and 318.4 rad/s, respec- tively. Clearly, the closed-loop system is quite less robust than the plant. In summary,
  • 107. 92 LINEAR SYSTEMS AND CLASSICAL CONTROL the PI compensator given by Eq. (2.166) not only results in a highly oscillatory response, but also a significant loss in robustness. Let us now improve the PID compensation by selecting the values of A^D, Kp, and KI, that lead to a desired closed-loop response. It is desirable to have a well damped closed-loop response, to reduce the number of oscillations, as well as the settling time. Hence, let us select a damping-ratio of £ = 0.707 for the closed-loop system, without changing the plant's natural frequency, a>,, =316.23 rad/s. The general transfer function of the forward path, G ( s ) H ( s ) , can then be written as follows: G(s)H(s) = 7W(KDs2 + KPs + tfi)/[5(52 + 155 + 100000)] (2.168) Note that the closed-loop system's type is increased from 0 to 1, due to the presence of the pole at 5 = 0 in G(s)H(s). Hence, the steady-state error to step input will be zero, irrespective of the values of KD, Kp, and K. The closed-loop transfer function is G(s)H(s}/[ + G(s)//(s)], which can be expressed as N(s)/D(s), where N ( s ) and D(s) are the following numerator and denominator polynomials, respectively: N(s) = 700(tfD5 + KPs + K}) D(s) = s + (15 + (100 000 + 700/^)5 + 700tfi (2.169) Note that the closed-loop system is of third order. We can write D(s) as a quadratic factor in s multiplied by a first order polynomial in 5, as follows: D(s) = (s2 + 2$a)ns + w 2 )(5 + p) (2.170) Note from Eq. (2.116) that the step (or impulse) response of a system is domi- nated by the poles with the smallest real part magnitudes. If we select the two poles of the closed-loop system resulting from the roots of (s2 + 2£ tons + to2) to be closer to the imaginary axis than the third pole s = —p, the closed-loop response would be dominated by the quadratic factor in D(s), with (s + p) influ- encing the closed-loop response by a lesser extent. In such a case, the roots of (s2 + 2t;cons + co2) are called the dominant poles of the closed-loop system. Since we have already selected the closed-loop damping-ratio as £ = 0.707, and natural frequency as, con = 316.23 rad/s, we can choose the pole s = —pto be further away from the imaginary axis in the left-half plane by having p > £&>„ (i.e. p > 223.57). Let us take p = 300. Substituting the values of £, con, and p into Eq. (2.170) and comparing with D(s) given in Eq. (2.169), we get the following values of the PID compensator constants that would result in the desired closed-loop dynamics: KI = 42857.14, KD = 1.0459, KP = 191.64, and the compensator's transfer func- tion is given by H ( s ) = (.0459s2 + 191. 645 +42 857. 14) /s (2.171) With this PID compensator, we get the following closed-loop transfer function: Y(s)/Yd(s) = (732.15s2 + 134 1405 + 3 x 107)/[(5 + 300)(52 + 447.155 + 00000)] (2.172)
  • 108. CLOSED-LOOP COMPENSATION TECHNIQUES 93 Let us check the closed-loop step response as follows: »nCL = [732.15 134140 3e7]; dCL = conv([1 300],[1 447.15 1e5]); <enter> »[s,t] = stepresp(nCL,dCL,0,0.0005,0.03); plot(t,s) <enter> The resulting closed-loop step response is plotted in Figure 2.46. Note the settling time of 0.025 seconds (as compared to 0.7 seconds for the plant), and a complete lack of high frequency oscillations in the step response, with a zero steady-state error. The performance is thus greatly improved by the PID compensation. Finally, let us determine the gain and phase margins of the PID compensated closed-loop system as follows: »[gmCL,pmCL,wgCL,wpCL]=margin(GCL) <enter> gmCL = Inf pmCL = 144.8891 wgCL = NaN wpCL = 583.6209 Note that the closed-loop gain margin is infinite, and the phase margin is 144.9° occurring at gain crossover frequency of 583.6 rad/s. Although the phase margin is no longer infinite as for the plant, it is quite large and adequate. The large 0.005 0.01 0.015 0.02 0.025 0.03 Time (s) Figure 2.46 Closed-loop step response of the PID compensated hard-disk read/write head positioning system
  • 109. 94 LINEAR SYSTEMS AND CLASSICAL CONTROL 1UU Compensator Closed-loop system CD TJ _^-^ Plant "*~ -— -______^ -100 ?nn 102 103 104 Frequency (rad/s) 1 100 ' ' i ' • ' ' '.'.''i i...j..i.ij-1-u ..•'""" Compensator .''"S'^--^ Closed-loop <D _...-•' 1 ^"'--.^ system (/> CO -100 Q. 1 Plant 101 102 103 104 Frequency (rad/s) Figure 2.47 Bode plots of the plant, PID compensator, and closed-loop system for the hard-disk read/write head value of the gain crossover frequency indicates a very fast response, which is evident in Figure 2.46. In short, the PID compensated closed-loop system has a good combination of performance and stability robustness. The Bode plots of the PID compensator and the closed-loop system are compared with those of the plant in Figure 2.47. Note that the PID compensator has a decreasing gain at low frequen- cies, and an increasing gain at high frequencies. Also, the PID compensator provides a phase-lag at frequencies below the plant's natural frequency, and a phase-lead at higher frequencies. The resulting closed-loop gain and phase plots are much flatter (compared to the plant). However, due to an increased closed-loop gain at high frequencies, there is an increased sensitivity (and decreased robustness) with respect to the high frequency measurement noise, which is undesirable. The process of finding suitable PID constants A^D, Kp, and K (as illustrated very simply in Example 2.23) is called PID tuning. Often, PID tuning in trying to achieve desirable closed-loop characteristics is an iterative procedure A PID (or PI) compensator contains an integrator (i.e. a pole s = 0) which requires special implementation techniques. Mechani- cally, a pure integration is possible using a rate-integrating gyroscope - a commonly used (but expensive) device in aircraft, missile, and spacecraft control systems. Figure 2.48(a) depicts the schematic diagram of a single degree of freedom rate gyroscope, with gimbal angle (i.e. rotation of the wheel assembly about the jc-axis), 9, as the output and the angular velocity of the case about the z-axis, Q, as the input. If we neglect the stiffness and inertia of the gimbal and wheel about the jc-axis, we can write the following transfer
  • 110. CLOSED-LOOP COMPENSATION TECHNIQUES 95 Z-* Figure 2.48 (a) Schematic diagram of a single degree of freedom, rate integrating gyroscope with output, 0(s) and input, Q(s). H is the angular momentum vector with a constant magnitude, H; (b) Active circuit of an operational amplifier connected as an integrator with input, ei (f) and output, function for the rate-integrating gyroscope: = H/(cs) (2.173) where H is the constant magnitude of the angular momentum vector, H, of the wheel about the >'-axis, and c is the viscous damping coefficient of the gimbal (i.e. rotary mechanism about the jc-axis) (see Figure 2.48(a)). Equation (2.173) indicates that the gimbal angle output is the time integral of the input angular velocity of the case. Modern control systems are relatively inexpensively implemented using either passive (unpowered) or active (powered) electronic circuits. Figure 2.48(b) shows an active circuit which uses an operational amplifier to represent a pure integrator. An operational amplifier has two input voltages, e ( t ) and e^(t}, and an output voltage, e^(t). In the circuit shown in Figure 2.48(b), ^(0 = 0, and the equation governing the circuit is the following: f (2.174) which implies that the output voltage, e^(t), is the time integral of the input voltage, e(t), multiplied by the constant — l/(/?C). Operational amplifiers can also be used to represent summing junctions, and other useful devices. Control systems based upon operational amplifiers (and other active circuits), are gener- ally more expensive and sensitive to noise than those based on passive circuits. A simpler alternative to operational amplifier is the approximation of the pure integrator by a passive circuit, called lag circuit. The chief difficulty in implementing PID compensators is the ideal differentiator (i.e. the term K^s in the expression for H(s)). An ideal differentiator is difficult to set up, and leads to the amplification of any noise present in the input signal. The noise amplification may interfere with the working of the entire control system. For these reasons, a pure differentiator is never used practically, but only an approximate differentiation is implemented using a passive circuit (called a lead circuit). Hence, the
  • 111. 96 LINEAR SYSTEMS AND CLASSICAL CONTROL ideal PID compensator is practically implemented by a combination of lag and lead circuits (called a lead-lag compensator), which represent approximate integration and differentiation. 2.12.2 Lag, lead, and lead-lag compensation Consider a compensator with the following transfer function: H(s) = (s + a>0)/(s + a>0/a) (2.175) where a is a real constant and co0 is a constant frequency. If or > 1, the compensator is called a lag compensator, because it always has a negative phase angle, i.e. a phase-lag. In the limit a -> oo, the lag compensator approaches an ideal PI compensator. Hence, a lag compensator can be used to approximate a PI compensator in practical implemen- tations. A lag compensator is useful in reducing the steady-state error of type 0 plants, and decreasing the gain of the closed-loop system at high frequencies (which is desirable for reducing the sensitivity to the measurement noise). However, lag compensation slows down the closed-loop transient response (i.e. increases the settling time). Lag compen- sation is relatively simple to use, because the passive circuit through which it can be implemented is quite inexpensive. In Eq. (2.175), if a < 1, the resulting compensator is called a lead compensator, because it always has a positive phase angle, i.e. a phase-lead. A lead compensator is useful for increasing the speed of the closed-loop response (i.e. decreasing the settling time), and increasing the phase margin of the closed-loop system, which also results in smaller overshoots in the transient response. Lead compensation usually requires amplifi- cation of error signals, which results in an expensive electrical circuit for implementation. Also, lead compensation increases the gain at high frequencies, which is undesirable due to increased sensitivity to measurement noise. A lead compensator given by the transfer function of Eq. (2.175) would decrease the DC gain of the type 0 open-loop transfer function, G(s)H(s), which is undesirable as it would increase the steady-state error due to a step input. So that the DC gain of the type 0 open-loop transfer function, G(s)H(s). is unchanged with a lead compensator, the lead compensator transfer function is usually multiplied by the factor I/or, resulting in H(s) = (s+ o)0)/(as + a>0) (2.176) Conversely, if we do not wish to increase the DC gain of G(s)H(s) (which may be infinite due to poles of G(s) at s = 0) with lag compensation, we would choose a lag compensator with the transfer function given by Eq. (2.176). Phase lag (or lead) compensation is traditionally employed in a variety of control applications. To combine the desirable properties of the lead and lag compensators, sometimes it is better to use a compensator which has both a phase-lag at low frequencies, and a phase-lead at high frequencies. Such a compensator is called a lead-lag compensator, and has the transfer function H(s) = [(s + o>,)/(5 + <wi/a)][(s + a>2)/(s/a + a*,)] (2.177)
  • 112. CLOSED-LOOP COMPENSATION TECHNIQUES 97 where a > 1, and a) and a>2 are constant frequencies. Note that the transfer function suggests that the lead-lag compensator consists of a lag compensator in series with a lead compensator. Also, note that the lag part of the transfer function is designed to increase the DC gain of open-loop system, G(s)H(s). The frequencies, a> and a>2, and the constant, a, must be selected to achieve desired closed-loop characteristics. It is easy to see that in the limit a -> oo, the lead-lag compensator approaches an ideal PID compensator. Figure 2.49 shows the passive circuits used to implement the lag, lead, and lead- lag compensators. In each circuit, e(t) and e2(t) are the input and output voltages, respectively. The transfer function of the lag circuit (Figure 2.49(a)) is expressed as H(s) = R2Cs}/[ (2.178) Comparing Eqs. (2.178) and (2.176), it is clear that a>0 = l/(R2C) and a = (R + R2)/R2. The lead circuit in Figure 2.49(b) has the transfer function H(s) = E 2 ( s ) / E l ( s ) = R l C s ) / [ ( R l + R2) (2.179) (a) E2(s) (b) E2(s) (c) E2(s) Figure 2.49 (a) Lag circuit with input voltage EI(S) and output voltage £2(5); (b) Lead circuit with input voltage £)(s) and output voltage EI(S); (c) Lead-lag circuit with input voltage FI(S) and output voltage £2(5)
  • 113. 98_ LINEAR SYSTEMS AND CLASSICAL CONTROL _ which implies that co0 = l/(RC) and a = R2/(R + R2). Finally, the transfer function of the lead-lag circuit shown in Figure 2.49(c) is the following: H(s) = E 2 ( s ) / E l ( s ) = [(1 + /?iC,5)(l + /?2C2s)]/[(l + /?,C,s)(l + R2C2s) + /?,C2s] (2.180) Comparing Eqs. (2. 1 80) and (2. 1 77), you may verify that a> = /(RC),a>1 = l/(/? 2 C 2 ), and a is obtained by factoring the denominator (i.e. solving a quadratic equation) in Eq. (2.180). Example 2.24 Consider the roll dynamics of a fighter aircraft with the following transfer function: <f>(s)/8(s) = G(s) = 1000/[s(s + 5)] (2.181) The output, y(s) = 0(5), is the roll-angle, while the input, U(s) = 6(5), is the aileron deflection angle. The maneuverability of an aircraft depends upon the time taken to achieve a desired roll-angle, (or bank-angle) Y^(s) = <f>d(s). It is required to design a closed-loop control system to achieve a unit step desired roll-angle in about three seconds, with a maximum overshoot less than 2 percent. Since the plant has a pole at s = 0, it is not asymptotically stable and the steady-state condition would not be achieved by plant alone, thereby requiring a feedback compensation that would provide asymptotic stability. Since the plant is of type 1 due to the pole at the origin, a simple feedback system with H(s) = K (where K is a constant) will achieve a zero steady-state error to a step desired output. With such a compensator, the closed-loop characteristic equation would be s2 + 5s + 1000 K = 0, and the closed- loop poles would be s_2 = -2.5 ± (1000AT2 - 6.25)1/2i, with a damping-ratio, £ = 0.0791/V^, and natural frequency, o>n = 31.6228v/tf. If we want to achieve a settling time, Ts, of 3 seconds, then from Eq. (2.125) we have Ts =4/(go>n), or £con = 4/3. The closed-loop system with H (s) = K can give us gcon = 0.0791 x 31.6228 = 2.5, or Ts = 4/2.5 = 1.6 seconds, which is a smaller settling time than required. The maximum overshoot requirement of 2 percent of steady-state response, according to Eq. (2.127) results in the condition Mp = 1.02 = 1 + exp[— gn/( — S- 2 ) 1 / 2 ], or £ = 0.7797, which requires JK = 0.0791/0.7797 = 0.1014, or K = 0.0103. Hence, we should have K < 0.0103 in order to satisfy both settling time and maximum overshoot requirements. Let us choose K = 0.01, which gives us a closed- loop settling time, rs=1.6 seconds, and maximum overshoot, Afp = 1.0172, or the maximum percentage overshoot of 1 .72 percent. Thus, the performance requirements are met quite successfully with H(s) = 0.01. Let us now consider a lag-compensator for this task. Since G(s) is of type 1, we do not need to increase the DC gain of G(s)//(s) to reduce the steady-state error to a step input. Hence, we would like to use a lag compensator transfer function of the form H(s) = (s + a)0)/(as +co0), with a > 1, which leaves the DC gain of G(s)H(s) unchanged. A candidate lag-compensator transfer function which achieves the desired performance is H(s) = (s + 0.001 )/( 100s +0.001), i.e. a>o = 0.001 rad/s and a = 100. The closed-loop transfer function is thus the
  • 114. CLOSED-LOOP COMPENSATION TECHNIQUES 99 following: (s)/(t>d(s) = 1000(5 + 0.001)/(100s3 + 500s2 + 1000^ + 1) (2.182) The natural frequencies and damping-ratios of the closed-loop system are the following: »nCL=[0 0 1000 1]; dCL=[100 500 1000 1]; damp(dCL) <enter> Eigenvalue Damping Freq. (rad/sec) -0.0010 1.0000 0.0010 -2.4995+1.9359i 0.7906 3.1615 -2.4995-1.9359i 0.7906 3.1615 Note that there is a closed-loop pole at s = —0.001. Since there is a closed-loop zero at the same location, after canceling the pole with the zero at s = —0.001, the closed-loop transfer function can be written as: 10) (2.183) which is the same transfer function as that obtained with H(s) — 0.01! This is an interesting result, and shows that the lag compensator has resulted in a third order closed-loop system, which essentially behaves as a second order system due to a pole-zero cancelation. The performance objectives are met by such a lag compen- sator, as shown above for H(s) = 0.01. Figure 2.50 compares the Bode plots of the plant, the lag compensator, and the closed-loop system. The lag compensator provides a negative phase and a reduction 200 100 - 10-4 10-2 10o 102 Frequency (rad/s) . > I ' .--I ..... "•'•-.. I " Lag compensator "•-,, T .-•' 'Closed-loop system- -100 - Plant -200 6 10~ io-2 10° 102 Frequency (rad/s) Figure 2.50 Bode plots of the plant, lag compensator, and closed-loop system for the roll control of a fighter aircraft
  • 115. 100 LINEAR SYSTEMS AND CLASSICAL CONTROL in gain in the frequencies below aa)Q (i.e. 0.1 rad/s). Since the closed-loop gain never crosses the 0 dB line, and the closed-loop phase tends asymptotically to —180°, the gain and phase margins are infinite for the closed-loop system. Also, note that there is no change in the slope of gain reduction with frequency (i.e. roll-off) at high frequencies of the closed-loop system, when compared to that of the plant, which implies that there is no reduction in the robustness with respect to high-frequency measurement noise. Example 2.25 Consider a large chemical plant with the following transfer function: Y(s)/U(s) = G(.s) = 0.025/[(s2 + 0.3s + 0.01)(s + 0.33)] (2.184) where the output, Y(s), is the temperature, and the input, U(s), is the mass flow-rate of Xylene gas. The natural frequencies of the plant are calculated as follows: »num=0.025; den=conv([1 0.33],[1 0.3 0.01]); damp(den) <enter> Eigenvalue Damping Freq. (rad/sec) -0.0382 1.0000 0.0382 -0.2618 1.0000 0.2618 -0.3300 1.0000 0.3300 The plant's response is dominated by the pole, 5 = —0.0382, which is very much closer to the imaginary axis than the other two poles. Hence, the plant has a settling time of approximately Ts = 4/0.0382 =105 seconds. The steady-state error of the plant is e(oo) = 1 — lim^o^Cs) = —6.5758 for a unit step input. It is required to design a closed-loop control system such that the steady-state error is brought down to less than ±0.15, with a maximum overshoot of 10 percent, and a settling time less than 20 seconds to a unit step desired output, Yd(s). Consider a lead compensator with COQ = 0.15 rad/s and a = 0.01, which results in a compensator transfer function, H(s) = (s + 0.15)/(0.01s + 0.15). The closed-loop transfer func- tion, G(s)H(s)/[ + G(s)H(s)], is thus Y(s)/Yd(s) = 0.025(s +0.15)/(0.01s4 + 0.1563s3 + 0.09559s2 +0.041383* + 0.004245) (2.185) The closed-loop poles and natural frequencies are the following: »nCL=0.025*[1 0.15]; dCL=[0.01 0.1563 0.09559 0.041383 0.004245]; damp (dCL) <enter> Eigenvalue Damping Freq. (rad/sec) -0.1358 1.0000 0.1358 -0.2414+0.3873i 0.5289 0.4563 -0.2414-0.3873i 0.5289 0.4563 -15.0115 1.0000 15.0115
  • 116. CLOSED-LOOP COMPENSATION TECHNIQUES 101 0 20 40 60 80 100 120 140 Time (s) Closed-loop system (chemical 0.5 plant with lead compensator) 10 15 20 Time (s) Figure 2.51 Step responses of the chemical plant and the closed-loop system with the lead compensator Since there is no clearly dominant pole (or conjugate pair of poles), the settling time of the closed-loop system is determined by the first three poles, which indi- cates a dominant third order system. The step response of the closed-loop system is compared with that of the plant in Figure 2.51, obtained using the M-file stepresp.m. Note from Figure 2.51 that the closed-loop settling time is about 19 seconds, while the maximum overshoot is about 8 percent. The closed-loop steady-state error is calculated to be e(oo) = 1 — lirn v _»o s Y ( s ) — 0.1166. Hence, the performance objec- tives have been met. The robustness properties of the closed-loop chemical plant control system are indicated by a Bode plot of the closed-loop transfer function, which is shown along with the Bode plots of the plant and the lead compensator in Figure 2.52. Note that the lead compensator provides a phase lead and a gain increase in the frequency range au>Q < co < OJQ/OI (i.e. 0.0015 < CD < 1500 rad/s). This results in a speeding-up of the closed-loop response, which is evident in a reduced settling time and an increased phase crossover frequency. Using the CST command margin, the gain and phase margins of the plant are calculated to be 8.349 dB and 33.6°, respec- tively, with gain and phase crossover frequencies of 0.1957 rad/s and 0.3302 rad/s, respectively. The closed-loop system has, however, a gain margin of 32.79 dB and an infinite phase margin, with a phase crossover frequency of 2.691 rad/s. Hence, the closed-loop system has a greater robustness to transfer function variations, and a faster response than the plant. However, due to an increased closed-loop gain at high frequencies, the roll-off at high frequencies is reduced for the closed-loop system, when compared to the plant. This implies an increased sensitivity of the closed-loop system to the high-frequency measurement noise.
  • 117. 102 UNEAR SYSTEMS AND CLASSICAL CONTROL 100 «M| , imu,, , ,imi,| Lead compensator 0 Closed-loop system -100 Plant ^ 10- 1C 3 1(T2 10-1 10° 101 102 Frequency (rad/s) 200 o> -..x. <D .Closed-loop system 0) | -200 Plant 0. -400 10~2 1Q-1 10° 101 102 Frequency (rad/s) Figure 2.52 Bode plots of the large chemical plant, lead compensator, and the closed-loop system From Examples 2.24 and 2.25, it is clear that while a lag compensator reduces the closed-loop steady-state error by providing a phase-lag at low frequencies, a lead compen- sator speeds-up the closed-loop response by providing a phase-lead at high frequencies. Let us see an application of the lead-lag compensation, which combines the desirable features of lag and lead compensators. Example 2.26 In Example 2.25, the use of lead compensation resulted in a faster closed-loop response of a chemical plant. However, the closed-loop steady-state error with lead compensation was non-zero. Let us try to reduce the steady-state error, while speeding up the response, with the help of lead-lag compensation. In Example 2.25, a lead compensator with transfer function, H(s) = (s + 0.15)/(0.01s + 0.15), produced a closed-loop steady-state error of 0.1166 and a settling time of 19 seconds. Let us choose the same transfer function for the lead part of the lag-lead compen- sator, i.e. a>2 = 0.15 rad/s and I/a = 0.01 (i.e. or = 100). The lag part of the lead-lag compensator would reduce the steady-state error by increasing the DC gain of the open-loop transfer function, G(s)H(s). Let us therefore modify our design require- ments to a closed-loop steady-state error of less than 0.002 and a settling time less than 20 seconds, while accepting a 10 percent maximum overshoot in the step response. To meet the new design requirements, a lag compensation frequency of CD =0.13 rad/s is selected, resulting in the following lead-lag compensator transfer
  • 118. _ CLOSED-LOOP COMPENSATION TECHNIQUES _ 103 function: H(s) = [(s + 0.15)(.v + 0. 13)]/[(0.01.s + 0.15)0? + 0.0013)] (2.186) which gives us the following closed-loop transfer function: = (0.0255 + 0.007)/(0.0 Is4 + 0.15631s3 + 0.095793s2 + 0.041507s + 0.0075163) (2.187) The closed-loop poles, damping, and natural frequencies are as follows: »nCL=[0.025 0.007] ;dCL=[1e-2 1.56316-1 9.57936-2 4.1507e-2 7.51636-3]; damp(dCL) <enter> Eigenvalue Damping Freq. (rad/sec) -1 .34836 -001+4. 87776 -002i 9.40366-001 1.43396-001 -1 .34836-001 -4. 8777e-002i 9.40366-001 1.43396-001 -1 .75146-001+3.57076-0011 4.40376-001 3.97706-001 -1 .75146-001 -3. 5707e-001i 4.40376-001 3.97706-001 -1.50116+001 1.0000e+000 1.50116+001 The first four poles, roughly located the same distance from the imaginary axis, are the dominant poles of the closed-loop system. The DC gain of the closed-loop system indicates the steady-state value of the step response, and is calculated using the MATLAB (CST) command dcgain as follows: »GCL=tf (nCL,dCL) ; dcgain(GCL) <enter>= ans = 0.9987 Hence, the closed-loop steady-state error is brought down to 1 — 0.9987 = 0.0013, which is acceptable. The closed-loop step response is plotted in Figure 2.53 for three different values of the lag frequency, u>. For a> =0.13 rad/s (used in the above calculations), the closed-loop response has a settling time of about 16 seconds, and a maximum overshoot of about 30 percent, which is unacceptable. Figure 2.53 shows that the maximum percentage overshoot can be reduced by decreasing a). For co = 0.05 rad/s, the maximum percentage overshoot is about 10 percent, and the settling time is about 13 seconds. However, decreasing u> below 0.05 rad/s results in an increase in the settling time, as is evident from the step response for ct>2 = 0.03 rad/s which has a maximum overshoot of about 5 percent, but a settling time of about 22 seconds. The steady-state error is unaffected by changing o>i . We select GL> — 0.05 rad/s, which gives a fast response and an acceptable maximum overshoot. The Bode plots of the plant, the lead-lag compensator with a>2 = 0. 15 rad/s, co = 0.05 rad/s, a = 100, and the resulting closed-loop system are shown in Figure 2.54.
  • 119. 104 LINEAR SYSTEMS AND CLASSICAL CONTROL 1.4 1.2 1.02SH 1 0.98s(~) 8 IF °- ^=0.05 rad/s "55" 0.6 o>2=0.10 rad/s 0^=0.13 rad/s 0.4 0.2 0 10 20 30 40 50 Time (s) Figure 2.53 Closed-loop step response of the chemical plant with a lead-lag compensator for various values of the lag frequency, 102 100 Lead-rag compensator CO ^ I.^Closed-loop system TJ -100 -200 10- 1 i-2 fl ic-1 10° 102 Frequency (rad/s) Lead-lag compensator Closed-loop system -200 Plant --..i - 1 fl- IC-1 10° 102 Frequency (rad/s) Figure 2.54 Bode plots of the large chemical plant, the lead-lag compensator, and the closed-loop system Comparing Figure 2.54 with Figure 2.52, the phase-lag and decreasing compensator gain below 0.1 rad/s, and phase-lag and increasing compensator gain above 0.1 rad/s are evident for the lead-lag compensator. The high-frequency closed-loop behavior is largely unaffected, when compared to the lead compensation in Figure 2.52. The closed-loop gain and phase margins are computed by the command margin to be 38.9 dB and 104.5°, respectively, with gain and phase crossover frequencies of
  • 120. MULTIVARIABLE SYSTEMS 105 0.3656 rad/s and 2.5456 rad/s, respectively. Comparing these values with those of Example 2.25 with lead compensation, we find that there is a slight increase in the gain margin, while the phase margin has been reduced from infinite to 104.5°. Furthermore, there is a slight slowing down of the closed-loop response due to the added lag compensation, which is evident in a slight reduction in the phase crossover frequency. The slowing down of the closed-loop response is also clear in the overshoot and settling time of the step response. The lead compensated system of Example 2.25 had an 8 percent overshoot and settling time of 19 seconds. To achieve the same overshoot, the lead-lag compensated system would require a settling time slightly larger than 20 seconds, which is obvious from Figure 2.53. Example 2.26 illustrates the iterative process of determining the three unknowns (a, w, OLK) of a lead-lag compensator to meet a conflicting set of performance requirements. Since a lead-lag compensator is a practical (approximate) implementation of the ideal PID compensator, we have witnessed an example of PID tuning in which the three unknown constants Kp, K®, and K are determined in a similar manner. The Control System Toolbox (CST) offers an interactive Graphical Users Interface (GUI) tool, called the SISO Design Tool, to carry out the steps illustrated in this section for the design of closed-loop compensators in a user-friendly manner. To use this design feature, go to MATLAB launch pad, click on the Control System Toolbox, and select the icon for 5/5*0 Design Tool from the resulting menu. Another interactive GUI tool available in the CST menu is the LTI Viewer, which lets you directly view all the important graphs of a linear, time-invariant system (step and impulse responses, Bode, Nyquist, root-locus, Nichols plots, and pole-zero map, etc.), as well as the performance characteristics of the system (peak response, rise time, settling time, and steady-state), along with several graphical operations. As an exercise to familiarize yourself with these GUI tools, repeat Examples 2.23-2.26 with the 5/50 Design Tool, and use LTI Viewer to check the closed- loop system's characteristics. 2.13 Multivariable Systems So far we have considered only single-input, single-output systems (an exception was the aircraft in Example 2.10, which had three outputs, and one input). A practical modern control system may simultaneously contain several inputs and several outputs. Such systems are called multivariable systems. For multivariable systems, we must re-define the relationship between the Laplace transform of the input, U(s), and the Laplace trans- form of the output, Y(s), both of which are now vectors, consisting of more than one signal. Each element of U(s) is the Laplace transform of the corresponding element of the input vector, u(t). Similarly, each element of Y(,v) is the Laplace transform of the corre- sponding element of the output vector, y(r). The input and output vectors are related in the Laplace domain by a transfer matrix (instead of the transfer function for the single-input, single-output systems), G(s), which is defined as follows: Y(s) = G(s)U(s) (2.188)
  • 121. 106 LINEAR SYSTEMS AND CLASSICAL CONTROL Note that we are using bold letters to denote vectors and matrices. This notation will be followed throughout the book. Refer to Appendix B, or Gantmacher [4] and Kreyszig [5] for vectors, matrices, and their properties. In Eq. (2.188) if the system consists of p outputs and r inputs, then the sizes of Y(s), U(s), and G(s) are (p x 1), (r x 1), and (p x r), respectively. (Clearly, the single-input, single-output system is a special case of the multivariable systems where p = 1 and r = 1.) Since we are dealing with vectors and matrices here, we have to be careful how we multiply them such that the sizes of the multiplied quantities are compatible (e.g. we can not write Eq. (2.188) as Y(s) = U(s)G(s)!). Example 2.27 Let us derive the transfer matrix of the multivariable system of Example 2.10. Recall that the system (longitudinal dynamics of an aircraft) consists of a single input whose Laplace transform is <5(s), and three outputs with Laplace transforms u(s), a(s), and 9(s}. Thus, we can write (2.189) The transfer matrix between G(s) can be obtained using the relationships between the input and the individual elements of Y(s) given by Eqs. (2.86)-(2.88) as follows: v(s)/8(s) Y(S) = a(s) (2.190) 0(s) 0(s)/S(s) or Y(5) -0.0005(5 - 7 ) 5 + 0 5 / ( 2 + 0.0055 + 0 0 6 ( 2 +5 + 1.4)] 0( .)[5 .0)5 -0.02(5 + 8 ) 5 + 0 0 6 5 + 0 0 6 / ( 2 + 0 0 5 + 0 0 6 ( 2 + s + 1.4)] 0(2 .05 .0)[5 . 0 5 .0)5 U(5) -1.4(5 + 0.02)(5 + 0.4)/[(52 + 0.0055 + 0.006)(52 +5+1.4)] (2.191) which, from Eq. (2.188), gives G(s) -0.0005(5 - 70)(5 + 0.5)/[(52 + 0.0055 + 0.006)(52 +5 + 1.4)] -0.02(5 + 80)(52 + 0.00655 + 0.006)/[(52 + 0.0055 + 0.006)(52 + 5+1.4)] -1.4(5 + 0.02)(5 + 0.4)/[(52 + 0.0055 + 0.006)(52 + s + 1.4)] (2.192) Note that the transfer matrix, G(s), is of size (3 x 1), denoting a single-input, three-output system.
  • 122. MULTIVARIABLE SYSTEMS 107 Figure 2.55 Three types of connections in multivariable control systems: (a) parallel, (b) series, and (c) negative feedback We must be able to determine a system's transfer matrix from the block diagram of a multivariable system, which may include transfer matrices of the various sub-systems. As in single-input, single-output (SISO) systems, there are three distinct ways in which the multivariable sub-systems can be connected to each other, as shown in Figure 2.55. Figure 2.55(a) depicts two sub-systems of transfer matrices 61 (s) and 62(5), respectively, connected in parallel. Here, the outputs of the two sub-systems, YI(.S) and Y2(*) (which clearly must be vectors of the same size) are added-up at the summing junction to give the system's output, Y(s), by = Y,(s) + Y2(5) - - [6, (5) (2.193) Hence, the parallel system's transfer matrix is the sum of the transfer matrices of its two (or more) components, i.e. G(s) — 61(5) + 62(5). The system of Figure 2.55(b) is in series, and it can be easily seen (left as an exercise for you) that the transfer matrix of such a system is given by the product of the transfer matrices of the two (or more) components, i.e. G(s) = G 2 (s)GiCs). In series combinations, one has to be careful in the sequence of multiplication (i.e. 62(5)61 (5), and not G (.5)62(5), etc.), because the matrix multiplication is not always conformable (i.e. for a matrix product G(s) = 62(5)61(5) to be defined, the number of columns in 61(5) must be equal to the number of rows in 62(5)) (see Appendix B). The third kind of connection, shown in Figure 2.55(c) is the feedback arrangement. The two sub-systems of this combination are the forward trans- mission, given by the transfer matrix 61 (5), and the feedback transmission, whose transfer matrix is 62(5). If the feedback signal, Z(s), is subtracted from the input, U(s) - as in Figure 2.55(c) - then the system is said to be of a negative feedback kind, and if Z(s) is added to U(s) at the summing junction, the system is called a positive feedback system. Again, as in SISO systems, we usually encounter the negative feedback arrangement in multivariable control systems, whose objective is to drive the inverse Laplace transform of the error vector, E(s) = U(s) — ZOs), to zero as t —> oo. For a negative feedback system, we can write = Gi(s)[U(5) - (2.194)
  • 123. 108_ UNEAR SYSTEMS AND CLASSICAL CONTROL _ or P + Gi(5)G2(j)]Y(5) = d(5)U(5) (2.195) and it follows that (2.196) where [ ]"' denotes the inverse of a (square) matrix, and I is the identity matrix of the same size as the product 61(5)62(5) (Appendix B). Hence, from Eq. (2.196), the transfer matrix of a negative feedback system is given by G(s) = [I + Gi(5)G2(5)]"1Gi(5). (Note that for a SISO system, the transfer matrix (function) becomes G(s) = Gi(.s)/[l + Gi(s)G2(5)].) Again, we must be careful with the sequence of matrix multiplication involved in expressions such as Eq. (2.196). Not all multi variable closed-loop systems are of the kind shown in Figure 2.55(c). Trying to find the transfer matrices of multivariable systems from their block diagrams can be a daunting task. The Control System Toolbox (CST) helps in constructing the transfer function from its individual components with model building commands, such as series, parallel, feedback, and append. For example, the multivariable system of Figure 2.55(a) can be constructed using the command parallel as follows: »sys = parallel (G1 ,G2) <enter> where Gl, G2 are the LTI objects (either transfer matrices, or state-space models (see Chapter 3)) of the two parallel sub-systems, G t and G2, respectively. Alternatively, we could type »sys = G1+G2 <enter> to get the transfer matrix (or state-space model) of the overall system. Similarly, we can use the series command for the system of Figure 2.55(b) as follows: »sys = series(G1 ,G2) <enter> or type »sys = G2*G1 <enter> For multivariable systems in which only some of the outputs of Gl are the inputs to G2, both parallel and series commands can be used with two additional input arguments such as »sys = series (G1,G2,OUTPUTS1,INPUTS2) <enter> which specifies that the outputs of Gl denoted by the index vector OUTPUTS 1 are connected to the inputs of G2 denoted by INPUTS2. (The vectors OUTPUTS 1 and INPUTS2 contain indices into the outputs and inputs of Gl and G2, respectively.) For the
  • 124. MULTIVARIABLE SYSTEMS 109 feedback multivariable system the CST command feedback gives the closed-loop transfer matrix as follows: »sys = feedback(G1,G2,FEEDIN,FEEDOUT,sign) <enter> The vector FEEDIN contains indices into the input vector of Gl, and specifies which inputs are involved in the feedback loop. Similarly, FEEDOUT specifies which outputs of Gl are used for feedback. If the sign is omitted, a negative feedback system is assumed, while sign=l results in a positive feedback system. If FEEDIN and FFEDOUT are omitted from the feedback command, it is assumed that all the outputs of Gl are the inputs to G2 (as shown in Figure 2.55(c)). Example 2.28 Consider the multivariable control system of Figure 2.56. The system's block- diagram indicates that only the second and third outputs of GI (s) are inputs to GaCs), while the second output of 62(5) is an input to 63(5). It is also clear that G]0) and 62(5) are in series, while GI(S) is in a negative feedback arrange- ment with G(s) and 62(5). The closed-loop system's transfer matrix from the input vector, U(s) = U(s), and the output vector, ¥(5) = [Y2(s)Y^(s)]r can be determined using the CST commands as follows: »G1=tf({1; -2; 1},{[1 1]; [1 0]; [1 0 5 ] } ) % transfer matrix,G1 <enter> Transfer function from input to output... 1 #1: s+1 -2 #2; U,(s) 1/(s+1) Y2( s) GI(S) = -2/s 1/(s2+5) Y3( Gj>(s)= P -1/s ° 1 s+1 G3(s) = -2(s+2)/(s2+3s+2) Figure 2.56 A multivariable closed-loop system consisting of sub-systems, GI , Gj, and
  • 125. 110 LINEAR SYSTEMS AND CLASSICAL CONTROL 1 #3: s~2+5 »G2=tf({[1 0] 0;-1 [1 1]},{1 1;[1 0] 1}) % transfer matrix, G2 <enter> Transfer function from input 1 to output... #1: s -1 #2: -- s Transfer function from input 2 to output... #1: 0 #2: s+1 »G3=tf(-2*[1 2],[1 3 2]) % transfer matrix, G3 <enter> Transfer function: -2s-4 s"2+3s+2 (Note the ease with which the transfer matrices are constructed using the LTI object, tf. The coefficients of the numerator and denominator polynomials are specified using {•}, {•}, with the transfer functions on different rows separated by;.) »G2G1=series(G1,G2,[2 3 ] , [ 1 2 ] ) %transfer matrix of the series connection <enter> Transfer function from input to output... s"3+3s~2+10 #2: ......... »GCL=feedback(G2G1 , G3, 1 , 2 ) % closed-loop transfer matrix from Ui(s) to [ Y 2 ( s ) ; Y 3 ( s ) ] <enter> Transfer function from input to output... -2s"6-6s~5-14s~4-30s~3-20s"2+7.43e-015s #1 : ......................................... s"6+3s'5+5s / s 4+5s"3-2s / v 2-20s-40
  • 126. MULTIVARIABLE SYSTEMS 111 S'5+6sM+11s"3+16s A 2+30s+20 #2: S"6+3s"5+5s"4+5s A 3-2s"2-20s-40 Thus the closed-loop transfer matrix indicates a sixth order, single-input, two-output system. The transfer function of the forward path from U(s) = U](s) to Y(s) is easily seen from Figure 2.56 to be /(s + 1). Note that the denominator polynomials of the two transfer functions constituting GCL are the same, which indicates that the closed-loop system's poles can be obtained by factoring the common denominator polynomial. The closed-loop zeros are the zeros of transfer functions constituting GCL, which are easily identified from Figure 2.56 as z = — 1 and 12 = —2. Let us determine the closed-loop zeros and poles using CST as follows: »zero(GCL) <enter> ans = -1.0000 -2.0000 »pole(GCL) <enter> ans = -2.0000 -1.3584+1.36341 -1.3584-1.36341 0.1132+1.90001 0.1132-1.90001 1.4904 Due to the presence of three poles with positive real parts, the closed-loop system is unstable. Example 2.28 indicates that, to determine the performance, stability, and robustness of a multivariable, linear, time-invariant control system, we should be first able to express its transfer matrix G(,v), as a matrix of rational transfer functions, Gy(s), given by Gim(s) (2.197) Gni(s) ( where n is the number of outputs and m is the number of inputs. Example 2.28 also illustrates that we can extend the logic of poles and zeros of a single-input, single-output system to multivariable systems by defining the roots of the denominator and numerator polynomials of all the elemental transfer functions, GJJ(S), as the system's poles and zeros, respectively. Such a definition also suggests that the characteristic polynomial of the multivariable system be defined as a single common denominator polynomial, and the roots of the characteristic polynomial are the poles of the system. Then we can apply the same stability criteria as for the single-input, single output systems by looking at the
  • 127. 112 LINEAR SYSTEMS AND CLASSICAL CONTROL locations of the system's poles. Similarly, the determination of responses to the singularity functions (or to an arbitrary input) can be carried out from G(s) in the same manner as we did for the single-input, single output systems, if we consider one input at a time. The robustness of a multivariable system can be determined using frequency response methods (see Chapter 7), provided we define scalar measures for multivariable systems analogous to gain and phase margins. For analyzing the robustness of a general closed-loop multivariable system, consider the multivariable counterpart of the single-input, single-output closed-loop system of Figure 2.32, in which we take G(s) and H(s) to denote the plant and controller transfer matrices, respectively. Note that for the system of Figure 2.32, the closed-loop transfer matrix, Gc(s), defined as Y(s) = G c (s)Yd(s), is given by Gc(5) = [I + G(s)H(s)r!G(s)H(s) (2.198) where I is identity matrix, G(s) is the plant's transfer matrix, and H(s) is the transfer matrix of the controller. In a manner similar to the single-loop feedback systems, we can define a return difference matrix. However, there are two different return difference matrices for the multivariable systems: the return difference matrix at the plant's output, [I + G(s)H(s)], and the return difference matrix at the plant's input, [I + H(s)G(s)]. These return difference matrices are the coefficient matrices of the output, Y(s), and the input, U(s), respectively, when the expressions relating the desired output, Yd(.s), with Y(s) and U(s), respectively, are written as [I + G(s)H(s)]Y(s) = G(s)H(s)Y d (s) and [I + H(s)G(s)]U(.s) = H(s)YdCs). Continuing the analogy with the single-input, single- output systems, the matrices G(s)H(s) and H(s)G(.s) are called the return ratio matrices at the plant output and input, respectively. For studying robustness of the closed-loop system, the return difference (and return ratio) matrices are considered important, as we shall discuss in Chapter 7. Before we can define quantities analogous to gain and phase margins of single-loop systems, we have to assign a scalar measure to the return difference matrix at the output, [I + G(s)H(.s)]. Such a scalar measure assigned to a matrix is its determinant. Since the determinant of the return difference matrix at the output is set to zero (i.e. |I + G(s)H(s)| = 0) is the characteristic equation which determines the closed-loop system's poles, we obtain stability robustness information by studying Bode or Nyquist plot of the determinant of the return difference matrix at the output, |I + G(.s)H(s)|. Since the return difference matrix at the output appears as an inverse in the closed-loop transfer function, we expect [I + G(s)H(s)] to be singular (i.e. a matrix whose inverse is not defined because its determinant is zero) at the poles of the system. If the closed-loop system is asymptotically stable, the poles must lie in the left-half s-plane. The stability robustness in this case is, therefore, a measure of how much the controller transfer matrix, H(s), is allowed to vary before the poles cross into the right half s-plane. Example 2.29 Consider a two-input, two-output chemical process plant with transfer matrix G(s) (Figure 2.52) controlled by three flow control servo-valves, each of which has a constant transfer function (or gain), K. The outputs, Y(s), and J^U), are fed back to the individual servo-control valves as shown. The plant's transfer matrix, G(s).
  • 128. MULTIVARIABLE SYSTEMS 113 is expressed as 3/s - (2.199) 0.05/5 -250/[s(s + 6) (5 + 30)] The closed-loop system of Figure 2.57 can be reduced to that of Figure 2.55(c), with the plant transfer matrix, G(s} = G(s), given by Eq. (2.199), and the controller transfer matrix, G2(s} = H(s), given by K 0 H(5) = Kl (2.200) 0 K For a given value of controller design parameter, K, the resulting closed-loop transfer matrix, Gc(s) = [l + Gi(s)G2(s)rlGi(s) = [I + G^Hfa)]-1 G(s), can m u^,^1^1 O/S -^UU/LS(,& + D^4> + JU^J G(s) = 0.05/s -250/[s(s + 6)(s + 30)] i>2(s) pH ^ ^ Figure 2.57 A chemical plant with transfer matrix G(s), controlled by two feedback servo-valves, each of transfer function, K 10 I I I I I 10 5 | 0 |P2 Imaginary 0 - OO(X)OCOOOOCOOOOOOCX)0€KOCaHDffiDO ($Hm ^— "~ - OJP3 -5 -10 -15 1 1 1 1 1 -1 00 -80 -60 -40 -20 0 2 Real Figure 2.58 Root-locus of the multivariable chemical control system as the controller gain, K, varies from 1 to 10. The arrows indicate how each of the four poles pi, P2, P3/ and p4 move as K is increased
  • 129. 114 LINEAR SYSTEMS AND CLASSICAL CONTROL be calculated using MATLAB (CST) with the use of the feedback command. Alter- natively, the closed-loop poles of the system are obtained by setting the determinant of the return difference matrix at the output to zero, i.e. |I + G(.s)H(s)| = 0, which results in the following characteristic equation: |I + G(s)H(s)| = s4 + (36 + 3/Os3 + (180 + 108/O*2 + 29QKs - 14QK2 = 0 (2.201) Figure 2.58 is a plot of the closed-loop poles (i.e. roots of Eq. (2.201)) p, p2, pi, and p4 as the controller gain K varies from 1 to 10. It is noted that for all values of K, one of the poles (p^) is always in the right-half s-plane, indicating instability. Hence, the system is unstable in the range 1 < K < 10. Although for this two- loop system we can plot the root-locus by using the determinant |I + G(s)H(.s)|, such a procedure quickly becomes unwieldy as the number of inputs and outputs is increased. Example 2.29 showed how |I + G(s)H(,s)| = 0 (i.e. the return difference matrix at the output, [I + G(s)H(s)], being singular) can be used to find out whether a multivariable system is stable. However, the determinant of a matrix is not a very good measure of how close the matrix is to being singular. Thus a Bode or Nyquist plot of |I -I- G(.s)H(s)| in the frequency domain is not going to give us a very accurate information about the stability robustness (such as gain and phase margins), and we need another scalar measure which is a better indicator of how close the return difference matrix is to being singular. One such measure is the set of singular values of the return difference matrix in the frequency domain (s = ico), which we will study in Chapter 7. Examples 2.28 and 2.29 illustrate the increased difficulty of estimating stability of a multivariable system using the classical frequency domain methods. While MATLAB allows that multivariable systems can be represented by their transfer matrices, an eval- uation of their performance would require calculation of step (or impulse) responses of individual elements of the transfer matrix - a task which becomes unwieldy as the number of inputs and outputs are increased. A better mathematical procedure of handling arbitrary input responses of multivariable systems is to employ the methods of matrix algebra in a more tractable manner through the introduction of a state-space model of the system. The chief advantage of the state-space methodology is that time responses of a multivariable system are obtained directly by solving a set of first-order differential equations (called state equations) which are used to represent the governing differential equations. The direct calculation of a system's response to an arbitrary input enables the design and analysis of multivariable systems in the time (rather than frequency, or Laplace) domain. The state-space approach treats a single-input, single-output system in exactly the same way as it does a multivariable system, irrespective of the number of inputs and outputs involved. The remainder of this book will discuss the application of the state-space methods in control system analysis and design. However, as we will see in Chapter 7, analyzing robustness of multivariable systems requires a return to frequency domain analysis through complex function theory.
  • 130. EXERCISES 115 Exercises 2.1. Consider an inverted pendulum of length L and mass m on a moving cart of mass, M (Figure 2.59). It is assumed that the cart moves on a frictionless, flat plane. The force, f ( t ) , applied to the cart is the input, while the output is the angular deflection, 9(t), of the pendulum from the vertical. The displacement of the cart from a fixed point is given by x ( t ) . The governing differential equations of the system are as follows: (M + m)x(2t) + mL9(2)(t} cos(0(f)) - mL[6> (1) (0] 2 sin(0(f)) = f ( t ) (2.202) (2) (2) rojt (0 cos(0(0) + mL0 (0 - mg sin(0(0.) = 0 (2.203) (a) What is the order of the system? (b) Eliminate x(t) from Eqs. (2.202) and (2.203) to get a differential equation in terms of the output, 0(f), and input, f ( t ) . (c) Linearize the system about the equilibrium point, 6(t) = 0. (d) Find the transfer function of the linearized system, ®(s)/F(s), where 0(5) = £0(0 and F(s) = L f ( t ) . (e) What are the poles of the linearized system? Is the linearized system stable? 2.2. Certain unforced physical systems obey the following governing differential equation, called van der Pol equation: •a[x(t)2 - l].x(1)(0 + MO = 0 (2.204) where x(t) is the output variable, and a and b are positive constants. Can you linearize such a system about an equilibrium point? 2.3. The governing equations of an electrical network (Figure 2.60(a)) are as follows: (2.205) vl)(t) = [u2(0 - v l ( t ) ] / ( R 2 C l ) - i, (2.206) u 2 n (r) = [u,(0 - U2(0]/(/?2C 2 ) - / 2 (0/C 2 (2.207) /2 (0 — —v2(t)/L (2.208) 0=0 Figure 2.59 Inverted pendulum on a moving cart
  • 131. 116 LINEAR SYSTEMS AND CLASSICAL CONTROL (a) v (t) * ^xxv "i(f) ^ 3 L 1 /2(0 (b) Dead-zone / -a Figure 2.60 (a) Electrical network for Exercise 2.3; (b) Nonlinear current, i] (f), with a dead-zone in the voltage band — a < vi (f) < a where i(t) is the current flowing through a nonlinear resistance, R, /2(0 is the current flowing through the inductor, L, and v ( t ) and 1^2(1) are the voltages across the capaci- tors, C and C2, respectively. The function f ( v ( t ) ) is shown in Figure 2.60(b). Such a nonlinear function is said to have a dead-zone in the voltage band, — a < v ( t ) < a. (a) Find the equilibrium points of the system, and linearize the system about each of them. (b) Derive the transfer function, G(s), between the current, i(t), as the output and the current, /2(0. as the input, of the system linearized about each equilibrium point. (c) Investigate the stability of the system about each equilibrium point. (d) What is the step response of the linearized system when the current MO is in the dead-zone? 2.4. Linearize the governing differential equation of a satellite in an orbit around a planet (Eq. 2.16) about the equilibrium point denoted by the circular orbit, r(t) = C. What are the natural frequency and damping-ratio of the linearized orbital dynamics? Is the orbital system stable about the equilibrium point? Find the response of the deviation of the satellite from the equilibrium point denoted by the circular orbit, if the input radial acceleration is 1000 m/s2 applied as a step input at t = 0, i.e. u(t) = QOOus(t). What are the maximum overshoot, settling time, and steady-state value of the response? (Assume that the satellite is in a circular orbit of radius, C = 3.0 x 108m, around Mars, with an angular momentum, h = 3.0 x 1012 m2/s. For Mars, k2 = 4.27 x 1013 m3/s2.) 2.5. Repeat Exercise 2.4 for a satellite in orbit around Jupiter, with C = 4.0 x 109 m, h = 4.8 x 1013 m2/s, and k2 = 1.27 x 1017 m3/s2.
  • 132. EXERCISES 117 Figure 2.61 Spring-mass-damper system with input, f(t), and output, x(f) 2.6. Consider the spring-mass-damper system shown in Figure 2.61, with mass, w, spring stiffness, k, and damping coefficient, c. The deflection, x(t), of the mass is measured from its static equilibrium position (given by x(t) = 0), and is the system's output. A force, ,/ (f), applied to the mass is the input. The governing differential equation of the system is c x ((1)( t ) + kx(t) = f ( t ) ) (2.209) (a) Derive an expression for the system's frequency response. (b) What are the expressions for the natural frequency, «„, and damping-ratio, g, of the system? (c) Assuming zero initial conditions, derive the step response and impulse response of the system. Plot the step response for g = 0.1 and g = 2.0. Calculate the maximum percentage overshoot, peak-time and settling-time in both the values of g. (d) If c = 0, is the system stable? 2.7. Calculate the impulse response of the following transfer functions: (a) (s + l)/[(j + 0.01)Cs+0.3)] (b) (s2 + 3.v + l)/(s 3 + 2s2 + Is + 10) (c) 2.8. Plot the step response of the following transfer functions, and calculate the maximum overshoot, settling time, and the steady-state output: (a) s / ( s + 5) (b) (j2 + l)/(j 2 + 3s + 2) (c) 10(s3 + 2s2 + 4s + l)/(s4 + s3 + 10s2 + 5s + 10) 2.9. Calculate and plot the response of a system with transfer function, G(s) = 100(s2 + 2)/(s3 + s2 + 5s + 1) to the input, u(t) = 10e~~l sin(5f), assuming zero initial conditions. What is the magnitude of the maximum overshoot? What is the steady-state value of the output?
  • 133. 118 LINEAR SYSTEMS AND CLASSICAL CONTROL 2.10. For the linearized satellite orbital dynamics of Exercise 2.4, plot the deviation from the circular orbit if the input is given by u(t) = 5000[sin(0.1r) +cos(0.2/)], assuming zero initial conditions. What is the magnitude of the maximum deviation from the circular orbit? 2.11. Plot the response of the spring-mass-damper system of Exercise 2.5, if m = 1 kg, k = 10 N/m, c = 0.1 Ns/m, and f ( t ) = 10e~2' cos(lOf), assuming zero initial conditions. 2.12. The transfer function of a control system is given by Y(s)/U(s) = G(s) = 20(s3 + 4s2 + 5s + 2)/(s5 4- 15s4 + 30s3) (2.210) (a) Investigate the stability of the system. (b) Plot the response to a unit ramp function, r(r), for zero initial conditions. (c) Draw a Bode plot of the system. 2.13. For a second-order linear system, prove that the step response goes to infinity in the limit t —» oo if the system has repeated poles with real part equal to zero. 2.14. Consider the control system shown in Figure 2.32, where the plant's transfer function is G(s) = l/[(s + 0.1)(s +0.2)]. It is intended to use a PID compensator for controlling this plant. (a) What are the values of the PID compensator constants, KP, K, and A"D, for achieving a zero steady-state error with a closed-loop pole at s = — 1, and two complex conjugate poles with damping ratio, £ = 0.707, and natural frequency, con = 1 rad/s? (b) Derive the closed-loop transfer function, Y(s)/YA(s), with the compensator in part (a), and compute the closed-loop system step response. What is the maximum percentage overshoot, settling time, and steady-state error of the closed-loop step response? (c) Plot the locus of the closed-loop poles as K varies from 0 to 10, with KD and Kp remaining constant at the values calculated in part (a). What are the values of K for which the closed-loop system is stable? (d) Draw a Bode plot of the closed-loop system of part (a), and determine the gain and phase margins, and the respective crossover frequencies. 2.15. For the control system shown in Figure 2.32, it is desired to track an object moving with a constant acceleration in m/s2 given by y<i(0 = 5r2 • us(t), by moving an antenna whose transfer function is G(s) = 2Q/[s(s + 100)]. Find a controller transfer function, H(s), such that the steady-state tracking error is less than 0.001 m/s2, with a settling time of about 0.1 seconds. Plot the closed-loop error response as a function of time. Determine the gain and phase margins, and the respective crossover frequencies of the closed-loop system. What are the maximum overshoot, settling time, and steady-state error of the closed-loop system if the desired output is a unit step function?
  • 134. EXERCISES 119 2 Y(s) G(s) = 1/(s + 9) Figure 2.62 Two loop control system for Exercise 2.16 2.16. (a) Derive the transfer function, Y(s)/Yd(s), of the closed-loop system shown in Figure 2.62. (b) What is the type of this system? (c) Find the values of K, K2, and AT3 such that the closed-loop transfer function becomes Y(s)/Yd(s) = (s + 10)/(s + 2)(r + % + 5) (2.211) (d) Determine the step response of the system in part (c). (e) Using the convolution integral, determine the response of the system in part (c) to a rectangular pulse (Figure 2.13) of magnitude, /0 = 1 and duration, T = 10 s. (f) Determine the gain and phase margins, and the respective crossover frequencies of the system in part (c). 2.17. For the control system in Exercise 2.16, determine the gain and phase margins if K — 10, K2 = 25, and K3 = 150. 2.18. For the control system shown in Figure 2.63: (a) Derive the closed-loop transfer function, Y(s)/Yd(s). If this control system is to be expressed as a negative feedback connection of two systems, G(s) and H(s), as shown in Figure 2.35, identify the plant transfer function, G(s), and the controller transfer function, H(s). (b) What is the type of this system? (c) Is the plant, G(s), stable? Figure 2.63 Control system for Exercise 2.18
  • 135. 120 LINEAR SYSTEMS AND CLASSICAL CONTROL (d) Plot the locus of closed-loop poles if K = 10, a = 2, K2 = 25, #3 = 150, and K{ is varied from 1 to 500. (e) What is the value of K for which the closed-loop system has a dominant pair of complex poles with natural frequency, a>n = 1.83 rad/s and damping-ratio, g = 0.753? (f) Plot the step response of the closed-loop system for the value of K desired in part (e). What is the resulting maximum percentage overshoot, settling-time and the steady-state error? (g) Draw the Bode plots of the plant, G(s), the controller, H(s), and the closed-loop system, and find the gain and phase margins of the control system with K of part (e). 2.19. For the electrical system of Example 2.8, consider a feedback control system of Figure 2.32 using a constant controller transfer function H(s) = K. (a) Draw a root-locus of the closed-loop poles as K is varied. What is the range of K for which the closed-loop system is stable? (b) Find the value of K for which the closed-loop system has a damping ratio, £ = 0.707. Plot the step response of the closed-loop system, and find the maximum overshoot, settling time, and steady-state error. 2.20. Re-design the controller, H(s), in Exercise 2.19 to make the steady-state error zero, and the damping ratio, £ = 0.707. Plot the step response of the closed-loop system, and find the maximum overshoot and settling time. 2.21. For the closed-loop system shown in Figure 2.32, the plant's transfer function is G(s) = 150000/(s3 + 110s2 + 1000s). It is desired to use a lag compensator to control this plant. (a) Draw a Bode plot of the plant, G(s), and find the gain and phase margins of the plant. (b) Draw a Bode plot of the appropriate lag compensator, //(s), for co0 = 1 rad/s and a = 10. What is the frequency at which the phase of H(s) is the minimum? What is the change in the gain of H(s) between 0 and 10 rad/s? (c) Compare the steady-state error, maximum overshoot, and settling time of the plant with those of the closed-loop system with the controller parameters of part (b), if the desired output is a unit step function. (d) Draw a Bode plot of the closed-loop system with the lag compensator of part (b). Find the gain and phase margins of the closed-loop system. (e) Repeat parts (b)-(d) with o>0 = 1 rad/s and a = 1.1. 2.22. For the closed-loop system shown in Figure 2.32, the plant's transfer function is G(s) = 1000/(s2 + 2s + 5). It is desired to use a lead compensator to control this plant. (a) Draw a Bode plot of the plant, G(s), and find the gain and phase margins of the plant. (b) Draw a Bode plot of the lead compensator, //(s), for a>0 = 40 rad/s and a = 0.01. What is the frequency at which the phase of H(s) becomes a maximum? What is the total change in gain over the entire frequency range?
  • 136. EXERCISES 121 (c) Compare the steady-state error, maximum overshoot, and settling time of the plant with those of the closed-loop system if the desired output is a unit step function. (d) Draw a Bode plot of the closed-loop system with the lead compensator of part (b). Find the gain and phase margins of the closed-loop system. (e) Repeat parts (b)-(d) with coa — 40 rad/s and a = 0.45. 2.23. A plant's transfer function is G(s) = 06/(s2 + 0.99s - 0.01). It is desired to use a lead- lag compensator in the control system of Figure 2.32 to control this plant. (a) Draw a Bode plot of the plant, G(s), and find the gain and phase margins of the plant. (b) Draw a Bode plot of the lead-lag compensator, H ( s ) , for co = 0.1 rad/s, o>2 = 1000 rad/s and a = 5. What are the frequencies corresponding to minimum and maximum phase of H(s)l (c) Compare the steady-state error, maximum overshoot, and settling time of the plant with those of the closed-loop system if the desired output is a unit step function. (d) Draw a Bode plot of the closed-loop system with the lead-lag compensator of part (b). Find the gain and phase margins of the closed-loop system. (e) Keeping the values of a> and a>2 the same as in part (b), what is the value of a for which the maximum overshoot of the closed-loop step response is 30 percent? What is the corresponding settling time? Calculate the new closed-loop gain and phase margins for this value of a. 2.24. Suppose the closed-loop system shown in Figure 2.32 has plant's transfer function, G(s) = (s + l)/(s 2 + 2s — 3) and controller's transfer function, H ( s ) = K/s. Such a controller is called an integral compensator, since it is obtained from the PID compensator by setting Ki = K, and KP = KD = 0. (a) Is the plant alone stable? (b) Derive the closed-loop transfer function, Y ( s ) / Y d ( s ) . (c) From a root-locus determine the range of variation of K for which the closed-loop system stable. (d) Derive the step response of the closed-loop system for K = 50. What is the maximum percentage overshoot, peak-time, settling-time and the steady-state error of the system? (e) What is the steady-state error of the closed-loop system with K = 50 if y c j(r) = t • «,(*)? (f) Determine the gain and phase margins, and the respective crossover frequencies of the system for K = 50. (g) Repeat (d)-(f) for K = 15. 2.25. For the aircraft in Example 2.10, it is desired to increase the damping in phugoid mode by using a lead compensator, with the plant's transfer function is G(s) = v(s)/S(s).
  • 137. 122_ LINEAR SYSTEMS AND CLASSICAL CONTROL _ (a) Find the gain and phase margins for the plant, G(s) = v(s)/8(s). (b) Find the values of the lead compensator parameters, a>0 and a, such that the closed- loop system has a gain margin greater than 10 dB and a phase margin greater than 130°. (c) Compare the settling time and maximum overshoot of the plant with those of the closed-loop system with the lead compensator designed in part (b), if the desired output is a unit step function, us(t). 2.26. For the aircraft in Example 2.10, it is desired to reduce the steady-state error in the angle of attack, a(s), (which is largely influenced by the short-period mode) by using a lag compensator as a controller in the closed-loop configuration of Figure 2.32, where the plant's transfer function is G(s) = a(s)/8(s). From Figure 2.27, it is clear that the phugoid mode does not appreciably affect, a(s)/8(s), implying that the denominator quadratic corresponding to the phugoid mode, (s2 + 0.0055 + 0.006), gets approximately canceled by the numerator quadratic (s2 + 0.00655 -I- 0.006) in the expression for a(s)/8(s) given by Eq. (2.87). Thus, we can write the approximate plant transfer function, a(s)/8(s), as follows: a ( s ) / 8 ( s ) % -0.02(5 + 80)/(52 + 5 + 1 .4) (2.212) (a) Compare the Bode plot of the approximate a(5)/<5(5) given by Eq. (2.212) with that shown in Figure 2.27 for the exact a(5)/<5(5). (b) Compare the gain and phase margins for the approximate and exact plant transfer function, G(5) = a(s)/8(s). (c) Find the values of the appropriate lag compensator parameters, <a0 and a, such that the closed-loop system has a gain margin greater than 1 1 dB and a phase margin greater than 130°. (d) Compare the settling time and maximum overshoot of the plant with those of the closed-loop system with the lag compensator designed in part (b), if the desired output is a unit step function, us(t). 2.27. In an aircraft, the actuator of a control surface - such as the elevator in Example 2.10 - takes some (non-zero) time to achieve the desired control-surface deflection angle, 8(t). The simplest model for such an actuator is given by a first-order transfer function, 8(s)/8d(s) = l/(Ts + 1), where T is a time-constant, and 8d(s) is the desired deflection angle. (a) If T = 0.02 second, find the step response of <5(5)/<5d(5) = /(Ts + 1) (i.e. 8(t) when <5d(0 = us(t)). What is the settling time and the steady-state error? (b) Make a Bode plot of the actuator transfer function for T = 0.02 second. What are the DC gain, and gain and phase margins of the actuator? (c) For the actuator of parts (a) and (b), plot the actual control-surface deflection, when the desired deflection, <5 d (f), is a rectangular pulse of width 0.5 second and height 0.05 radian, applied at t = 0. (Such a pulse elevator input is normally applied by the pilot to excite the phugoid mode.)
  • 138. EXERCISES 123 (d) To account for the presence of the actuator, the longitudinal transfer functions of Example 2.10, are multiplied by the elevator actuator transfer function, 8(s)/8d(s) = /(Ts + 1), resulting in the transfer functions, v ( s ) / 8 d ( s ) , a(s)/8d(s), and 0(s)/8d(s). If T = 0.02 second, compare the Bode plots of v(s)/8d(s), a(s)/8d(s), and 9(x)/8d(s), with those of v(s)/8(s), a ( s ) / 8 ( s ) , and 0(s)/8(s) (shown in Figures 2.26-2.28), respectively. Is there any difference in the corresponding gain and phase margins? (e) Plot the step response of 0(s)/8d(s), and compare it with that of Q(s)/8(s) shown in Figure 2.29. Is there a difference in the two step responses? (f) Repeat the design of a lead compensator for controlling the phugoid mode carried out in Exercise 2.25 with a plant transfer function, G(s) = v(s)/8d(s), instead of G(s) = v(s)/8(s). 2.28. For controlling the deviation of a satellite from a circular orbit (Exercise 2.4), it is desired to use a derivative compensator, H(s) = Ks, in the feedback arrangement of Figure 2.35, such that the plant's transfer function is G(s), and the feedback controller transfer function is H ( s ) . It is required that the closed-loop response to a step input of magnitude 1000 m/s2 (i.e. u(t) = 1000M.S(0) should have a maximum overshoot of 2 m and a settling time less than 13 seconds. Find the value of A" which achieves this, and plot the closed- loop step response. What are the maximum overshoot and the settling time? Plot the output, z ( t ) , of the compensator, H(s). What is the maximum magnitude of the controller output, z(t)l Draw the Bode plots of the plant, the compensator, and the closed-loop system, and compare the gain and phase margins of the plant with those of the closed-loop system. 2.29. Find the poles and zeros, and analyze the stability of multivariable systems with the following transfer matrices: (a) G(s) = [(s + l ) / ( s + 3)s/(s 2 - 7* + 1)] l/(s + l) 0 (s + 4)/Cv 2 + 35 + 2) s/(s + 2) (c) G(s) = l/s 1/0?+4) 2.30. Consider a multivariable system of Figure 2.32, with plant transfer matrix, G(s). and controller transfer matrix, H (.$•), given by (2.213) (a) Derive the characteristic equation of the system. (b) Plot the root-locus as K varies from 0.01 to 10. For what range of variation of K is the system stable?
  • 139. 124 LINEAR SYSTEMS AND CLASSICAL CONTROL References 1. Zarchan, P. Tactical and Strategic Missile Guidance, 2nd Edition, Vol. 157. Progress in Aero- nautics and Astronautics, American Institute of Aeronautics and Astronautics, Washington, DC, 1994. 2. D'Azzo, J.J. and Houpis, C. Feedback Control System Analysis and Synthesis, 2nd Edition. McGraw-Hill, 1966. 3. Blakelock, J.H. Automatic Control of Aircraft and Missiles, 2nd Edition. Wiley, 1991. 4. Gantmacher, F.R. Theory of Matrices, Vol. 1. Chelsea, New York, 1959. 5. Kreyszig, E. Advanced Engineering Mathematics. Wiley, New York, 1972.
  • 140. 3 State-Space Representation 3.1 The State-Space: Why Do I Need It? In Chapter 1, we defined the state of a system as any set of quantities which must be specified at a given time in order to completely determine the behavior of the system. The quantities constituting the state are called the state variables, and the hypothetical space spanned by the state variables is called the state-space. In a manner of speaking, we put the cart before the horse - we went ahead and defined the state before really understanding what it was. In the good old car-driver example, we said that the state variables could be the car's speed and the positions of all other vehicles on the road. We also said that the state variables are not unique; we might as well have taken the velocities of all other vehicles relative to the car, and the position of the car with respect to the road divider to be the state variables of the car-driver system. Let us try to under- stand what the state of a system really means by considering the example of a simple pendulum. Example 3.1 Recall from Example 2.2 that the governing differential equation for the motion of a simple pendulum on which no external input is applied (Figure 2.3) is given by Eq. (2.8). If we apply a torque, M(r), about the hinge, O, as an input to the pendulum, the governing differential equation can be written as L0(2)(t) + gsin(6>(?)) - M(r)/(mL) (3.1) where # (2) (0 represents the second order time derivative of 0(t), as per our notation (i.e. d20(t)/dt2 = 0 (2) (0)- Let the output of the system be the angle, 0(f), of the pendulum. We would like to determine the state of this system. To begin, we must know how many quantities (i.e. state variables) need to be specified to completely determine the motion of the pendulum. Going back to Chapter 2, we know that for a system of order n, we have to specify precisely n initial conditions to solve the governing differential equation. Hence, it must follow that the state of an nth order system should consist of precisely n state variables, which must be specified at some time (e.g. t = 0) as initial conditions in order to completely determine the solution to the governing differential equation. Here we are dealing with a second order system - which implies that the state must consist of two state variables. Let
  • 141. 126 STATE-SPACE REPRESENTATION The State-Space for a simple pendulum Figure 3.1 The two-dimensional state-space for a simple pendulum (Example 3.1 ) us call these state variables x(t) and X2(t), and arbitrarily choose them to be the following: *, (0=0(0 (3-2) (3.3) The state-space is thus two-dimensional for the simple pendulum whose axes are *i(0 and jc2(0 (Figure 3.1). It is now required that we express the governing differential equation (Eq. (3.1)) in terms of the state variables defined by Eqs. (3.2) and (3.3). Substituting Eqs. (3.2) and (3.3) into Eq. (3.1), we get the following first order differential equation: x(2l)(t) = M(t)/(mL2) - (s/L)sin(jt,(0) (3.4) Have we transformed a second order differential equation (Eq. (3.1)) into a first order differential equation (Eq. (3.4)) by using the state-variables? Not really, because there is a another first order differential equation that we have forgotten about - the one obtained by substituting Eq. (3.2) into Eq. (3.3), and written as *j !) (0=*2(0 <3-5> Equations (3.4) and (3.5) are two first order differential equations, called the state equations, into which the governing equation (Eq. (3.1)) has been transformed. The order of the system, which is its important characteristic, remains unchanged when we express it in terms of the state variables. In addition to the state equations (Eqs. (3.4) and (3.5)), we need an output equation which defines the relationship between the output, 0(0, and the state variables x(t) and x2(t). Equation (3.2) simply gives the output equation as 0(0=*i(0 (3-6) The state equations, Eqs. (3.4) and (3.5), along with the output equation, Eq. (3.6), are called the state-space representation of the system.
  • 142. THE STATE-SPACE: WHY DO I NEED IT? 127 Instead of choosing the state variables as 9(t) and 6> { l ) (f), we could have selected a different set of state variables, such as (3.7) and x2(t) = L2e(l}(t) (3.8) which would result in the following state equations: (3.9) x2lt) = M(t)/m-gLsin(xi(t)/L) (3.10) and the output equation would be given by 0(t)=X](t)/L (3.11) Although the state-space representation given by Eqs. (3.9)-(3.11) is different from that given by Eqs. (3.4)-(3.6), both descriptions are for the same system. Hence, we expect that the solution of either set of equations would yield the same essential character- istics of the system, such as performance, stability, and robustness. Hence, the state-space representation of a system is not unique, and all legitimate state-space representations should give the same system characteristics. What do we mean by a legitimate state- space representation? While we have freedom to choose our state variables, we have to ensure that we have chosen the minimum number of state variables that are required to describe the system. In other words, we should not have too many or too few state variables. One way of ensuring this is by taking precisely n state variables, where n is the order of the system. If we are deriving state-space representation from the system's governing differential equation (such as in Example 3.1), the number of state-variables is easily determined by the order of the differential equation. However, if we are deriving the state-space representation from a transfer function (or transfer matrix), some poles may be canceled by the zeros, thereby yielding an erroneous order of the system which is less than the correct order. Example 3.2 Consider a system with input, u(t), and output, y ( t ) , described by the following differential equation: y(2t) + (b- a ) y ( l ) ( t ) - ab y(t) = u ( l ) ( t ) - au(t) (3.12) where a and b are positive constants. The transfer function, Y(s)/U(s), of this system can be obtained by taking the Laplace transform of Eq. (3.12) with zero initial conditions, and written as follows: Y(s)/U(s) = (s- a)/[s2 + (b- a)s - ab] = (s - a)/[(s - a)(s + b)] (3.13)
  • 143. 128 STATE-SPACE REPRESENTATION In Eq. (3.13), if we cannot resist the temptation to cancel the pole at s = a with the zero at s = a, we will be left with the following transfer function: Y(s)/U(s) = l/(s+b) (3.14) which yields the following incorrect differential equation for the system: y ( l ) ( t ) + by(t) = u(t) (3.15) Since the pole cancelled at s = a has a positive real part, the actual system given by the transfer function of Eq. (3.13) is unstable, while that given by Eq. (3.14) is stable. Needless to say, basing a state-space representation on the transfer func- tion given by Eq. (3.14) will be incorrect. This example illustrates one of the hazards associated with the transfer function description of a system, which can be avoided if we directly obtain state-space representation from the governing differ- ential equation. Another cause of illegitimacy in a state-space representation is when two (or more) state variables are linearly dependent. For example, if x(t) = 0(t) is a state variable, then X2(t) = L9(t} cannot be another state variable in the same state-space representation, because that would make x(t) and x2(t) linearly dependent. You can demonstrate that with such a choice of state variables in Example 3.1, the state equations will not be two first order differential equations. In general, for a system of order n, if x (t), x2(t),..., xn- (/) are state variables, then xn(t) is not a legitimate state variable if it can be expressed as a linear combination of the other state variables given by xn(t) = ci*i (0 + c2x2(t) + ••• + cH-}xn-i(t) (3.16) where c,c2,..., c n _i are constants. Thus, while we have an unlimited choice in selecting state variables for a given system, we should ensure that their number is equal to the order of the system, and also that each state variable is linearly independent of the other state variables in a state-space representation. In Chapter 2, we saw how single-input, single-output, linear systems can be designed and analyzed using the classical methods of frequency response and transfer function. The transfer function - or frequency response - representations of linear systems were indispensable before the wide availability of fast digital computers, necessitating the use of tables (such as the Routh table [1]) and graphical methods, such as Bode, Nyquist, root-locus, and Nichols plots for the analysis and design of control systems. As we saw in Chapter 2, the classical methods require a lot of complex variable analysis, such as interpretation of gain and phase plots and complex mapping, which becomes complicated for multivariable systems. Obtaining information about a multivariable system's time- response to an arbitrary input using classical methods is a difficult and indirect process, requiring inverse Laplace transformation. Clearly, design and analysis of modern control systems which are usually multivariable (such as Example 2.10) will be very difficult using the classical methods of Chapter 2.
  • 144. THE STATE-SPACE: WHY DO I NEED IT? 129 In contrast to classical methods, the state-space methods work directly with the govern- ing differential equations of the system in the time-domain. Representing the governing differential equations by first order state equations makes it possible to directly solve the state equations in time, using standard numerical methods and efficient algorithms on today's fast digital computers. Since the state equations are always of first order irrespec- tive of the system's order or the number of inputs and outputs, the greatest advantage of state-space methods is that they do not formally distinguish between single-input, single-output systems and multivariable systems, allowing efficient design and analysis of multivariable systems with the same ease as for single variable systems. Furthermore, using state-space methods it is possible to directly design and analyze nonlinear systems (such as Example 3.1), which is utterly impossible using classical methods. When dealing with linear systems, state-space methods result in repetitive linear algebraic manipula- tions (such as matrix multiplication, inversion, solution of a linear matrix equation, etc.), which are easily programmed on a digital computer. This saves a lot of drudgery that is common when working with inverse Laplace transforms of transfer matrices. With the use of a high-level programming language, such as MATLAB, the linear algebraic manip- ulations for state-space methods are a breeze. Let us find a state-space representation for a multivariable nonlinear system. Example 3.3 Consider an inverted pendulum on a moving cart (see Exercise 2.1), for which the governing differential equations are the following: (M + m)x(2)(t)+mLe{2)(t)cos(6(t))-mL[e(l}(t)]2sm(e(t)) - f(t) (3.17) m* (2) (0cos(0(0) +mLO(2)(t} - mgsm(0(t)) =0 (3.18) where m and L are the mass and length, respectively, of the inverted pendulum, M is the mass of the cart, 9(t) is the angular position of the pendulum from the vertical, x ( t ) is the horizontal displacement of the cart, /(/) is the applied force on the cart in the same direction as x(t) (see Figure 2.59), and g is the acceleration due to gravity. Assuming f ( t ) to be the input to the system, and x(t} and 0(0 to be the two outputs, let us derive a state-space representation of the system. The system is described by two second order differential equations; hence, the order of the system is four. Thus, we need precisely four linearly independent state-variables to describe the system. When dealing with a physical system, it is often desirable to select physical quantities as state variables. Let us take the state variables to be the angular position of the pendulum, 0(0, the cart displacement, x ( t ) , the angular velocity of the pendulum, 0 ( l ) (0> and the cart's velocity, x ( l ) ( t ) . We can arbitrarily number the state variables as follows: jc, ( 0 = 0 ( 0 (3.19) (3.20) (3.21) (3.22)
  • 145. 130 STATE-SPACE REPRESENTATION From Eqs. (3.19) and (3.21), we get our first state-equation as follows: JC, ( I ) (0=JC 3 (0 (3.23) while the second state-equation follows from Eqs. (3.20) and (3.22) as (3.24) The two remaining state-equations are derived by substituting Eqs. (3.19)-(3.22) into Eq. (3.17) and Eq. (3.18), respectively, yielding jcnO = *sin(jc,(0)/L-jc; (3.25) - [mL/(M + m)]x(3l)(t) cos(jc,(0) + f ( t ) / ( M + m) (3.26) The two output equations are given by (3.27) x(t) = x2(t) (3.28) Note that due to the nonlinear nature of the system, we cannot express the last two state-equations (Eqs. (3.25), (3.26)) in a form such that each equation contains the time derivative of only one state variable. Such a form is called an explicit form of the state-equations. If the motion of the pendulum is small about the equilib- rium point, 0 = 0, we can linearize Eqs. (3.25) and (3.26) by assuming cos(0(0) = cos(*i(0) - 1, sin(0(0) = sin(jt,(0) = *i(0, and [0(1>(012sin«9(0) = [x^(t)f sin(;ci(0) = 0. The corresponding linearized state equations can then be written in explicit form as follows: (0 = - /(0/(ML) (3.29) = -(mg/M)xi(t) + f(t)/M (3.30) The linearized state-equations of the system, Eqs. (3.23), (3.24), (3.29), and (3.30), can be expressed in the following matrix form, where all coefficients are collected together by suitable coefficient matrices : 0 0 1 0 0 0 0 1 /(O (M+m)g/(ML) 0 0 0 -mg/M 0 0 0 JC4(/) 1/M '(Oj (3.31) with the output matrix equation given by [0(0] fl 0 0 0 ] L ^ ( o J ~ L ° i ° °J -I- [S] /(O (3.32)
  • 146. THE STATE-SPACE: WHY DO I NEED IT? 131 I Note that the state-space representation of the linearized system consists of linear I state-equations, Eq. (3.31), and a linear output equation, Eq. (3.32). ( Taking a cue from Example 3.3, we can write the state-equations of a general linear system of order n, with m inputs and p outputs, in the following matrix form: (3.33) and the general output equation is y(0 - Cx(0 + Du(0 (3.34) where x(0 = [x(t); *2(0; . . . ; xn(t)]T is the state vector consisting of n state variables as its elements, x (1) (0 = [jcj'V); x2lt); • • • '•> x(nl)(t)]T is the time derivative of the state vector, u(0 = [«i(0; "2(0; • • • ; «/-(OJ r is the input vector consisting of r inputs as its elements, y(0 = lji(0; ^2(0; • • •; yp(t)]T is the output vector consisting of p outputs as its elements, and A, B, C, D are the coefficient matrices. Note that the row dimension (i.e. the number of rows) of the state vector is equal to the order of the system, n, while those of the input and output vectors are r and p, respectively. Correspondingly, for the matrix multiplications in Eqs. (3.33) and (3.34) to be defined, the sizes of the coefficient matrices, A, B, C, D, should be (n x n), (n x r), (p x «), and (p x r), respectively. The coefficient matrices in Example 3.3 were all constant, i.e. they were not varying with time. Such a state-space representation in which all the coefficient matrices are constants is said to be time-invariant. In general, there are linear systems with coefficient matrices that are functions of time. Such state-space representations are said to be linear, but time-varying. Let us take another example of a linear, time-invariant state-space representation, which is a little more difficult to derive than the state-space representation of Example 3.3. Example 3.4 Re-consider the electrical network presented in Example 2.8 whose governing differ- ential equations are as follows: Rii(t) + R3[i}(t) - 12 (01 = e(t) (3.35) •(2) r, .(1) = [R3/(R[+R3)]e(l)(t) (3.36) If the input is the applied voltage, e(t), and the output, y(t), is the current in the resistor R3 (given by i(t) — *2(0) when the switch S is closed (see Figure 2.19), we have to find a state-space representation of the system. Looking at Eq. (3.36), we find that the time derivative of the input appears on the right-hand side. For a linear, time-invariant state-space form of Eqs. (3.33) and (3.34), the state variables must be selected in such a way that the time derivative of the input, e(lt), vanishes from the state and output equations. One possible choice of state variables which
  • 147. 132_ STATE-SPACE REPRESENTATION _ accomplishes this is the following: *i (0 = i2(0 (3.37) !) x2(t) = i< (0 - R3e(t)/[L(Ri + *3)1 (3.38) Then the first state-equation is obtained by substituting Eq. (3.37) into Eq. (3.38), and expressed as *i(1)(0 = *2(0 + *3«(0/[L(Ki + *3)1 (3.39) Substitution of Eqs. (3.37) and (3.38) into Eq. (3.36) yields the second state-equat- ion, given by R3e(t)/L(Ri + *3)] -*i(0/O.C) (3.40) The output equation is given by using Eq. (3.35) as follows: yi(0 = «i(0 ~ '2(0 = [«(0 + *3*i(0]/(*i + K3) - *i(0 = -*,jr,(0/(Ki + R3) + *(0/(*i + /?3) (3.41) In the matrix notation, Eqs. (3.39)-(3.41) are expressed as 4- R2R3)/[L(Ri + K3)l J [ *2(0 J (f) (342) V ' ^ ^ 0] + !/(/?, + /?3MD (3.43) Comparing Eqs. (3.42) and (3.43) with Eqs. (3.33) and (3.34), we can find the constant coefficient matrices, A, B, C, D, of the system, with the input vector, u(0 = e(t), and the output vector, y(f) = y(t). If we compare Examples 3.3 and 3.4, it is harder to select the state variables in Example 3.4 due to the presence of the time derivative of the input in the governing differential equation. A general linear (or nonlinear) system may have several higher-order time derivatives of the input in its governing differential equations (such as Eq. (2.4)). To simplify the selection of state variables in such cases, it is often useful to first draw a schematic diagram of the governing differential equations. The schematic diagram is drawn using elements similar to those used in the block diagram of a system. These elements are the summing-junction (which adds two or more signals with appropriate
  • 148. THE STATE-SPACE: WHY DO I NEED IT? 133 x(f) —J r U^ !x(t)dt Gain element X 2 (f) Summing junction Figure 3.2 The state-space schematic diagram elements signs), and the two transfer elements, namely the gain element (which multiplies a signal by a constant), and the integrator (which integrates a signal). The arrows are used to indicate the direction in which the signals are flowing into these elements. Figure 3.2 shows what the schematic diagram elements look like. Let us use the schematic diagram approach to find another state-space representation for the system in Example 3.4. Example 3.5 The system of Example 3.4 has two governing equations, Eqs. (3.35) and (3.36). While Eq. (3.35) is an algebraic equation (i.e. a zero order differential equation), Eq. (3.36) is a second order differential equation. Let us express Eq. (3.36) in terms of a dummy variable (so called because it is neither a state variable, an input, nor output) z ( t ) , such that z (2) (0 + [(RiR3 + R}R2 + R2Ri)/[L(R} + * 3 )k (1) (0 + /(LC}z(t) = e(t) (3.44) where i2(f) = * 3 /[£(*i+*3)]z (l) (0 (3.45) We have split Eq. (3.36) into Eqs. (3.44) and (3.45) because we want to elimi- nate the time derivative of the input, e(lt), from the state-equations. You may verify that substituting Eq. (3.45) into Eq. (3.44) yields the original differential equation, Eq. (3.36). The schematic diagram of Eqs. (3.44) and (3.45) is drawn in Figure 3.3. Furthermore, Figure 3.3 uses Eq. (3.35) to represent the output, y ( t ) = i(t) — /2(0- Note the similarity between a block diagram, such as Figure 2.1, and a schematic diagram. Both have the inputs coming in from the left, and the outputs going out at the right. The difference between a block diagram and a schematic diagram is that, while the former usually represents the input-output relationship as a transfer function (or transfer matrix) in the Laplace domain, the latter represents
  • 149. 134 STATE-SPACE REPRESENTATION ; 1 i i-l 1+^3)]—>Jfil/(fil+^3)—W>>- • * — --I x_y y(0 e(0 Figure 3.3 Schematic diagram for the electrical system of Example 3.4 the same relationship as a set of differential equations in time. Note that the number of integrators in a schematic diagram is equal to the order of the system. A state-space representation of the system can be obtained from Figure 3.3 by choosing the outputs of the integrators as state variables, as shown in Figure 3.3. Then using the fact that the output from the second integrator from the left, is the time integral of its input, x2(t), the first state-equation is given by (3.46) The second state-equation is obtained seeing what is happening at the first summing junction from the left. The output of that summing junction is the input to the first integrator from left, x2lt), and the two signals being added at the summing junction are e(t) and -*i(f)/(LC) - [(^3 + /?i/?2 + R2R3)/[L(R + /?3)]*2(0. Therefore, the second state-equation is given by e(t) (3.47) The output equation is obtained by expressing the output, y(t) = i(t) — i 2 (t), in terms of the state variables. Before relating the output to the state variables, we should express each state variable in terms of the physical quantities, i(t), i 2 (0, and e(t). We see from Figure 3.3 that x2(t) = z(1)(0; thus, from Eq. (3.45), it follows that (3.48) Then, substitution of Eq. (3.48) into Eq. (3.47) yields jti(r) = LC[e(t) - h (3.49) Using the algebraic relationship among /i(r), i2(t) and e(t) by Eq. (3.35), we can write the output equation as follows:
  • 150. T H E STATE-SPACE: W H Y D O I NEED I T ? 1 3 5 y}(t) = -R1R3/L(R] + R3)"]x2(t) + e(t)/(R + /?3) (3.50) In matrix form, the state-space representation is given by 0 1 (3.52) Note the difference in the state-space representations of the same system given by Eqs. (3.42), (3.43) and by Eqs. (3.51), (3.52). Also, note that another state- space representation could have been obtained by numbering the state variables in Figure 3.3 starting from the left rather than from the right, which we did in Example 3.5. Example 3.6 Let us find a state-space representation using the schematic diagram for the system with input, u(t), and output, y(t), described by the following differential equation: y("t) + an-iy(n-])(t) + • • • + ai>' (1) (0 + aQy(t) = bnu(n)(t)+bn^u(n~l}(t) + • • •+blu{l)(t)+b0u(t) (3.53) Since the right-hand side of Eq. (3.53) contains time derivatives of the input, we should introduce a dummy variable, z(t), in a manner similar to Example 3.5, such that z(n)(t) + an-iz(n~l)(t) + • • • + fliz(1)(0 + a0z(t) = u(t) (3.54) and bnz(n)(t) + bn-iz(n-"(t) + ••• + b l Z ( ] ) ( t ) + b0z(t) = y(t) (3.55) Figure 3.4 shows the schematic diagram of Eqs. (3.54) and (3.55). Note that Figure 3.4 has n integrators arranged in a series. As in Example 3.5, let us choose the state variables to be the integrator outputs, and number them beginning from the right of Figure 3.4. Then the state-equations are as follows: xlt)=x2(t) (3.56a) x(7])(t)=x3(t) (3.56b)
  • 151. 136 STATE-SPACE REPRESENTATION y(0 W-2 "1 X,(t) --O Figure 3.4 Schematic diagram for the controller companion form of the system in Example 3.6 (3.56c) = -[a n _ijc w (r)+a n _2 (3.56d) The output equation is obtained by substituting the definitions of the state variables, namely, jci(r) = z(r), x2(t) = z(1)(0, ...,*„(*)= z(n~l)(t) into Eq. (3.55), thereby yielding + bix2(t) + •••+ bn-ixn(t) + bHx™ (t) (3.57) and substituting Eq. (3.56d) into Eq. (3.57), the output equation is expressed as follows: ?„_! - an-bn)xn(t) + bnu(t) (3.58) The matrix form of the state-equations is the following: 0 1 0 ... 0 0 0 1 ... 0 0 0 0 ... 1 xa-i(t) -GO —a —02 ••• —&n- xa(t) (3.59) and the output equation in matrix form is as follows: y(0 = [(bo - a^bn) (b - abn)... (bn- - an-bn}] bnu(t) (3.60) _*«(')_
  • 152. _ THE STATE-SPACE: WHY DO I NEED IT?_ 137 Comparing Eqs. (3.59) and (3.60) with the matrix equations Eqs. (3.33) and (3.34), respectively, we can easily find the coefficient matrices, A, B, C, D, of the state-space representation. Note that the matrix A of Eq. (3.59) has a particular structure: all elements except the last row and the superdiagonal (i.e. the diagonal above the main diagonal) are zeros. The superdiagonal elements are all ones, while the last row consists of the coefficients with a negative sign, — UQ, —a, . . . , —an-. Taking the Laplace transform of Eq. (3.53), you can verify that the coefficients a®, ai, . . . ,an-i are the coefficients of the characteristic polynomial of the system (i.e. the denominator polynomial of the transfer function, Y(s)/U(s)) given by sn + an~sn~l + • • • + as + ao. The matrix B of Eq. (3.59) has all elements zeros, except the last row (which equals 1). Such a state-space representation has a name: the controller companion form. It is thus called because it has a special place in the design of controllers, which we will see in Chapter 5. Another companion form, called the observer companion form, is obtained as follows for the system obeying Eq. (3.53). In Eq. (3.53) the terms involving deriva- tives of y(t} and u(t) of the same order are collected, and the equation is written as follows: ) - bQu(t)] = 0 (3.61) On taking the Laplace transform of Eq. (3.61) subject to zero initial conditions, we get the following: sn[Y(s) - bnU(s)] + sn~[an + • • - + s [ a i Y ( s ) - biU(s)] + [aoY(s) - b0U(s)] = 0 (3.62) Dividing Eq. (3.61) by sn leads to Y(s) = bnU(s) + [bn^U(s) - an^Y(s}]/s + • • • + [b{U(s] - a}Y(S)]/Sn (3.63) We can draw a schematic diagram for Eq. (3.63), using the fact that the multi- plication factor 1/5 in the Laplace domain represents an integration in time. Therefore, according to Eq. (3.63), [bn_iU(s) - an-Y(s)] must pass through one integrator before contributing to the output, Y(s). Similarly, [biU(s) — aY(s)] must pass through (n — 1) integrators, and [boU(s) — aoY(s)] through n inte- grators in the schematic diagram. Figure 3.5 shows the schematic diagram of Eq. (3.63). On comparing Figures 3.4 and 3.5, we see that both the figures have a series of n integrators, but the feedback paths from the output, y(t), to the integrators are in opposite directions in the two figures. If we select the outputs of the integrators as state variables beginning from the left of Figure 3.5, we get the following state- equations:
  • 153. 138 STATE-SPACE REPRESENTATION Figure 3.5 Schematic diagram for the observer companion form of the system in Example 3.6 = -aoxn(t) + (b0 - a0bn)u(t) (l) x 2 ( t ) = x,(0 - aixn(t) - a}bn)u(t) (3.64) ^_i(0 = xn-2(t) - an-2xn(t) + (bn-2 - an-2bn x(nl)(t) = -an.ixn(t) + (bn-i - an-ibn) and the output equation is y(t) = xn(t) + bnii(t) (3.65) Therefore, the state coefficient matrices, A, B, C, and D, of the observer companion form are written as follows: 0 0 ... 0 -oo 1 0 ... 0 -a, (b -a[bn) 0 1 ... 0 -o2 (b2 - a2bn) B = 0 0 ... 1 -fl n _ 2 ,_ 2 -an-2bn) ^0 0 ... 0 -o n _iJ C = [0 0 ... 0 1]; 1 (3.66) Note that the A matrix of the observer companion form is the transpose of the A matrix of the controller companion form. Also, the B matrix of the observer
  • 154. THE STATE-SPACE: WHY DO I NEED IT? 139 companion form is the transpose of the C matrix of the controller companion form, and vice versa. The D matrices of the both the companion forms are the same. Now we know why these state-space representations are called companion forms: they can be obtained from one another merely by taking the transpose of the coefficient matrices. The procedure used in this example for obtaining the companion forms of a single-input, single-output system can be extended to multi-variable systems. Thus far, we have only considered examples having single inputs. Let us take up an example with multi-inputs. Example 3.7 Consider the electrical network for an amplifier-motor shown in Figure 3.6. It is desired to change the angle, 0(0, and angular velocity, 0 (1) (0, of a load attached to the motor by changing the input voltage, e(t), in the presence of a torque, 7/XO» applied by the load on the motor. The governing differential equations for the amplifier-motor are the following: + (R + Ro)i(t) + aO(])(t) = KAe(t) (3.67) (2} (l) J0 (t) + be (t) - ai(t) = -TL(t) (3.68) where /, R, L, and b are the moment of inertia, resistance, self-inductance, and viscous damping-coefficient of the motor, respectively, and a is a machine constant. RO and KA are the resistance and voltage amplification ratio of the amplifier. Since the loading torque, 7/,(0, acts as a disturbance to the system, we can consider it as an additional input variable. The input vector is thus given by u(0 = [e(t) TL(t)]r. The output vector is given by y(0 = [0(0; 0(1)(0]r- We see from Eqs. (3.67) and (3.68) that the system is of third order. Hence, we need three state variables for the state-space representation of the system. Going by the desirable convention of choosing state variables to be physical quantities, let us select the state variables as xi(t) = 0(t), x2(t) = 0 (1) (0» and Jt3(0 — i(t). Then the state-equations can be written as follows: Amplifier Figure 3.6 Amplifier-motor circuit of Example 3.7
  • 155. 140 STATE-SPACE REPRESENTATION ,<'>(,) =*2<0 (3.69) x(2l)(t) = -(b/J)x2(t) + (a/J)x3(t) - TL(t)/J (3.70) x™(t) = -(a/L)jt 2 (f) - [(R + Ro)/L]x3(t) + (^A/L)e(0 (3.71) and the output equations are 0(0 =*,<*) (3.72) (I ( 0 > »=* 2 <0 (3.73) In matrix form, the state-equation and output equations are written as Eqs. (3.33) and (3.34), respectively, with the state-vector, x(?) = [x(t); x2(t)', x^(t)]T and the following coefficient matrices: " 0 1 ° 1 0 0 1 A= 0 -b/J a/J ; B= 0 -1/7 ; _o -a/L -(R + RQ)/L _i<A/L 0 J |~1 0 0] |"0 0] C ; (3.74) ~ [o i oj |_° °J 3.2 Linear Transformation of State-Space Representations Since the state-space representation of a system is not unique, we can always find another state-space representation for the same system by the use of a state transformation. State transformation refers to the act of producing another state-space representation, starting from a given state-space representation. If a system is linear, the state-space representa- tions also are linear, and the state transformation is a linear transformation in which the original state-vector is pre-multiplied by a constant transformation matrix yielding a new state-vector. Suppose T is such a transformation matrix for a linear system described by Eqs. (3.33) and (3.34). Let us find the new state-space representation in terms of T and the coefficient matrices, A, B, C, D. The transformed state-vector, x'(f), is expressed as follows: x'(r) = Tx(r) (3.75) Equation (3.75) is called a linear state-transformation with transformation matrix, T. Note that for a system of order n, T must be a square matrix of size (n x «), because order of the system remains unchanged in the transformation from x(f) to x'(r). Let us assume that it is possible to transform the new state-vector, x'(f), back to the original state-vector, x(f), with the use of the following inverse transformation: x(r) = T-1x'(r) (3.76)
  • 156. LINEAR TRANSFORMATION OF STATE-SPACE REPRESENTATIONS 141 Equation (3.76) requires that the inverse of the transformation matrix, T ', should exist (in other words, T should be nonsingular). Equation (3.70) is obtained by pre-multiplying both sides of Eq. (3.75) by T"1, and noting that T T"1 = I. To find the transformed state-equation, let us differentiate Eq. (3.76) with time and substitute the result, x (!) (?) = T~'x' u; (0, along with Eq. (3.76), into Eq. (3.33), thereby yielding AT~ l x'(r) (3.77) Pre-multiplying both sides of Eq. (3.77) by T, we get the transformed state-equation as follows: V(0 + TBu(0 (3.78) We can write the transformed state-equation Eq. (3.78) in terms of the new coefficient matrices A', B', C', D', as follows: where A' = TAT~ J , and B' = TB. Similarly, substituting Eq. (3.76) into Eq. (3.34) yields the following transformed output equation: y(t) = C'x'(r) + D'u(f) (3.80) where C' = CT"1, and D' = D. There are several reasons for transforming one state-space representation into another, such as the utility of a particular form of state-equations in control system design (the controller or observer companion form), the requirement of transforming the state vari- ables into those that are physically meaningful in order to implement a control system, and sometimes, the need to decouple the state-equations so that they can be easily solved. We will come across such state-transformations in the following chapters. Example 3.8 We had obtained two different state-space representations for the same electrical network in Examples 3.4 and 3.5. Let us find the state-transformation matrix, T, which transforms the state-space representation given by Eqs. (3.42) and (3.43) to that given by Eqs. (3.51) and (3.52), respectively. In this case, the original state- vector is x(r) = [/2(0; i(2t} ~ R3e(t)/{L(R + /?3)}]r, whereas the transformed state-vector is x'(0 = [LC{e(t) - i2(t)(RRi + R1R2 + R2R3)/R3 - Li(2l)(t) (Ri + #3)//?3}; i2(t)L(R} +Ri)/Ri]T. The state-transformation matrix, T, is of size (2 x 2). From Eq. (3.69), it follows that LC{e(t) - i i2(t)L(Rl (3.81) 22 (t)-R3e(t)/{L(R{+R3)}
  • 157. 142 STATE-SPACE REPRESENTATION where Tn, T2, T2, and 722 are the unknown elements of T. We can write the following two scalar equations out of the matrix equation, Eq. (3.81): LCe(t) - LCi2(t)(RiR3 + /?i/?2 + /?2/?s)//?3 - L2Ci(2l)(t)(Ri + /?3)//?3 - r,,i 2 (f) + Tl2[i2]t) - R3e(t)/{L(R + K3)}] (3.82) i2(t)L(Ri + R3)/R3 = r 2 ii 2 (f) + T22[i2t) - R3e(t)/[L(R[ + J? 3 )J] (3.83) Equating the coefficients of i2(t) on both sides of Eq. (3.82), we get r,, = -LC(R{R3 + R,R2 + /?2*3)/tf3 (3.84) Equating the coefficients of e(t) on both sides of Eq. (3.82), we get 7,2 = -L2C(R} + /?3)//?3 (3-85) Note that the same result as Eq. (3.85) is obtained if we equate the coefficients of i2l)(t) on both sides of Eq. (3.82). Similarly, equating the coefficients of corre- sponding variables on both sides of Eq. (3.83) we get 72i = L(R} + R3)/R3 (3.86) and 722 = 0 (3.87) Therefore, the required state-transformation matrix is 0 ' With the transformation matrix of Eq. (3.88), you may verify that the state-space coefficient matrices of Example 3.5 are related to those of Example 3.4 according to Eqs. (3.79) and (3.80). Example 3.9 For a linear, time-invariant state-space representation, the coefficient matrices are as follows: [1 21; D = [0 0] (3 89) ' If the state-transformation matrix is the following: =H _Jj (3.90) let us find the transformed state-space representation. The first thing to do is to check whether T is singular. The determinant of T, |T| =2. Hence, T is nonsingular and
  • 158. LINEAR TRANSFORMATION OF STATE-SPACE REPRESENTATIONS 143 its inverse can be calculated as follows (for the definitions of determinant, inverse, and other matrix operations see Appendix B): —1 - (1/2) (3.91) Then the transformed state coefficient matrices, A', B', C', D', of Eqs. (3.79) and (3.80) are then calculated as follows: A'- A - l -l 1/2 -3/2 7/2' -1/2 (3.92) -i ' = TB = i - i ii ro o i (3.93) -3/2] (3.94) D' = D = [ 0 0 ] (3.95) It will be appreciated by anyone who has tried to invert, multiply, or find the determinant of matrices of size larger than (2 x 2) by hand, that doing so can be a tedious process. Such calculations are easily done using MATLAB, as the following example will illustrate. Example 3.10 Consider the following state-space representation of the linearized longitudinal dynamics of an aircraft depicted in Figure 2.25: "v(1)(0" " -0.045 0.036 -32 - 2 "1 " t>(0~| a {1> (0 -0.4 -3 -0.3 250 (y(t) (l) 6> (0 ~ 0 0 0 1 9(t) n) _4 (0_ 0.002 -0.04 0.001 -3.2J L ?(OJ o o.r -30 0 p(0l (3.96) 0 0 UoJ _-10 0 r.vioi |"0 0 1 01 a(t) ro o i r ^ o l (3.97)
  • 159. 144 STATE-SPACE REPRESENTATION where the elevator deflection, 8(t) (Figure 2.25) and throttle position, /z(f) (not shown in Figure 2.25) are the two inputs, whereas the change in the pitch angle, 0(t), and the pitch-rate, q(t} = 0 (1) (0> are the two outputs. The state-vector selected to represent the dynamics in Eqs. (3.96) and (3.97) is x(f) = [v(t); a(f); 0(r); q(t)]T, where v(?) represents a change in the forward speed, and a(t) is the change in the angle of attack. All the changes are measured from an initial equilibrium state of the aircraft given by x(0) = 0. Let us transform the state-space representation using the following transformation matrix: 1 0 0 0 -2 0 T= (3.98) -3.5 0 -1 0 2.2 3 You may verify that T is nonsingular by finding its determinant by hand, or using the MATLAB function det. The state-transformation can be easily carried out using the intrinsic MATLAB functions as follows: »A=[-0.045 0.036 -32 -2; -0.4 -3 -0.3 250; 0 0 0 1 ; 0.002 -0.04 0.001 -3.2]; <enter> »B=[0 0.1;-30 0;0 0;-10 0]; C=[0 0 1 0; 0 0 0 1]; D=zeros(2,2); <enter> »T=[1 -1 0 0; 0 0 -2 0; -3.5 1 0 -1; 0 0 2.2 3]; <enter> »Aprime=T*A*inv(T), Bprime=T*B, Cprime=C*irw(T) <enter> Aprime = -4.3924 -77.0473 -1.3564 -84.4521 0 -0.7333 0 -0.6667 4.4182 40.0456 1.3322 87.1774 0.1656 -2.6981 0.0456 -2.4515 Bprime = 30.0000 0.1000 0 0 -20.0000 -0.3500 -30.0000 0 Cprime = -0.5000 0 0.3667 0.3333 and iy is, of course, just D. The transformed state coefficient matrices can be obtained in one step by using the MATLAB Control System Toolbox (CST) command ss2ss. First, a state-space LTI object is created using the function ss as follows: sys1=ss(A,B,C,D) <enter> a = x1 x2 x3 x4 x1 -0.045 0.036 -32 -2 x2 -0.4 -3 -0.3 250
  • 160. LINEAR TRANSFORMATION OF STATE-SPACE REPRESENTATIONS 145 x3 0 0 0 1 1 x4 0.002 -0.04 0.001 -3.2 1 b = 1 u1 u2 I X1 0 0.1 x2 -30 0 x3 0 0 x4 -10 0 = c x1 x2 x3 x4 yi 0 0 1 0 y2 0 0 0 1 d = u1 u2 yi 0 0 1 y2 0 0 I Continuous-time model. Then, the function ss2ss is used to transform the LTI object, sysl, to another state-space representation, sys2 : »sys2 = ss2ss (sys1,T) <enter> a = x1 x2 x3 x4 x1 -4.3924 -77.047 -1.3564 -84.452 x2 0 -0.73333 0 -0.66667 x3 4.4182 40.046 1.3322 87.177 x4 0.1656 -2.6981 0.0456 -2.4515 1 b = I u1 u2 1 x1 30 0.1 1 x2 0 0 I x3 x4 -20 -30 -0.35 0 1 I c = 1 x1 x2 x3 *4 I yi o -0.5 o 0 I y2 0 0.36667 0 0.33333 1 d = 1 u1 u2 1 yi o o 1 y2 o o I Continuous-time model.
  • 161. 146_ STATE-SPACE REPRESENTATION _ Since a system's characteristics do not change when we express the same system by different state-space representations, the linear state transformations are also called similarity transformations. Let us now see how we can obtain information about a system's characteristics - locations of poles, performance, stability, etc. - from its state- space representation. 3.3 System Characteristics from State-Space Representation In Chapter 2, we defined the characteristics of a system by its characteristic equation, whose roots are the poles of the system. We also saw how the locations of the poles indicate a system's performance - such as natural frequency, damping factor, system type - as well as whether the system is stable. Let us see how a system's characteristic equation can be derived from its state-space representation. The characteristic equation was defined in Chapter 2 to be the denominator polynomial of the system's transfer function (or transfer matrix) equated to zero. Hence, we should first obtain an expression for the transfer matrix in terms of the state-space coefficient matrices, A, B, C, D. Recall that the transfer matrix is obtained by taking the Laplace transform of the governing differential equations, for zero initial conditions. Taking the Laplace transform of both sides of the matrix state-equation, Eq. (3.33), assuming zero initial conditions (i.e. x(0) = 0) yields the following result: sX(s) = AX(s) + BU(s) (3.99) where X(s) = £[x(r)], and U(.s) = £[u(f)L Rearranging Eq. (3.99), we can write (si - A)X(s) = BU(s) (3. 100) or X(5) = (sI-A)~ 1 BU(5) (3.101) Similarly, taking the Laplace transform of the output equation, Eq. (3.34), with Y(s) = £[y(t)], yields (s) = CX(j) + DU(s) (3. 102) Substituting Eq. (3.101) into Eq. (3.102) we get Y(s) = C(sl - A)-'BU(j) + DU(j) = [C(sl - A)"!B + D]U(s) (3.103) From Eq. (3.103), it is clear that the transfer matrix, G(s), defined by Y(s) = G is the following: A)- 1 B-|-D (3.104) Equation (3.104) tells us that the transfer matrix is a sum of the rational matrix (i.e. a matrix whose elements are ratios of polynomials in s), C(sl — A)~ ! B, and the
  • 162. SYSTEM CHARACTERISTICS FROM STATE-SPACE REPRESENTATION 147 matrix D. Thus, D represents a direct connection between the input, U(s), and the output, Y(s), and is called the direct transmission matrix. Systems having D = 0 are called strictly proper, because the numerator polynomials of the elements of G(s) are smaller in degree than the corresponding denominator polynomials (see the discussion following Eq. (2.1) for the definition of strictly proper single variable systems). In Example 2.28, we had obtained the characteristic equation of a multivariable system from the denominator polynomial of G(s). Hence, the characteristic polynomial of the system must be related to the denominator polynomial resulting from the matrix, Example 3.11 For a linear system described by the following state coefficient matrices, let us determine the transfer function and the characteristic equation: 1 ~ ' ~ ' *' ~ " 1]; D=0 (3.105) The inverse (5! — A) ' is calculated as follows: OsI-Ar 1 =adj(sI-A)/|(.sI-A)| (3.106) where the determinant (sl — A)| is given by (3.107) (s — i ) and the adjoint, adjCsI — A), is given by (See Appendix B for the definitions of the inverse, adjoint, and determinant.) Substi- tuting Eqs. (3.107) and (3.108) into Eq. (3.106) we get (3.109) —^- $ — i ) i Then the transfer matrix is calculated as follows: -1 _ 2 (S~ 1) 2 1 2 L - (J-DJ 2 = [ l / ( 5 - Z s + 5)][(5-3) (5 + 1)] (3.110) = [l/(5 2 -2s + 5)][(s-3); (5+1)] = (s - 3)/(52 - 2s + 5) (3.111)
  • 163. 148 STATE-SPACE REPRESENTATION The conversion of a system's state-space representation into its transfer matrix is easily carried out with the MATLAB Control System Toolbox's (CST) LTI object function tf as follows: »sys = tf(sys) <enter> Example 3.12 Let us convert the state-space representation of the aircraft longitudinal dynamics (Example 3.10) given by Eqs. (3.96) and (3.97) into the transfer matrix of the system, as follows: »sys1=tf (sysl) <enter> Transfer function from input 1 to output... -10s~2-29.25s-1.442 #1: S"4+6.245S"3+19.9s"2+1.003S+0.7033 -10s~3-29.25S~2-1.442S-5.2936-016 #2: SA4+6.245SA3+19.9S"2+1.003S+0.7033 Transfer function from input 2 to output... 0.0002S+0.0022 #1: S~4+6.245S"3+19.9s"2+1.003S+0.7033 0.0002s~2+0.0022S+3.671e-019 #2: SM+6.245S~3+19. 9S"2+1 .003S+0.7033 Note that the single-input, single-output system of Example 3.11, the transfer function has a denominator polynomial s2 — 2s + 5, which is also the characteristic polyno- mial of the system (see Chapter 2). The denominator polynomial is equal to |(sl — A)| (Eq. (3.107)). Thus, the poles of the transfer function are the roots of the characteristic equation, (sl — A)| = 0. This is also true for the multivariable system of Example 3.12, where all the elements of the transfer matrix have the same denominator polynomial. Using linear algebra, the characteristic equation of a general, linear time-invariant system is obtained from the following eigenvalue problem for the system: Av*=A*v* (3.112) where A/t is the Jtth eigenvalue of the matrix A, and v* is the eigenvector associated with the eigenvalue, A* (see Appendix B). Equation (3.112) can be written as follows: (XI-A)v = 0 (3.113)
  • 164. SYSTEM CHARACTERISTICS FROM STATE-SPACE REPRESENTATION 149 For the nontrivial solution of Eq. (3.113) (i.e. v / 0), the following must be true: |(A1-A)|=0 (3.114) Equation (3.114) is another way of writing the characteristic equation, whose the roots are the eigenvalues, A. Hence, the poles of the transfer matrix are the same as the eigenvalues of the matrix, A. Since A contains information about the characteristic equation of a system, it influences all the properties such as stability, performance and robustness of the system. For this reason, A is called the system's state-dynamics matrix. Example 3.13 For the state-space representation of the electrical network derived in Examples 3.4 and 3.5, let us substitute the numerical values from Example 2.8 (R = R?, = 10 ohms, R2 — 25 ohms, L = 1 henry, C = 10~6 farad) and calculate the transfer functions and eigenvalues for both the state-space representations. The state-space representation of Example 3.4 yields the following state coeffi- cient matrices: A= E l ?n6 Ll; = °',5J' C = [-0.5 0]; D = 0.05 (3.115) [-10 -30 J L~ 1 5 J while the state-space representation of Example 3.5 has the following coefficient matrices: -30 J ; B '= (3.116) Either using Eq. (3.104) by hand, or using the CST LTI object function, tf, we can calculate the respective transfer functions as follows: »A=[0 1;-1e6 -30]; B=[0.5; -15]; C = [ - 0 . 5 0] ; D=0.05;sys1=ss(A,B,C,D) ; sys1=tf (sysl ) <enter> Transfer function: 0.05s"2+1 .255+56004 s"2+30s+1e006 » A=[0 1;-1e6 -30]; B=[0; 1]; C=[0 -0.25]; D=0.05;sys2=ss(A,B,C,D); sys2=tf(sysl) <enter> Transfer function: 0.05sA2+1.25s+5e004 s"2+30s+1e006 Note that the two transfer functions are identical, as expected, because the two state-space representations are for the same system. The characteristic equation is
  • 165. 150 STATE-SPACE REPRESENTATION obtained by equating the denominator polynomial to zero, i.e. s2 + 30s + 106 = 0. Solving the characteristic equation, we get the poles of the system as follows: »roots([1 30 1e6]) <enter> ans = - 1 . 50006+001 +9 . 9989e+002i - 1 . 5000e+001 -9 . 99896+0021 which agree with the result of Example 2.8. These poles should be the same as the eigenvalues of the matrix, A(= A'), obtained using the intrinsic MATLAB function eig as follows: »eig([0 -30]) <enter> ans = - 1 . 50006+001 +9 . 9989e+002i - 1 . 50006+001 - 9 . 9989e+002i Example 3.13 shows that the system's characteristics are unchanged by using different state-space representations. Example 3.14 Consider the following two-input, two-output turbo-generator system [2]: "-18.4456 4.2263 -2.2830 0.2260 0.4220 -0.0951" -.97 -.76 407 600 5.6825 - . 9 6 066 -1.2246 0.2873 1.4449 1.4336 - . 4 7 267 069 .02 087 -.30 .99 020 -.03 009 0.2302 - . 0 2 -0.1764 050 -6.3152 0.1350 - . 4 4 -0.3489 006 0.7238 6.3117 -.86 068 0.3645 _ - . 6 2 -0.2361 000 0.2300 0.0915 -0.3214 - . 0 7 _ 028 "- . 7 8 024 3.1463 " -0.0501 - 9.3737 -0.1550 749 .26 0.0716 -4.9176 -0.0814 -10.2648 004 .24 13.7943 ).5971 -0.7697 4.8850 4.8608 -9.8177 -8.8610 1.1013 9.3422 - . 0 0 560 -0.7490 2.9974 10.5719 -is :i (3.117)
  • 166. SYSTEM CHARACTERISTICS FROM STATE-SPACE REPRESENTATION T_51 The eigenvalues and the associated natural frequencies and damping factors of the system are found by using the MATLAB command damp(A) as follows: »damp(A) <enter> Eigenvalue Damping Freq. (rad/sec) -2.3455e-001 1.00006+000 2.34556-001 -3.4925e-001+6.3444e+000i 5.4966e-002 6.35406+000 -3.4925e-001-6.3444e+000i 5.4966e-002 6.3540e+000 -1.04446+000 1.00006+000 1.04446+000 -1.03876+001 1.00006+000 1.0387e+001 -1.58736+001 1.OOOOe+000 1.5873e+001 Note that there are four real eigenvalues, and a pair of complex conjugate eigenvalues. All the eigenvalues (i.e. poles) have negative real parts, implying an asymptoti- cally stable system from the stability criteria of Chapter 2. Also from Chapter 2, the damping factors associated with all real eigenvalues with negative real parts are 1.0, since such eigenvalues represent exponentially decaying responses. Only complex conjugate eigenvalues have damping factors less than 1.0. These eigenvalues repre- sent an oscillatory response. If it were possible to decouple the state-equations by the use of a state transformation, such that the each of the transformed state-equations is in terms of only one state variable, then each eigenvalue would represent a partic- ular mode in which the system can respond. Hence, there are six modes in this sixth order system, consisting of four real (or first order) modes, and a second order mode defined by a pair of complex conjugate eigenvalues. Note that the second order mode has a relatively small damping factor (0.055). The transfer matrix, G(s), defined by Y(s) = G(s)UCs), of this two-input, two-output system, is written as follows: G(.v) = [G,(5) G2(s)] (3.118) where ¥(5) = Gi(s)U(s) + G2(s)U2(s), with U(s) and U2(s) being the two inputs. Gj(s) and G2(s) are usually obtained using the CST LTI objects ss and ff as follows: »syst=ss(A,B,C,D); syst=tf(syst) <enter> Transfer function from input 1 to output... 0.048298^5+1.876s~4+1.949s~3-1228s A 2-5762s-2385 #1: - S A 6+28.24s"5+258.3S~4+1468s A 3+8214s A 2+88018+1631 - 0.4919s"5+9.483s A 4-49.05s"3+551.6s"2-939.6S+907.6 #2: s~6+28.24s~5+258.3s"4+1468s"3+8214s"2+88018+1631 Transfer function from input 2 to output... 0.02915s"5+1 .289SM-0.30418 A 3-2.388e004s ~2-8.29e005s -9.5446005
  • 167. 152 STATE-SPACE REPRESENTATION #1 : ..................................................... S"6+28 . 24s"5+258 . 3s"4+1 468s"3+821 4sA2+8801 S+1 631 - 0 . 671 6s~5+804 . 5s~4+2 . 781 e004s"3+8 . 085e004s"2+1 . 21 4e006s +1 .0826006 #2 : ....................................................... S~6+28.24s~5+258. 3s"4+1 468s"3+821 48*2+8801 S+1 631 Therefore, _ r(0.04829s5 + l. 876s4 + 1. 949s3 -1228-s2- 5762s -2385)A/(s) 1 ~ [(-0.49 1 9s5 + 9.483s4- 49.05s3 + 55 1.6s2- 939.6s + 907.6) /d(s) J G( ) 2 S _ |"(0.02915s5 + 1.289s4 -0.304 Is3- 2.388 x 10* s2 - 8.29 x lO5*- 9.544 x lO5)/*/^)! ~ |_(-0.6716s5 + 804.5s4 + 27810s3 + 8085s2+1.214x 106s + 1.082x ltf)/d(s) J (3.119) where d(s) = (s6 + 28.24s5 + 258.3s4 + 1468s3 + 8214s2 + 8801s + 1631) (3.120) For brevity, the coefficients have been rounded off to four significant digits. If the MATLAB's long format is used to report the results, a greater accuracy is possible. Note that all the elements of the transfer matrix G(s) have a common denominator polynomial, whose roots are the poles (or eigenvalues) of the system. This is confirmed by using the coefficients of d(s) rounded to five significant digits with the intrinsic MATLAB function roots as follows: »roots([1 28.238 258.31 1467.9 8214.5 8801.2 1630.6]) <enter> ans = -15.8746 -10.3862 -0.3491+6.34441 -0.3491-6.34441 - 1 . 0444 -0.2346 3.4 Special State-Space Representations: The Canonical Forms In Section 3.1 we saw how some special state-space representations can be obtained, such as the controller and observer companion forms. The companion forms are members of a special set of state-space representations, called canonical forms. In addition to the companion forms, another canonical form is the Jordan canonical form, which is derived from the partial fraction expansion of the system's transfer matrix as described below. In Section 3.3, we saw how the transfer matrix can be obtained from a state-space
  • 168. _ SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS_ 153 representation. Now we will address the inverse problem, namely deriving special state-space representations from the transfer matrix. For simplicity, consider a single-input, single-output system with the transfer function given by the following partial fraction expansion: 2 Y ( s ) / U ( s ) = k() + k { / ( s -pi) + k2/(s - p2) + • • • + k i / ( s - /?/) + ki+l/(s - Pi) m+{ + •••+ ki+m/(s - Pi} + ••• + kn/(s - pn) (3. 121) where n is the order of the system, and all poles, except s = Pi, are simple poles. The pole, s = pi, is of multiplicity (m + 1), i.e. (s — /?,) occurs as a power (m + 1) in the transfer function. Let us select the state-variables of the system as follows: = /(s - /?,); X2(s)/U(s) = /(s - p2); . . . ; Xi(s)/U(s) = /(s - Pi); Xi+[(s)/U(s) - /(s - Pl)2- . . . ; m+l Xi+m(s)/U(s) = /(s - Pi) ;...;XM/U(s) = / ( s - pn) (3.122) Taking the inverse Laplace transform of Eq. (3.122), we get the following state-equations: = p2X2(t) + U(t) (3.123) x^[)(t) = Pnxn(t} + u(t) and the output equation is given by y ( t ) = k i x i ( t ) -f £2*2(0 H ----- 1- kiXi(t) + ki+ixi+i (?) + - • • + ki+mxi+m(t) + • • • + knxn(t) + k()u(t) (3.124) (Note that in deriving the state-equations corresponding to the repeated pole, s = /?/, we have used the relationship Xi+i(s) = X(/(s - /?,-), Xi+2(s) = Xi+i/(s - Pi), and so on.) The state-space representation given by Eqs. (3.123) and (3.124) is called the Jordan canonical form. The state coefficient matrices of the Jordan canonical form are, thus, the
  • 169. 154 STATE-SPACE REPRESENTATION following: "PI 0 .. 0 0 0 ... 0 0 ... 0 0 P2 .. 0 0 0 ... 0 0 ... 0 0 0 . .. 0 0 0 ... 0 0 ... 0 0 0 .. pi 0 0 ... 0 o; ... 0 0 0 . .. l Pi 0 ... 0 0 ... 0 0 0 . .. ;0 1 Pi ... 0 o: ... 0 0 0 . .. io 0 0 ... 1 Pi ... 0 0 0 . .. 0 0 0 ... 0 0 ... Pn_ 1 1 l " """ ..Pi 1 • 1],T .*! *2 -. . ki 1:,-+i ... ^ .. *„] V = k0 (3.125) Note the particular structure of the A matrix in Eq. (3.125). The system's poles (i.e. the eigenvalues of A) occur on the main diagonal of A, with the repeated pole, p,, occurring as many times as the multiplicity of the pole. A square block associated with the repeated pole, pi, is marked by a dashed border, and is known as the Jordan block of pole, p,. The diagonal below the main diagonal - called the subdiagonal - of this block has all elements equal to 1. All other elements of A are zeros. The matrix B also has a particular structure: all elements associated with the simple poles are ones, the first element of the Jordan block of repeated pole, p, - shown in dashed border - is one, while the remaining elements of the Jordan block of p, are zeros. The elements of matrix C are simply the residues corresponding to the poles in the partial fraction expansion (Eq. (1.121)), while the matrix D is equal to the direct term, &o, in the partial fraction expansion. If a system has more than one repeated poles, then there is a Jordan block associated with each repeated pole of the same structure as in Eq. (3.125). If none of the poles are repeated, then A is a diagonal matrix. The Jordan canonical form can be also obtained similarly for multi-input, multi-output systems. Example 3.15 Let us find the Jordan canonical form of the following system: Y(s)/U(s) = (5 + l)/[(5 - 1)2(5 - 3)] (3.126)
  • 170. SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS 155 The partial fraction expansion of Eq. (3.126) is the following: Y ( s ) / U ( s ) = /(s - 3) - l/(s - 1) - l/(5 - I) 2 (3.127) Comparing Eq. (3.127) with Eq. (3.121) and using Eq. (3.125), we get the following Jordan canonical form: 3 0 0" A = 0 |l 0! B I'll 0 l ioi D c =[ i E = (3.128) The Jordan block associated with the repeated pole, s = , is shown in dashed borders. While Jordan canonical form is an easy way of obtaining the state-space representation of a system, it has a major drawback: for the Jordan canonical form to be a practical representation, all the poles of the system (i.e. eigenvalues of A) must be real. After all, the purpose of having state-space representations is to practically implement a control system, using electrical circuits or mechanical devices. A state-space representation with complex coefficient matrices cannot be implemented in a hardware (have you ever heard of a complex electrical resistance, or a spring with complex stiffness!). To make some sense out of Jordan canonical form for a system with complex poles, we can combine the partial fractions corresponding to each pair of complex conjugate poles, p^ = a ± /'&>, into a second order real sub-system as follows: k/(s - p) + k2/(s - p2) = 2[as - (oca + pa))]/(s2 - 2as + a2 + or) (3.129) where k^ — a ± ifi are the residues corresponding to the poles, p^- Remember that the residues corresponding to complex conjugate poles are also complex conjugates. Since the complex poles always occur as complex conjugates, their combination into real second order sub-systems using Eq. (3.129) will lead to a real state-space representation. From Eq. (3.129), it can be shown that the real Jordan block in A corresponding to a pair of complex conjugate poles, p^ — a ± ito, is a 2 x 2 block with real parts on the diagonal, and the imaginary parts off the diagonal as follows: Jordan block of pti — a ± iu> in A = i —a> a (3.130) The MATLAB Control System Toolbox function canon provides an easy derivation of the canonical forms, using the methodology presented above. The function is used as follows: »[csys,T] = canon(sys,'type') <enter> where sys is an LTI object of the system (either transfer matrix, or state-space), 'type' is either 'modal' for Jordan canonical form, or 'companion' for the observer companion
  • 171. 156 STATE-SPACE REPRESENTATION form, csys is the returned canonical form, and T is the returned state-transformation matrix which transforms the state-space representation from sys to csys (T is meaningful only if sys is a state-space representation, and not the transfer matrix). The matrix A of the Jordan canonical form obtained using canon has each pair of complex eigenvalues in a real Jordan block given by Eq. (3.130). Example 3.16 For the system of Example 3.14, let us obtain the canonical forms. For the Jordan canonical form, the MATLAB (CST) command canon is used as follows: » syst=ss(A, B, C, D); [ j s y s t . T ] = canon(syst, 'modal') <enter> a = x1 x2 x3 X4 x5 x1 -15.873 0 0 0 0 x2 0 -10.387 0 0 0 x3 0 0 -0.34925 6.3444 0 x4 0 0 -6.3444 -0.34925 0 x5 0 0 0 0 -1.0444 x6 0 0 0 0 0 x6 x1 0 x2 0 x3 0 x4 0 x5 0 x6 -0.23455 b = U1 u2 X1 0.50702 -20.055 x2 -0.36131 30.035 x3 0.092163 -5.577 X4 0.13959 13.23 x5 -0.17417 8.7113 x6 0.021513 14.876 c = x1 x2 x3 X4 X5 y1 0.86988 2.3105 2.7643 6.459 2.8803 y2 -7.9857 -11.128 -0.19075 -0.78991 3.2141 x6 -9.885 y2 10.406 d = u1 u2 0 0 y2 0 0 Continuous-time model.
  • 172. SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS 157 Columns 1 through 2 -1.67367664062877 0.82071823417532 0.93271689676861 -1.37011949477365 0.00703777816771 0.01235017857500 -0.01678546516033 0.05675504485937 0.01434336645020 0.32743224909474 0.00550594309107 -0.03421867428744 Columns 3 through 4 -0.64877657888967 0.02185375479665 1.30954638127904 0.00863637157274 0.06144994008648 1.42410332092227 -0.12409538851455 0.03844790932243 1.10820137234454 0.07909786976484 0.01382978986462 -0.04137902672467 Columns 5 through 6 0.15933965118530 -0.03863614709032 -0.32626410503493 0.08854860917358 -0.00622411675595 0.07244625298095 -1.41411419523105 0.02977656775124 -0.08538437917204 0.21852854369639 -0.01967206771160 1.01709518519537 Note the 2 x 2 real Jordan block in A corresponding to the complex eigenvalues /?3,4 = —0.349 25 ± 6.34441. Also, note that the corresponding terms in the matrices B and C are also real. The transformation matrix, T, has been reported in long format for greater accuracy in calculations. Next, we calculate the observer canonical form of the system as follows: »[csyst, T] = canon(syst, 'companion') <enter> a = x1 x2 x3 x4 X5 x1 9.60346-015 -1.30176-013 1 , 68226-012 -4.87726-011 1.58626-009 x2 1 5.68996-014 1 , 69646-012 -3.44766-011 7.77626-010 x3 7.77166-016 1 2, 60686-013 -4.65416-012 1.04256-010 x4 4.51036-017 2.49976-015 1 -8.33116-013 1.90146-011 x5 1.51796-018 2.78646-016 5. 53036-015 1 2.15296-012 x6 5.4216-020 1.01036-017 1.96026-016 -3.25436-015 1 x6 x1 -1630.6 x2 -8801.2 x3 -8214.5 x4 -1467.9 x5 -258.31 x6 -28.238 b = u1 u2 X1 1 945.61 x2 0 1128.8 x3 0 201 .9
  • 173. 158 STATE-SPACE REPRESENTATION x4 0 36.481 x5 0 4.0669 X6 0 0.1451 C = x1 x2 x3 X4 X5 yi 0.04829 0.51209 -24.985 -725.97 204 04 y2 -0.49194 23.374 -581.99 11670 -2.10416+005 x6 y1 -3.4886+005 y2 3 5 4 6 0 6 . 9 4 + 0 d = u1 u2 y1 0 0 y2 0 0 Continuous-time model. T = Columns 1 through 0.36705413565042 -1.48647885543276 0.48941400292950 04760762 .6450868 0.06992034388180 0.10572273608335 0.01406952155565 0.02165321186650 0.00129963404010 0.00361303652580 00034907 .0094070 00056935 .0176980 Columns 3 through 4 3.02790751537344 -2, 47039343978461 10.58180159205530 -2, 47081762640110 1.83987823178029 -0, 61525593744681 03363077 .4807472 -0. 10310276871196 0 0 0 3 3 0 2 4 . 4 0 8 7 4 0 4 -0. 00922166413447 0.00145527317768 -0. 0 0 8 1 4 6 6 0 2 9 6 8 0 4 Columns 5 through -1.39030096046515 63.91103372168656 -2.11561239460537 73.88483216381728 -0.39195667361013 13.19012284392485 -0.09863522809937 2 3 0 6 9 2 2 9 . 6 7 7 7 7 6 6 -0.01208541334668 0.26314010184181 -0.00043627032173 0.00940569645931 In the A matrix of the computed observer companion form, all the elements except those in the last column and the subdiagonal are negligible, and can be assumed to be zeros. We can also derive the controller companion form merely by taking the transposes of A, B, and C of the observer form computed above. The controller companion form is thus denoted by the coefficient set (A7, Cr, B 7 , D). The Jordan canonical form is useful for decoupling the state-equations of systems with distinct eigenvalues; such systems have a diagonal A matrix of the Jordan canonical form.
  • 174. SPECIAL STATE-SPACE REPRESENTATIONS: THE CANONICAL FORMS 159 The companion forms are useful in designing control systems. However, a great disadvan- tage of the companion forms (both controller and observer) is that they are ill-conditioned, which means that the eigenvalues and eigenvectors of the matrix A are very sensitive to perturbations in the elements of A. This results in large inaccuracies in the computed eigenvalues (and eigenvectors), even if there is a small error in calculating A. Since a system's characteristics are governed by the eigenvalues and eigenvectors of A, an ill- conditioned A matrix is undesirable. The ill-conditioning of companion forms generally gets worse as the order of the system increases. Hence, we should normally avoid using the companion forms as state-space representations, especially for large order systems. MATLAB assigns a condition number to each square matrix. The condition number indi- cates how close a matrix is to being singular (i.e. determinant of the matrix being zero). A larger condition number means that the matrix is closer to being singular. With MATLAB we can assess the condition number of a square matrix, A, using the command cond(A). If cond(A) is small, it indicates that A is well-conditioned. If cond(A) is very large, it implies an ill-conditioned A. Whenever we try to invert an ill-conditioned matrix, MATLAB issues a warning that the matrix is ill-conditioned and the results may be inaccurate. Example 3.17 Let us compare the condition numbers for the Jordan canonical form and the observer companion form derived in Example 3.16. The condition number for the Jordan canonical form is calculated by first retrieving the state coefficient matrices from the LTI object jsyst using the Control System Toolbox (CST) function ssdata, and then applying cond to matrix A as follows: » [Aj,Bj,Cj,Dj]=ssdata(jsyst); cond(Aj) <enter> ans = 67.6741 while the condition number for the companion form is the following: » [ A c , B c , C c , D c ] = s s d a t a ( c s y s t ) ; cond(Ac) <enter> ans = 9.1881e+004 The condition number for the companion form is, thus, very large in comparison to that of the Jordan canonical form, confirming that the former is ill-conditioned. Why is a companion form ill-conditioned while the Jordan canonical form is not? The answer lies in all the diagonal elements, except the last, being zeros in the matrix A of the companion forms. In contrast, the Jordan form's matrix A has a populated diagonal, i.e. none of the diagonal elements are zeros. For conversion of a transfer matrix into a state-space representation, you can use the MATLAB (CST) LTI object ss. However, the state-space conversion of a transfer matrix
  • 175. 160 STATE-SPACE REPRESENTATION with ss results in the controller companion form, which we know to be ill-conditioned. Hence, we should avoid converting a transfer matrix to state-space representation using the command ss, unless we are dealing with a low order system. 3.5 Block Building in Linear, Time-Invariant State-Space Control systems are generally interconnections of various sub-systems. If we have a state- space representation for each sub-system, we should know how to obtain the state-space representation of the entire system. Figure 2.55 shows three of the most common types of interconnections, namely the series, parallel, and feedback arrangement. Rather than using the transfer matrix description of Figure 2.55, we would like to depict the three common arrangements in state-space, as shown in Figure 3.7. The series arrangement in Figure 3.7(a) is described by the following matrix equations: (3.131) (3.132) (3.133) (3.134) where the state-space representation of the first sub-system is (Aj, BI, Ci, DI), while that of the second subsystem is (A2, 82, C2, D2). The input to the system, u(f), is also (a) u(f) y(0 x2<1>(0 = A^ = C 1 x 1 (f)-»-D 1 u(0 y(0 = 02X2(0+0^(0 (b) u2(0 ya(0 y2(0 = C2x2(0+D2u2(0 (c) a(0 y(0 xc(1)(0 = Acxc(0+Bc[yd(0-y(Ol V1)(0 = ApXpW+BpUfO -0* - u(0 Figure 3.7 Three common arrangements of sub-systems models in state-space
  • 176. BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE 161 the input to the first sub-system, while the system's output, y ( t ) , is the output of the second sub-system. The output of the first sub-system, yi(/), is the input to the second sub-system. Substitution of Eq. (3.132) int Eq. (3.133) yields: x^(r) = A 2 x 2 (/) + B 2 C l X , (0 + B 2 D,uU) (3.135) and substituting Eq. (3.132) into Eq. (3.134), we get - C 2 x 2 (f) + D 2 C,x,(?) + D 2 D,u(0 (3.136) If we define the state-vector of the system as x(f) = [xf (0; x 2 (?)] r , Eqs. (3.131) and (3.135) can be expressed as the following state-equation of the system: A 0 ' A lx(0 + LBjJu(,) (3.137) Ac and the output equation is Eq. (3.136), re-written as follows: y(0 = [D2Ci C 2 ]x(f)+D 2 Diu(f) (3.138) The MATLAB (CST) command series allows you to connect two sub-systems in series using Eqs. (3.137) and (3.138) as follows: »sys = series(sys1,sys2) <enter> The command series allows connecting the sub-systems when only some of the outputs of the first sub-system are going as inputs into the second sub-system (type help series (enter] for details; also see Example 2.28). Note that the sequence of the sub-systems is crucial. We will get an entirely different system by switching the sequence of the sub-systems in Figure 3.7(a), unless the two sub-systems are identical. Deriving the state and output equations for the parallel connection of sub-systems in Figure 3.7(b) is left to you as an exercise. For connecting two parallel sub-systems, MATLAB (CST) has the command parallel, which is used in a manner similar to the command series. The feedback control system arrangement of Figure 3.7(c) is more complicated than the series or parallel arrangements. Here, a controller with state-space representation (AC,BC, CC,DC) is connected in series with the plant (Ap, Bp, Cp, Dp) and the feedback loop from the plant output, y(/), to the summing junction is closed. The input to the closed-loop system is the desired output, yd(0- The input to the controller is the error [yd(0 ~ y(OL while its output is the input to the plant, u(/). The state and output equations of the plant and the controller are, thus, given by x p ( l ) (r) = ApXp(r) + Bpu(r) (3.139) y(0 - Cpxp(r) + DpU(0 (3.140) (l) Xc (f) = Acxc(0 + Bc[yd(0 - y(r)J (3.141) u(0 = C c xc(r) + Dc[yd(0 - y(r)] (3.142)
  • 177. 162_ STATE-SPACE REPRESENTATION _ Substituting Eq. (3.142) into Eqs. (3.139) and (3.140) yields the following: xp (1) (0 = ApXp(f) + BpCcXc(r) + BpDc[yd(r) - y(r)] (3.143) y(0 = CpXpO + DpCcXc(r) + DpDc[yd(0 - y(/)] (3.144) Equation (3.144) can be expressed as y(r) = (I + DpDc)-1[CpXp(0 + DpCcXc(0] + (I + DpDc)-1DpDcyd(0 (3.145) provided the square matrix (I + DpDc) is non-singular. Substituting Eq. (3.145) into Eq. (3.143) yields the following state-equation of the closed-loop system: (3.146) and the output equation of the closed-loop system is Eq. (3.145) re-written as: y(0 = Cx(f)+Dyd(0 (3.147) where A = -Bc(I + DpDc) >Cp C = (I + DPDC) -'[Cp D P C C ]; D = ( I + DpDc)-1DpDc; B= [ . (3.148) Using MATLAB (CST), the closed-loop system given by Eqs. (3.146)-(3.148) can be derived as follows: »sysO = series (sysc, sysp) % series connection of LTI blocks sysc and sysp <enter> »sys1=ss(eye(size(sysO))) % state-space model (A=B=C=0, D=I) of the feedback block, sysl <enter> »sysCL= feedback(sysO, sysl ) % negative feedback from output to input of sysO <enter> where sysO is the state-space representation of the controller, sysc, in series with the plant, sysp, sysl is the state-space representation (A = B = C = 0, D = I) of the feedback block in Figure 3.7(c), and sysCL is the state-space representation of the closed-loop system. Note that sysO is the open-loop system of Figure 3.7(c), i.e. the system when the feedback loop is absent. I Example 3.18 I Let us derive the state-space representation of an interesting system, whose I block-diagram is shown in Figure 3.8. The system represents a missile tracking |
  • 178. BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE 163 Aircraft xa(1)(0 == Aaxa(0 + Ba u(0 u(0 + yd(0 = Caxa(0 + Dau(0 yd<o i T / ^- fc u°m(0 = ccxjo + Dcc[ydd(o-y(0] •uo x (1 >( y(0 = Cmxm(0 + Dmum(0 (0 Controller Missile Figure 3.8 Block diagram for the aircraft-missile control system of Example 3.1 8 a maneuvering aircraft. The pilot of the aircraft provides an input vector, u(r), to the aircraft represented as (Aa, Ba, Ca, Da). The input vector, u(t), consists of the aircraft pilot's deflection of the rudder and the aileron. The motion of the aircraft is described by the vector, yd(0, which is the desired output of the missile, i.e. the missile's motion - described by the output vector, y ( t ) - should closely follow that of the aircraft. The output vector, y(f), consists of the missile's linear and angular velocities with respect to three mutually perpendicular axes attached to the missile's center of gravity - a total of six output variables. The state-space representation for the missile is (Am, Bm, Cm, Dm). The missile is controlled by a feedback controller with the state-space representation (Ac, Bc, Cc, Dc) whose task is to ultimately make y(r) = ya(?), i-e. cause the missile to hit the maneuvering aircraft. The matrices representing the aircraft missile, and controller are as follows: " -0.0100 -0.1000 0 0 0 0 0 - 0 -0.4158 1.0250 0 0 0 0 0 0.0500 -0.8302 0 0 0 0 Aa = 0 0 0 -0.5600 - 1.0000 0.0800 0.0400 0 0 0 0.6000 -0.1200 -0.3000 0 0 0 0 -3.0000 0.4000 -0.4700 0 0 0 0 0 0.0800 1.0000 0 _ " 0 0 0 0 0 0 Ba = 0.0730 0.0001 -4.8000 1 .2000 1 .5000 10.0000 0 0
  • 179. 164 STATE-SPACE REPRESENTATION "i oo o o o 01 ro 01 0 00 250 000 00 02500 0 0 0 0 _ 00 3 — Do = a 0 00 0 0 1 0 ' 00 0 0 1 0 0 0 0 0 0 .0 oo o i o oj l_o oj " 0.4743 0 0.0073 0 0 0 1 0 -0.4960 0 0 0 0 -0.0368 0 -0.4960 0 0 0 /"m.01 — 0 -0.0015 0 -0.0008 0 0.0002 0 0 -0.2094 0 -0.0005 0 0 -0.2094 0 0 0 -0.0005 J "o o o i ri o o o o 0 1 191.1918 0 0 0 1 0 0 0 0 0 191.1918 0 . 0 0 1 0 0 0 Bm = m 0 0 1.0000 ' ~ 0 0 0 1 0 0 0 232.5772 0 0 0 0 0 1 0 _232.5772 0 0 J [ o O O O O l J "0 0 01 0 0 0 0 0 0 m = 0 0 0 0 0 0 .0 0 oj ~ 0 0 0 1.0 0 0 1 0 0 0 0 1.0 0 0 0 0 0 0 1.0 Ac = -1.0 0 0 -0.3 0 0 0 -1.0 0 0 -0.3 0 0 0 -1.0 0 0 -0.3 J ~0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 Bc = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.6774 0.0000 0.0052 0.0000 -0.0001 0.0000 _ 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 J 100000' 000000 0 1 0 0 0 0 000000 0 0 1 0 0 0 000000
  • 180. BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE 165 Note that the aircraft is a seventh order sub-system, while the missile and the controller are sixth order sub-systems. The state-space representation of the entire system is obtained as follows: »sysc=ss(Ac,Bc,Cc,Dc) ; sysm=ss(Am,Bm,Cm,Dm) ; sysO = series(sysc,sysm) ; <enter> »sys1=ss(eye(size(sysO) ) ) ; <enter> »sysCL=feedback(sysO,sys1 ) ; <enter> »sysa=ss(Aa,Ba,Ca,Da) ; syst=series(sysa, sysCL) <enter> a = x1 x2 x3 x4 x5 X1 0. 4743 0 0.0073258 0 0 x2 0 -0.49601 0 0 0 x3 -0 .036786 0 -0.49601 0 0 X4 0 -0.0015497 0 -0.00082279 0 x5 0 0 -0 .20939 0 -0.00048754 x6 0 -0.20939 0 -8.22796-006 0 x7 0 0 0 0 0 x8 0 0 0 0 0 x9 0 0 0 0 0 x10 0 0 0 0 0 X11 -0 .6774 0 -0.0052 0 0.0001 x12 0 0 0 0 0 x13 0 0 0 0 0 x14 0 0 0 0 0 x15 0 0 0 0 0 X16 0 0 0 0 0 x17 0 0 0 0 0 x18 0 0 0 0 0 x19 0 0 0 0 0 x6 x7 x8 x9 x10 x1 0 0 0 0 0 x2 0 191 .19 0 0 0 x3 0 0 191.19 0 0 x4 0. 00017749 0 0 1 0 x5 0 0 232.58 0 0 x6 -0 .00048754 232.58 0 0 0 x7 0 0 0 0 1 x8 0 0 0 0 0 x9 0 0 0 0 0 X10 -0 .0001 -1 0 0 -0.3 X11 0 0 - 1 0 0 x12 0 0 0 - 1 0 x13 0 0 0 0 0 x14 0 0 0 0 0 x15 0 0 0 0 0 x16 0 0 0 0 0 x17 0 0 0 0 0 x18 0 0 0 0 0 x19 0 0 0 0 0 |
  • 181. 166 STATE-SPACE REPRESENTATION 1 x1 x2 x3 x4 X11 0 0 0 0 x12 0 0 0 0 x13 0 0 0 0 x14 0 0 0 0 x15 0 0 0 0 x5 0 0 0 0 0 x6 0 0 0 0 0 x7 0 0 0 0 0 x8 1 0 0 0 0 x9 0 1 0 0 0 x10 0 0 0 0 0 X11 -0.3 0 0.6774 1 .3 -0.0001 x12 0 -0.3 0 0 0 x13 0 0 -0.01 -0.1 0 x14 0 0 0 -0.4158 1.025 x15 0 0 0 0.05 -0.8302 x16 0 0 0 0 0 x17 0 0 0 0 0 x18 0 0 0 0 0 x19 0 0 0 0 0 x16 x17 X18 x19 x1 0 0 0 0 x2 0 0 0 0 x3 0 0 0 0 x4 0 0 0 0 x5 0 0 0 0 x6 0 0 0 0 x7 0 0 0 0 x8 0 0 0 0 x9 0 0 0 0 x10 0 0.0001 0 0 X11 0 0 0 0 x12 0 0 0 0 x13 0 0 0 0 x14 0 0 0 0 x15 0 0 0 0 x16 -0.56 -1 0.08 0.04 x17 0.6 -0.12 -0.3 0 x18 -3 0.4 -0.47 0 x19 0 0.08 1 0 b = U1 u2 x1 0 0 x2 0 0 x3 0 0 x4 0 0 x5 0 0 x6 0 0 x7 0 0 x8 0 0 x9 0 0 x10 0 0 X11 0 0
  • 182. BLOCK BUILDING IN LINEAR, TIME-INVARIANT STATE-SPACE 167 x12 0 0 x13 0 0 X14 0 0 x15 0 0 x16 0.073 0.0001 x17 -4.8 1.2 x18 1 .5 10 x19 0 0 C = x1 x2 x3 x4 x5 yi 1 0 0 0 0 y2 0 1 0 0 0 y3 0 0 1 0 0 y4 0 0 0 1 0 y5 0 0 0 0 1 y6 0 0 0 0 0 x6 x7 x8 x9 X10 yi 0 0 0 0 0 y2 0 0 0 0 0 y3 0 0 0 0 0 y4 0 0 0 0 0 y5 0 0 0 0 0 y6 1 0 0 0 0 X11 x12 x13 x14 x15 yi 0 0 0 0 0 y2 0 0 0 0 0 V3 0 0 0 0 0 y4 0 0 0 0 0 y5 0 0 0 0 0 y6 0 0 0 0 0 x16 X17 x18 X19 yi 0 0 0 0 y2 0 0 0 0 ys 0 0 0 0 y4 0 0 0 0 y5 0 0 0 0 y6 0 0 0 0 d = u1 U2 yi 0 0 y2 0 0 ya 0 0 y4 0 0 y5 0 0 y6 0 0 Continuous-time model. The total system, syst, is of order 19, which is the sum of the individual orders of the sub-systems. If the entire system, syst, is asymptotically stable, the missile
  • 183. 168 STATE-SPACE REPRESENTATION will ultimately hit the aircraft, irrespective of the pilot's inputs to the aircraft. To analyze whether the pilot can escape the missile by maneuvering the aircraft with the help of rudder and aileron inputs, let us find the eigenvalues of the entire system as follows: » [a,b,c,d]=ssdata(syst); damp(a) <enter> Eigenvalue Damping Freq. (rad/s) 3.076-001+1.026+0001 -2.896-001 1.066+000 3.07e-001-1 .026+0001 -2.896-001 1.066+000 -7.236-004 1.006+000 7.236-004 -8.236-004 1 .006+000 8.236-004 -1.006-002 1.006+000 1.006-002 -1.556-002 1.006+000 1 .556-002 -1 .59e-002 1.006+000 1.596-002 -2. 746-002+1. 136+0001 2.426-002 1.136+000 -2.746-002-1.136+0001 2.426-002 1.136+000 -1.396-001+9.896-0011 1.396-001 9.996-001 -1.396-001-9.896-0011 1.396-001 9.996-001 -1.506-001+9.896-0011 1.506-001 1.006+000 -1 .506-001-9.896-0011 1 .506-001 1.006+000 -3.166-001 1.006+000 3.166-001 -3.826-001 1.006+000 3.826-001 -5.046-001 1.006+000 5.046-001 -5.386-001 1.006+000 5.386-001 -9.306-001 1 .006+000 9.306-001 -1 .096+000 1.006+000 1.096+000 The complex conjugate eigenvalues 0.307 ± 1.02/ with a positive real part indicate that the system is unstable. Hence, it is possible for the pilot to ultimately escape the missile. The controller, sysc, must be re-designed to enable a hit by making the entire system asymptotically stable. Exercises 3.1. Derive a state-space representation for each of the systems whose governing differential equations are the following, with outputs and inputs denoted by y,(r) and uf(t) (if i > 1), respectively: (a) ld*y(t)/dt3 + I0dy(t)/dt - 2y(f) = 2du(t)/dt + 5u(t). (b) J 2 yi (t)/dt 2 + 3dy} (t)/dt - 6y2(r) = -u , (r)/7; -2d2y2(t)/dt2 + 9y2(r) - </y, (/)/ dt = 5dui(t)/dt-u2(t). (c) 100J4y(0/^4 - 33d3y(t)/dt3 + I2d2y(t)/dt2 + 8y(f) = 21dui(t)/dt - 5ii 2 (r). (d) d5yi(t)/dt + 9y,(r) -Id2y2(t)/dt2 +dy2(t)/dt = 2d*u(t)/dt* - 6d2u(t)/dt2 41du(t)/dt
  • 184. EXERCISES 169 3.2. Derive a state-space representation for the systems whose transfer matrices are the following: (a) Y(s)/U(s) = (s2 -3s + l)/(s5 + 4s3 + 3s2 - s + 5). (b) Y(.s-)/U(s) - [(s + l ) / ( s 2 +25 + 3) s / ( s + 3) /(s3 + 5)]. 3.3. Derive a state-space representation for a satellite orbiting a planet (Example 2.3). Linearize the nonlinear state-space representation for small deviations from a circular orbit. 3.4. For a missile guided by beam-rider guidance law (Eq. (2.19)), derive a state-space repre- sentation considering the commanded missile acceleration, a^c(t), as the input, and the missile's angular position, B^(t), as the output. 3.5. For the closed-loop beam-rider guidance of a missile shown in Figure 2.8, derive a state- space representation if the target's angular position, Oj(t), is the input, and the missile's angular position, #M(?), is the output. 3.6. For a missile guided by the command line-of-sight guidance law (Eq. (2.20)), derive a state-space representation considering the commanded missile acceleration, aMc(t), as the input, and the missile's angular position, #M(0» as the output. 3.7. For the closed-loop command line-of-sight guidance of a missile shown in Figure 2.9, derive a state-space representation if the target's angular position, 9j(t), is the input, and the missile's angular position, 9M(t), is the output. Can the state-space representation be linearized about an equilibrium point? 3.8. Derive a state-space representation for the longitudinal dynamics of an aircraft (Exam- ple 2.10) with elevator deflection, 8(t), as the input, and [v(t) a(t) d(t)]T as the output vector. Convert the state-space representation into: (a) the Jordan canonical form, (b) the controller companion form, (c) the observer companion form. 3.9. Derive a state-space representation for the compensated closed-loop chemical plant of Example 2.25, with the closed-loop transfer function given by Eq. (2.159). Convert the state-space representation into: (a) the Jordan canonical form, (b) the controller companion form, (c) the observer canonical form.
  • 185. 170 STATE-SPACE REPRESENTATION 3.10. For the closed-loop multivariable chemical process of Example 2.29, derive a state-space representation. Transform the state-space representation into: (a) the Jordan canonical form, (b) the controller companion form, (c) the observer canonical form. 3.11. For the aircraft longitudinal dynamics of Example 3.10 derive: (a) the Jordan canonical form, (b) the controller companion form, (c) the observer canonical form. 3.12. For the nonlinear electrical network of Exercise 2.3, derive a state-space representation with input as the voltages, v ( t ) and i>2(0» and the output as the current i°2(/). Linearize the state-space representation about the equilibrium point falling in the dead-zone, —a < v i ( t ) < a. Use L = 1000 henry, R{ = 100 ohm, R2 = 200 ohm, C = 2 x 10~5 farad, and €2 = 3 x 10~5 farad. Is the electrical network stable about the equilibrium point? 3.13. Repeat Exercise 2.29 using a state-space representation for each of the multivariable systems. 3.14. For the multivariable closed-loop system of Exercise 2.30, derive a state-space represen- tation, and convert it into the Jordan canonical form. References 1. Nise, N.S. Control Systems Engineering. Addison-Wesley, 1995. 2. Maciejowski, J.M. Multivariable Feedback Design. Addison-Wesley, 1989, pp. 406-407.
  • 186. 4 Solving the State-Equations 4.1 Solution of the Linear Time Invariant State Equations We learnt in Chapter 3 how to represent the governing differential equation of a system by a set of first order differential equations, called state-equations, whose number is equal to the order of the system. Before we can begin designing a control system based on the state-space approach, we must be able to solve the state-equations. To see how the state-equations are solved, let us consider the following single first order differential equation: (4.1) where x(t) is the state variable, u(t) is the input, and a and b are the constant coefficients. Equation (4. 1 ) represents a first order system. Let us try to solve this equation for t > ?o with the initial condition, x(to) = XQ. (Note that since the differential equation, Eq. (4.1), is of first order we need only one initial condition to obtain its solution). The solution to Eq. (4.1) is obtained by multiplying both sides of the equation by exp{— a(t — to]} and re-arranging the resulting equation as follows: exp{-a(f - fo)}*(1)(0 - exp{-a(f - t())}ax(t) = exp{-a(f - t0)}bu(t) (4.2) We recognize the term on the left-hand side of Eq. (4.2) as d/dt[exp{ — a(t — to)}x(t)], Therefore, Eq. (4.2) can be written as d/dt[exp{-a(t - t(})}x(t)] = exp{-a(t - t0)}bu(t) (4.3) Integrating both sides of Eq. (4.3) from to to f, we get = (' exp{— a(t — to)}x(t) — x(to) = / exp{—a(r — to)}bu(T}dr Jtl} (4.4) Applying the initial condition, x(to) — XQ, and multiplying both sides of Eq. (4.4) by exp{a(t — to}}, we get the following expression for the state variable, x(t): r< x ( t ) = Qxp{a(t — t())}xo + / e fl - •bu(r}dx (t > to) (4.5)
  • 187. 172_ SOLVING THE STATE-EQUATIONS _ Note that Eq. (4.5) has two terms on the right-hand side. The first term, exp{a(f — to)}xo, depends upon the initial condition, JCQ, and is called the initial response of the system. This will be the only term present in the response, x(t), if the applied input, u(t), is zero. The integral term on the right-hand side of Eq. (4.5) is independent of the initial condition, but depends upon the input. Note the similarity between this integral term and the convolution integral given by Eq. (2.120), which was derived as the response of a linear system to an arbitrary input by linearly superposing the individual impulse responses. The lower limit of the integral in Eq. (4.5) is to (instead of — oo in Eq. (2.120)), because the input, u(t), starts acting at time to onwards, and is assumed to be zero at all times t < to- (Of course, one could have an ever-present input, which starts acting on the system at t = — oo; in that case, to = — oo). If the coefficient, a, in Eq. (4.1) is negative, then the system given by Eq. (4.1) is stable (why?), and the response given by Eq. (4.5) will reach a steady-state in the limit t —> oo. Since the initial response of the stable system decays to zero in the limit / —> oo, the integral term is the only term remaining in the response of the system in the steady-state limit. Hence, the integral term in Eq. (4.5) is called the steady-state response of the system. All the system responses to singularity functions with zero initial condition, such as the step response and the impulse response, are obtained form the steady-state response. Comparing Eqs. (2.120) and (4.5), we can say that for this first order system the impulse response, g(t — to), is given by g(t- t0) = ep{a(t - t0)}b (4.6) You may verify Eq. (4.6) by deriving the impulse response of the first order system of Eq. (4.1) using the Laplace transform method of Chapter 2 for u(t) = 8(t — to) and X(IQ) = 0. The step response, s(t), of the system can be obtained as the time integral of the impulse response (see Eqs. (2.104) and (2.105)), given by s(t) = i ea(t~T)bdT = [exp{a(r - /0)} - U/« (4.7) Jt JtQ Note that Eq. (4.7) can also be obtained directly from Eq. (4.5) by putting u(t) = us(t — t0) and *(fo) = 0. To find the response of a general system of order n, we should have a solution for each of the n state-equations in a form similar to Eq. (4.5). However, since the state-equations are usually coupled, their solutions cannot be obtained individually, but simultaneously as a vector solution, (t), to the following matrix state-equation: = Ax(r) + Bu(f) (4.8) Before considering the general matrix state-equation, Eq. (4.8), let us take the special case of a system having distinct eigenvalues. We know from Chapter 3 that for such systems, the state-equations can be decoupled through an appropriate state transformation. Solving
  • 188. _ SOLUTION OF THE LINEAR TIME INVARIANT STATE EQUATIONS_ 173 decoupled state-equations is a simple task, consisting of individual application of Eq. (4.5) to each decoupled state-equation. This is illustrated in the following example. Example 4.1 Consider a system with the following state-space coefficient matrices: Let us solve the state-equations for t > 0 with the following initial condition: The individual scalar state-equations can be expressed from Eq. (4.8) as follows: jc[ 1} (f) = -3jc,(0 + M(0 (4.11) x(2l}(t) = -2jc2 (f) - u(t) (4.12) where x(t) and X2(t} are the state variables, and u(t) is the input defined for t > 0. Since both Eqs. (4.11) and (4.12) are decoupled, they are solved independently of one another, and their solutions are given by Eq. (4.5) as follows: jd(0 = e~3r + / e~3(t~T)u(T)dT (t > 0) (4.13) Jo x2(t) = - Q-2(!~r}u(T)dr (t > 0) (4.14) Example 4.1 illustrates the ease with which the decoupled state-equations are solved. However, only systems with distinct eigenvalues can be decoupled. For systems having repeated eigenvalues, we must be able to solve the coupled state-equations given by Eq. (4.8). To solve the general state-equations, Eq. (4.8), let us first consider the case when the input vector, u(0, is always zero. Then Eq. (4.8) becomes a homogeneous matrix state-equation given by x ( 1 ) (r)=Ax(0 (4.15) We are seeking the vector solution, x(0, to Eq. (4.15) subject to the initial condition, x(?o) = XQ. The solution to the scalar counterpart of Eq. (4.15) (i.e. x^t) = ax(t)) is just the initial response given by x ( t ) = exp{a(t — t0)}x0, which we obtain from Eq. (4.5) by setting u(t) = 0. Taking a hint from the scalar solution, let us write the vector solution to Eq. (4.15) as x(0 = exp{A(f - fo)}x(r 0 ) (4.16)
  • 189. 174 SOLVING THE STATE-EQUATIONS In Eq. (4.16) we have introduced a strange beast, exp{A(f — to)}, which we will call the matrix exponential of A(f — to). This beast is somewhat like the Loch Ness monster, whose existence has been conjectured, but not proven. Hence, it is a figment of our imagination. Everybody has seen and used the scalar exponential, exp{a(r — to)}, but talking about a matrix raised to the power of a scalar, e, appears to be stretching our credibility beyond its limits! Anyhow, since Eq. (4.16) tells us that the matrix exponential can help us in solving the general state-equations, let us see how this animal can be defined. We know that the Taylor series expansion of the scalar exponential, exp{a(f — to)}, is given by exp{a(/ - to)} = 1 + a(f - to) + a2(t - t0)2/2 + at - r0)3/3! + • • • + ak(t - t0)k/k + ••• (4.17) Since the matrix exponential behaves exactly like the scalar exponential in expressing the solution to a first order differential equation, we conjecture that it must also have the same expression for its Taylor series as Eq. (4.17) with the scalar, a, replaced by the matrix, A. Therefore, we define the matrix exponential, exp{A(f — to)}, as a matrix that has the following Taylor series expansion: exp{A(/ - to)} = I + A(r - to) + A 2 (r - r0)2/2! + A 3 (r - /0)3/3! + • • • + k(t - t0)k/k + ••• (4.18) Equation (4.18) tells us that the matrix exponential is of the same size as the matrix A. Our definition of exp{A(/ — to)} must satisfy the homogeneous matrix state-equation, Eq. (4.15), whose solution is given by Eq. (4.16). To see whether it does so, let us differentiate Eq. (4.16) with time, t, to yield x (1) (r) = d/dt(exp{A(t - t0)}x(t0)] = d/dt[cxp{(t - t0)}]x(to) (4.19) The term d/dt[exp{(t — to)}] is obtained by differentiating Eq. (4.17) with respect to time, t, as follows: d/dt[exp{(t - to)}] = A + 2(t - to) + A3(r - r0)2/2! -I- A4(f - r0)3/3! + • • • + A*+1 (t - t0)k/k + • • • = A[I + A(r - t0) + A2(t - t0)2/2 + A 3 (/ - r0)3/3! + • • • + k(t - tQ)k/k + • • •] = Aexp{A(f-/ 0 )} (4-20) (Note that the right-hand side of Eq. (4.20) can also be expressed as [I + A(/ —1 0 ) + A2(f - f 0 ) 2 /2!+A 3 (r - t0)3/3 + • • • + A*(f - t0)k/k + - • -]A = exp{A(r - f 0 ))A, which implies that Aexp{A(/ - t0)} = exp{A(f - to)}A.) Substituting Eq. (4.20) into Eq. (4.19), and using Eq. (4.16), we get x (1) (0 = Aexp{A(r — to)}xo = x(t) (4.21)
  • 190. _ SOLUTION OF THE LINEAR TIME INVARIANT STATE EQUATIONS_ 175 which is the same as Eq. (4.15). Hence, our definition of the matrix exponential by Eq. (4.18) does satisfy Eq. (4.15). In Eq. (4.20) we saw that the matrix exponential, exp{A(f - to)}, commutes with the matrix, A, i.e. Aexp{A(? — fn)} = exp{A(? - fn)}A. This is a special property of exp{A(f — to)}, because only rarely do two matrices commute with one another (see Appendix B). Looking at Eq. (4.16), we see that the matrix expo- nential, exp{A(? — to)}, performs a linear transformation on the initial state-vector, x(?o), to give the state-vector at time t, x(f). Hence, exp{A(? — to)}, is also known as the state- transition matrix, as it transitions the system given by the homogeneous state-equation, Eq. (4.15), from the state, x(?0), at time, to, to tne state x(f), at time, t. Thus, using the state-transition matrix we can find the state at any time, t, if we know the state at any previous time, to < t. Table 4.1 shows some important properties of the state-transition matrix, which you can easily verify from the definition of exp{A(r — /o)K Eq. (4.18). Now that we know how to solve for the initial response (i.e. response when u(?) = 0) of the system given by Eq. (4.8), let us try to obtain the general solution, x(/), when the input vector, u(t), is non-zero for t > ?o- Again, we will use the steps similar to those for the scalar state-equation, i.e. Eqs. (4.1)-(4.5). However, since now we are dealing with matrix equation, we have to be careful with the sequence of matrix multiplications. Pre-multiplying Eq. (4.8) by exp{ — (t — t0)}, we get exp{-A(r - r 0 )}x (1) (0 = exp{-A(r - ?0)}Ax(0 + exp{-A(f - f 0 )}Bu(/) (4.22) Bringing the terms involving x(?) to the left-hand side, we can write exp{-A(f - ? 0 )}[x (1) (0 - Ax(01 - exp{-A(r - f 0 )}Bu(0 (4.23) From Table 4.1 we note that d/dt[ep{ — A(t — to)}] = -exp{— A(f - to)} A. Therefore, the left-hand side of Eq. (4.23) can be expressed as follows: exp{-AU - ? 0 )}x (1) (0 - exp{-A(f - fo)}Ax(f) = exp{-A(f - f 0 )}x (1) (f) + d/dt[Gxp{-(t - r0)}]x(r) -(t - f 0 )}x(r)] (4.24) Hence, Eq. (4.23) can be written as JA/r[exp{-A(r - t0)}x(t)] = exp{-A(r - f 0 )}Bu(r) (4.25) Table 4.1 Some important properties of the state-transition matrix S. No. Property Expression 1 Stationarity exp{A(?o — to)} = I 2 Commutation with A Aexp{A(r — r0)} = exp{A(r — f 0 )}A 3 Differentiation with time, t d/dt[exp{A(t — /0)}] = exp{A(? — to)} A. 4 Inverse [exp{A(f - ^o)}]^ 1 = exp{A(r0 - 01 5 Time-marching exp{A(r - t ) } exp{A(f] - t0)} = exp{A(? - r0)}
  • 191. 176 SOLVING THE STATE-EQUATIONS Integrating Eq. (4.25) with respect to time, from to to t, we get exp{-A(/ - /0)}x(0 - x(f0) = exp{-A(r - r0)}Bu(r)dr (4.26) Pre-multiplying both sides of Eq. (4.26) by exp{A(f — to)}, and noting from Table 4.1 that exp{—A(f — to)} = [exp{A(r — to)}]~1, we can write the solution state-vector as follows: /" x(f) = exp{A(f — to)}(to) + I exp{A(f — r)}Bu(r)dr; (/ > to) (4.27) Note that the matrix equation, Eq. (4.27), is of the same form as the scalar equation, Eq. (4.5). Using Eq. (4.27), we can calculate the solution to the general matrix state- equation, Eq. (4.8), for / > to. However, we do not yet know how to calculate the state- transition matrix, exp{A(r — to)}. 4.2 Calculation of the State-Transition Matrix If we can calculate the state-transition matrix, exp{A(r — /o)K when the state-dynamics matrix, A, and the times, to and t > to, are specified, our task of solving the linear state- equations will simply consist of plugging exp{A(f — to)} into Eq. (4.27) and getting the solution x(r), provided we know the initial state-vector, x(f0), and the input vector, u(r), for t > to. As stated at the beginning of Section 4.1, the easiest way to solve a matrix state-equation is by decoupling the individual scalar state-equations, which is possible only if the system has distinct eigenvalues. First, let us calculate the state-transition matrix for such a system. For a linear system of order n, having n distinct eigenvalues, k, A.2 A.,,, the eigen- value problem (see Chapter 3) is written as follows: Av*=A*v*; (*=l,2,...,n) (4.28) We know from Chapter 3 that such a system can be decoupled (or diagonalized) by using the following state-transformation: x'(r) = Tx(0; T = [v,; v 2 ; . . . ; ¥„]-' (4.29) and the state-dynamics matrix then becomes diagonalized as follows: A, 0 0 ... 0 0 X 2 0 ... 0 (4.30) 0 0 0 ... A.n
  • 192. CALCULATION OF THE STATE-TRANSITION MATRIX 177 You can easily show from the definition of the state-transition matrix, Eq. (4.18), that the state-transition matrix for the decoupled system is given by 'exp{A.i(f-f 0 )} 0 0 ... 0 exp{A(f 0 exp{A.2(f - fo)} 0 ... 0 0 0 0 ... exp{X B (f-f 0 )} (4.31) Equation (4.31) shows that the state-transition matrix for a decoupled system is a diagonal matrix. In general, the state-transition matrix for any transformed system, x'(t) = Tx(r), can be expressed as exp{A(f -t0)} = l + A'(t-t0) + (A')t-t0)2/2 + (A')t-to)3/3 + --- + (Af)k(t-t0)k/kl + --- 1 1 1 2 2 = TT" + (TATr )(f - fo) + (TAT" ) (f - t0) /2l / 3 ! + - - - + (TAT- 1 ) /c (r-f 0 )V^! + - - - (r - f 0 ) 2 /2! + A 3 (/ - f 0 ) 3 /3! + • • • + Ak(t - t 0 ) k / k l + • • -JT"1 1 (4.32) Example 4.2 Let us calculate the state-transition matrix of the following system, and then solve for the state-vector if the initial condition is x(0) = [ 1; O] 7 and the applied input is u(t) = 0: -1 : The eigenvalues of the system are obtained by solving the following characteristic equation: + 1) -2 |AJ-A| = = (A + 1) (X + 3) + 2 = r + 4A + 5 = 0 1 (A + 3) (4.34) which gives the following eigenvalues: A.i,2 = -2 ± / (4.35) Note that the negative real parts of both the eigenvalues indicate an asymptotically stable system. Since the eigenvalues are distinct, the system can be decoupled using the state-transformation given by Eq. (4.29). The eigenvectors, YI = [u n ; v2]T and V2 = [vi2', V22]T are calculated from Eq. (4.28). The equation Avi = X.v yields the following scalar equations: -v +2t'2i (4.36a) —v - 3v2 (4.36b)
  • 193. 178 SOLVING THE STATE-EQUATIONS Note that Eqs. (4.36a) and (4.36b) are linearly dependent, i.e. we cannot get the two unknowns, v, and 1*21, by solving these two equations. You may verify this fact by trying to solve for V[ and V2. (This behavior of the eigenvector equations is true for a general system of order n; only (n — 1) equations relating the eigenvector elements are linearly independent). The best we can do is arbitrarily specify one of the two unknowns, and use either Eq. (4.36a) or Eq. (4.36b) - since both give us the same relationship between v and V2 - to get the remaining unknown. Let us arbitrarily choose v = 1. Then either Eq. (4.36a) or (4.36b) gives us vi = (1 + A.0/2 = (-1 + 0/2. Hence, the first eigenvector is v, = [ 1; (-1 + i ) / 2 ] T . Similarly, the second eigenvector is obtained by 'solving' Av2 = X2V2, yielding the second eigenvector as ¥2 = [ 1; (— 1 — i ) / 2 ] T . Plugging the two eigenvectors in Eq. (4.29), we get the state-transformation matrix, T, as (-1-0/2J (l+/)/2 ' (4.37) Then the diagonalized state-dynamics matrix, A', is given by A' TAT-' = r*1 X°iJ |_r ( - 2+/) (-2-0 Ji A=TAT [ 0 0 2 ° = /A™ (4 38) ' and the state-transition matrix for the transformed system is , 6 = o ] r e ( - 2+/) ' o (4 39) [ 0 exp(A2oH 0 e<- ' Note that t0 = 0 in this example. Then from Eq. (4.32) the state-transition matrix for the original system is given by r i i ire(-2+/)' o i [0-0/2 -n ~ [(-!+ 0/2 (-1-0/2JL 0 e<- 2 -''>'JL(l+i)/2 ij [(1 - i)e [(1 (4.40) Those with a taste for complex algebra may further simplify Eq. (4.40) by using the identity ea+lb = efl[cos(&) + i sin(t)], where a and b are real numbers. The resulting expression for eAr is as follows: 2e-sin,,) 1 2 2/ L -e~ ' sin(r) e~ [cos(r) - sin(f)] J The solution, x(0, is then given by Eq. (4.27) with u(0 = 0 as follows: x(0 = [,, (,); ,2(,)f = e-x(O) =
  • 194. CALCULATION OF THE STATE-TRANSITION MATRIX 179 The state variables, x(t) and X2(t), given by Eq. (4.42) are plotted in Figure 4.1. Note that both the state variables shown in Figure 4.1 decay to zero in about 3 s, thereby confirming that the system is asymptotically stable. 0.8 0.6 0.4 0.2 0 -0.2 2 3 4 5 Time (s) Figure 4.1 The calculated state variables, XT (f) and X2(0, for Example 4.2 The method presented in Example 4.2 for calculating the state-transition matrix is restricted to those systems which have distinct eigenvalues. The intrinsic MATLAB func- tion expm3 lets you use the diagonalization method for the calculation of the matrix exponential for systems with distinct eigenvalues as follows: »eP = expm3(P) <enter> where P is a square matrix of which the matrix exponential, eP, is to be calculated. Alternatively, you can use the intrinsic MATLAB function eig as follows to calculate the eigenvector matrix, V, and the diagonalized matrix, D, with eigenvalues of P as its diagonal elements: »[V,D] = eig(P) <enter> Then use the MATLAB function exp as follows to calculate the matrix exponential of D: »eD = e x p ( D ) - r o t 9 0 ( e y e ( s i z e ( D ) ) ) <enter> The MATLAB function exp(D) calculates a matrix whose elements are exponentials of the corresponding elements of the matrix D. The matrix exponential of D is obtained by subtracting the off-diagonal elements of exp(D) (which are all ones) from exp(D); this is done by forming a matrix whose diagonal elements are zeros and whose off-diagonal elements are all ones-an identity matrix of same size as D, eye(size(D)), rotated by 90
  • 195. 180 SOLVING THE STATE-EQUATIONS degrees using the command rot90(eye(size(D))). Finally, the matrix exponential of P can be obtained as follows, using eP = VeDV"1: »eP = V*eD*inv(V) <enter> Example 4.3 Using MATLAB, let us calculate the state-transition matrix for the system in Example 4.2 for /0 = 0 and t = 2 s. First, let us use the command expmS as follows: »A=[-1 2; -1 -3]; eAt = expm3(A*2) <enter> eAt = 9.03246-003 3.3309e-002 -1.66546-002 -2.42766 -002 Now let us use the alternative approach with the command eig as follows: »[V, D] = eig(A*2) <enter> V = 8.16506-001 8.16506-001 -4.08256-001 +4.08256-0011 -4.08256-001 -4.08256-0011 D = -4.00006+000+ 2.00006+0001 0 0 -4.00006+000- 2.00006+0001 Then the state-transition matrix of the diagonalized system is calculated as follows: »eD = e x p ( D ) - r o t 9 0 ( e y e ( s i z e ( D ) ) ) <enter> eD = -7.62206-003+1.66546-0021 0 0 -7.62206-003 -1.66546-0021 Finally, using the inverse state-transformation from the diagonalized system to the original system, we get the state-transition matrix, e A/ , as follows: »eAt = V*eD*inv(V) <enter> eAt = 9.03246-003 3.33096-002 -2.26466-0181 -1.66546-002 -2.42766-002 +1.65056-0181 which is the same result as that obtained using expm3 (ignoring the negligible imaginary parts). You may verify the accuracy of the computed value of e^ by comparing it with the exact result obtained in Eq. (4.41) for / = 2 s.
  • 196. CALCULATION OF THE STATE-TRANSITION AAATRIX 181 For systems with repeated eigenvalues, a general method of calculating the state- transition matrix is the Laplace transform method, in which the Laplace transform is taken of the homogeneous state-equation, Eq. (4.15) subject to the initial condition, x(0) = x() as follows: sX(s) - x(0) = AX(s) (4.43) where X(s) = £[x(t)]. Collecting the terms involving X(s) to the left-hand side of Eq. (4.43), we get (si - A)X(s) = x(0) (4.44) X(s) (si - ArVO) = (si - (4.45) Taking the inverse Laplace transform of Eq. (4.45), we get the state-vector, x ( t ) , as x(f) = £~[[X(s)] = £~l[(sl - Ar'xo] = £~][(sl - A)~ 1 ]x 0 (4.46) Comparing Eq. (4.46) with Eq. (4.16), we obtain the following expression for the state- transition matrix: 1 eA? = j r - « [ ( 5 i _ A ) - ] (4.47) Thus, Eq. (4.47) gives us a general method for calculating the state-transition matrix for / > 0. The matrix (5! — A)"1 is called the resolvent because it helps us in solving the state-equation by calculating e Ar . If the initial condition is specified at t — to, we would be interested in the state-transition matrix, exp{A(? — to)}, for t > to, which is obtained from Eq. (4.47) merely by substituting t by (t — to). Example 4.4 Consider a system with the following state-dynamics matrix: -2 I 5' A = 0 0 —3 (4.48) 0 0 0 Let us calculate the state-transition matrix and the initial response, if the initial condition is x(0) = [0; 0; 1 ] r . The eigenvalues of the system are calculated as follows: + 2) -1 -5 0 A 3 (4.49) 0 0 A From Eq. (4.49) it follows that the eigenvalues of the system are A] = ^2 = 0, and A. 3 = —2. Since the first two eigenvalues are repeated, the system cannot be decou- pled, and the approach of Example 4.2 for calculating the state-transition matrix is inapplicable. Let us apply the Laplace transform approach given by Eq. (4.47). First, the resolvent (si — A)~ ! is calculated as follows:
  • 197. 182 SOLVING THE STATE-EQUATIONS (si - A)- 1 = adj((5l - A)/|5l - A| = l/[52(5 + 2)] 2 X r * 5 0 5(5 + 2) 0 I7 0 |_ (55 + 3) -3(5 + 2) 5(5 + 2) _ ~ l / ( 5 + 2) 1,/[5(5+2)J (55 + 3)/[52(5 + 2)]l 2 = 0 1/5 -3/5 (4.50) 0 0 1/5 J Taking the inverse Laplace transform of Eq. (4.50) with the help of partial fraction expansions for the elements of (5! —A)"1 and using Table 2.1, we get the state- transition matrix as follows: l~e-2' (l-e- 2 ')/2 7(1 -e- 2 ')/4 + 3r/2~ A e '= 0 1 -3r ; (f>0) (4.51) |_ 0 0 1 Note that the inverse Laplace transform of 1/5 is us(t) from Table 2.1. However, since we are interested in finding the state-transition matrix and the response only for t > 0 (because the response at t = 0 is known from the initial condition, x(0)) we can write £~'(l/5) = 1 for t > 0, which has been used in Eq. (4.51). The initial response is then calculated as follows: x(r) = X2(t) = eA'x(0) = -3r ; (r>0) (4.52) L*3(0_ 1 Note that the term 3t/2 makes x(t) keep on increasing with time, t > 0. Similarly, X2(t) keeps on increasing with time. This confirms that the system is unstable. A plot of jcj(0, X2(t), and Jt3(/) is shown in Figure 4.2. 10 i '*i(0 ' • - ^-^^ 5 ^>^^ - 0 ""••«._ I x3(0 - -5 "••-... "•--.. x2(f) -10 -15 i i i i 0 1 2 3 4 5 Time (s) Figure 4.2 The calculated state variables, xj (t), X2(f), and xj(t), for Example 4.4
  • 198. UNDERSTANDING THE STABILITY CRITERIA THROUGH THE STATE-TRANSITION MATRIX 183 4.3 Understanding the Stability Criteria through the State-Transition Matrix In Section 2.6 we listed the criteria by which we can judge whether a system is stable. The state-transition matrix allows us to understand the stability criteria. We saw in Example 4.2 that the elements of eA/ are linear combinations of exp(A^), where A^ for k = 1,2 n are the distinct eigenvalues of the system (Eq. (4.40)). Such elements can be expressed as exp(a^r) multiplied by oscillatory terms, sin(/v) and cos(&*0» where a^ and b^ are real and imaginary parts of the &th eigenvalue, A* = ak + ibk (Eq. (4.41)). If the real parts, ak, of all the eigenvalues are negative - as in Example 4.2 - the initial responses of all the state-variables will decay to zero as time, /, becomes large due to the presence of exp(a^r) as the factor in all the elements of e Ar . Hence, a system with all eigenvalues having negative real parts is asymptotically stable. This is the first stability criterion. By the same token, if any eigenvalue A*, has a positive real part, a^ then the corresponding factor exp(#£/0 will diverge to infinity as time, t, becomes large, signifying an unstable system. This is the second stability criterion. In Example 4.4, we saw that if a zero eigenvalue is repeated twice, it leads to the presence of terms such as ct, where c is a constant, in the elements of eAr (Eq. (4.51)). More generally, if an eigenvalue, A#, which is repeated twice has zero real part (i.e. A/.. = ibk), then eA/ will have terms such as ?sin(^0 and t cos(bkt) - and their combi- nations - in its elements. If an eigenvalue with zero real part is repeated thrice, then eA/ will have combinations of t2 sin(^r), t2 cos(Z^/), t sin(^f), and / cos(^-f) in its elements. Similarly, for eigenvalues with zero real parts repeated larger number of times, there will be higher powers of t present as coefficients of the oscillatory terms in the elements of e Ar . Hence, if any eigenvalue, A*, having zero real part is repeated two or more times, the presence of powers of t as coefficients of the oscillatory terms, sin(^r) and cos(^f), causes elements of eA? to blow-up as time, t, increases, thereby indicating an unstable system. This is the third stability criterion. Note that individual initial responses to a specific initial condition may not be sufficient to tell us whether a system is stable. This is seen in the following example. Example 4.5 Reconsider the system of Example 4.4 with the initial condition, x(0) = [1; 0; O j 7 . Substituting the initial condition into Eq. (4.16), we get the following initial response for the system: e -2r x(0) (t > 0) (4.53) Equation (4.53) indicates that x(f) -> 0 as t -> oo. Thus, a system we know to be unstable from Example 4.4 (and from the third stability criterion), has an initial response decaying asymptotically to zero when the initial condition is x(0) = [1: 0; 0 ] r , which is the characteristic of an asymptotically stable system. Example 4.5 illustrates that we can be fooled into believing that a system is stable if we look at its initial response to only some specific initial conditions. A true mirror of the
  • 199. 184_ SOLVING THE STATE-EQUATIONS _ system's stability is its state-transition matrix, which reflects the three stability criteria. If any element of the state-transition matrix grows to infinity as time becomes large, the system is unstable. Then it is possible to find at least one initial condition that leads to an unbounded initial response. The state-transition matrix contains information about how a system will respond to an arbitrary initial condition. Hence, the stability of a system is deduced from all possible initial conditions (i.e. the state-transition matrix), rather than from only some specific ones. 4.4 Numerical Solution of Linear Time-Invariant State-Equations In the previous sections, we saw two methods for calculating the state-transition matrix, which is required for the solution of the linear state-equations. The diagonalization method works only if the system eigenvalues are distinct. Calculating the state-transition matrix by the inverse Laplace transform method of Eq. (4.47) is a tedious process, taking into account the matrix inversion, partial fraction expansion, and inverse Laplace transfor- mation of each element of the resolvent, as Example 4.4 illustrates. While the partial fraction expansions can be carried out using the intrinsic MATLAB function residue, the other steps must be performed by hand. Clearly, the utility of Eq. (4.47) is limited to small order systems. Even for the systems which allow easy calculation of the state- transition matrix, the calculation of the steady-state response requires time integration of the input terms (Eq. (4.27)), which is no mean task if the inputs are arbitrary functions of time. The definition of the matrix exponential, exp{A(r — /o)K by the Taylor series expansion of Eq. (4.18) gives us another way of calculating the state-transition matrix. However, since Eq. (4.18) requires evaluation of an infinite series, the exact calculation of exp{A(f — to)} is impossible by this approach. Instead, we use an approximation to exp{A(f — ?o)} in which only a finite number of terms are retained in the series on the right-hand side of Eq. (4.18): exp{A(/ - r0)} % I + A(r - t0) + A 2 (r - t0)2/2 + A3(t - f 0 ) 3 /3! + • • • + N(t - t0)N/N (4.54) Note that the approximation given by Eq. (4.54) consists of powers of A(r — to) up to N. In Eq. (4.54), we have neglected the following infinite series, called the remainder series, R/v, which is also the error in our approximation of exp{A(f — to)}: RN = A"+1 (/ - t0)N+l/(N + 1)! + A" +2 (f - t0)N+2/(N + 2)! oc + N+3(t-t0)N+3/(N + 3)! + • • - . = £ A.k(t-t0)k/k (4.55) *=yv+i Clearly, the accuracy of the approximation in Eq. (4.54) depends upon how large is the error, RN, given by Eq. (4.55). Since RN is a matrix, when we ask how large is the error, we mean how large is each element of R#. The magnitude of the matrix, R#, is
  • 200. NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS 185 a matrix consisting of magnitudes of the elements of R^. However, it is quite useful to assign a scalar quantity, called the norm, to measure the magnitude of a matrix. There are several ways in which the norm of a matrix can be defined, such as the sum of the magnitudes of all the elements, or the square-root of the sum of the squares of all the elements. Let us assign such a scalar norm to measure the magnitude of the error matrix, R/v, and denote it by the symbol ||R/v||, which is written as follows: IRA/II = ||A*||(f-fo)V* (4.56) The inequality on the right-hand side of Eq. (4.56) is due to the well known triangle inequality, which implies that if a and b are real numbers, then a + b < a + b. Now, for our approximation of Eq. (4.54) to be accurate, the first thing we require is that the magnitude of error, ||R/vli» be a finite quantity. Secondly, the error magnitude should be small. The first requirement is met by noting that the Taylor series of Eq. (4.18) is convergent, i.e. the successive terms of the series become smaller and smaller. The mifinite series on the extreme right-hand side of Eq. (4.56) - which is a part of the Taylor series - is also finite. Hence, irrespective of the value of N, ||R#|| is always finite. From Eq. (4.56), we see that the approximation error can be made small in two ways: (a) by increasing N, and (b) by decreasing (t — to). The implementation of Eq. (4.54) in a computer program can be done using an algorithm which selects the highest power, TV, based on the desired accuracy, i.e. the error given by Eq. (4.56). MATLAB uses a similar algorithm in its function named expm2 which computes the matrix exponential using the finite series approximation. Other algorithms based on the finite series approximation to the matrix exponential are given in Golub and van Loan [1] and Moler and van Loan [2J. The accuracy of the algorithms varies according to their implementation. The MATLAB functions expm and expm] use two different algorithms for the computation of the matrix exponential based on Laplace transform of the finite-series of Eq. (4.54) - which results in each element of the matrix exponential being approximated by a rational polynomial in s, called the Fade approximation. Compared to expm2 - which directly implements the finite Taylor series approximation - expm and expml are more accurate. There is a limit to which the number of terms in the approximation can be increased. Therefore, for a given N, the accuracy of approximation in Eq. (4.54) can be increased by making (t — fo) small. How small is small enough? Obviously, the answer depends upon the system's dynamics matrix, A, as well as on N. If (t — to) is chosen to be small, how will we evaluate the state-transition matrix for large time? For this purpose, we will use the time-marching approach defined by the following property of the state-transition matrix (Table 4.1): exp{A(f - t0)} = exp{A(r - f , ) } exp{A(ri - r{))} (4.57) where to < t < t. The time-marching approach for the computation of the state-transition matrix consists of evaluating e AAf as follows using Eq. (4.54): eAAf % I + AA? + A 2 (A0 2 /2! + A 3 (Ar) 3 /3! + • • • + AN(&t)N/N (4.58)
  • 201. 186_ SOLVING THE STATE-EQUATIONS _ where Af is a small time-step, and then marching ahead in time - like an army marches on with fixed footsteps - using Eq. (4.57) with t = r0 + «Af and t = to + (n — l)Af as follows: exp{A(f0 + n A?)} = eAA' exp{A[f0 + (n - l)Af]} (4.59) Equation (4.59) allows successive evaluation of exp{A(f0 + «Af)} for n = 1, 2, 3, ... until the final time, f, is reached. The time-marching approach given by Eqs. (4.58) and (4.59) can be easily programmed on a digital computer. However, instead of finding the state-transition matrix at time, t > to, we are more interested in obtaining the solution of the state-equations, Eq. (4.8), x(f), when initial condition is specified at time tQ. To do so, let us apply the time-marching approach to Eq. (4.27) by substituting t = to + wA/, and writing the solution after n time-steps as follows: to+nAt exp{A(fo + n&t - r)}Bu(T)</r; (n = 1, 2, 3, . . .) / -j (4.60) For the first time step, i.e. n = 1, Eq. (4.60) is written as follows: 'o+A/ exp{A(r0 + Ar - r)}Bu(r)dr (4.61) / j The integral term in Eq. (4.61) can be expressed as fo+f fo+Af /-A/ /-/ exp{A(r0 + A/ - r)}Bu(r)dr = eAA' / e~ Ar Bu(/ 0 + T)dT (4.62) / .j Jo where T = r — t0. Since the time step, Ar, is small, we can assume that the integrand vector e~ArBu(?o + T) is essentially constant in the interval 0 < T < Af , and is equal to e~AA'Bu(?o + A/). Thus, we can approximate the integral term in Eq. (4.62) as follows: /•Af eAA' / e-A7"Bu(r0 + T)dT % eAA'e-AA'Bu(r0 4- Ar)Af = Bu(r0 + Ar)Ar = Bu(r 0 )Ar Jo (4.63) Note that in Eq. (4.63), we have used u(fo + Ar) = u(fo), because the input vector is assumed to be constant in the interval to < t < to + A/. Substituting Eq. (4.63) into Eq. (4.61), the approximate solution after the first time step is written as x(r0 + AO % e AA 'x(r 0 ) + Bu(r 0 )Af (4.64) For the next time step, i.e. n = 2 and t = to + 2Af , we can use the solution after the first time step, x(tQ + Af), which is already known from Eq. (4.64), as the initial condition and, assuming that the input vector is constant in the interval tQ + Af < t < to + 2Ar, the solution can be written as follows: x(r0 + 2Af) % eAA'x(r0 + A/) + Bu(r0 + A/) A/ (4.65) The process of time-marching, i.e. using the solution after the previous time step as the initial condition for calculating the solution after the next time step, is continued and the
  • 202. NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS 187 solution after n time steps can be approximated as follows: Bu(f0 + (n - l ) A / ) A f ; (n = 1 , 2 , 3 , . . . ) (4.66) A special case of the system response is to the unit impulse inputs, i.e. u(f) = S(t — r0)[ 1; 1; . . . ; 1 ] T . In such a case, the integral in Eq. (4.62) is exactly evaluated as follows, using the sampling property of the unit impulse function, S(t — to), given by Eq. (2.24): f J'to tn exp{A(f0 + Af - r)}Bu(r)jT = e AAf B (4.67) which results in the following solution: -(n - l ) A / ) + B A f ] ; (n = 1, 2, 3 , . . . ) (4.68) Note that the solution given by Eq. (4.68) is an exact result, and is valid only if all the inputs are unit impulse functions applied at time t = IQ. By the time-marching method of solving the state-equations we have essentially converted the continuous-time system, given by Eq. (4.8), to a discrete-time (or digital) system given by Eq. (4.66) (or, in the special case of unit impulse inputs, by Eq. (4.67)). The difference between the two is enormous, as we will see in Chapter 8. While in a continuous-time system the time is smoothly changing and can assume any real value, in a digital system the time can only be an integral multiple of the time step, A? (i.e. A/ multiplied by an integer). The continuous-time system is clearly the limiting case of the digital system in the limit A? —> 0. Hence, the accuracy of approximating a continuous- time system by a digital system is crucially dependent on the size of the time step, A?; the accuracy improves as A/ becomes smaller. The state-equation of a linear, time-invariant, digital system with to = 0 can be written as x(/iAr) = A d x ( ( n - l ) A f ) + B d u ( ( n - l ) A f ) ; (« = 1,2, 3, ...) (4.69) where Ad and B<j are the digital state coefficient matrices. Comparing Eqs. (4.66) and (4.69) we find that the solution of a continuous-time state-equation is approximated by the solution of a digital state-equation with Ad = e AAr and Bd = BAf when the initial condition is specified at time / = 0. The digital solution, x(«AO, is simply obtained from Eq. (4.69) using the time-marching method starting from the initial condition, x(0), and assuming that the input vector is constant during each time step. The digital solution of Eq. (4.69) is easily implemented on a digital computer, which itself works with a non-zero time step and input signals that are specified over each time step (called digital signals). The assumption of a constant input vector during each time step, used in Eq. (4.63), results in a staircase like approximation of u(?) (Figure 4.3), and is called a zero-order hold, i.e. a zero-order linear interpolation of u(f) during each time step, (n — 1)A/1 < t < nAt. The zero-order hold approximates u(0 by a step function in each time step. It is a good approximation even with a large time step, A?, if u(?) itself is a step like function in continuous-time, such as a square wave. However, if u(0 is a smooth function in continuous-time, then it is more accurate to use a higher order interpolation to approximate u(t) in each time step, rather than using the zero-order hold. One such approximation is
  • 203. 188 SOLVING THE STATE-EQUATIONS u(t) First-order hold Continuous-time Zero-order hold At Figure 4.3 The zero-order and first-order hold digital approximations of a continuous-time input, u(f) the first-order hold which approximates u(0 as a ramp function (i.e. a first-order linear interpolation) in each time step (n — 1)A/ < / < nA/ (Figure 4.3). The conversion of a continuous-time system to the corresponding digital approximation using the zero-order hold for the input vector (Eq. (4.66)) is performed by the MATLAB Control System Toolbox (CST) function c2d, which calculates eAA' using the intrinsic MATLAB function expm. The command c2d is employed as follows: »sysd = c2d(sysc,Ts,'method') <enter> where sysc is the continuous-time state-space LTI object, Ts is the specified time step, (Ar), and sysd is the resulting digital state-space approximation of Eq. (4.69). The 'method' allows a user to select among zero-order hold ('zo/O, first-order hold ('/o/i'), or higher-order interpolations for the input vector, called Tustin (or bilinear) approximation ( l tustin'), and Tustin interpolation with frequency prewarping ('prewarp'). The Tustin approximation involves a trapezoidal approximation for u ( l ) (/) in each time step (we will discuss the Tustin approximation a little more in Chapter 8). Tustin interpolation with frequency prewarping ('prewarp') is a more accurate interpolation than plain'tustin'. An alternative to eld is the CST function c2dm, which lets the user work directly with the state coefficient matrices rather than the LTI objects of the continuous time and digital systems as follows: »[Ad,Bd,Cd,Dd] = c2dm(A,B,C,D,Ts,'method') <enter> where A, B, C, D are the continuous-time state-space coefficient matrices, Ad, Bd, Cd, Dd are the returned digital state-space coefficient matrices, and Ts and 'method' are the same as in eld. For more information on these MATLAB (CST) commands, you may refer to the Users' Guide for MATLAB Control System Toolbox [3]. How large should be the step size, Ar, selected in obtaining the digital approximation given by Eq. (4.69)? This question is best answered by considering how fast the system is likely to respond to a given initial condition, or to an applied input. Obviously, a fast changing response will not be captured very accurately by using a large Ar. Since the state-transition matrix, e AA ', has elements which are combinations of exp(A*Ar), where kk, k = 1, 2, etc., are the eigenvalues of A, it stand to reason that the time step.
  • 204. NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS 189 Af, should be small enough to accurately evaluate the fastest changing element of e A A r . which is represented by the eigenvalue, A.fc, corresponding to the largest natural frequency. Recall from Chapter 2 that the natural frequency is associated with the imaginary part, b, of the eigenvalue, Ajt = a+bi, which leads to oscillatory terms such as s'm(bAt) and cos(&Af) in the elements of e AAf (Example 4.2). Hence, we should select At such that A? < l/l&lmax where |b|max denotes the largest imaginary part magnitude of all the eigenvalues of A. To be on the safe-side of accuracy, it is advisable to make the time step smaller than the ten times the reciprocal of the largest imaginary part magnitude, i.e. A? < 0. l/|£| max . If all the eigenvalues of a system are real, then the oscillatory terms are absent in the state-transition matrix, and one can choose the time step to be smaller than the reciprocal of the largest real part magnitude of all the eigenvalues of the system, i.e. Once a digital approximation, Eq. (4.69), to the linear, time-invariant, continuous-time system is available, the MATLAB (CST) command Ititr can be used to solve for x(«A/) using time-marching with n = 1, 2, 3, ..., given the initial condition, x(0), and the input vector, u(r), at the time points, t = (n — l ) A r , n = 1. 2, 3, . . . as follows: »x = ltitr(Ad,Bd,u,xO) <enter> where Ad, Bd, are the digital state-space coefficient matrices, xO is the initial condition vector, u is a matrix having as many columns as there are inputs, and the /th row of u corresponds to the z'th time point, x is the returned matrix with as many columns as there Table 4.2 Listing of the M-file march.m march.m function [y,X] = march(A,B,C,D,XO,t,u,method) % Time-marching solution of linear, time-invariant % state-space equations using the digital approximation. % A= state dynamics matrix; B= state input coefficient matrix; % C= state output coefficient matrix; % D= direct transmission matrix; % X0= initial state vector; t= time vector. % u=matrix with the ith input stored in the ith column, and jth row % corresponding to the jth time point. % y= returned output matrix with ith output stored in the ith column, % and jth row corresponding to the jth time point. % X= returned state matrix with ith state variable stored in the ith % column, and jth row corresponding to the jth time point. % method= method of digital interpolation for the inputs(see 'c2dm') % copyright(c)2000 by Ashish Tewari n-size(t,2); dt=t(2)-t(1); % digital approximation of the continuous-time system:- [ad,bd,cd,dd]=c2dm(A,B,C,D,dt,method); % solution of the digital state-equation by time-marching:- X=ltitr(ad,bd,u,XO); % calculation of the outputs:- y=X*C'+u*D';
  • 205. 190 SOLVING THE STATE-EQUATIONS are state variables, and with the same number of rows as u, with the ith row corresponding to the ith time-point (the first row of x consists of the elements of xO). The entire solution procedure for the state-space equation using the digital approxima- tion of Eq. (4.66) can be programmed in a new M-file named march, which is tabulated in Table 4.2. This M-file can be executed as follows: >> [y>x] = march(A,B,C,D,xO,t,u,'method') <enter> where A, B, C, D, xO, u, x, and 'method' are the same as those explained previously in the usage of the MATLAB (CST) command c2dm, while t is the time vector containing the equally spaced time-points at which the input, u, is specified, and y is the returned matrix containing the outputs of the system in its columns, with each row of y corresponding to a different time-point. Example 4.6 Using the time-marching approach, let us calculate the response of the system given in Example 4.1 when «(/) = us(t). Since the largest eigenvalue is —3, we can select the time step to be Ar < 1/3, or Ar < 0.333. Selecting A/ = 0.1, we can generate the time vector regularly spaced from t = 0 to t = 2 s, and specify the unit step input, M, as follows: »t=0:0.1:2; u=ones(size(t,2),1); <enter> 0.5 y2(0 -0.5 0.5 1 1.5 Time (s) Figure 4.4 The calculated outputs, yi (t) and 72(t), for Example 4.6
  • 206. NUMERICAL SOLUTION OF LINEAR TIME-IN VARIANT STATE-EQUATIONS 191 Then, the M-file march.m is executed with zero-order hold, after specifying the state coefficient matrices and the initial condition vector (it is assumed that the outputs are the state variables themselves, i.e. C — I, D = 0) as follows: »A= [-3 0; 0 -2]; B = [1; -1]; C = eye(2); D = zeros(2,1); XO = [1; 0]; <enter> >> [y,X] = march(A,B,C,D,XO,t,u,'zoh'); <enter> The outputs, which are also the two state variables, x(t) and x2(t), are plotted against the time vector, t, in Figure 4.4 as follows: »plot(t,y) <enter> You may verify that the result plotted in Figure 4.4 is almost indistinguishable from the analytical result obtained in Eqs. (4.13) and (4.14), which for a unit step input yield the following: A-,(?) = (2e~3/ 4- l)/3; x2(t) = (e~2t - 0/2 (4.70) Example 4.7 In Examples 2.10 and 3.10, we saw how the linearized longitudinal motion of an aircraft can be represented by appropriate transfer functions and state-space representations. These examples had involved the assumption that the structure of the aircraft is rigid, i.e. the aircraft does not get deformed by the air-loads acting on it. However, such an assumption is invalid, because most aircraft have rather flexible structures. Deformations of a flexible aircraft under changing air-loads caused by the aircraft's motion, result in a complex dynamics, called aeroelasticity. Usually, the short-period mode has a frequency closer to that of the elastic motion, while the phugoid mode has little aeroelastic effect. The longitudinal motion of a flexible bomber aircraft is modeled as a second order short-period mode, a second- order fuselage bending mode, and two first-order control-surface actuators. The sixth order system is described by the following linear, time-invariant, state-space representation: " 0.4158 1.025 -0.00267 -0.0001106 -0.08021 0 -5.5 -0.8302 -0.06549 -0.0039 -5.115 0.809 0 0 0 1.0 0 0 A= -1040 -78.35 -34.83 -0.6214 -865.6 -631 0 0 0 0 -75 0 0 0 0 0 0 -100 " 0 0 0 0 75 0 100
  • 207. 192 SOLVING THE STATE-EQUATIONS Pitch-rate, Normal y2(0 acceleration, C.G. Normal acceleration Elevator sensor Figure 4.5 Inputs and outputs for the longitudinal dynamics of a flexible bomber aircraft -[ -1491 -146.43 -40.2 0 1.0 0 -0.9412 0 -1285 -564.66' (4.71) The inputs are the desired elevator deflection (rad.), MI(/), and the desired canard deflection (rad.), U2(t), while the outputs are the sensor location's normal accelera- tion (m/s2), yi(0, and the pitch-rate (rad./s), j2(0- See Figure 4.5 for a description of the inputs and outputs. Let us calculate the response of the system if the initial condition and the input vector are the following: x(0) = [0.1; 0; 0; 0; 0; u(r) = (4.72) sin(120 First, let us select a proper time step for solving the state-equations. The system's eigenvalues are calculated using the command damp as follows: »damp(A) <enter> Eigenvalue Damping Freq. (rad/sec) -4.2501e-001 + 1.87486+OOOi 2.21096-001 1.92246+000 -4.25016-001 - 1.87486+OOOi 2.21096-001 1.92246+000 -5.08696-001 + 6.0289e+000i 8.40776-002 6.05036+000 -5.08696-001 - 6.02896+OOOi 8.40776-002 6.05036+000 -7.50006+001 1 .00006+000 7.50006+001 -1.00006+002 1 .00006+000 1 . 00006+002 The largest imaginary part magnitude of the eigenvalues is 6.03, while the largest real part magnitude is 100. Therefore, from our earlier discussion, the time step should be selected such that Af < 0.1/6 s and Ar < 1/100 s. Clearly, selecting the smaller of the two numbers, i.e. Ar < 1/100 s, will satisfy both the inequalities.
  • 208. NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS 193 Hence, we select A? = 1/150 s = 6.6667e — 003 s. The time vector, t, the input matrix, u, and initial condition vector, xO, are then specified as follows: »t = 0:6.66676-3:5; u = [ -0.05*sin(10*t) ; 0.05*sin(12*t) ] ' ; XO = [ 0 , 1 zeros(1 ,5) ] ' ; <enter> Then the M-file march.m is used with a first-order hold for greater accuracy (since the inputs are smoothly varying) as follows: »[yf,Xf] = march(A,B,C,D,XO,t,u, 'foh1 ) ; <enter> To see how much is the difference in the computed outputs if a less accurate zero- order hold is used, we re-compute the solution using march.m with 'zo/z' as the 'method': »[yz,Xz] = j U , ' z o h ' ) ; <enter> The computed outputs, y ( t ) , and y2(t), are plotted in Figures 4.6 and 4.7, respec- tively, for the zero-order and first-order holds. It is observed in Figure 4.6 that the output y ( t ) calculated using the first-order hold has slightly lower peaks when compared to that calculated using the zero-order hold. Figure 4.7 shows virtually no difference between the values of y2(/) calculated by zero-order and first-order holds. 200 r i Zero-order hold 150 -First-order hold-. 100 50 0 -50 -100 -150 -200 0 2 3 Time (s) Figure 4.6 The normal acceleration output, /i(f), for the flexible bomber aircraft of Example 4.7
  • 209. 194 SOLVING THE STATE-EQUATIONS 0.05 - -0-05 - -0.1 - Zero-order hold _ First-order hold -0.15 Figure 4.7 The pitch-rate output, 72(0, of the flexible bomber aircraft of Example 4.7 The MATLAB (CST) function Isim is an alternative to march for solving the state- equations by digital approximation, and is used as follows: >> [y,t,x] = lsim(sys,u,t,xO,'method'); <enter> where sys is an LTI object of the system, while the arguments u, t, 'method' (either 'zo/i', or '/0/z') and the returned output matrix, y, and state solution matrix, x, are defined in the same manner as in the M-file march. The user need not specify which interpolation method between 'zoh' and 'foh' has to be used in Isim. If a 'method' is not specified, the function Isim checks the shape of the input, and applies a zero-order hold to the portions which have step-like changes, and the first-order hold to the portions which are smooth functions of time. In this regard, Isim is more efficient than march, since it optimizes the interpolation of the input, u(r), portion by portion, instead of applying a user specified interpolation to the entire input done by march. However, Isim can be confused if there are rapid changes between smooth and step-like portions of the input. Hence, there is a need for selecting a small time step for rapidly changing inputs in Isim. Example 4.8 For the system in Example 4.7, compare the solutions obtained using the MATLAB (CST) command Isim and the M-file march when the initial condition is xO = [0.1; 0; 0; 0; 0; 0] r when the elevator input, M I ( f ) is a rectangular pulse applied at t = 0 with amplitude 0.05 rad. and duration 0.05 s, while the canard input, u2(t), is a sawtooth pulse applied at t = 0 with amplitude 0.05 rad. and duration 0.05 s. The rectangular pulse and the sawtooth pulse are defined in Examples 2.5 and 2.7, respectively.
  • 210. NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS 195 Mathematically, we can express the input vector as follows, using Eqs. (2.32) and (2.33): 0.05[M.V ( f + 0 . 0 5 ) - M S ( 0 ] (4.73) r(0 - r(t - 0.05) - 0.05w,(f - 0.05) where us(t) and r(0 are the unit step and unit ramp functions, respectively. Using MATLAB, the inputs are generated as follows: »dt=6.6667e-3; t=0:dt:5; u1=0.05*(t«3.05+dt); i=find(t<0.05+dt); u2=u1; u2(i)=t(i); u = [u1' u 2 ' ] ; <enter> Assuming that A, B, C, D, xO are already available in the MATLAB workspace from Example 4.7, we can calculate the response of the system using march as follows: »[Y1,X1] = m a r c h ( A , B 3 C , D } X O , t , u J ' z o h ' ) ; <enter> where Yl is the returned output matrix for zero-order hold. For comparison, the solution is also obtained using him and the output is stored in matrix Y2 as follows: »sys=ss(A,B,C,D); [Y2,t,X2] = lsim(sys,u,t,XO); <enter> The computed outputs, y (0 and }>2(0, by the two different methods are compared in Figures 4.8 and 4.9, respectively. Note that the responses calculated using march with zero-order hold and him are indistinguishable. i i i - march with zero-order hold Isim Figure 4.8 Normal acceleration output for the flexible bomber aircraft in Example 4.8 with rectangular pulse elevator input and sawtooth pulse canard input
  • 211. 196 SOLVING THE STATE-EQUATIONS 0.05 - -0.05 -0.1 - march with zero-order hold Isim -0.15 0 Figure 4.9 Pitch-rate output for the flexible bomber aircraft in Example 4.8 with rectangular pulse elevator input and sawtooth pulse canard input When the inputs are impulse functions, the M-files march and Isim cannot be used directly, because it is impossible to describe the impulse function (which, by definition, goes to infinity in almost zero time) by an input vector. Instead, the digital approximation is obtained using an equation similar to Eq. (4.68), which gives the solution if all the inputs are unit impulse functions applied at t = IQ. For a more general case, i.e. when the input vector is given by u(r) = 8(t — /o)[ c; C2', . . . ; cm ]T, where c, C 2 , . . . , cm are constants, we can write the solution to the state-equation as follows: x(r0 + = eAA'[x(?0 + (n- 1)AO + BcAf]; (n = 1, 2, 3 , . . . ) (4.74) where c = [c GI ...; cm ]T. Comparing Eqs. (4.68) and (4.74), we find that the digital approximation for impulse inputs is given by A<j = eAA' and B<j = e AA 'B Af, if and only if the input vector is given by u(r) = us(t)c. For calculating the response to general impulse inputs of this type applied at t = 0, we can write a MATLAB M-file in a manner similar to march.m. Such an M-file, called impgen.m is given in Table 4.3. MATLAB (CST) does have a standard M-file for calculating the impulse response called impulse.m, which, however, is limited to the special case when all of the imputs are simultaneous unit impulses, i.e. all elements of the vector c are equal to 1. Clearly, impgen is more versatile than impulse. (MATLAB (CST) also has a dedicated function for calculating the step response, called step, which also considers all inputs to be simultaneous unit step functions.) The advantage of using the MATLAB command impulse (and step) lies in quickly checking a new control design, without having to generate the time vector, because the time vector is automatically generated. Also, for systems that are not strictly proper (i.e. D ^ 0) the CST function impulse disregards the impulse in the response at
  • 212. NUMERICAL SOLUTION OF LINEAR TIME-INVARIANT STATE-EQUATIONS 197 Table 4.3 Listing of the M-ftle impgen.m impgen.m function [y,X] = impgen(A,B,C,D,XO,t,c) % Time-marching solution of linear, time-invariant % state-space equations using the digital approximation when the % inputs are impulse functions scaled by constants. The scaling % constants for the impulse inputs are contained in vector 'c'. % A= state dynamics matrix; B= state input coefficient matrix; % C= state output coefficient matrix; % D= direct transmission matrix; % X0= initial state vector; t= time vector. % y= returned output matrix with ith output stored in the ith % column, and jth row corresponding to the jth time point. % X= returned state matrix with ith state variable stored in the % ith column, and jth row corresponding to the jth time point. % copyright(c)2000 by Ashish Tewari n=size(t,2); m=size(c,2); dt=t(2)-t(1); % digital approximation of the continuous-time system:- [ad,bd,cd,dd]=c2dm(A,BJC,D,dt,'zoh'); Bd=ad*bd; u=ones(n,1)*c'; % time-marching solution of the digital state equation:- X=ltitr(ad,Bd,u,XO); % calculation of the outputs:- y=X*C'+u*D'; t = 0 (see Eq. (2.115)). For details on the usage of these specialized CST functions, use the MATLAB help command. Example 4.9 For the flexible bomber aircraft of Example 4.7, let us determine the response if the initial condition is xO — [0.1; 0; 0; 0; 0; 0]T and the input vector is given by: First, the time vector, t, and the coefficient vector, c, are specified as follows: »dt=6.6667e-3; t=0:dt:10; c = [ 0 . 1 ; - 0 . 1 ] ; <enter> Then, impgen is invoked as follows, assuming A, B, C, D, xO have been already computed and stored in the MATLAB workspace:
  • 213. 198 SOLVING THE STATE-EQUATIONS 200 i i i l l l l l l «r 100 1 X ° * -100 A/w i i i 1 y^ 1 1 1 1 1 200 ) 1 2 3 4 5 6 7 8 9 10 Time (s) 0.4 l i l i i i i i i •ST 0.2 ^a ~ 0 _^ ^ -0.2 -0.4( l l l i i i i i i ^ ) 1 2 3 4 5 Time (s) 6 7 8 9 Figure 4.10 Response of the flexible bomber aircraft of Example 4.9 to elevator and canard 10 impulse inputs of same magnitude but opposite signs » [ y , X ] =impge n ( A , B , C , D , XO , t , c ) ; <enter> The computed outputs, y(t) and y2(0, which are the first and second columns of the returned matrix, y, respectively, are plotted in Figure 4.10. Note that we could not get this response from the CST function impulse, which is confined to the case ofc = [l; If. 4.5 Numerical Solution of Linear Time-Varying State-Equations There is no general analytical procedure of solving the state-equations for linear time- varying systems (i.e. when the state coefficient matrices, A,B,C,D, are functions of time). Thus, numerical solution procedures using digital approximation methods, similar to those of the previous section, are required for solving the state-equations of such systems. For special time-varying systems in which the state-dynamics matrix, A, is a constant and the matrices B, C, and D are functions of time, the analytical solution given by Eq. (4.27) is valid with the following modification: = exp{A(r - - r) B(r)u(r)dr; > f0) (4.76) Jtn where x(fo) is the initial condition and B(r) indicates the controls coefficient matrix evaluated at time t = r. For linear, time-varying systems the output equation is given by: (4.77)
  • 214. _ NUMERICAL SOLUTION OF LINEAR TIME-VARYING STATE-EQUATIONS_ 199 For systems with a constant A matrix, the output can be calculated by Eq. (4.77), in which x(f ) is calculated using Eq. (4.76). A digital approximation of Eq. (4.76) is given by x(nAr) = Adx((« - l)AO+B d ((n - l)A/)u((n - l)Af); (n = 1 - 2 , 3 . . . . ) (4.78) where Ad = e AA/ and Bd((n — 1)AO = B((« — l)Ar)Ar. The solution given by Eq. (4.78) can be implemented in a computer program, such as march.m. However, since time-varying systems with a constant A matrix are rarely encountered, such a program will be rarely used. Instead, we need a general solution procedure which is applicable to a general time-varying system given by: x ( I ) (0 = A(r)x(r) + B(r)u(r) (4.79) A practical procedure for solving Eq. (4.79) is the application of the time-marching approach of Section 4.5, assuming that A(0 is constant during each time step, Ar, but Table 4.4 Listing of the M-file vmarch.m vmarch.m function [ y , X ] = vmarch(tvfun,XO,t,u, method) % Time-marching solution of linear, time-varying % state-space equations using the matrix exponential. % X0= initial state vector; t= time vector; % u=matrix with the ith input stored in the ith column, and jth row % corresponding to the jth time point % y= returned matrix with the ith output stored in the ith column, and jth row % corresponding to the jth time point % X= returned matrix with the ith state variable stored in the ith column, % and jth row corresponding to the jth time point % method= method of digital interpolation for the inputs (see 'c2dm') % copyright (c)2000 by Ashish Tewari n=size(t,2) ; dt=t(2)-t(l); % initial condition: - X(1,:)=XO'; % function evaluation of time varying state coefficient matrices % using the M-file 'tvfun.m' for initial time t=t(1):- [A,B,C,D]=feval(tvfun,t(1)); % outputs for t=t(1 ) : - y(1,:)=X(1,:)*C'+u(1,:)*D'; % beginning of the time-loop: - for i=1 :n-1 % function evaluation of time varying state coefficient matrices % using the M-file 'tvfun.m' for t=t(i):- [A,B,C,D]=feval(tvfun,t(i)); % digital approximation of the continuous-time system: - [ ad , bd , cd , dd ] =c2dm ( A , B , C , D , dt , method ) ; % solution of the digital state and output equations :- : )=X(i, :)*ad'+u(i, :)*bd' ; end
  • 215. 200_ SOLVING THE STATE-EQUATIONS _ varies as we proceed from one time step to the next. In essence, this procedure applies a zero-order hold to A(r). Thus, the approximate digital solution for a general time-varying system can be written as follows: = Ad((n - l)AOx((n - l)Af) + Bd((n - l)Af)u((w - 1)A/); (n - 1, 2, 3, . . .) (4.80) where Ad = exp{A((n - l)Af)Af} and Bd((n - l)Af) = B((n - l)Af)Ar. A MATLAB M-file can be written based on Eqs. (4.80) and (4.77) for computing the time marching output of a general linear, time-varying system. Such an M-file, called vmarch.m is given in Table 4.4. Example 4.10 Consider the following linear, time-varying system: -O.lsin(r) 0 1 r0.2sin(f)~| ,. 01. 0 -0.7cos(r)J ; B( ) = ' [o J (4 81) ' -1]; D(r) = -0.05 cos(r) (4.82) Let us calculate the output, y(0, when the initial condition is x(0) = [0; — l]r and the input is a unit setp function, u(t) = us(t). The time vector, initial condition, and input are specified by the following MATLAB command: »t = 0:0.1:10; XO = [0 - 1 ] ' ; u = ones(size(t,2) , 1); <enter> The time- vary ing coefficient matrices are calculated by the M-file timv.m tabulated in Table 4.5. Then, the solution to the time-varying state-equations and the output are obtained by calling vmarch.m as follows: >> [ y » X ] = vmarch( 'timv' , X O , t , u , ' z o h ' ) ; <enter> The resulting output, y(0, is plotted in Figure 4.11. Table 4.5 Listing of the M-file timv.m timv.m function [A.B.C.D % Linear time-varying state coefficient matrices for Example 4.10. A=[-0.1*sin(t) 0;0 -0.7*cos(t) ] ; B=[0.2*sin(t);0]; C=[1 - 1 ] ; D=-0.05*cos(t);
  • 216. NUMERICAL SOLUTION OF LINEAR TIME-VARYING STATE-EQUATIONS 201 2.2 2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0 4 6 10 Time (s) Figure 4.11 Output of the linear, time-varying system of Example 4.10 Example 4.11 Let us obtain the response of an interesting time-varying system. Consider a surface- to-air missile propelled by a rocket engine. Once launched, the rocket consumes the fuel rapidly, thereby changing the mass, center-of-gravity, and moments of inertia of the missile. Also, as the fuel is burned, the missile accelerates and changes altitude. The aerodynamic forces and moments acting on the missile are functions of the flight velocity and the altitude; therefore, the aerodynamic prop- erties of the missile also keep changing with time. The motion of the missile is described by the following state variables: velocities, U, V, and W, along three mutually perpendicular axes, x, y, z, respectively, passing through the missile's center of gravity, and the rotation rates, p, q, and r, about x, y, and z, respec- tively. The state-vector is thus x(f) = [U(t) V(t); W(t); p(t); q(t}; r ( t ) ] T . All the state-variables are assumed to be the outputs of the system. A diagram of the missile showing the state-variables and the inputs is given in Figure 4.12. One input to the missile is the rolling-moment, AL, about the longitudinal axis of the missile caused by the deflection of an aerodynamic control surface. In addition, the thrust from the rocket engine can be vectored (i.e. deflected) by small angles, a and ft, in the longitudinal (X, Z) plane and lateral (Y, Z) plane, respectively, of the missile (Figure 4.12). These thrust deflection angles constitute two additional inputs to the missile. The input vector is u(?) = [a; ft; AL] r . The thrust of the missile is assumed constant until the rocket motor burns-out at t = 20 s, after which time the thrust is zero. The time-varying state-coefficient matrices representing the
  • 217. 202 SOLVING THE STATE-EQUATIONS X, U Y, V Thrust Figure 4.12 State-variables and inputs for a surface-to-air missile equipped with thrust vectoring and aerodynamic roll control surfaces linearized motion of the missile are calculated by the M-file misstimv.m tabulated in Table 4.6. Let us calculate the response of the missile if the initial condition is zero, and the inputs are given by 0.01 sin(0 u(f) = 0 (4.83) 0.01 cos(0 The time vector, initial condition, and input are specified by the following MATLAB command: »t = 0:0.2:30; XO = zeros(6,1); u = [0.01*sin(0.1*t)' 0.01*cos(0.1*t)' z e r o s ( s i z e ( t , 2 ) , 1 ) ] ; <enter> The output and state solution are then calculated by the following call to vmarch.m: >> [ y J X ] = v m a r c h ( ' m i s s t i m v ' , X O , t , u , ' z o h ' ) ; <enter> The calculated outputs, £7(0, V(t), W(t), and p(t), are plotted in Figure 4.13, while the outputs q(t) and r(r) are shown in Figure 4.14. Note the discontinuity in the slopes of all the responses at t = 20 s, which is the rocket burn-out time.
  • 218. NUMERICAL SOLUTION OF LINEAR TIME-VARYING STATE-EQUATIONS 600 6 5F 400 3/T 4 £ § 200 "**•—' P 0 0 0 10 20 30 0 10 20 30 t(s) t(s) 20 0 -0.01 | 0 -0.02 |f -20 -0.03 -40 -0.04 0 10 20 30 0 10 20 30 t(s) t(s) Figure 4.13 The outputs U(t), V(t), W(f), and p(t), for the missile of Example 4.11 10 15 20 25 30 10 15 20 25 Figure 4.14 The outputs q(f) and r(t) for the missile of Example 4.11
  • 219. 204 SOLVING THE STATE-EQUATIONS Table 4.6 Listing of the M-file misstimv.m misstimv.m function [A,B,C,D]=misstimv(t); % Linear, time-varying state coefficient matrices for a missile %x=[uvwpqr]'; % A= state dynamics matrix; B= state input coefficient matrix % C= state output coefficient matrix; D= direct transmission matrix % t= time after launch % copyright(c)2000 by Ashish Tewari % Thrust as a function of time:- if t<=20 Th=1.27176+005; else Th=0; end % inertia properties as functions of time:- m=983.6716-29.4208*t-0.5812*tA2+0.0338*tA3; iy=1000*(2.5475-0.0942*t+0.0022*t~2);ix=iy/10; xcg=3.6356-0.0217*t-0.0008*t~2; % aerodynamic and propulsive properties as functions of time:- Zw=-(246.44+21.9038*t-1.5996*t*t+0.0244*tA3); Mw=-(872.95-52.7448*t-0.0006*tA2+0.0368*tA3); Mq=(-3-1.39*t+0.08*tA2)/10; Lr=0.0134+0.0029*t-0.0001*t~2; Lp=-0.0672-0.0143*t+0.0006*t~2; Lv=-0.1159-0.0317*t+0.0015*tA2; Zu=-9.5383-2.592*t+0.1209*t~2-0.0011*tA3; Xw=1 .9067+0.5186*t -0.0242*t "2+0.0002*^3; Md=1e5*(1.3425-2.3946*t+0.1278*t"2-0.0017*tA3); Zd=1e4*(-2.0143-3.6649*t+0.1854*tA2-0.0023*tA3); Yv=Zw;Nv=Mw;Nr=Mq;Np=Lp/10;Xu=Th/400+Zu/10;ci=(iy-ix)/iy; % the state coefficient matrices:- A=[Xu/m 0 Xw/m 0 0 0;0 Yv/m 0 0 0 0;Zu/m 0 Zw/m 0 0 0 ; 0 Lv/ix 0 Lp/ix 0 Lr/ix;0 0 Mw/iy 0 Mq/iy 0; 0 Nv/iy 0 Np/iy 0 Nr/iy]; B=[0 0 0;Th/m 0 0;0 Th/m 0;0 0 1;0 Th*xcg/iy 0;Th*xcg/iy 0 0]; C=eye(6);D=zeros(6,3); 4.6 Numerical Solution of Nonlinear State-Equations The nonlinear state-equations are the most difficult to solve. As for time-varying systems, there is no analytical solution for a set of general nonlinear state-equations. There are several numerical schemes available for solving a set of nonlinear, first-order differential equations using the digital approximation to the continuous-time differential equations. Since the state-equations of a nonlinear system are also a set of nonlinear, first-order differential equations, we can use such numerical schemes to solve the state-equations of nonlinear systems. Due to the nonlinear nature of the differential equations, the solution procedure often is more complicated than merely marching forward in time, as we did
  • 220. NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS 205 for linear systems in the previous two sections. Instead, an iterative solution procedure may be required at each time step, which means that we assume a starting solution, and then go back and keep on changing the assumed solution until the solution converges (i.e. stops changing appreciably with the steps of the iteration). A general set of nonlinear state-equations can be expressed as follows: x ( l ) (0 = /(x(0.u(0,0 (4.84) where x(0 is the state-vector, u(0 is the input vector, and /(x(0, u(0, 0 denotes a nonlinear function involving the state variables, the inputs, and time, t. The solution, x(0, of Eq. (4.84) with the initial condition, x(?o) = x0 may not always exist. The exis- tence of solution of nonlinear differential equations requires that the nonlinear function, /(x(0, u(0, t), should be defined and continuous for all finite times, t > to. Also, it is required that /(x(0, u(0, 0 must satisfy the following condition, known as the Lipschitz. condition: |/(x(0, u(f), 0 - /(x*(0, u(0, 01 < K x ( t ) - x*(OI (4.85) where x*(0 is a vector different from x(0, K is a constant, and |V| denotes a vector consisting of the absolute value of each element of the vector V. For greater details on the existence of solution of ordinary nonlinear differential equations see a textbook on ordinary differential equations, such as Henrici [4]. In this book, we will assume that we are dealing with nonlinear system which have a solution to their state-equations. Owing to the nonlinear nature of the differential equations, the numerical procedure cannot be a one-shot (i.e. an open-loop) process, such as that used for linear differential equations. Instead, an iterative solution procedure is required for nonlinear systems, which consists of repeatedly evaluating the solution in a loop (such as the feedback loop) at each time step, until the solution meets certain desirable conditions. Hence, a nonlinear solution procedure itself is a closed-loop system. The digital solution procedures for Eq. (4.84) can be divided into single-step methods, multi-step methods, and hybrid methods. The single-step methods obtain the approximate solution vector by using the state-vector and input vector only at the previous time step. The time marching solution methods of the previous two sections are single-step methods for linear state-equations. For nonlinear systems, examples of single-step methods are Runge-Kutta and Adams methods. The multi-step methods use information from more than one previous time steps to obtain the approximate solution at a given time step. The predictor-corrector methods are examples of multi-step methods. The hybrid methods are those that either do not fall into the categories of single- and multi-step methods, or those that use information from previous time steps as well as future (extrapolated) time steps. The Euler method falls in the hybrid category. For more information on the numerical solution methods for nonlinear differential equations see Ralston and Rabinowitz [5]. While choosing which method to use for solving a nonlinear set of differential equations one should consider numerical accuracy (how large is the digital approximation error), efficiency (how fast is the algorithm when implemented on a computer), numerical stability (whether the algorithm converges to a solution), and starting problem (how the algorithm can be started). While the multi-step and hybrid methods offer a greater efficiency for a comparable accuracy than the single-step methods, they are usually very difficult to
  • 221. 206_ SOLVING THE STATE-EQUATIONS _ start, and special attention must be paid in changing the time steps to avoid stability problems. Such issues make multi-step or hybrid methods more complicated than the single-step methods. Complexity of an algorithm often results in a reduced efficiency when implemented in a computer program. A single-step method which is simple to implement, and which provides good accuracy in a wide variety of problems is the Runge-Kutta method. The Runge-Kutta method uses the following digital approximation to Eq. (4.84): p (tn) - (tn-i) = ^ Ufa (4.86) i=i where tn and tn- are the nth and (n — l)th time steps, respectively, wf are constants, and 1=1 k, = Afn/Cxa.-O + Tftyk^ua,-! ),*„_, +a l -Af n ) (4.87) where A?n =tn— tn-, a, and fa are constants, with a = 0. The time step size, Ar w , can be variable. The constants a, and fa are evaluated by equating the right-hand side of Eq. (4.86), with the following Taylor series expansion: kx^fo-i)/*! (4.88) However, since we cannot numerically evaluate an infinite series, the right-hand side of Eq. (4.88) is approximated by a finite series of m terms as follows: m x(tn) - xfo,-,) % Ar^U-i)/*! (4.89) The approximation given by Eq. (4.89) leads to a Runge-Kutta method of order m. The higher the number of terms in the series of Eq. (4.89), the greater will be the accuracy of the approximation. Comparing Eqs. (4.86) and (4.89), it can be shown that the largest number of terms that can be retained in the series of Eq. (4.89) is m = p. Usually, when m = 4, the resulting fourth order Runge-Kutta method is accurate enough for most practical purposes. It can be shown [5] that substituting Eq. (4.89) into Eq. (4.86), and making use of the exact differential equation, Eq. (4.84), results in the following relationships for the parameters of the fourth order Runge-Kutta method: ;;; (/=2,3,4) (4.90) 7=1 ' ' ' * f ^ I * * f ^ ' ' = 1/6; W3d2p32 + ^("^42 + a 3/843) = +"3^43) = 1/8; W4&2P32P41 = 1/24 (4.91)
  • 222. NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS 207 Equations (4.90) and (4.91) represent 11 equations and 13 unknowns. Hence, we can obtain the solution of any 11 unknowns in terms of the remaining two unknowns, which we choose to be a2 and #3. The Runge-Kutta parameters are thus the following: w = 1/2 + [1 - 2(a2 + a 3 )]/(I2a 2 a 3 ); w2 = (2a3 - l)/[12a3(a3 - «2)0 - « 2 )] u'3 = (1 -2a 2 )/[12a 3 (a 3 -a 2 )(l -a 3 )]; w4 = 1/2 + [2(a 2 +a 3 ) - 3]/[12(l - a 2 ) ( l -a 3 )] 032 = 023 = «,(«., - a 2 )/[2a 2 ( I - « 2 )]; «4 - 1 (4.92) £42 = ^ = (1 - a 2 )[a 2 + a, - 1 - (2a3 - l) 2 ]/{2a 2 (a 3 - «2)[6a2a3 - 4(a2 + a 3 ) + 3]} 043 = 034 = (I - 2a 2 )(l - a 2 )(l - a 3 )/{a 3 (a 3 - a2)[6a2a3 - 4(a2 + a 3 ) + 3]} Obviously, we should take care to avoid selecting those values for the two parameters, «2 and «3, which lead to the denominators of the expressions in Eq. (4.92) becoming zero. A popular choice of these two parameters is a2 = «3 — 1/2. However, the choice which minimizes the approximation error in the fourth order Runge-Kutta method is ao — 0.4, and «3 = 7/8 - (3/16)^5. The Runge-Kutta algorithm consists of marching in time using Eq. (4.86) with a vari- able time step size, Atn. The truncation-error (i.e. error of approximating Eq. (4.88) by Eq. (4.89)) is estimated using the matrix norm (such as the one defined in Section 4.5) after each time step. If the error is acceptable, then the solution is updated; if not, the time step size is reduced, and the error re-calculated until the error becomes acceptable. This process is repeated for the next time step, using the solution from the previous step, and so on until the final time is reached. Using MATLAB, a Runge-Kutta algorithm can be easily programmed. Fortunately, MATLAB comes with intrinsic nonlinear functions ode23 and ode45, which are based on third and fifth order Runge-Kutta algorithms, respectively. Other MATLAB functions for solving nonlinear equations are ode 113, ode15s, ode23s, ode23t, and ode23tb. The function odel!3 uses a variable order integration method for nonlinear equations. The functions with names ending with the letters s, t, or tb are specially suited for solving stiff equations. Stiff equations [5] are a set of first-order nonlinear equations with a large difference in their time scales (e.g. solution to each equation may have a significantly different time for reaching a steady state). The normal solution procedure that takes into account only the shortest time scale of stiff equations may either fail to converge, or may require very large number of time steps to arrive at a steady state. Hence, stiff equations require special solution procedures [5]. We will consider the more common variety of nonlinear equations (i.e. non-stiff equations) that can be solved using ode23, odel!3, and ode45. These functions are used as follows to obtain a solution to a set of nonlinear state-equations: »[t,X] = ode23(@fun,tspan,XO,options); <enter> where @fun denotes a user supplied M-file, fun.m, in which the time derivative of the state-vector, x (1) (r), is evaluated using Eq. (4.84), tspan = [ti tl t2 13 .. .tf] is a row vector containing the initial time, ti, at which the initial condition vector, xO, is specified, any intermediate times, tl, t2, t3, ..., at which the solution is desired (optional), and the final time, tf, and t is a vector containing the time points at which the returned solution.
  • 223. 208 SOLVING THE STATE-EQUATIONS x, is obtained. The returned matrix x contains as many rows as there are the time points, and each column of x corresponds to a state variable. The first executable statement of the M-fileywn.ra should be the following: »function xdot = (t,x) and the remaining statements offun.m should evaluate the derivative of the state-vector, xdot, based on the state-vector, x, and time, t. Note that the input vector, u(r), is internal to the M-file/wn.m, i.e. it is not used directly in ode23, odel!3 or ode45, but only indirectly through xdot. The fourth input argument, options, can be used to specify relative error and absolute error tolerances, Reltol (a scalar) and Abstol (a vector of the same size as x), respectively, for convergence through the function odeset. This ensures that the error in the ith component of the solution vector, JC,, does not exceed the greater number between Reltolxi and Abstol(i). If options are not specified, then the default values of relative tolerance of 0.001 and absolute tolerance of 10~6 are used. For more information on the ode functions use the MATLAB's help command. Example 4.12 Consider a double-pendulum (Figure 1.5). A choice of the state variables for this fourth order system is xi(r) = 6(t), x2(t) = 92(t), x3(t) = 0, (I) (f); x4(t) = 02t), which results in the following state-equations: 4(0 sin(x2(0 - m 2 )gsin(;ti(f))]/[Li(mi + m 2 ) - m2L cos2(jr2(0 - jc2(0) + L,jc 3 2 (/)sin(jr 2 (f) -jc,(r)) + Lix(3l}(t)cos(x2(t) - jc, (r))]/L2 + u(t)/(m2L$) (4.93) where u(t) is the input torque applied on the mass, m 2 . Note that the last state- equation has a term involving x3lt) on the right-hand side. This has been done for the sake of brevity (you can substitute x3]t) from the previous state-equation into the last state-equation to obtain the state-equations in explicit form). It is desired to obtain the solution of Eq. (4.93) for the initial condition x(0) = [0.7 rad.; 1.4 rad.; 0 rad./s; 0 rad./s]r and input, u(t) = 0.01 sin(5r)W-m. The function M- file for evaluating the time derivative of the state-vector, x ( 1 ) (f), is called doub.m and is tabulated in Table 4.7. Note that the input, u(t), must be specified within the function file doub.m, while the initial condition is specified in the call to the Runge-Kutta solver (either ode23 or ode45).
  • 224. NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS 209 Table 4.7 Listing of the M-file doub.m doub.m function xp=doub(t,x) % Nonlinear state-equations for a double-pendulum, excited % by input, u ( t ) , torque acting on mass m2. % x=[theta1 theta2 thetadotl thetadot2] % xp is the time derivative of the state-vector, x. % copyright(c)2000 by Ashish Tewari m1=1;m2=2;l1=1;12=2;g=9.8; u=0.01*sin(5*t); xp(1,1)=x(3); xp(2,1)=x(4); x21=x(2)-x(1); xp(3,1)=(m2*H*x(3)*x(3)*sin(x21)*cos(x21)+m2*l2*x(4)*x(4)*sin(x21) + m2*g*sin(x(2))*cos(x21)-(m1+m2)*g*sin(x(1)))/((m1+m2)*l1-... m2*H*cos(x21 ) * c o s ( x 2 1 ) ) ; x p ( 4 , 1 ) =- ( g * s i n ( x ( 2 ) ) + l 1 * x ( 3 ) * x ( 3 ) * s i n ( x 2 1 ) + H * x p ( 3 ) * c o s ( x 2 1 ) ) / l 2 +u/(m2*12*12); ode23.m; ode45.m 2 1 0 -1 -2 4 6 10 Time (s) Figure 4.15 The calculated state variables, xi(f) = 6-(f) and X2(f) = #2(0 for the double- pendulum, Example 4.12 Let us compare the solutions obtained using ode23 and ode45, as follows: » [ t 1 , x 1 ] = ode23(@doub, [0 10], [0.7 1.4 0 0 ] ' ) ; <enter> » [ t 2 , x 2 ] = ode45(@doub, [0 10], [0.7 1.4 0 0 ] ' ) ; <enter> »subplot(211), p l o t ( t 1 , x 1 ( : , 1 ) , t 2 , x 2 ( : , 1 ) ) , hold on, subplot(212), p l o t ( t 1 , x 1 ( : , 2 ) , t 2 , x 2 ( : , 2 ) ) <enter>
  • 225. 210 SOLVING THE STATE-EQUATIONS ode23. m; ode45. m 10 5 0 -5 -10 0 2 4 6 8 10 Time (s) -5 4 6 10 Time (s) Figure 4.16 The calculated state variables, x3 (t) = 0{ ] ' (t), and X4 (0 = ^'' ( f ) k>r ^e double- pendulum, Example 4.12 The resulting plots of Jti(r) and Jt2(0 are shown in Figure 4.15. Figure 4.16 plotting xi(t) and x^(t} is obtained by the following commands: »newfig <enter> »subplot(211), p l o t ( t 1 , x 1 ( : , 3 ) , t 2 l x 2 ( : , 3 ) ) l hold on, subplot(212), plot(t1,x1(:,4) > t2,x2(:,4)) <enter> Note that in Figures 4.15 and 4.16, a very small difference is observed between the state variables calculated by ode23.m and those calculated by ode45.m. This difference is seen to increase with time, indicating a larger truncation error for the third order Runge-Kutta method of ode23.m when compared to the fifth order Runge-Kutta method of ode45. Since the truncation error is added up after each time step, there is an error accumulation as time increases. The double-pendulum falls into a special category of nonlinear systems, called chaotic systems, which were discussed in Section 1.3. Figure 1.6 compared the state variable, .*2(/), calculated for two very slightly different initial conditions and a zero input, and was generated using ode45. Figure 1.6 showed a large difference in the response, *2(r), when the initial conditions differed by a very small amount, which is the hallmark of a chaotic system.
  • 226. _ NUMERICAL SOLUTION OF NONLINEAR STATE-EQUATIONS_ 211 Example 4.13 Let us consider another interesting nonlinear system, called the wing-rock phenomenon. Wing-rock is a special kind of rolling and yawing motion observed in modern fighter type aircraft when operating at a large angle of attack (defined as the angle made by the longitudinal axis of the aircraft and the direction of flight). The nonlinear state-equations modeling the wing-rock dynamics of a fighter aircraft are the following [6J: Lrx5(t) 4 ( t ) =x5(t) ( l} 5 (t) = -Npx2(t) - Npx4(t) - Nrx5(t) (4.94) where the state variables are, x(t): bank angle (rad.), x2(t): roll-rate (rad./s), aileron deflection angle (rad.), X4(t): sideslip angle (rad.), and x^(t): sideslip-rate (rad./s). The input, u(t), is the desired aileron deflection (rad.). The constants &>, /Zj, ^L2, b, b2, LS, Lp, Lr, Np, Np, and Nr depend on the inertial and aerodynamic properties of the aircraft, while the constant k is the aileron-actuator's time-constant (the aileron is an aerodynamic control surface which is deployed using a first order actuator). Let us obtain the solution to Eq. (4.94) when the initial condition is x(0) = [1.0 rad.; 0.5 rad./s; 0 rad.; 0 rad.; 0 rad./s]r and the input is zero. The time derivative of state-vector, x (1) (0, is evaluated using the M-file called wrock.m, which is tabulated in Table 4.8. Using ode45, the initial response (i.e. response when u(t) = 0) is obtained as follows: »[t,x]= ode45(@wrock, [0 700], [0.2 0 0 0 0]'); <enter> The plot of the bank angle, x(t), from / = 0 s to / = 700 s is shown in Figure 4.17. Note that instead of decaying to zero in the limit t -> oo, the initial response keeps on oscillating with a constant time period, and an amplitude which becomes constant in the limit t —> oo. Such a motion is called a limit cycle motion. Note that while the system is not unstable (i.e. the response does not tend to infinity in the limit t -> oo), a limit cycle response is undesirable from weapons aiming and delivery considerations, and also because it may lead to structural fatigue in the aircraft (or other mechanical systems) thereby causing the wings to come-off. Figure 4.18 shows a plot of x2(t) against x(t). Such a plot in which the time derivative of a variable (x2(t) = xlt) is plotted against the variable itself (x(t)) is called a phase-plane plot. Figure 4.18 shows that the limit cycle motion corresponds to a limiting outer boundary in the phase-plane plot, indicating that the amplitude
  • 227. 212 SOLVING THE STATE-EQUATIONS Table 4.8 Listing of the M-file wrock.m wrock.m function xdot=wrock(t,x) % nonlinear state-equations for the wing-rock problem; % including first order aileron actuator % xdot is the time derivative of the state-vector, x. % copyright(c)2000 by Ashish Tewari a=[-0.05686 0.03254 0.07334 -0.3597 1.4681]; % pure-rolling mode natural-frequency squared:- w=-0.354*a(1); % aileron-actuator time-constant:- k=1/0.0495; % linear aerodynamic coefficients:- lbet=-0.02822;lr=0.1517;np=-0.0629;nbet=1.3214;nr=-0.2491;ldelt=1; % nonlinear inertial and aerodynamic coefficients:- u(1)=0.354*a(2)-0.001; u(2)=0.354*a(4); b(1)=0.354*a(3); b(2)=0.354*a(5); % desired aileron deflection as the input, 'f':- f=0; % the nonlinear state-equations:- xdot(1,l)=x(2); xdot(2,1) = -w*x(1)+u(1)*x(2)+b(1)*x(2r3+u(2)*x(2)*x(ir2 +b(2)*x(1)*x(2)"2...+ldelt*x(3)+lbet*x(4)-lr*x(5); xdot(3,1)=-k*x(3)+k*f; xdot(4,1)=x(5); xdot(5,1)=-nbet*x(4)+nr*x(5)-np*x(2); -. 0 06 100 200 300 400 500 600 700 Time (s) Figure 4.17 Initial response of bank angle, xi (f), for the wing-rock problem of Example 4.13 showing a limit cycle motion (i.e. constant amplitude oscillation in the limit f —»• oc)
  • 228. SIMUIATING CONTROL SYSTEM RESPONSE WITH SIMULINK 213 -0.08 -0.6 -0.4 Figure 4.18 Phase-plane plot of X2(f) vs. xi(f) for the wing-rock problem of Example 4.13 showing the limit cycle boundary x10~ 4 Limit cycle boundary -4 -3 - 2 - 1 0 1 Figure 4.19 Phase-plane plot of X5(f) vs. xi(f) for the wing-rock problem of Example 4.13 showing the limit cycle boundary of the motion has become constant. Similarly, Figure 4.19 shows the phase-plane plot of x5(t) against ^(O, displaying the limit cycle boundary. 4.7 Simulating Control System Response with SIMULINK SIMULINK is very handy in quickly obtaining solutions to linear or nonlinear state- equations resulting from control systems with many sub-systems, using the ordinary differential equation solvers of MATLAB. SIMULINK allows the representation of each
  • 229. 214 SOLVING THE STATE-EQUATIONS system by a set of linear and nonlinear blocks, and lets inputs and outputs to be modeled as special blocks called sources and sinks, respectively. A multivariable system can be repre- sented either using the individual transfer functions between scalar inputs and outputs, or more conveniently by state-space model blocks. Copying the blocks from the SIMULINK block library makes simulating a control system very easy. Refer to Appendix B, or SIMULINK User's Guide [7] for more information on SIMULINK. Since SIMULINK works seamlessly with MATLAB and the Control System Toolbox (CST), you can draw upon the functions libraries of MATLAB and CST (and any other toolboxes that you may happen to have on your computer). The default simulation of SIMULINK uses the MATLAB function ode45, which is a fifth order, variable time-step Runge-Kutta solver (see Section 4.6). This allows a simulation of both linear and nonlinear state-equations. Example 4.14 Let us simulate the step response of the flexible bomber aircraft (Example 4.7) using SIMULINK. The SIMULINK block diagram and the resulting simulation are shown in Figure 4.20. Note the state-space block modeling the aircraft dynamics, which requires that the state-coefficient matrices A, B, C, D of the aircraft (Eq. (4.71)) be available in the MATLAB work-space. The source step input block applies simultaneous unit step inputs, u (t) and u2(t), to the aircraft, and the resulting output _ir~ i ^x=Ax+Bu: ?n • • *• '1 '1 y= Cxt- Du L Normal acceleratio Step flexible bomber aircraft y dynamics •r 1 1 Pitch rate >2 onrin I I I I I i I i I ;£ 1000 //A~~- - - ^ -1000 ?nnn / y ^ 1 1 1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 1 0 Time (s) 0 1 2 3 4 5 6 7 8 9 1 0 Time (s) Figure 4.20 Simulation of the flexible bomber's step response using SIMULINK
  • 230. SIMULATING CONTROL SYSTEM RESPONSE WITH SIMULINK 215 vector is split into its two scalar elements, y ( t ) (normal acceleration), and '2(0 (pitch-rate), by a demux block. The two simulated outputs are displayed individually on the scope blocks, as shown in Figure 4.20. The simulation is run with default parameters (variable time-step ode45 solver with relative error tolerance of 0.001 and absolute tolerance of 10~6 per element). A useful feature of SIMULINK is the availability of many nonlinear blocks, such as dead-zone, backlash, saturation, rate-limiter, switch, relay, coulomb and viscous friction, etc., which are commonly encountered in modeling many practical control systems. The following example illustrates the use of SIMULINK for a nonlinear control system. Example 4.15 Let us simulate a nonlinear control system for controlling the roll dynamics of a fighter aircraft (Example 2.24). The aileron input, 8(t), to the aircraft is modeled Aileron actuator Saturation Bank angle (Phi) 1.5 1 0.5 0 0 1 3 4 5 6 10 Time (s) t I I I I I I I I I 3 CO 73 (0 2 - _ CL L - 1 _ 1 I i I I I i I °C) 1 2 3 4 5 6 7 8 9 1 Time (s) Figure 4.21 Simulation of a nonlinear control system for a fighter aircraft's roll dynamics using SIMULINK
  • 231. 216 SOLVING THE STATE-EQUATIONS by a first-order actuator with a time-constant of 0.05 s, and a dead-zone in the interval —0.05 < t < 0.05. The actuator is saturated at 5(0 = ±0.3 rad. A nonlinear feedback control system is devised using a switch which allows a feedback gain of 1.9 when the roll-rate, p(t} = </> (1) (r), is greater than or equal to 1 rad/s, and a unity feedback otherwise. A nominal cascade compensator gain of 0.1 is used to achieve desirable response (which is different from that designed in Example 2.24 due to the additional actuator dynamics). Figure 4.21 shows the SIMULINK block diagram and the resulting step response of the closed-loop system. Note that a zero overshoot, a zero steady-state error, zero oscillation, and a settling time of less than two seconds have been achieved, despite the nonlinear control system dynamics. A maximum roll-rate of about 3 rad/s is observed. This performance is representative of modern fighter aircraft, where the ability to achieve a large steady bank angle quickly and without any overshoots or oscillations is an important measure of the aircraft's dog-fighting maneuverability. SIMULINK has many advanced features for simulating a complex control system, such as the creation of new sub-system blocks and masking blocks through M-files, C programs, or SIMULINK block diagrams, for effortless integration in your system's model. This allows an extension of the SIMULINK graphical functions to suit your own needs of analysis and design. The SIMULINK demos and the User's Guide for SIMULINK [7] are very helpful in explaining the advanced usage and extension of SIMULINK block library. Exercises 4.1. A homogeneous linear, time-invariant system is described by the following state-dynamics matrix: -2 -3 0 A = 0 0 1 (4.95) 0 -2 -4 (a) Find the state-transition matrix of the system. (b) Find the eigenvalues of the system. Is the system stable? (c) Calculate the response, x(f), of the system to the initial condition, x(0) = [l;-0.1;0.5] r . 4.2. For a linear, time-invariant system described by the following state-space representation: calculate the response, x(r), if the initial condition is x(0) = [10; 2]T, and the input vector is u(r) = [/; ]T .
  • 232. EXERCISES 217 4.3. The lateral dynamics of an aircraft are described by the following state-equation: V 1} (0~ "-15 0 -15 0" ~ P(t}~ "25 3 " r (1) (0 0 -0.8 10 0 r(t) 0 -3.5 I" MO "I $ (1) (0 0 -1 -0.8 0 P(t) 0 0 I <5tf(OJ ' _0(1)(0_ 1 0 0 0 _0(0_ 0 0 (a) Determine the step response, x(r) = [/?(/): r(t) /3(t); </>(0] 7 , to the aileron input. SA(t) = M,(0- (b) Determine the step response, x(0 = [p(t) r(t); fi(t); 0(0] r , to the rudder input, 8K(t) = u s ( t ) . (c) Determine the response, x(0 = [/?(/); r(r); fi(t} 0(01 7 , if the initial condition is /HO) = 0.1 rad/s, r(0) = 0(0) = 0(0) = 0, and the two inputs are zeros, 8A(t) = 8R(t) = 0. (d) Determine the response, y(t) = [p(t); 0(017 > if the initial condition is zero, x(0) = 0, and the input vector is u(0 = [8A(t) 8R(t)]T = [0.15(0; -0.1«5(?)]r. 4.4. For the compensated closed-loop chemical plant of Example 2.25 (for which a state-space representation was obtained in Exercise 3.9), determine the output, y ( t ) , and the plant input, u(t), if the desired output, ya(t), is a unit impulse function, and the initial condition is zero. 4.5. For the multivariable closed-loop system of Exercise 2.30 (for which a state-space repre- sentation was obtained in Exercise 3.13) with controller parameter K = 1, determine the output, y(f), and the plant input, u(t), if the desired output is yd(0 = [us(t); — u s ( t } ] T , and the initial condition is zero. 4.6 A linear time-varying system has the following state-space representation: -5/13 1 r^/21 A(r) = ;B(r) (4.98) -5/13 k'J Calculate the response, x(r), if the input is a unit step function and the initial condition is x(0) = [-l; l] r . 4.7. For the missile of Example 4.11, compute: (a) the step response to a(t) — u x ( t ) . (b) the step response to AL(t) = u s ( t ) . (c) the initial response, (t), to the initial condition, x(0) = [100; -10; 100; 0; 0; O]7 and zero input, u(0 = 0. 4.8. Solve the van der Pol equation (Eq. (2.204)) of Exercise 2.2, if a = 5 and b = 3, and the initial condition is given by ;c (1) (0) = —0.1, and x(0) = 0.5.
  • 233. 218 SOLVING THE STATE-EQUATIONS 4.9. Solve for the motion of the double-pendulum (Example 4.12) if the initial condition is zero, x(0) = 0, and the input torque is a unit step function, u ( t ) = us(t). 4.10. For the wing-rock dynamics of Example 4.13, solve for the bank angle, x(t), and roll- rate, X2(t), if the initial condition is zero, x(0) = 0, and the desired aileron input is a unit step function, u(t) = us(t). References 1. Golub, G.H. and van Loan, C.F. Matrix Computation. Johns Hopkins University Press, 1983. 2. Moler, C.B. and van Loan, C.F. Nineteen dubious ways to compute the exponential of a matrix. SI AM Review, 20, 801-836, 1979. 3. Control System Toolbox-S.Ofor Use with MATLAB®-User's Guide, The Math Works Inc., Natick, MA, USA, 2000. 4. Henrici P., Discrete Variable Methods in Ordinary Differential Equations. John Wiley & Sons. New York, 1962. 5. Ralston, A. and Rabinowitz, P. A First Course in Numerical Analysis. McGraw-Hill, New York. 1988. 6. Tewari, A. Nonlinear optimal control of wing rock including yawing motion. Paper No. AIAA- 2000-4251, Proceedings ofAlAA Guidance, Navigation, and Controls Conference, Denver, CO. August 14-17,2000. 7. SIMULINK-4.0 User's Guide. The Math Works Inc., Natick, MA, USA, 2000.
  • 234. 5 Control System Design in State-Space 5.1 Design: Classical vs. Modern A fashion designer tailors the apparel to meet the tastes of fashionable people, keeping in mind the desired fitting, season and the occasion for which the clothes are to be worn. Similarly, a control system engineer designs a control system to meet the desired objectives, keeping in mind issues such as where and how the control system is to be implemented. We need a control system because we do not like the way a plant behaves, and by designing a control system we try to modify the behavior of the plant to suit our needs. Design refers to the process of changing a control system's parameters to meet the specified stability, performance, and robustness objectives. The design parameters can be the unknown constants in a controller's transfer function, or its state-space representa- tion. In Chapter 1 we compared open- and closed-loop control systems, and saw how a closed-loop control system has a better chance of achieving the desired performance. In Chapter 2 we saw how the classical transfer function approach can be used to design a closed-loop control system, i.e. the use of graphical methods such as Bode, Nyquist, and root-locus plots. Generally, the classical design consists of varying the controller transfer function until a desired closed-loop performance is achieved. The classical indicators of the closed-loop performance are the closed-loop frequency response, or the locations of the closed-loop poles. For a large order system, by varying a limited number of constants in the controller transfer function, we can vary in a pre-specified manner the locations of only a few of the closed-loop poles, but not all of them. This is a major limitation of the classical design approach. The following example illustrates some of the limitations of the classical design method. Example 5.1 Let us try to design a closed-loop control system for the following plant transfer function in order to achieve a zero steady-state error when the desired output is the unit step function, us(t): G(s) = (s + l)/[(s - 1)(5 + 2)(5 + 3)] (5.1)
  • 235. 220 CONTROL SYSTEM DESIGN IN STATE-SPACE The single-input, single-output plant, G(s), has poles located at s = 1, s = — 2, and ^ = —3. Clearly, the plant is unstable due to a pole, s = 1, in the right-half s-plane. Also, the plant is of type 0. For achieving a zero steady-state error, we need to do two things: make the closed-loop system stable, and make type of the closed-loop system at least unity. Selecting a closed-loop arrangement of Figure 2.32, both of these requirements are apparently met by the following choice of the controller transfer function, H(s): H(s) = K(s - )/s (5.2) Such a controller would apparently cancel the plant's unstable pole at s = 1 by a zero at the same location in the closed-loop transfer function, and make the system of type 1 by having a pole at 5 = 0 in the open-loop transfer function. The open-loop transfer function, G(s)H(s), is then the following: G(s)H(s) = K(s + )/[s(s + 2)(s + 3)] (5.3) and the closed-loop transfer function is given by Y(s)/Yd(s) = G(s)H(s)/[ + G(s)H(s)] = K(s + )/[s(s + 2)(5 + 3) + K(s + 1)] (5.4) From Eq. (5.4), it is apparent that the closed-loop system can be made stable by selecting those value of the design parameter, K, such that all the closed-loop poles lie in the left-half s-plane. The root-locus of the closed-loop system is plotted in Figure 5.1 as K u.o 1 1 1 1 1 1 I 0.6 0.4 + w 0.2 Q. K>0 K<Q S" 0' BOOOOO O + +-H+Hf IMHK - c 'en | -0.2- O -0.4 - 0 -0.6 - O nQ 1 1 1 1 1 1 1 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 Real part Figure 5.1 Apparent loci of the closed-loop poles of Example 5.1 as the classical design parameter, K, is varied from —1 to 1
  • 236. DESIGN: CLASSICAL VS. MODERN 221 is varied from -1 to 1. Apparently, from Figure 5.1, the closed-loop system is stable for K > 0 and unstable for K < 0. In Figure 5.1, it appears that the pole s = p^ determines the stability of the closed-loop system, since it is the pole which crosses into the right-half s-plane for K < 0. This pole is called the dominant pole of the system, because being closest to the imaginary axis it dominates the system's response (recall from Chapter 4 that the smaller the real part magnitude of a pole, the longer its contribution to the system's response persists). By choosing an appropriate value of K, we can place only the dominant pole, s = p3, at a desired location in the left-half s-plane. The locations of the other two poles, s = p and s ~ p^, would then be governed by such a choice of K. In other words, by choosing the sole parameter K, the locations of all the three poles cannot be chosen independently of each other. Since all the poles contribute to the closed-loop performance, the classical design approach may fail to achieve the desired performance objectives when only a few poles are being directly affected in the design process. Furthermore, the chosen design approach of Example 5.1 is misleading, because it fails to even stabilize the closed-loop system! Note that the closed-loop transfer function given by Eq. (5.4) is of third order, whereas we expect that it should be of fourth order, because the closed-loop system is obtained by combining a third order plant with a first order controller. This discrepancy in the closed-loop transfer function's order has happened due to our attempt to cancel a pole with a zero at the same location. Such an attempt is, however, doomed to fail as shown by a state-space analysis of the closed-loop system. Example 5.2 Let us find a state-space representation of the closed-loop system designed using the classical approach in Example 5.1. Since the closed-loop system is of the configuration shown in Figure 3.7(c), we can readily obtain its state-space repre- sentation using the methods of Chapter 3. The Jordan canonical form of the plant, , is given by the following state coefficient matrices: 0 0 0 -2 0 1/3 0 -3 -1/2 CP = 1 1]; 1 (5.5) A state-space representation of the controller, H ( s ) , is the following: Ac=0; Bc = K- Cc = -l; Dc = K (5.6) Therefore, on substituting Eqs. (5.5) and (5.6) into Eqs. (3.146)-(3.148), we get the following state-space representation of the closed-loop system: x(0=Ax(?)+Byd(0 (5.7) (5.8)
  • 237. 222 CONTROL SYSTEM DESIGN IN STATE-SPACE where 1 0 0 0 0 -K/3 (-2-K/3) -K/3 -1/3 K/3 B= K/2 K/2 (-3 + K/2) 1/2 -K/2 -K -K is 0 K C= [1 1 1 0]; (5.9) The closed-loop system is of fourth order, as expected. The closed-loop poles are the eigenvalues of A, i.e. the solutions of the following characteristic equation: 0 0 0 K/3 (A + 2 + K/3) K/3 1/3 -K/2 -K/2 (A + 3 -K/2) -1/2 K K K A (5.10) It is evident from Eq. (5.10) that, irrespective of the value of K, one of the eigenvalues of A is A = 1, which corresponds to a closed-loop pole at 5 = 1. Hence, irrespective of the design parameter, K, we have an unstable closed-loop system, which means that the chosen design approach of cancelling an unstable pole with a zero does not work. More importantly, even though we have an unconditionally unstable closed-loop system, the closed-loop transfer function given by Eq. (5.4) fools us into believing that we can stabilize the closed-loop system by selecting an appropriate value for K. Such a system which remains unstable irrespective of the values of the control design parameters is called an unstabilizable system. The classical design approach of Example 5.1 gave us an unstabilizable closed-loop system, and we didn't even know it! Stabilizability of a system is a consequence of an important property known as controllability, which we will consider next. (Although we considered a closed-loop system in Example 5.2, the properties controllability and Stabilizability are more appropriately defined for a plant.) 5.2 Controllability When as children we sat in the back seat of a car, our collective effort to move the car by pushing on the front seat always ended in failure. This was because the input we provided to the car in this manner, no matter how large, did not affect the overall motion of the car. There was something known as the third law of Newton, which physically prevented us from achieving our goal. Hence, for us the car was uncontrollable when we were sitting in the car. The same car could be moved, however, by stepping out and giving a hefty push to it from the outside; then it became a controllable system for our purposes. Controllability can be defined as the property of a system when it is possible to take the system from any initial state, x(r0), to any final state, x(t{), in a finite time, (tf — to). by means of the input vector, u(t), to < t < tf. It is important to stress the words any and finite, because it may be possible to move an uncontrollable system from some initial
  • 238. CONTROLLABILITY 223 states to some final states, or take an infinite amount of time in moving the uncontrollable system, using the input vector, u (?)• Controllability of a system can be easily determined if we can decouple the state-equations of a system. Each decoupled scalar state-equation corresponds to a sub-system. If any of the decoupled state-equations of the system is unaffected by the input vector, then it is not possible to change the corresponding state variable using the input, and hence, the sub-system is uncontrollable. If any sub-system is uncontrollable, i.e. if any of the state variables is unaffected by the input vector, then it follows that the entire system is uncontrollable. Example 5.3 Re-consider the closed-loop system of Example 5.2. The state-equations of the closed-loop system (Eqs. (5.7)-(5.9)) can be expressed in scalar form as follows: xl}(t)=X[(t) (5.1 la) (l) x 2( t ) = -Kxi(t)/3 - (2 + K/3)x2(t) - Kx3(t)/3 (5. l i b ) = Kx{(t)/2 + Kx2(t)/2 + (-3 + K/2)x3(t) + x4(t)/2-Kyd(t)/2 (5.1 Ic) x (l t ) = -Kxi(t) - Kx2(t) - Kx3(t) + Kyd(t) (5.1 Id) On examining Eq. (5.1 la), we find that the equation is decoupled from the other state-equations, and does not contain the input to the closed-loop system, y d (t). Hence, the state variable, x i ( t ) , is entirely unaffected by the input, yd(t), which implies that the system is uncontrollable. Since the uncontrollable sub-system described by Eq. (5.11 a) is also unstable (it corresponds to the eigenvalue A = 1), there is no way we can stabilize the closed-loop system by changing the controller design parameter, K. Hence, the system is unstabilizable. In fact, the plant of this system given by the state-space representation of Eq. (5.5) is itself unstabilizable, because of the zero in the matrix Bp corresponding to the sub-system having eigen- value A = 1. The unstabilizable plant leads to an unstabilizable closed-loop system. Example 5.3 shows how a decoupled state-equation indicating an uncontrollable and unstable sub-system implies an unstabilizable system. Example 5.4 Let us analyze the controllability of the following system: 0 0 (5.12) -1 1
  • 239. 224 CONTROL SYSTEM DESIGN IN STATE-SPACE The system is unstable, with four zero eigenvalues. Since the state-equations of the system are coupled, we cannot directly deduce controllability. However, some of the state-equations can be decoupled by transforming the state-equations using the transformation z(f) = Tx(r), where 1 1 0 0 1 - 1 0 0 T= (5.13) 0 0 1 1 0 0 1 - 1 The transformed state-equations can be written in the following scalar form: z™(t)=x'3(t) (5.14a) z(2t) = x'4(t) (5.14b) 4'V)=0 (5.14c) (5.14d) Note that the state-equation, Eq. (5.14c) denotes an uncontrollable sub-system in which the state variable, zi(t), is unaffected by the input, u(t). Hence, the system is uncontrollable. However, since the only uncontrollable sub-system denoted by Eq. (5.14c) is stable (its eigenvalue is, A = 0), we can safely ignore this sub-system and stabilize the remaining sub-systems denoted by Eqs. (5.14a),(5.14b), and (5.14d), using a feedback controller that modifies the control input, u(t). An uncontrol- lable system all of whose uncontrollable sub-systems are stable is thus said to be stabilizable. The process of stabilizing a stabilizable system consists of ignoring all uncontrollable but stable sub-systems, and designing a controller based on the remaining (controllable) sub-systems. Such a control system will be successful, because each ignored sub-system will be stable. In the previous two examples, we could determine controllability, only because certain state-equations were decoupled from the other state-equations. Since decoupling state- equations is a cumbersome process, and may not be always possible, we need another criterion for testing whether a system is controllable. The following algebraic controlla- bility test theorem provides an easy way to check for controllability. Theorem A linear, time-invariant system described by the matrix state-equation, x ( l ) (/) = Ax(/) + Bu(f) is controllable if and only if the controllability test matrix P = [ B ; AB; A2B; A3B; ...; A M -'B] is of rank n, the order of the system. (The rank of a matrix, P, is defined as the dimension of the largest non-zero determinant formed out of the matrix, P (see Appendix B). If P is a square matrix,
  • 240. CONTROLLABILITY 225 the largest determinant formed out of P is |P|. If P is not a square matrix, the largest determinant formed out of P is either the determinant formed by taking all the rows and equal number of columns, or all the columns and equal number of rows of P. See Appendix B for an illustration of the rank of a matrix. Note that for a system of order n with r inputs, the size of the controllability test matrix, P, is (n x nr). The largest non-zero determinant of P can be of dimension n. Hence, the rank of P can be either less than or equal to n.) A rigourous proof of the algebraic controllability test theorem can be found in Friedland [2]. An analogous form of algebraic controllability test theorem can be obtained for linear, time-varying systems [2]. Alternatively, we can form a time-varying controllability test matrix as P(f)=[B(0; A(r)B(0; A 2 (f)B(r); A 3 (r)B(r); ...; An~-](t)E(t)] (5.15) and check the rank of P(0 for all times, / > to, for a linear, time-varying system. If at any instant, t, the rank of P(r) is less than n, the system is uncontrollable. However, we must use the time-varying controllability test matrix of Eq. (5.15) with great caution, when the state-coefficient matrices are rapidly changing with time, because the test can be practically applied at discrete time step - rather than at all possible times (see Chapter 4) - and there may be some time intervals (smaller than the time steps) in which the system may be uncontrollable. Example 5.5 Using the controllability test theorem, let us find whether the following system is controllable: B = The controllability test matrix is the following: P = [B; AB] = Hu ~2] (5.17) L -' J The largest determinant of P is |P| = — 1 ^ 0, Hence the rank of P is equal to 2, the order of the system. Thus, by the controllability test theorem, the system is controllable. Applying the algebraic controllability test involves finding the rank of P, and checking whether it is equal to n. This involves forming all possible determinants of dimension n out of the matrix P, by removing some of the columns (if m > 1), and checking whether all of those determinants are non-zero. By any account, such a process is cumbersome if performed by hand. However, MATLAB provides us the command rank(P) for finding the rank of a matrix, P. Moreover, MATLAB 's Control System Toolbox (CST) lets you directly form the controllability test matrix, P, using the command ctrb as follows: »P = ctrb(A, B) <enter>
  • 241. 226 CONTROL SYSTEM DESIGN IN STATE-SPACE or »P = ctrb(sys) <enter> where A and B are the state coefficient matrices of the system whose LTI object is sys. Example 5.6 Let us verify the uncontrollability of the system given in Example 5.4, using the controllability test. The controllability test matrix is constructed as follows: »A=[0 0 1 0; zeros(1,3)1; zeros(2,4)]; B=[0 0 -1 1 ] ' ; P=ctrb(A,B) <enter> P = 0 - 1 0 0 0 1 0 0 -1 0 0 0 1 0 0 0 Then the rank of P is found using the MATLAB command rank: »rank(P) <enter> ans = 2 Since the rank of P is less than 4, the order of the system, it follows from the controllability test theorem that the system is uncontrollable. What are the causes of uncontrollability? As our childhood attempt of pushing a car while sitting inside it indicates, whenever we choose an input vector that does not affect all the state variables physically, we will have an uncontrollable system. An attempt to cancel a pole of the plant by a zero of the controller may also lead to an uncontrollable closed-loop system even though the plant itself may be controllable. Whenever you see a system in which pole-zero cancellations have occurred, the chances are high that such a system is uncontrollable. Example 5.7 Let us analyze the controllability of the closed-loop system of configuration shown in Figure 2.32, in which the controller, H(s), and plant, G(s), are as follows: H(s) = K (s-2)/(s + 1); G(s) = 3/(s - 2) (5.18)
  • 242. CONTROLLABILITY 227 The closed-loop transfer function in which a pole-zero cancellation has occurred at s = 2 is the following: Y ( s ) / Y d ( s ) = G ( s ) H ( s ) / [ + G(s}H(s)] = 3K/(s + 3K 4- 1) (5.19) The Jordan canonical form of the plant is the following: Ap = 2; Bp = 3; Cp = 1; Dp = 0 (5.20) Note that the plant is controllable (the controllability test matrix for the plant is just P = Bp, which is of rank 1). The Jordan canonical form of the controller is the following: Ac = —1; Bc = K', Cc — —3; Dc = K (5.21) The closed-loop state-space representation is obtained using Eqs. (3.146)-(3.148) as the following: (2-3/0 -9 -K -l C = [1 0]; D=0 (5.22) The controllability test matrix for the closed-loop system is the following: ^ If ^? M {Q W^- '""|i .J iV 1 I 7 /V "3 ]f / "1 , _ _ _ , P ( r / a A 2 -(- A ) J ^ , ^/ ^ 5 - 23 ) A — (^J To see whether P is of rank 2 (i.e. whether P is non-singular) let us find its determinant as follows: -9AT 3 -3AT 2 + 9*3 + 3ff 2 = 0 (5.24) Since |P| = 0, P is singular, its rank is less than 2. Therefore, the closed- loop system is uncontrollable no matter what value of the controller design parameter, K, is chosen. Hence, a controllable plant has led to an uncontrollable closed-loop system in which a pole-zero cancellation has occurred. Other causes of uncontrollability could be mathematical, such as using superfluous state variables (i.e. more state variables than the order of the system) when modeling a system; the superfluous state variables will be definitely unaffected by the inputs to the system, causing the state-space representation to be uncontrollable, even though the system may be physically controllable. A rare cause of uncontrollability is too much symmetry in the system's mathematical model. Electrical networks containing perfectly balanced bridges are examples of systems with too much symmetry. However, perfect symmetry almost never exists in the real world, or in its digital computer model.
  • 243. 228_ CONTROL SYSTEM DESIGN IN STATE-SPACE _ Now that we know how to determine the controllability of a system, we can avoid the pitfalls of Examples 5.1 and 5.7, and are ready to design a control system using state-space methods. 5.3 Pole-Placement Design Using Full-State Feedback In Section 5.1 we found that it may be required to change a plant's characteristics by using a closed-loop control system, in which a controller is designed to place the closed-loop poles at desired locations. Such a design technique is called the pole-placement approach. We also discussed in Section 5.1 that the classical design approach using a controller transfer function with a few design parameters is insufficient to place all the closed-loop poles at desired locations. The state-space approach using full-state feedback provides sufficient number of controller design parameters to move all the closed-loop poles independently of each other. Full-state feedback refers to a controller which generates the input vector, u(0, according to a control-law such as the following: u(r) = K[Xd(r) - x(01 - KdXd(f) - K n x n (» (5.25) where x(0 is the state-vector of the plant, Xd(0 is the desired state-vector, x n (f) is the noise state- vector and K, K<j and Kn are the controller gain matrices. The desired state- vector, xj(0, and the noise state- vector, xn(0, are generated by external processes, and act as inputs to the control system. The task of the controller is to achieve the desired state-vector in the steady state, while counteracting the affect of the noise. The input vector, u(f), generated by Eq. (5.25) is applied to the plant described by the following state and output equations: x (1) (0 = Ax(f) + Bu(r) + Fx n (r) (5.26) y(0 = Cx(r) + Du(r) + Ex n (/) (5.27) where F and E are the noise coefficient matrices in the state and output equations, respectively. Designing a control system using full-state feedback requires that the plant described by Eq. (5.26) must be controllable, otherwise the control input generated using Eq. (5.25) will not affect all the state variables of the plant. Furthermore, Eq. (5.25) requires that the all the state variables of the system must be measurable, and capable of being fed back to the controller. The controller thus consists of physical sensors, which measure the state variables, and electrical or mechanical devices, called actuators, which provide inputs to the plant based on the desired outputs and the control-law of Eq. (5.25). Modern controllers invariably use digital electronic circuits to implement the control-law in a hardware. The controller gain matrices, K, Kj, and Kn are the design parameters of the control system described by Eqs. (5.25)-(5.27). Note that the order of the full-state feedback closed-loop system is the same as that of the plant. A schematic diagram of the general control system with full-state feedback is shown in Figure 5.2. Let us first consider control systems having Xd(0 =0. A control system in which the desired state-vector is zero is called a regulator. Furthermore, for simplicity let us assume that all the measurements are perfect, and that there is no error committed in modeling
  • 244. POLE-PIACEMENT DESIGN USING FULL-STATE FEEDBACK 229 Figure 5.2 Schematic diagram of a general full-state feedback control system with desired state, )/ and noise, xn(f) the plant by Eqs. (5.26) and (5.27). These two assumptions imply that all undesirable inputs to the system in the form of noise, are absent, i.e. n(t) = 0. Consequently, the control-law of Eq. (5.25) reduces to u(0 = -Kx(0 (5.28) and the schematic diagram of a noiseless regulator is shown in Figure 5.3. On substituting Eq. (5.28) into Eqs. (5.26) and (5.27), we get the closed-loop state and output equations of the regulator as follows: x (1) (0 = (A-BK)x(O (5.29) y(0 = (C - DK)x(r) (5.30) Equations. (5.29) and (5.30) indicate that the regulator is a homogeneous system, described by the closed-loop state coefficient matrices ACL = A — BK, BCL = 0> CCL = C — DK, and DCL = 0. The closed-loop poles are the eigenvalues of ACL- Hence, by selecting the controller gain matrix, K, we can place the closed-loop poles at desired locations. For a plant of order n with r inputs, the size of K is (r x h). Thus, we have a total of r • n scalar design parameters in our hand. For multi-input systems (i.e. r > 1), the number of design parameters are, therefore, more than sufficient for selecting the locations of n poles. Figure 5.3 Schematic diagram of a full-state feedback regulator (i.e. control system with a zero desired state-vector) without any noise
  • 245. 230_ CONTROL SYSTEM DESIGN IN STATE-SPACE _ Example 5.8 Let us design a full-state feedback regulator for the following plant such that the closed-loop poles are s = —0.5 ± i: The plant, having poles at s = 1 and s = — 2, is unstable. Also, the plant is control- lable, because its decoupled state-space representation in Eq. (5.31) has no elements of B equal to zero. Hence, we can place closed-loop poles at will using the following full-state feedback gain matrix: K=[ATi; K2] (5.32) The closed-loop state-dynamics matrix, ACL = A — BK, is the following: (5.33) AI (-24- K2) The closed-loop poles are the eigenvalues of ACL, which are calculated as follows: = (A - 1 +ffiXA.+ 2 - K2) + K} K2 = 0 (5.34) The roots of the characteristic equation (Eq. (5.34)) are the closed-loop eigenvalues given by -K2+l)± 0.5(A'1 + K - 2KK2 - 6Kl - 2K2 + 9) = -0.5 ± / (5.35) Solving Eq. (5.35) for the unknown parameters, K and K2, we get Ki = K2 = 13/12 (5.36) Thus, the full-state feedback regulator gain matrix which moves the poles from s = l,s = -2tos = -0.5 ± / is K = [13/12; 13/12] . 5.3.1 Pole-placement regulator design for single-input plants Example 5.8 shows that even for a single-input, second order plant, the calculation for the required regulator gain matrix, K, by hand is rather involved, and is likely to get out of hand as the order of the plant increases beyond three. Luckily, if the plant is in the controller companion form, then such a calculation is greatly simplified for single-input plants. Consider a single-input plant of order n whose controller companion form is the
  • 246. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 231 following (see Chapter 3): ~-an- -an-2 -<*n-3 • .. -a -«o~ "i" 1 0 0 .. 0 0 0 0 1 0 0 0 0 A = 0 0 1 .. 0 0 ; B 0 (5.37) 0 0 0 1 0 0 0 0 0 .. 0 1 _0_ where « o , . . . , an- are the coefficients of the plant's characteristic polynomial s — A| = s" + an-sn~[ + . . . + d[S 4- flo- The full-state feedback regulator gain matrix is a row vector of n unknown parameters given by K2; (5.38) It is desired to place the closed-loop poles such that the closed-loop characteristic polynomial is the following: sl - ACL| = sl - A + BK| = 5" an-2s (5.39) where the closed-loop state dynamics matrix, ACL = A — BK, is the following: ~ (—«,,_! — K ) (— 0«-2 — #2) (—a,, -3 — KT,) ... (-fll -*„_,) (-OQ — Kn)- 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 (5.40) ACL - 0 0 0 1 0 0 0 0 0 1 It is interesting to note that the closed-loop system is also in the controller companion form! Hence, from Eq. (5.40), the coefficients of the closed-loop characteristic polynomial must be the following: an-2 =fln-2+ a — a Kn (5.41) or, the unknown regulator parameters are calculated simply as follows: (5.42) In vector form, Eq. (5.42) can be expressed as (5.43) where of = [an- QLn-2 • • •', «i; «o] and a = an-; an-2', • • •', a; a0]. If the state-space representation of the plant is not in the controller companion form, a state-transformation
  • 247. 232 CONTROL SYSTEM DESIGN IN STATE-SPACE can be used to transform the plant to the controller companion form as follows: x'(r) = Tx(f); A' = TAT~'; B' = TB (5.44) where x'(r) is the state-vector of the plant in the controller companion form, x(/) is the original state-vector, and T is the state-transformation matrix. The single-input regulator's control-law (Eq. (5.28)) can thus be expressed as follows: -!„'/ «(0 = - = -KT~'x'(0 (5.45) Since KT l is the regulator gain matrix when the plant is in the controller companion form, it must be given by Eq. (5.43) as follows: KT~' = a - a (5.46) or K = (a - a)T (5.47) Let us derive the state-transformation matrix, T, which transforms a plant to its controller companion form. The controllability test matrix of the plant in its original state-space representation is given by P = [B; AB; A2B; ...; A^B] (5.48) Substitution of inverse transformation, B = T~*B', and A = T~!A'T into Eq. (5.48) yields A'B'; '2' (A')2B'; (AT~'B'] = (5.49) where P* is the controllability test matrix of the plant in controller companion form. Pre- multiplying both sides of Eq. (5.49) with T, and then post-multiplying both sides of the resulting equation with P-1 we get the following expression for T: T = PI*"1 (5.50) You can easily show that P7 is the following upper triangular matrix (thus called because all the elements below its main diagonal are zeros): "1 -an- -fln-2 • . -a2 ~a 0 1 — an- . • -03 -a2 0 0 1 . -«4 -a3 (5.51) 0 0 0 1 -an- _0 0 0 . 0 1
  • 248. POLE-PIACEMENT DESIGN USING FULL-STATE FEEDBACK 233 Also note from Eq. (5.51) that the determinant of P' is unity, and that (P') ' is obtained merely by replacing all the elements above the main diagonal of P' by their negatives. Substituting Eq. (5.50) into Eq. (5.47), the regulator gain matrix is thus given by K = (a - a)P'P (5.52) Equation (5.52) is called the Ackermann's pole-placement formula. For a single-input plant considered here, both P and P' are square matrices of size (n x «). Note that if the plant is uncontrollable, P is singular, thus T = p'p~' does not exist. This confirms our earlier requirement that for pole-placement, a plant must be controllable. Example 5.9 Let us design a full-state feedback regulator for an inverted pendulum on a moving cart (Figure 2.59). A linear state-space representation of the plant is given by Eqs. (3.31) and (3.32), of which the state coefficient matrices are the following: 0 0 1 0 0 0 0 0 1 0 A= + m)g/(ML) 0 0 0 •I/(ML) -mg/M 0 0 0 /M 1 0 0 0 C= (5.53) 0 1 0 0 The single-input, u(t), is a force applied horizontally to the cart, and the two outputs are the angular position of the pendulum, 9 ( t ) , and the horizontal position of the cart, x(t). The state-vector of this fourth order plant is x ( t ) = [9(t) x ( t ) ; 0 ( l ) ( t ) ; x ( l ) ( t ) ] T . Let us assume the numerical values of the plant's parameters as follows: M = 1 kg, m — 0.1 kg, L — 1 m, and g = 9.8 m/s2. Then the matrices A and B are the following: 0 0 1 0 0' 0 0 0 1 0 (5.54) 10.78 0 0 0 -1 -0.98 0 0 0 1 Let us first determine whether the plant is controllable. This is done by finding the controllability test matrix, P, using the MATLAB (CST) command ctrb as follows: »P = ctrb(A,B)) <enter> P = 0 -1.0000 0 -10.7800 0 1.0000 0 0.9800 -1.0000 0 -10.7800 0 1.0000 0 0.9800 0
  • 249. 234 CONTROL SYSTEM DESIGN IN STATE-SPACE The determinant of the controllability test matrix is then computed as follows: »det(P) <enter> ans = -96.0400 Since |P| ^ 0, it implies that the plant is controllable. However, the magnitude of |P| depends upon the scaling of matrix P, and is not a good indicator of how far away P is from being singular, and thus how strongly the plant is controllable. A better way of detecting the measure of controllability is the condition number, obtained using the MATLAB function cond as follows: »cond(p) <enter> ans = 12.0773 Since condition number of P is small in magnitude, the plant is strongly controllable. Thus, our pole-placement results are expected to be accurate. (Had the condition number of P been large in magnitude, it would have indicated a weakly controllable plant, and the inversion of P to get the feedback gain matrix would have been inaccurate.) The poles of the plant are calculated by finding the eigenvalues of the matrix A using the MATLAB command damp as follows: »damp(A) <enter> Eigenvalue Damping Freq. (rad/sec) 3.2833 -1.0000 3.2833 0 -1.0000 0 0 -1.0000 0 -3.2833 1.0000 3.2833 The plant is unstable due to a pole with positive real-part (and also due to a pair of poles at s = 0). Controlling this unstable plant is like balancing a vertical stick on your palm. The task of the regulator is to stabilize the plant. Let us make the closed-loop system stable, by selecting the closed-loop poles as s = — 1 ± i , and s = — 5 ± 5i. The coefficients of the plant's characteristic polynomial can be calculated using the MATLAB command poly as follows: »a=poly(A) <enter> a = 1.0000 0.0000 -10.7800 0 0 which implies that the characteristic polynomial of the plant is s4 — 10.78s2 = 0. Hence, the polynomial coefficient vector, a, is the following: a = [0; -10.78; 0; 0] (5.55)
  • 250. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 235 The characteristic polynomial of the closed-loop system can also be calculated using the command poly as follows: »v = [-1+j; - 1 - j ; -5+5*j; -5-5*j]; alpha = poly(v) <enter> alpha = 1 12 72 120 100 which implies that the closed-loop characteristic polynomial is a4 + 2a3 + 72a2 + 120a + 100, and the vector a is thus the following: a = [12; 72; 120; 100] (5.56) Note that the MATLAB function poly can be used to compute the characteristic polynomial either directly from a square matrix, or from the roots of the char- acteristic polynomial (i.e. the eigenvalues of a square matrix). It now remains to find the upper triangular matrix, P', by either Eq. (5.49) or Eq. (5.51). Since a controller companion form is generally ill-conditioned (see Chapter 3), we would like to avoid using Eq. (5.49) which involves higher powers of the ill-conditioned matrix, A'. From Eq. (5.51), we get 1 0 10.78 0 0 1 0 10.78 (5.57) 0 0 1 0 0 0 0 1 Finally, the regulator gain matrix is obtained through Eq. (5.52) as follows: »Pdash=[1 0 10.78 0; 0 1 0 10.78; 0 0 1 0; 0 0 0 1 ] ; a=[0 -10.78 0 0 ] ; alpha=[12 72 120 100]; K = (alpha-a)*Pdash*inv(P) <enter> K = -92.9841 -10.2041 -24.2449 -12.2449 The regulator gain matrix is thus the following: K = [-92.9841; -10.2041; -24.2449; -12.2449] (5.58) Let us confirm that the eigenvalues of the closed-loop state-dynamics matrix, ACL = A — BK, are indeed what we set out to achieve as follows: »ACL = A-B*K <enter> ACL = 0 0 1.0000 0 0 0 0 1.0000 -82.2041 -10.2041 -24.2449 -12.2449 92.0041 10.2041 24.2449 12.2449
  • 251. 236 CONTROL SYSTEM DESIGN IN STATE-SPACE The closed-loop poles are then evaluated by the command eig as follows: »eig(ACL) <enter> ans = -5.0000+5.00001 -5.0000-5.0000i -1.0000+1.OOOOi -1.0000-1.00001 Hence, the desired locations of the closed-loop poles have been obtained. The computational steps of Example 5.9 are programmed in the MATLAB (CST) function called acker for computing the regulator gain matrix for single-input plants using the Ackermann's formula (Eq. (5.52). The command acker is used as follows: »K = acker(A,B,V) <enter> where A, B are the state coefficient matrices of the plant, V is a vector containing the desired closed-loop pole locations, and K is the returned regulator gain matrix. Since Ackermann's formula is based on transforming the plant into the controller companion form, which becomes ill-conditioned for large order plants, the computed regulator gain matrix may be inaccurate when n is greater than, say, 10. The command acker produces a warning, if the computed closed-loop poles are more than 10% off from their desired locations. A similar MATLAB (CST) function called place is also available for computing the pole-placement regulator gain for single-input plants. The function place also provides an output ndigits, which indicates the number of significant digits to which the closed- loop poles have been placed. The design of Example 5.9 is simply carried out by using the command place as follows: »V = [ - 1 + j ; - 1 - j ; -5+5*j; - 5 - 5 * j ] ; K = place(A,B,V) <enter> place: ndigits= 17 K = -92.9841 -10.2041 -24.2449 -12.2449 The result is identical to that obtained in Example 5.9; ndigits = 17 indicates that the locations of the closed-loop poles match the desired values up to 17 significant digits. The locations of closed-loop poles determine the performance of the regulator, such as the settling time, maximum overshoot, etc. (see Chapter 2 for performance parameters) when the system is disturbed by a non-zero initial condition. A design is usually specified in terms of such performance parameters, rather than the locations of the closed-loop poles themselves. It is the task of the designer to ensure that the desired performance is achieved by selecting an appropriate set of closed-loop poles. This is illustrated in the following example.
  • 252. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 237 Example 5.10 For the inverted-pendulum on a moving cart of Example 5.9, let us design a regu- lator which achieves a 5% maximum overshoot and a settling time less than 1 second for both the outputs, when the cart is initially displaced by 0.01 m. The state coefficient matrices, A, B, C, and D, of the plant are given in Eq. (5.53). The initial condition vector has the perturbation to the cart displacement, x(t), as the only non-zero element; thus, x(0) = [0; 0.01; 0; 0]r. Let us begin by testing whether the regulator designed in Example 5.9 meets the performance specifications. This is done by using the MATLAB (CST) function initial to find the initial response as follows: »t = 0:0.1:10; sysCL=ss(A-B*K, z e r o s ( 4 , 1 ) , C , D ) ; [ y , t , X ] = initial (sysCL,[0 0.01 0 0 ] ' , t ) ; <enter> where y, X, and t denote the returned output, state, and time vectors and sysCL is the state-space LTI model of the closed-loop system. The resulting outputs y(f) = [0(0; x(t)]T are plotted in Figure 5.4. In Figure 5.4, both the responses are seen to have acceptably small maximum overshoots, but settling-times in excess of 5 s, which is unacceptable. In order to speed-up the closed-loop response, let us move all the poles deeper inside the left- half plane by decreasing their real parts such that the new desired closed-loop poles are s = —7.5 ± 7.5i, and s = —10 ± 10z. Then, the new regulator gain matrix, the closed-loop dynamics matrix, and the initial response are obtained as follows: Cart's displacement, x(t), in meters Pendulum's angular position, 9(t), in radians 4 6 10 Time (s) Figure 5.4 Closed-loop initial response of the regulated inverted pendulum on a moving cart to perturbation on cart displacement for the regulator gain matrix, K = [—92.9841; — 10.2041; -24.2449;-12.2449]
  • 253. 238 CONTROL SYSTEM DESIGN IN STATE-SPACE »V=[-7.5+7.5*j - 7 . 5 - 7 . 5 * j -10+10*j -10-10*]]'; K = place(A,B,V) <enter> place: ndigits= 19 K = -2.91926+003 -2.29596+003 -5.7071e+002 -5.3571e+002 »t = 0:0.01:2; sysCL=ss(A-B*K, zeros(4,1),C,D); [ y , t , X ] = initial(sysCL, [0 0.01 0 0]',t); <enter> The resulting outputs are plotted in Figure 5.5, which indicates a maximum over- shoot of the steady-state values less than 4%, and a settling time of less than 1 s for both the responses. How did we know that the new pole locations will meet our performance requirements? We didn't. We tried for several pole configurations, until we hit upon the one that met our requirements. This is the design approach in a nutshell. On comparing Figures 5.4 and 5.5, we find that by moving the closed-loop poles further inside the left-half plane, we speeded-up the initial response at the cost of increased maximum overshoot. The settling time and maximum overshoot are, thus, conflicting requirements. To decrease one, we have to accept an increase in the other. Such a compromise, called a trade- off, is a hallmark of control system design. Furthermore, there is another cost associated with moving the poles deeper inside the left-half plane - that of the control input. Note that the new regulator gain elements are several times larger than those calculated in Example 5.9, which implies that the regulator must now apply an input which is much 0.04 I I I •Cart's displacement x(t), in meters 0.03 0.02 Pendulum's angular position, 0(f), in radians 0.01 0 -0.01 -0.02 -0.03 0.5 1 1.5 Time (s) Figure 5.5 Closed-loop initial response of the regulated inverted pendulum on a moving cart to perturbation on cart displacement for the regulator gain matrix, K = [—2919.2; —2295.9; —570.71; -535.71]
  • 254. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 239 larger in magnitude than that in Example 5.9. The input, u(/) = — Kx(Y), can be calculated from the previously calculated matrices, K and x, as follows: »u = - K * X ' ; <enter> The control inputs for the two values of the regulator gain matrix are compared in Figure 5.6. The control input, u ( t ) , which is a force applied to the cart, is seen to be more than 200 times in magnitude for the design of Example 5.10 than that of Example 5.9. The actuator, which applies the input force to the cart, must be physically able to generate this force for the design to be successful. The cost of controlling a plant is a function of the largest control input magnitude expected in actual operating conditions. For example, if the largest expected initial disturbance in cart displacement were 0.1 m instead of 0.01 m, a ten times larger control input would be required than that in Figure 5.6. The larger the control input magnitude, the bigger would be the energy spent by the actuator in generating the control input, and the higher would be the cost of control. It is possible to minimize the control effort required in controlling a plant by imposing conditions - other than pole-placement - on the regulator gain matrix, which we will see in Chapter 6. However, a rough method of ensuring that the performance requirements are met with the minimum control effort is to ensure that all the closed-loop poles are about the same distance from the imaginary axis in the left-half plane. The poles in the left-half plane that are farthest away from the imaginary axis dictate the control input magnitude, while the speed of response (i.e. the settling time of the transients) is governed by the poles with the smallest real parts, called the dominant poles. If some closed-loop poles are close to, and some are very far from the imaginary axis, it implies that too much control energy is being spent for a given settling time, and thus the design is inefficient. The most efficient closed-loop configuration thus appears to be the one where all the poles are placed in the ou i 1 20 : K = [-291 9.2; -2295.9; -570.71; -535.71] _ <D 10 o ,0 0 ^ ^— Q. m ^-^ 0 0.2 0.4 0.6 0.8 1 1.2 Time (s) 0.1 S 0.1 h K = [-92.984;-10.204;-24.245;-12.245] - |B 0.05 I 0 Q. - -0.05 0 1 2 3 4 5 6 Time (s) Figure 5.6 Control inputs of the regulated inverted pendulum on a moving cart for two designs of the full-state feedback regulator
  • 255. 240 CONTROL SYSTEM DESIGN IN STATE-SPACE 1 i i i i i i, X 0.8 o 0.6 - •c 0.4 - + CO Q. 0.2 I 0: <- on = 2 - 1 -0.2 + n= 4 " + -0.4 - -0.6 0 -0.8 x i i i i i + r 1 -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 Real part Figure 5.7 Butterworth pattern of poles in the left-half plane for n = 2, 3, and 4 left half plane, roughly the same distance from the imaginary axis. To increase the speed of the closed-loop response, one has to just increase this distance. One commonly used closed-loop pole configuration is the Butterworth pattern, in which the poles are placed on a circle of radius R centered at the origin, and are obtained from the solution of the following equation: 2 (s/R)"" = - (5.59) where n is the number of poles in the left-half plane (usually, we want all the closed- loop poles in the left-half plane; then n is the order of the system). For n = 1, the pole in the left-half plane satisfying Eq. (5.59) is s = —R. For n = 2, the poles in the left-half plane satisfying Eq. (5.59) are the solutions of (s/R)2 + (s/R)V2 + 1 = 0 . The poles satisfying Eq. (5.59) in the left-half plane for n = 3 are the solutions of (s//?)3 + 2(s/R)2 + 2(s/R) + 1=0. For a given n, we can calculate the poles satisfying Eq. (5.59) by using the MATLAB function roots, and discard the poles having positive real parts. The Butterworth pattern for n = 2, 3, and 4 is shown in Figure 5.7. Note, however, that as n increases, the real part of the two Butterworth poles closest to the imaginary axis decreases. Thus for large n, it may be required to move these two poles further inside the left-half plane, in order to meet a given speed of response. Example 5.11 Let us compare the closed-loop initial response and the input for the inverted pendulum on a moving cart with those obtained in Example 5.10 when the closed- loop poles are in a Butterworth pattern. For n = 4, the poles satisfying Eq. (5.59) in the left-half plane are calculated as follows:
  • 256. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 241 »z = r o o t s ( [ 1 0 0 0 0 0 0 0 1 ] ) <enter> -0.9239+0.38271 -0.9239-0.38271 -0.3827+0.92391 -0.3827-0.92391 0.3827+0.92391 0.3827-0.92391 0.9239+0.38271 0.9239-0.38271 The first four elements of z are the required poles in the left-half plane, i.e. s/R = -0.9239 ± 0.3827/ and s/R = -0.3827 ± 0.9239*. For obtaining a maximum over- shoot less than 5% and settling-time less than 1 s for the initial response (the design requirements of Example 5.10), let us choose R = 15. Then the closed-loop char- acteristic polynomial are obtained as follows: »i = find(real(z) < 0); p = poly(15*z(i) ) <enter> Columns 1 through 3 1.00006+000 3.91976+001-3.5527e-015i 7.68206+002-5.68436-0141 Columns 4 through 5 8.81936+003-3.18326 -0121 5.06256+004-2.16546 -0111 Neglecting the small imaginary parts of p, the closed-loop characteristic polyno- mial is s4 + 39.197s3 + 768.2s2 + 8819.3s + 50625, with the vector a given by »alpha=real(p(2:5)) <enter> alpha = 3.91976+001 7.68206+002 8.81936+003 5.06256+004 a =[39.197: 768.2; 8819.3; 50625] (5.60) Then using the values of a, P, and P' calculated in Example 5.9, the regulator gain matrix is calculated by Eq. (5.52) as follows: »K = (alpha-a)*Pdash*inv(P) <enter> K = -5.94486+003 -5.16580+003 -9.3913e+002 -8.99930+002 and the closed-loop state-dynamics matrix is obtained as
  • 257. 242 CONTROL SYSTEM DESIGN IN STATE-SPACE »ACL=A-B*K <enter> ACL = 0 0 1.OOOOe+000 0 0 0 0 LOOOOe+000 -5.9340e+003 -5.16586+003 -9.39136+002 -8.99936+002 5.94386+003 5.16586+003 9.39136+002 8.99936+002 The closed-loop eigenvalues are calculated as follows: »eig(ACL) <enter> ans = -5.74036+000+1.38586+0011 -5.74036+000-1.38586+001i -1.38586+001+5.74036+OOOi -1.38586+001 -5.74036+OOOi which are the required closed-loop Butterworth poles for R = 15. The initial response of the closed-loop system is calculated as follows, and is plotted in Figure 5.8: »t = 0 : 1 . 0 7 5 3 6 - 2 : 1 . 2 ; sysCL=ss(ACL,zeros(4,1),C,D); [y,t,X]=initial (sysCL,[0 0.01 0 0 ] ' , t ) ; <enter> 0.08 l I 1 I I s Cart's displacement x(t), in meters 0.06 Pendulum's angular position, 0.04 9(t), in radians 0.02 0 -0.02 -0.04 -0.06 0.2 0.4 0.6 0.8 1.2 Time (s) Figure 5.8 Initial response of the regulated inverted pendulum on a moving cart, (or the closed-loop poles in a Butterworth pattern of radius, R = 15
  • 258. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 243 I i K = [-5944.8; -5165.8; -939.13; -899.93] 0.4 0.6 0.8 Time (s) Figure 5.9 Control input for the regulated inverted pendulum on a moving cart, for closed-loop poles in a Butterworth pattern of radius, R = 15 Note from Figure 5.8 that the maximum overshoot for cart displacement is about 6% for both the outputs, and the settling time is greater than 1 s. The design is thus unacceptable. The slow closed-loop response is caused by the pair of dominant poles with real part —5.7403. If we try to increase the real part magnitude of the dominant poles by increasing R, we will have to pay for the increased speed of response in terms of increased input magnitude, because the poles furthest from the imaginary axis (s/R = —0.9239 ± 0.38270 will move still further away. The control input, w(0, is calculated and plotted in Figure 5.9 as follows: »u = -K*X'; plot(t.u) <enter> Figure 5.9 shows that the control input magnitude is much larger than that of the design in Example 5.10. The present pole configuration is unacceptable, because it does not meet the design specifications, and requires a large control effort. To reduce the control effort, we will try a Butterworth pattern with R = 8.5. To increase the speed of the response, we will move the dominant poles further inside the left-half plane than dictated by the Butterworth pattern, such that all the closed-loop poles have the same real parts. The selected closed-loop pole configuration is s - -7.853 ± 3.2528i, and 5 = -7.853 ± 7.853i. The regulator gain matrix which achieves this pole placement is obtained using MATLAB as follows: »format long e <enter> »v=[-7.853-3.25281 -7.853+3.25281 -7.853-7.8531 -7.853+7.8531]'; K=place ( A , B , v ) <enter> place: ndigits= 18
  • 259. 244 CONTROL SYSTEM DESIGN IN STATE-SPACE K = Columns 1 through 3 -1.3623640503602326+003 -9.0931607952022266+002 -3.4487416675480966+002 Column 4 -3.1346216675480896+002 Note that we have printed out K using the long format, because we will need this matrix later. A short format would have introduced unacceptable truncation errors. The closed-loop initial response is calculated and plotted in Figure 5.10 as follows: »sysCL=ss(A-B*K,zeros(4,1),C,D); [ y , t , X ] = initial(sysCL, [0 0.01 0 0]', t); <enter> 0.03 0.025 Cart's displacement x(f), in meters 0.02 Pendulum's angular position, 0.015 0(0, in radians 0.01 0.005 0 -0.005 -0.01 -0.015 -0.02 0.2 0.4 0.6 0.8 1.2 Time (s) Figure 5.10 Initial response of the regulated inverted pendulum on a moving cart for the design of Example 5.11 with the closed-loop poles at s = -7.853 ± 3.25281, and s = -7.853 ± 7.853i Design of Example 5.10. _ Design of Example 5.11, with the closed-loop poles at s = -7.853 ± 3.25281, and s = -7.853 ± 7.8S3/. -10 0.2 0.4 0.6 0.8 1.2 Time (s) Figure 5.11 Comparison of the control input for the design of Example 5.10 with that of Example 5.11 with closed-loop poles at s = -7.853 ± 3.25281, and s = -7.853 ± 7.S53/
  • 260. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 245 Figure 5.10 shows that the closed-loop response has a maximum overshoot of about 2.5% and a settling time of 1 s, which is a better performance than the design of Example 5.10. The control input of the present design is compared with that of Example 5.10 in Figure 5.11, which shows that the former is less than half of the latter. Hence, the present design results in a better performance, while requiring a much smaller control effort, when compared to Example 5.10. 5.3.2 Pole-placement regulator design for multi-input plants For a plant having more than one input, the full-state feedback regulator gain matrix of Eq. (5.28) has (r x n) elements, where n is the order of the plant and r is the number of inputs. Since the number of poles that need to be placed is n, we have more design parameters than the number of poles. This over-abundance of design parameters allows us to specify additional design conditions, apart from the location of n poles. What can be these additional conditions? The answer depends upon the nature of the plant. For example, it is possible that a particular state variable is not necessary for generating the control input vector by Eq. (5.28); hence, the column corresponding to that state variable in K can be chosen as zero, and the pole-placement may yet be possible. Other conditions on K could be due to physical relationships between the inputs and the state variables; certain input variables could be more closely related to some state variables, requiring that the elements of K corresponding to the other state variables should be zeros. Since the structure of the regulator gain matrix for multi-input systems is system specific, we cannot derive a general expression for the regulator gain matrix, such as Eq. (5.52) for the single-input case. The following example illustrates the multi-input design process. Example 5.12 Let us design a full-state feedback regulator for the following plant: '0 0 A = 0 0.01 0 -1 0 0 0 -2 1 0 C= D= (5.61) 0 0 0 0 The plant is unstable due to a pole at s = 0.01. The rank of the controllability test matrix of the plant is obtained as follows: »rank(ctrb(A, B)) <enter> ans = 3
  • 261. 246 CONTROL SYSTEM DESIGN IN STATE-SPACE Hence, the plant is controllable, and the closed-loop poles can be placed at will. The general regulator gain matrix is as follows: ^3 I (5.62) K4 K6 J and the closed-loop state dynamics matrix is the following: -K -K2 ACL = A - BK = K4 (0.01 + *5) (5.63) 2K4 2K5 which results in the following closed-loop characteristic equation: |5l-AcLl = -K4 (s - 0.01 - K5) =0 (5.64) -2K4 -2K5 (5+0.1 -2K6) or (s + Ki)[(s - 0.01 - K5)(s + 0.1 - 2K6) - 2K5K6] + K4[K2(s + 0.1 - 2K6) + 2K3K5] + 2K4[K2K6 + K3(s - 0.01 - *5)] = 0 (5.65) or + (0.09 -Ks- 2K6 + K})s2 -Kx K5 - 0.001 + 0.02/£6 - 0. 1 K5)s + 0. 1 K2K4 + 0.02/T, K6 -QAKiKs- 0.02/^3^4 = 0 (5.66) Let us choose the closed-loop poles as s = — 1, and s = — 0.045 ±0.5i. Then the closed-loop characteristic equation must be (s + )(s +0.045 — Q.5i)(s + 0.045 + 0.5/) = s3 + 1.09s2 + 0.342s + 0.252 = 0, and comparing with Eq. (5.66), it follows that K5 = 0.343 0. K2 0.02K, K6- 0.001 K} - 0.1 K K5 -Q. = 0.252 (5.67) which is a set of nonlinear algebraic equations to be solved for the regulator design parameters - apparently a hopeless task by hand. However, MATLAB (CST) again comes to our rescue by providing the function place, which allows placing the poles of multi-input plants. The function place employs an eigenstructure assignment algorithm [3], which specifies additional conditions to be satisfied by the regulator gain elements, provided the multiplicity of each pole to be placed does not exceed the number of inputs, and all complex closed-loop poles must appear in conjugate pairs. For the present example, the regulator gain matrix is determined using place as follows:
  • 262. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 247 »A=[0 0 0;0 0.01 0;0 0 - 0 . 1 ] ; B = [ 1 0;0 - 1 ; 0 - 2 ] ; p = [ - 1 -0.045-0.51 -0.045+0.51]; K=place(A,B,p) <enter> place: ndigits= 16 K = 0.9232 0.1570 -0.3052 0.1780 -2.4595 1.1914 »eig(A-B*K) <enter> ans = -1.0000 -0.0450+0.50001 -0.0450-0.50001 You may verify that the computed values of the gain matrix satisfies Eq. (5.67).The optimal control methods of Chapter 6 offer an alternative design approach for regulators based on multi-input plants. 5.3.3 Poke-placement regulator design for plants with noise In the previous two sections, we had ignored the presence of disturbances, or noise, in a plant when designing full-state feedback regulators. Designs that ignore noise in a plant are likely to fail when implemented in actual conditions where noise exists. Noise can be divided into two categories: measurement noise, or the noise caused by imperfections in the sensors that measure the output variables; and the process noise, or the noise which arises due to ignored dynamics when modeling a plant. Since neither the sensors nor a plant's mathematical model can be perfect, we should always expect some noise in a plant. The state-equation of a plant with noise vector, x n ( t ) , is the following: x (1) (0 = Ax(0 + Bu(0 + Fx M (0 (5.68) where F is the noise coefficient matrix. To place the closed-loop poles at desired locations while counteracting the effect of the noise, a full-state feedback regulator is to be designed based on the following control-law: u(0 = -Kx(0 - K w x w (0 (5.69) Substituting Eq. (5.69) into Eq. (5.68) yields the following state-equation of the closed- loop system: x (1) (0 = (A - BK)x(0 + (F - BK w )x w (0 (5.70) Note that Eq. (5.70) implies that the noise vector, x M (0, acts as an input vector for the closed-loop system, whose state-dynamics matrix is ACL = (A — BK). A schematic diagram of the full-state feedback regulator with noise is shown in Figure 5.12.
  • 263. 248 CONTROL SYSTEM DESIGN IN STATE-SPACE Figure 5.12 Schematic diagram of a full-state feedback regulator with noise, xn(f) The regulator feedback gain matrix, K, is selected, as before, to place the closed- loop poles (eigenvalues of ACL) at desired locations. While we may not know the exact process by which the noise, n(t), is generated (because it is usually a stochastic process, as discussed in Chapter 1), we can develop an approximation of how the noise affects the plant by deriving the noise coefficient matrix, F, from experimental observations. Once F is known reasonably, the regulator noise gain matrix, K w , can be selected such that the effect of the noise vector, x n (f), on the closed-loop system is minimized. It would, of course, be ideal if we can make (F — BK W ) = 0, in which case there would be absolutely no influence of the noise on the closed-loop system. However, it may not be always possible to select the (rq) unknown elements of Kn to satisfy the (nq) scalar equations constituting (F — BKn) = 0, where n is the order of the plant, r is the number of inputs, and q is the number of noise variables in the noise vector, n(t). When r < n (as it is usually the case), the number of unknowns in (F — BKn) = 0 is less than the number of scalar equations, and hence all the equations cannot be satisfied. If r = n, and the matrix B is non-singular, then we can uniquely determine the regulator noise gain matrix by Kn = — B~1F. In the rare event of r > n, the number of unknowns exceed the number of equations, and all the equations, (F - BKn) = 0, can be satisfied by appropriately selecting the unknowns, though not uniquely. Example 5.13 Consider a fighter aircraft whose state-space description given by Eqs. (5.26) and (5.27) has the following coefficient matrices: -1.7 50 260" -272' 0.02 0.1 A = 0.22 -1.4 -32 0 -0.0035 0.004 0 0 -12 14 0 0 C = I; D = 0; E=0 (5.71) The state variables of the aircraft model are normal acceleration in m/s2, JCi(f), pitch-rate in rad/s, *2(/), and elevator deflection in rad, x^(t), while the input, u(t), is the desired elevator deflection in rad. (For a graphical description of the system's variables, see Figure 4.5.) The poles of the plant are calculated as follows:
  • 264. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 249 »A=[-1.7 50 260; 0.22 -1.4 -32; 0 0 -12]; damp(A) <enter> Eigenvalue Damping Freq. (rad/sec) 1.7700 -1.0000 1.7700 -4.8700 1.0000 4.8700 -12.0000 1.0000 12.0000 The plant is unstable due to a pole at s = 1.11. To stabilize the closed-loop system, it is desired to place the closed-loop poles at s = — 1 ± / and 5 = — 1. The following controllability test reveals a controllable plant, implying that pole-placement is possible: »B=[-272 0 14]'; rank(ctrb(A,B)) <enter> ans = 3 The regulator feedback gain matrix is thus obtained as follows: »v = [ - i - i - i + i - 1 ] ; K = p l a c e ( A , B , v ) <enter> place: ndigits= 19 K = 0.0006 -0.0244 -0.8519 and the closed-loop state dynamics matrix is the following: »ACL=A-B*K <enter> ACL = -1.5267 43.3608 28.2818 0.2200 -1.4000 -32.0000 -0.0089 0.3417 -0.0733 To determine the remaining regulator matrix, KM = [Kn Kn2, let us look at the matrix (F — '0.02 + 272^1 0.1+272/^2 F — BKn = -0.0035 0.004 (5.72) -AKn] Equation (5.72) tells us that it is impossible to make all the elements of (F — BK n ) zeros, by selecting the two unknown design parameters, Kn and Kn2. The next best thing to (F — BKn) = 0 is making the largest elements of (F — BK n ) zeros, and living with the other non-zero elements. This is done by selecting Kn = —0.02/272 and Kni = -0.1/272 which yields the following (F - BKn): 0 0 F - BK« = -0.0035 0.004 (5.73) 0.00103 0.00515
  • 265. 250 CONTROL SYSTEM DESIGN IN STATE-SPACE With (F — BK,,) given by Eq. (5.73), we are always going to have some effect of noise on the closed-loop system, which hopefully, will be small. The most satis- fying thing about Eq. (5.73) is that the closed-loop system given by Eq. (5.70) is uncontrollable with noise as the input (you can verify this fact by checking the rank of ctrb (Act, (F — BK,,)). This means that the noise is not going to affect all the state variables of the closed-loop system. Let us see by what extent the noise affects our closed-loop design by calculating the system's response with a noise vector, n(t) — [1 x 10~5; —2 x 10~6]r sin(lOOr), which acts as an input to the closed-loop system given by Eq. (5.70), with zero initial conditions. Such a noise model is too simple; actual noise is non-deterministic (or stochastic), and consists of a combination of several frequencies, rather than only one frequency (100 rad/s) as assumed here. The closed-loop response to noise is calculated by using the MATLAB (CST) command Isim as follows: »t=0:0.01:5; xn=[1e-5 -2e-6]'*sin(100*t) ; Bn=[0 0;-3.5e-3 0.004;1 .03e-3 5.15e-3]; <enter> »sysCL=ss(ACL,Bn,eye(3),zeros(3,2)) ; [y,t,X]=lsim(sysCL,xn',t') ; plot(t.X) <enter> The resulting closed-loop state variables, x(t), *2(0, and x ^ ( t ) , are plotted in Figure 5.13, which shows oscillations with very small amplitudes. Since the amplitudes are very small, the effect of the noise on the closed-loop system can be said to be negligible. Let us see what may happen if we make the closed- loop system excessively stable. If the closed-loop poles are placed at s = —100, s = — 100±100/, the resulting closed-loop response to the noise is shown in Figure 5.14. Note that the closed-loop response has increased by about 300 times in Figure 5.13 Closed-loop response of the regulated fighter aircraft to noise, when the closed-loop poles are s = — 1, s = — 1 ± /
  • 266. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 251 x 10" x2(t); x3(0 6 4 2 0 ^v^i^^ -2 -4 -6 0.5 1 1.5 Time (s) Figure 5.14 Closed-loop response of the regulated fighter aircraft to noise, when the closed-loop poles are s = -100, s = -100 ± 100 / magnitude, compared with that of Figure 5.13. Therefore, moving the poles too far into the left-half plane has the effect of increasing the response of the system due to noise, which is undesirable. This kind of amplified noise effect is due to the resulting high gain feedback. High gain feedback is to be avoided in the frequency range of expected noise. This issue is appropriately dealt with by filters and compensators (Chapter 7). The conflicting requirements of increasing the speed of response, and decreasing the effect of noise are met by a pole configuration that is neither too deep inside the left-half plane, nor too close to the imaginary axis. The optimum pole locations are obtained by trial and error, if we follow the pole-placement approach. However, the optimal control methods of Chapters 6 and 7 provide a more effective procedure of meeting both speed and noise attenuation requirements than the pole-placement approach. 5.3.4 Pole-placement design of tracking systems Now we are in a position to extend the pole-placement design to tracking systems, which are systems in which the desired state-vector, x d (r), is non-zero. Schematic diagram of a tracking system with noise was shown in Figure 5.2, with the plant described by Eqs. (5.26) and (5.27), and the control-law given by Eq. (5.25). The objective of the tracking system is to make the error, e(f) = (xd(0 - x(0), zero in the steady-state, while counteracting the effect of the noise, x w (r). If the process by which the desired state- vector is generated is linear and time-invariant, it can be represented by the following
  • 267. 252 CONTROL SYSTEM DESIGN IN STATE-SPACE state-equation: /1 (5.74) Note that Eq. (5.74) represents a homogeneous system, because the desired state vector is unaffected by the input vector, u(/). Subtracting Eq. (5.26) from Eq. (5.74), we can write the following plant state-equation in terms of the error: xdn(0 - x (1) (0 = A dXd (0 - Ax(0 - Bu(0 - Fxn(0 (5.75) or e (1) (0 = Ae(0 + (Ad - A)Xd(r) - Bu(?) - ¥xn(t) (5.76) and the control-law (Eq. (5.25)) can be re- written as follows: u(0 = Ke(0 - KdXdCO - K,,xw(0 (5.77) Referring to Figure 5.2, we see that while K is a feedback gain matrix (because it multiplies the error signal which is generated by the fed back state-vector), Kd and Kn are feedforward gain matrices, which multiply the desired state- vector and the noise vector, respectively, and hence feed these two vectors forward into the control system. Substituting Eq. (5.77) into Eq. (5.76) yields the following state-equation for the tracking system: e (1) (0 = (A - BK)e(r) + (Ad - A + BKd)Xd(0 + (BKn - F)xn(0 (5.78) The design procedure for the tracking system consists of determining the full-state feedback gain matrix, K, such that the poles of the closed-loop system (i.e. eigenvalues of ACL = A — BK) are placed at desired locations, and choose the gain matrices, Kd and K n , such that the error, e(0, is either reduced to zero, or made as small as possible in the steady-state, in the presence of the noise, x n (0- Of course, the closed-loop system described by Eq. (5.78) must be asymptotically stable, i.e. all the closed-loop poles must be in the left-half plane, otherwise the error will not reach a steady-state even in the absence of noise. Furthermore, as seen in Example 5.13, there may not be enough design parameters (i.e. elements in Kj and K n ) to make the error zero in the steady-state, in the presence of noise. If all the closed-loop poles are placed in the left-half plane, the tracking system is asymptotically stable, and the steady-state condition for the error is reached (i.e. the error becomes constant in the limit t -> oo). Then the steady state condition is described by e (1) (0 = 0, and Eq. (5.78) becomes the following in the steady state: 0 = (A - BK)ess + (Ad - A + BK^x^ + (BKn - F)x,ISS (5.79) where e(0 ->• ess (the steady state error vector), Xd(0 -> Xdss, and x w (0 -> xnss as t -»• oo. From Eq. (5.79), we can write the steady state error vector as follows: ess = (A - BK)-'[(A - BIQ - Ad)XdSS + (F - BK n )x nss ] (5.80)
  • 268. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 253 Note that the closed-loop state-dynamics matrix, ACL = A — BK, is non-singular, because all its eigenvalues are in the left-half plane. Hence, (A — BK)"1 exists. For ess to be zero, irrespective of the values of Xdss and x,,ss, we should have (A — BKd — Ad) = 0 and (F — BK W ) = 0, by selecting the appropriate gain matrices, Kd and K,,. However, as seen in Example 5.13, this is seldom possible, owing to the number of inputs to the plant, r, being usually smaller than the order of the plant, n. Hence, as in Example 5.13, the best one can usually do is to make some elements of ess zeros, and living with the other non-zero elements, provided they are small. In the rare case of the plant having as many inputs as the plant's order, i.e. n = r, we can uniquely determine Kd and K,, as follows, to make ess — 0: Kd=B-'(A-Ad); Krt=B'F (5.81) Example 5.14 For the fighter aircraft of Example 5.13, let us design a controller which makes the aircraft track a target, whose state-dynamics matrix, Ad, is the following: -2.1 35 150 0.1 -1.1 -21 (5.82) 0 0 -8 The eigenvalues of Ad determine the poles of the target, which indicate how rapidly the desired state-vector, Xd(0> is changing, and are calculated as follows: »Ad = [ - 1 0 . 1 35 150; 0.1 - 1 . 1 -21; 0 0 - 8 ] ; damp(Ad) <enter> Eigenvalue Damping Freq. (rad/sec) -0.7266 1.0000 0.7266 -8.0000 1.0000 8.0000 -10.4734 1.0000 10.4734 The target dynamics is asymptotically stable, with the pole closest to the imaginary axis being, s = —0.7266. This pole determines the settling time (or the speed) of the target's response. To track the target successfully, the closed-loop tracking system must be fast enough, i.e. the poles closest to the imaginary axis must have sufficiently small real parts, i.e. smaller than —0.7266. However, if the closed- loop dynamics is made too fast by increasing the negative real part magnitudes of the poles, there will be an increased effect of the noise on the system, as seen in Example 5.13. Also, recall that for an efficient design (i.e. smaller control effort), all the closed-loop poles must be about the same distance from the imaginary axis. Let us choose a closed-loop pole configuration as s = — 1, s = — 1 ± /. The feedback gain matrix for this pole configuration was determined in Example 5.13 to be the following: K = [0.0006; -0.0244; -0.8519] (5.83)
  • 269. 254 CONTROL SYSTEM DESIGN IN STATE-SPACE with the closed-loop state-dynamics matrix given by -1.5267 43.3608 28.2818 ACL = A - BK = 0.2200 -1.4000 -32.0000 -0.0089 0.3417 -0.0733 (5.84) The noise gain matrix, K w , was determined in Example 5.13 by making the largest elements of (F — BK,,) vanish, to be the following: K,, = [ -0.02/272; -0.1 /272 ] (5.85) It remains to find the feedforward gain matrix, K^ = [Kd', K.&I', Kd3 L by considering the steady state error, ess, given by Eq. (5.81). Note from Eq. (5.80) that, since the target is asymptotically stable, it follows that x<iss = 0, hence Kj will not affect the steady state error. However, the transient error, e(/), can be reduced by considering elements of the following matrix: 272^,) 110 + 272/^3) A - Ad - 0.12 -0.3 11 (5.86) -4Kd2 4 - 4Kd3 Since by changing Kd we can only affect the first and the third rows of (A — A^— BKd), let us select Kj such that the largest elements of (A — A<j — BKj), which are in the first row, are minimized. By selecting Kd = —8.4/272, Kdi = —15/272, and Kd3 = —110/272, we can make the elements in the first row of (A — Aj — BKj) zeros, and the resulting matrix is the following: 0 0 0 A - Ad - 0.12 -0.3 -11 (5.87) 0.432 0.772 1.704 and the required feedforward gain matrix is given by Kd = [ -8.4/272; -15/272; -110/272] (5.88) The closed-loop error response to target initial condition, Xd(0) = [3; 0; 0]r, and noise given by n(t) = [ I x 10~5; -2 x 10~6]r sin(lOOf), can be obtained by solving Eq. (5.78) with Xd(f) and x n (f) as the known inputs. The noise vector, x,,(f), and the matrix (BKn — F), are calculated for time upto 10 s as follows: »t = 0:0.01:10; Xn = [1e-5 -2e-6]'*sin(100*t) ; Bn = - [ 0 0; -3.5e-3 0.004;1 ,03e-3 5.15e-3]; <enter> The desired state- vector, x^(t), is obtained by solving Eq. (5.74) using the MATLAB (CST) command initial as follows: »sysd=ss(Ad,zeros(3,1),eye(3),zeros(3,1)); [yd.t.Xd,] = initial(sysd, [3 0 0]',t); <enter>
  • 270. POLE-PLACEMENT DESIGN USING FULL-STATE FEEDBACK 255 10 Figure 5.15 Closed-loop error and control input response of the fighter aircraft tracking a target with initial condition X,j(0) = [3; 0; 0]r The closed-loop error dynamics given by Eq. (5.78) can be written as follows: e ( l ) (0 - ACLe(0 + BCLf(0 (5.89) where ACL = A - BK, BCL = [(A d -A 4- BKd); (BK,T-F)], and the input vector, f(f) = [Xd(0 7 ; x,,(r) 7 ] r , which are calculated as follows: »ACL = A-B*K; BCL = [Ad-A+B*Kd Bn]; f = [Xd X n ' ] ; <enter> Finally, using the MATLAB command Isim, the closed-loop error response, e(t), is calculated as follows: »sysCL=ss(ACL,BCL,eye(3) ,zeros(3,5) ) ; e = lsim(sysCL,f ,t') ; <enter> The error, e(f) = [ei(f); ^z(0; e i ( t ) ] T , and control input, u(t) = Ke(f) - KdXdCO — K w x n (0, are plotted in Figure 5.15. Note that all the error transients decay to zero in about 10 s, with a negligible influence of the noise. The settling time of error could be made smaller than 1.0 s, but with a larger control effort and increased vulnerability to noise. The controller design with gain matrices given by Eqs. (5.83), (5.85), and (5.88) is the best we can do with pole-placement, because there are not enough design parameters (controller gain elements) to make the steady state error identically zero. Clearly, this is a major drawback of the pole-placement method. A better design approach with full-state feedback is the optimal control method, which will be discussed in Chapters 6 and 7.
  • 271. 256 CONTROL SYSTEM DESIGN IN STATE-SPACE 5.4 Observers, Observability, and Compensators When we designed control systems using full-state feedback in the previous section, it was assumed that we can measure and feedback all the state variables of the plant using sensors. However, it is rarely possible to measure all the state variables. Some state variables are not even physical quantities. Even in such cases where all the state variables are physical quantities, accurate sensors may not be available, or may be too expensive to construct for measuring all the state variables. Also, some state variable measurements can be so noisy that a control system based on such measurements would be unsuccessful. Hence, it is invariably required to estimate rather than measure the state- vector of a system. How can one estimate the state-vector, if it cannot be measured? The answer lies in observing the output of the system for a known input and for a finite time interval, and then reconstructing the state-vector from the record of the output. The mathematical model of the process by which a state-vector is estimated from the measured output and the known input is called an observer (or state estimator). An observer is an essential part of modern control systems. When an observer estimates the entire state-vector, it is called a full-order observer. However, the state variables that can be measured need not be estimated, and can be directly deduced from the output. An observer which estimates only the unmeasurable state variables is called the reduced- order observer. A reduced-order observer results in a smaller order control system, when compared to the full-order observer. However, when the measured state variables are noisy, it is preferable to use a full-order observer to reduce the effect of noise on the control system. A controller which generates the control input to the plant based on the estimated state-vector is called a compensator. We will consider the design of observers and compensators below. Before we can design an observer for a plant, the plant must be observable. Observ- ability is an important property of a system, and can be defined as the property that makes it possible to determine any initial state, x(fo), of an unforced system (i.e. when the input vector, u(f), is zero) by using & finite record of the output, y(f). The term finite record implies that the output is recorded for only a finite time interval beginning at t = to. In other words, observability is a property which enables us to determine what the system was doing at some time, to, after measuring its output for a finite time interval beginning at that time. The term any initial state is significant in the definition of observ- ability; it may be possible to determine some initial states by recording the output, and the system may yet be unobservable. Clearly, observability requires that all the state variables must contribute to the output of the system, otherwise we cannot reconstruct all possible combinations of state variables (i.e. any initial state-vector) by measuring the output. The relationship between observability and the output is thus the dual of that between controllability and the input. For a system to be controllable, all the state variables must be affected by the input; for a system to be observable, all the state vari- ables must affect the output. If there are some state variables which do not contribute to the output, then the system is unobservable. One way of determining observability is by looking at the decoupled state-equations, and the corresponding output equation of a system.
  • 272. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 257 Example 5.15 Consider a system with the following scalar state-equations: (5.90) The scalar output equations of the system are the following: y(t) = x{(t) y2(t) = 2 x 2 ( t ) + x l ( t ) + u ( t ) (5.91) Equation (5.90) implies that the state variable, xj(t), is decoupled from the other two state variables, x(t) and x2(t). Also, x?,(t) does not affect either of the two output variables, y ( t ) and y2(t). Since the state variable XT,(t), does not contribute to the output vector, y(?) = [y(t); y 2 ( t ) ] T , either directly or indirectly through jci(f) and x2(t), it follows that the system is unobservable. As it is not always possible to decouple the state-equations, we need another way of testing for observability. Similar to the algebraic controllability test theorem, there is an algebraic observability test theorem for linear, time-invariant systems stated as follows. Theorem The unforced system, x (1) (?) = Ax(f), y(0 = Cx(f), is observable if and only if the rank of the observability test matrix, N = [C T ; ATCT; (AT)2CT; . . . ; (A T )"~'C T ], is equal to n, the order of the system. The proof of this theorem, given in Friedland [2], follows from the definition of observ- ability, and recalling from Chapter 4 that the output of an unforced (homogeneous) linear, time-invariant system is given by y(f) — Cexp{A(f - ?o)}x(?o), where x(f 0 ) is the initial state-vector. Example 5.16 Let us apply the observability test theorem to the system of Example 5.15. The state coefficient matrices, A and C, are the following: 0 0 0 0 A= -1 0 c= 1 0 (5.92) 0 5 The observability test matrix, N, is constructed as follows: 0 0 1 2 -1 0 CT = 0 1 0 5 0 0
  • 273. 258 CONTROL SYSTEM DESIGN IN STATE-SPACE 1 2 0 1 (5.93) 0 0 or 1 2 1 2 1 2 0 1 0 - 1 0 1 (5.94) 0 0 0 0 0 0 The entire third row of N consists of zeros; hence it is impossible t6 form a (3 x 3) sized, non-zero determinant out of the rows and columns of N. Thus rank (N) < 3 for this third order system, therefore the system is unobservable. Rather than forming the observability test matrix, N, by hand as in Example 5.16, which could be a tedious process for large order systems, we can use the MATLAB (CST) command ctrb, noting that N is the controllability test matrix in which A is replaced by AT and B is replaced by CT. Thus, the command »N = ctrb(A',C') <enter> will give us the observability test matrix. The reasons for unobservability of a system are pretty much the same as those for uncontrollability, namely the use of superfluous state variables in state-space model, pole-zero cancellation in the system's transfer matrix, too much symmetry, and phys- ical unobservability (i.e. selection of an output vector which is physically unaffected by one or more state variables). If the sub-systems which cause unobservability are stable, we can safely ignore those state variables that do not contribute to the output, and design an observer based on the remaining state variables (which would constitute an observable sub-system). Thus a stable, unobservable system is said to be detectable. If an unobserv- able sub-system is unstable, then the entire system is said to be undetectable, because an observer cannot be designed by ignoring the unobservable (and unstable) sub-system. In Example 5.15, the unobservable sub-system corresponding to the decoupled state vari- able, *3(f), is unstable (it has a pole at s = 5). Hence, the system of Example 5.15 is undetectable. 5.4.1 Pole-placement design of full-order observers and compensators A full-order observer estimates the entire state-vector of a plant, based on the measured output and a known input. If the plant for which the observer is required is linear, the observer's dynamics would also be described by linear state-equations. Consider a noise- free, linear, time-invariant plant described by the following state and output equations: l) (r) = Ax(r) + Bu(f) (5.95) y(r) = Cx(r) + Du(r) (5.96)
  • 274. _ OBSERVERS, OBSERVABILITY, AND COMPENSATORS_ 259 The linear, time-invariant state-equation which describes the dynamics of a full-order observer can be expressed as follows: x^Cf) - AoXo(0 + B0u(0 + Ly(r) (5.97) where x 0 (?) is the estimated state-vector, u(?) is the input vector, y(t) is the output vector, A0, B0 are the state-dynamics and control coefficient matrices of the observer, and L is the observer gain matrix. The matrices A0, B0, and L must be selected in a design process such that the estimation error, e 0 (r) = x(r) — x 0 (f), is brought to zero in the steady state. On subtracting Eq. (5.97) from Eq. (5.95), we get the following error dynamics state-equation: e^CO - A0e0(?) + (A - A 0 )x(?) + (B - B 0 )u(r) - Ly(r) (5.98) Substitution of Eq. (5.96) into Eq. (5.98) yields e^(r) = A0e0(r) + (A - A0)x(?) + (B - B0)u(0 - L[Cx(r) + Du(r)] (5.99) or e^(0 = A0e0(0 + (A - A0 - LC)x(0 + (B - B0 - LD)u(f) (5.100) From Eq. (5.100), it is clear that estimation error, e 0 (f), will go to zero in the steady state irrespective of x(t) and u(t), if all the eigenvalues of A0 are in the left-half plane, and the coefficient matrices of x(?) and u(?) are zeros, i.e. (A — A0 — LC) = 0, (B — B0 — LD) = 0. The latter requirement leads to the following expressions for A0 and B0: A0 = A - L C ; B0 = B-LD (5.101) The error dynamics state-equation is thus the following: 0 (5.102) The observer gain matrix, L, must be selected to place all the eigenvalues of A0 (which are also the poles of the observer) at desired locations in the left-half plane, which implies that the estimation error dynamics given by Eq. (5.102) is asymptotically stable (i.e. e0(0 -> 0 as t -> oo). On substituting Eq. (5.101) into Eq. (5.97), we can write the full-order observer's state-equation as follows: x > ( t ) = (A - LC)Xo(0 + (B - LD)u(f) + Ly(0 - Ax 0 (r) + L[y(0 - Cx0(0 - Du(/)J (5.103) Note that Eq. (5.103) approaches Eq. (5.95) in the steady state if x 0 (r) -> x(r) as t -» oo. Hence, the observer mirrors the plant dynamics if the error dynamics is asymptotically stable. The term [y(0 - Cx0(0 - Du(r)j in Eq. (5.103) is called the residual, and can be expressed as follows: [y(0 - Cxo(r) - Du(f)] = Cx(/) - Cx 0 (r) = Ce0(r) (5.104) From Eq. (5.104), it is clear that the residual is also forced to zero in the steady-state if the error dynamics is asymptotically stable.
  • 275. 260 CONTROL SYSTEM DESIGN IN STATE-SPACE The observer design process merely consists of selecting L by pole-placement of the observer. For single-output plants, the pole-placement of the observer is carried out in a manner similar to the pole-placement of regulators for single-input plants (see Section 5.3.1). For a plant with the characteristic polynomial written as |sl — A| = s" +an-is"~~l H -as + OQ, it can be shown by steps similar to Section 5.3.1 that the observer gain matrix, L, which places the observer's poles such that the observer's characteristic polynomial is sl — A0| = sn + pn-s"~l - h Ps + fa is given by L = [(/?-a)N'N" 1 ] r (5.105) where 0 = [&_i; fl,_ 2 ; ...; ft; ft], a = [«„_,; a n _ 2 ; ...; ai; a0], N is the observability test matrix of the plant described by Eqs. (5.95) and (5.96), and N' is the observability test matrix of the plant when it is in the observer companion form. Since for single-input, single-output systems, the observer companion form can be obtained from the controller companion form merely by substituting A by AT, B by CT, and C by BT (see Chapter 3), you can easily show that N' = F, where F is the controllability test matrix of the plant when it is in the controller companion form. Thus, we can write L = [(jff-a)P'N~ 1 ] r (5.106) Recall that Pf is an upper triangular matrix, given by Eq. (5.51). Example 5.17 Let us try to design a full-order observer for the inverted pendulum on a moving cart (Example 5.9). A state-space representation of the plant is given by Eq. (5.53), with the numerical values of A and B given by Eq. (5.54). For this single-input, two-output plant, let us try to design an observer using only one of the outputs. If we select the single output to be y(t) = 0(f), the angular position of the inverted pendulum, the matrices C and D are the following: C = [l; 0; 0; 0]; D= 0 (5.107) The first thing to do is to check whether the plant is observable with this choice of the output. We do so by the following MATLAB command: »N = (ctrb(A',C'); rank(N) <enter> ans = Since the rank of the observability test matrix, N, is 2, i.e. less than 4, the order of the plant, the plant is unobservable with the angular position of the pendulum as the only output. Hence, we cannot design an observer using y(f) =0(t). If we choose y(t) = jc(f), the cart's displacement, then the output coefficient matrices are as follows: C = [0; 1; 0; 0]; D= 0 (5.108)
  • 276. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 261 On forming the observability test matrix, N, with this choice of output, and checking its rank we get »N = ( c t r b ( A ' , C ' ) ) ; rank(N) <enter> ans = Since now rank (N) = 4, the order of the plant, the plant is observable with y ( t ) = x(t), and an observer can be designed based on this choice of the output. Let us place the observer poles at s = —10 ± 10z, and s = — 20 ± 20/. Then the observer's characteristic polynomial coefficients vector, ft, is calculated as follows: »v = [-10-101 -10+101 -20-201 -20+201]'; p = poly(v); beta = p(2:5) <enter> beta = 60 1800 24000 160000 The plant's characteristic polynomial coefficient vector, a, is calculated as follows: »p = poly(A); a = p ( 2 : 5 ) <enter> d 0 -10.7800 0 0 and the matrix P' is evaluated using Eq. (5.51) as follows: »Pdash = [1 - a ( 1 : 3 ) ; 0 1 - a ( 1 : 2 ) ; 0 0 1 - a ( 1 ) ; 0 0 0 1 ] <enter> Pdash = 1.0000 0 10.7800 0 0 1.000 0 10.7800 0 0 1.0000 0 0 0 0 1.0000 Finally, the observer gain matrix, L, is calculated using Eq. (5.106) as follows: »format long e; L = ( ( b e t a - a ) * P d a s h * i n v ( N ) ) ' <enter> -2.5149795918367356+004 6.0000000000000006+001 -1.8318388612244906+005 1.8107800000000006+003 Note that we have printed out L in the long format, since we need to store it for later calculations. Let us check whether the observer poles have been placed at desired locations, by calculating the eigenvalues of A0 = (A — LC) as follows:
  • 277. 262 CONTROL SYSTEM DESIGN IN STATE-SPACE »Ao = A-L*C; eig(Ao) <enter> ans = -20.0000+20.00001 -20.0000-20.00001 -10.0000+10.00001 -10.0000-10.00001 Hence, observer pole-placement has been accurately achieved. Example 5.17 illustrates the ease by which single-output observers can be designed. However, it is impossible to design single-output observers for those plants which are unobservable with any single output. When multi-output observers are required, gener- ally there are more design parameters (i.e. elements in the observer gain matrix, L) than the observer poles, hence all of these parameters cannot be determined by pole- placement alone. As in the design of regulators for multi-input plants (Section 5.3.2), additional conditions are required to be satisfied by multi-output observers, apart from pole-placement, to determine the observer gain matrix. These additional conditions are hard to come by, and thus pole-placement is not a good method of designing multi- output observers. A better design procedure in such cases is the Kalman filter approach of Chapter 7. MATLAB's Control System Toolbox (CST) provides the command estim for constructing a state-space model, syso, of the observer with the observer gain matrix, L, and a state-space model, sysp, of the plant, with state coefficient matrices A, B, C, D, as follows: »sysp=ss[A,B,C,D]; sysp = estim(syso,L) <enter> The input to the observer thus formed is the plant's output, y(/), while output vector of the observer is [ {Cxo(r)}r; x«(f) r ]T, where Xo(r) is the estimated state-vector. Observers (also known as estimators) by themselves are very useful in estimating the plant dynamics from a limited number of outputs, and are employed in parameter estimation, fault detection, and other similar applications. The utility of an observer in a control system lies in feeding the estimated state-vector to a controller for generating input signals for the plant. The controllers which generate input signals for the plant based on the estimated state-vector (rather than the actual, fed back state-vector) are called compensators. However, design of compensators involves a dilemma. The estimated state-vector is obtained from an observer, which treats the plant's input vector as a known quantity, while the compensator is yet to generate the input vector based on the estimated state-vector. It is like the classic chicken and egg problem, since we do not know which came first: the control input on which the estimated state-vector is based, or the estimated state-vector on which the input is based! A practical way of breaking this vicious circle is the separation principle, which states that if we design an observer (assuming known input vector), and a compensator (assuming known estimated state-vector) separately, and then combine the two, we will end up with a control system that works. The separation principle thus allows us to design the observer and the controller independently of each
  • 278. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 263 other. The resulting control system can be a regulator or a tracking system, depending on the desired state-vector being zero or non-zero, respectively. Let us consider a tracking system (i.e. a control system with a non-zero desired state- vector) based on a noise-free plant described by Eqs. (5.95) and (5.96), for which a full-order observer, given by Eq. (5.103) has been designed. Then a compensator can be designed to generate the input vector for the plant according to the following control-law: - Kdxd(0 (5.109) where x0(0 is the estimated state-vector, xd(0 is the desired state-vector, K is the feedback gain matrix, and Kd is the feedforward gain matrix. On substituting Eq. (5.109) into Eq. (5.103), the observer state-equation becomes x ( V'(0 = (A - LC - BK + LDK)Xo(0 + (B - LD)(K - K d )x d (r) + Ly(?) (5.110) On substituting the output equation, Eq. (5.96), into Eq. (5.110), and again substituting Eq. (5.109), we get the following state-equation for the compensator: = (A - LC - BK)o(0 + B(K - K d )x d (0 + LCx(f) (5.111) The plant's state-equation, Eq. (5.95), when the input is given by Eq. (5.109), becomes the following: = Ax(0 - BKxo(r) + B(K - K d )x d (r) (5.112) Equations. (5.111) and (5.112) are the state-equations of the closed-loop system, and can be expressed as follows: A -BK ["B(K- LC (A - LC - BK) [B(K-K d ) (5.in) The closed-loop tracking system is thus of order 2n, where n is the order of the plant. The input to the closed-loop system is the desired state-vector, Xd(0- A schematic diagram of the tracking system is shown in Figure 5.16. Note that this control system is essentially Compensator Plant Figure 5.16 Closed-loop tracking system with a full-order compensator
  • 279. 264_ CONTROL SYSTEM DESIGN IN STATE-SPACE _ based on the feedback of the output vector, y(r), to the compensator, which generates the input vector, u(f), for the plant. To obtain the state-equation for the estimation error, e 0 (/) = x(0 — Xo(r), let us write Eq. (5.112) as follows: x (1) (r) - (A - BK)x(r) + BKe0(0 + B(K - Kd)Xd(/) (5.1 14) On subtracting Eq. (5.111) from Eq. (5.114) we get /) (5.115) which is the same as Eq. (5.102). The state-equation for the tracking error, e(/) = x(f), is obtained by subtracting Eq. (5.114) from Eq. (5.74), which results in e(1)(0 = (A - BK)c(0 + (Ad - A + BKd)Xd(f) - BKe0(r) (5.1 16) The tracking system's error dynamics is thus represented by Eqs. (5.1 15) and (5.1 16), which can be expressed together as follows: e<'>(Ol_f(A-BK) -BK ] [ e(r) ] , F(A d - A + BK,,) - « (A-LC)(r) + 0 ^O (5.117) Note that Eq. (5.117) represents the closed-loop tracking system in a decoupled state-space form. The closed-loop poles must be the eigenvalues of the following closed-loop state- dynamics matrix, ACL^ ^~BK) ° 1 ,5118) (5 118) 0 (A-LC)J ' Equation (5.117) implies that the closed-loop poles are the eigenvalues of ACL- i.e. the roots of the characteristic equation sl — ACL| = 0, which can be written as |[si - (A - BK)][sI - (A - LC)]| = 0, resulting in sl - (A - BK)| = 0 and sl - (A —LC)| =0. Hence, the closed-loop poles are the eigenvalues of (A — BK) and eigenvalues of (A — LC), which are also the poles of the full-state feedback regulator and the observer, respectively. Note from Eq. (5.117) that for the estimation error, e 0 (/), to go to zero in the steady state, all the eigenvalues of (A — LC) must be in the left-half plane. Also, for the tracking error, e(r), to go to zero in the steady state, irrespective of the desired state-vector, Xd(0, all the eigenvalues of (A — BK) must be in the left-half plane, and the coefficient matrix multiplying d(0 must be zero, (Ad — A + BKd) = 0. Recall from Section 5.3 that (A — BK) is the state-dynamics matrix of the full-state feedback regulator, and from Eq. (5.103) that (A — LC) is the state-dynamics matrix of the full- order observer. Hence, the compensator design process consists of separately deriving the feedback gain matrices L and K, by pole-placement of the observer and the full- state feedback regulator, respectively, and selecting Kd to satisfy (Ad — A + BKd) = 0. Usually, it is impossible to satisfy (Ad — A + BKd) = 0 by selecting the feedforward gain matrix, K^. Alternatively, it may be possible to satisfy (Ad — A 4- BKd)x<j(0 = 0 when
  • 280. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 265 some elements of Xd(0 are zeros. Hence, the steady state tracking error can generally be reduced to zero only for some values of the desired state-vector. In the above steps, we have assumed that the desired state-vector, Xd(0> is available for measurement. In many cases, it is possible to measure only a desired output, jd(0 = C d Xd(0, rather than xd(0 itself. In such cases, an observer can be designed to estimate x d (f) based on the measurement of the desired output. It is left to you as an exercise to derive the state- equations for the compensator when Xd(?) is not measurable. Example 5.18 Let us design a compensator for the inverted pendulum on a moving cart (Example 5.9), when it is desired to move the cart by 1 m, while not letting the pendulum fall. Such a tracking system is representative of a robot, which is bringing to you an inverted champagne bottle precariously balanced on a finger! The plant is clearly unstable (as seen in Example 5.9). The task of the compensator is to stabilize the inverted pendulum, while moving the cart by the desired displacement. The desired state-vector is thus a constant, consisting of the desired angular position of the inverted pendulum, 6&(t) = 0, desired cart displacement, x&(t} = 1 m, desired angular velocity of the pendulum, #d t) = 0, and desired cart velocity, x(d t) = 0. Hence, xd(0 = [0; 1; 0; O]7. Since xd(0 is constant, it implies that x d '(0 = 0, and from Eq. (5.74), Ad = 0. By the separation principle, we can design a tracking system assuming full-state feedback, and then combine it with a full-order observer, which estimates the plant's state-vector. A full-state feedback regulator has already been designed for this plant in Example 5.11, which places the eigenvalues of the regulator state-dynamics matrix, (A — BK), at s = -7.853 ± 3.252S/, and 5 = —7.853 ± 7.853z using the following feedback gain matrix: K = [-1362.364050360232; -909.3160795202226; -344.8741667548096; -313.4621667548089] (5.119) We have also designed a full-order observer for this plant using the cart displace- ment, x ( t ) , as the output in Example 5.17. The observer poles, i.e. the eigenvalues of (A - LC), were selected to be at s = -10 ± 0i, and 5 - -20 ± 20/, and the observer gain matrix which achieved this observer pole configuration was obtained to be the following: L = [-25149.79591836735; 60.0; -183183.8861224490; 1810.780]f (5.120) The separation principle allows us to combine the separately designed observer and regulator into a compensator. However, it remains for us to determine the feedforward gain matrix, Kd. The design requirement of zero tracking error in the steady state is satisfied if (Ad - A + BKd)x d (/) = 0 in Eq. (5.117). The elements of
  • 281. 266 CONTROL SYSTEM DESIGN IN STATE-SPACE Kd = [ Kd Kj2 KJT,; K<J4 ] are thus determined as follows: " 0 " "0" (Ad — A + BKd)Xd(0 = o = o (5.121) K-d2 _Kd2_ 0_ Equation (5.121) is exactly satisfied by selecting Kdi = 0. What about the other elements of Kd? There are no conditions placed on the other elements of Kd, and thus we can arbitrarily take them to be zeros. Therefore, by choosing Kd = 0, we are able to meet the zero tracking error requirement in the steady state. On substituting the designed values of the gain matrices, K, L, and Kd into Eq. (5.113), we can get the closed-loop state-equations for the tracking system in terms of the plant's state-vector, x(f), and the estimated state-vector, Xo(/), and then solve them to get the closed-loop response. This is done using MATLAB as follows: »K=[-1362.364050360232 -909.3160795202226 -344.8741667548096 -313.46216675 48089]; <enter> »L=[-25149.79591836735 60.0 -183183.8861224490 1810.780]'; Kd=zeros(1 ,4) ; <enter> »ACL = [A -B*K; L*C ( A - L * C - B * K ) ] ; BCL = [ B * ( K - K d ) ; B * ( K - K d ) ] ; < e n t e r > Let us confirm that the eigenvalues of ACL are the poles of the regulator designed in Example 5.11 and the observer designed in Example 5.17 as follows: »eig(ACL) <enter> ans = -20.0000+20.00001 -20.0000-20.00001 -10.0000+10.00001 -10.0000-10.00001 -7.8530+7.85301 -7.8530-7.85301 -7.8530+3.25281 -7.8530-3.25281 which indeed they are. Finally, the closed-loop response to the desired state-vector is calculated as follows: »t = 0:1.0753e-2:1.2; n=size(t,2); for i=1:n; Xd(i,:) = [ 0 1 0 0 ] ; end <enter> »sysCL=ss(ACL, BCL,[C z e r o s ( 1 , 4 ) ] , z e r o s ( 1 , 4 ) ) ; [ y , t , X ] = lsim(sysCL,Xd,t'); <enter> The closed-loop cart's displacement, jc(r), and pendulum's angular position, 0(0. are plotted in Figure 5.17, as follows: »plot(t,X(: > 1:2)) <enter>
  • 282. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 267 2 1.5 1 Cart's displacement, x(t), in meters 0.5 Pendulum's angular position, 9(t), 0 in radians -0.5 -1 -1.5 _2 I | L 0 0.2 0.4 0.6 0.8 1.2 Time (s) Figure 5.1 7 Response of the compensator based tracking system for inverted- pendulum on a moving cart, with desired angular position, 0^(t) = 0, and desired cart's displacement, x^Cr) = 1 m, when the regulator poles are s = -7.853 ± 3.2S28/, and s = -7.853 ± 7.S53/ The closed-loop transient response for x ( t ) and 9(t) is seen in Figure 5.17 to settle to their respective desired values in about 1 s, with maximum overshoots of 1 .65 m and 1.57rad., respectively. However, an overshoot of 1.57 rad. corresponds to 90°, which implies that the pendulum has been allowed to fall and then brought back up to the inverted position, 9(t) = 0°. If the inverted pendulum represents a drink being brought to you by a robot (approximated by the moving cart), clearly this compensator design would be unacceptable, and it will be necessary to reduce the maximum overshoot to an angle less than 90° by suitably modifying the closed-loop poles. Recall from Example 3.3 that the linearized state-space model of the system given by Eq. (5.53) is invalid when the pendulum sways by a large angle, 0 ( t ) , and the results plotted in Figure 5.17 are thus inaccurate. Hence, the regulator design that was adequate for stabilizing the plant in the presence of a small initial disturbance in cart displacement, is unsatisfactory for moving the cart by a large displacement. Note that the location of the regulator poles, i.e. the eigenvalues of (A — BK), governs the closed-loop response of the plant's state-vector, x(f). By moving the regulator poles closer to the imaginary axis, it would be possible to reduce the maximum overshoot at the cost of increased settling time. Let us select the new regulator poles as s = -0.7853 ± 3.25328* and s = -0.7853 ± 0.7853*. The new feedback gain matrix, K, is calculated as follows: »v=[- 0.7853+3. 253281 -0.7853-3.253281 -0.7853+0.78531 -0.7853-0.78531]'; K=place(A,B,v) place: ndigits= 16 K = -27.0904 -1.4097 -5.1339 -1.9927
  • 283. 268 CONTROL SYSTEM DESIGN IN STATE-SPACE I I I I 1 / 0.8 Carf s displacement, x(t), in meters - 0.6 / 0.4 / / Pendulum's angular position, 0(t), in 0.2 / radians 0 -0.2 ( i i i i ) 2 4 6 8 1( Time (s) Figure 5. 1 8 Response of the compensator based tracking system for inverted- pendulum on a moving cart, with desired angular position, Oj(t) = 0, and desired carfs displacement, x^f) = 1 m, when regulator poles are s = -0.7853 ± 3.2532S/ and s = -0.7853 ± 0.7853/ and the new closed-loop response is plotted in Figure 5.18, which shows that the maximum overshoots have been reduced to less than l . l m and 0.1 rad. (5.7°) for jc(/) and 0(/), respectively, but the settling time is increased to about 7 s. Since the pendulum now sways by small angles, the linearized model of Eq. (5.53) is valid, and the compensator design is acceptable. However, the robot now takes 7 seconds in bringing your drink placed 1 m away! You may further refine the design by experimenting with the regulator pole locations. Let us see how well the compensator estimates the state-vector by looking at the estimation error vector, e 0 (r) = x(r) — XQ(/). The elements of the estimation error vector, eol(f) = 0d(0 - 0(0, eo2(t) = *d(0 - *(0, *o3(0 = 0dU(0 - 0 (l) (0, and = x^(t) — *(1)(0 are plotted in Figure 5.19 as follows: »plot(tJX(:,1)-X(:>5),t>X(:J2)-X(:,6),t,X(:J3)-X(:,7)>t,X(:>4)-X(:,8)) <enter> Figure 5.19 shows that the largest estimation error magnitude is about 1.5 x 10 9 rad/s for estimating the pendulum's angular velocity, 0 (1) (0, and about 5 x 10~10 rad. for estimating the pendulum's angular position, 0(0- Since the observer is based on the measurement of the cart's displacement, x(t), the estimation error magnitudes of x ( t ) and :t(1)(0 are seen to be negligible in comparison with those of 0(0 and 0 ( 1 ) (f )• All the estimation errors decay to zero in about 7 s, which is the same time as the settling time of the closed-loop response for the state-vector, x(r). The observer poles are therefore at acceptable locations. Note that we can move the observer poles as much inside the left- half plane as we want, because there is no control input cost associated with the observer. However, if the measurements of the output are noisy, there will be an increased influence
  • 284. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 269 x10,-9 1.5 %>(') = 1 0.5 0 -0.5 0 4 6 10 Time (s) Figure 5.19 Estimation errors for the compensator based tracking system for inverted- pendulum on a moving cart, with desired angular position, #d(f) = 0, and desired carfs displacement, x^f) = 1 m, when regulator poles are s = -0.7853 ± 3.253281 and s = -0.7853 ± 0.7853/ of noise on the closed-loop system if the observer poles are too far inside the left-half plane. 5.4.2 Pole-placement design of reduced-order observers and compensators When some of the state variables of a plant can be measured, it is unnecessary to estimate those state variables. Hence, a reduced-order observer can be designed which estimates only those state variables that cannot be measured. Suppose the state-vector of a plant, x(f), can be partitioned into a vector containing measured state variables, %i(0, and unmeasurable state variables, xi(t), i.e. x(0 = [xi(0 r ; x 2 (0 r ] 7 - The measured output vector, y(r), may either be equal to the vector, xi(0 - implying that all the state variables constituting xi(f) can be directly measured - or it may be equal to a linear combination of the state variables constituting i(t). Hence, the output equation can be generally expressed as (5.122) where C is a constant, square matrix, indicating that there are as many outputs as the number of elements in x t (r). When X](f) can be directly measured, C = I. The plant's state-equation (Eq. (5.95)) can be expressed in terms of the partitioned state-vector,
  • 285. 270 CONTROL SYSTEM DESIGN IN STATE-SPACE x(/) — [ i ( t ) T ; 2(t)T]T, as follows: l}(t) = AnXi(r) + Ai 2 x 2 (r) + B!U(/) (5.123) -A 22 x 2 (r) + B 2 u(r) (5.124) where FA,, A.,1 fR.l (5.125) Let the order of the plant be n, and the number of measured state variables (i.e. the dimension of (t)) be k. Then a reduced-order observer is required to estimate the vector x2(0, which is of dimension (n — k). Hence, the estimated state- vector is simply given by *o2(') (5.126) where x«2(0 is the estimation of the vector x 2 (r). Note that Eq. (5.126) requires that C should be a non-singular matrix, which implies that the plant should be observable with the output given by Eq. (5.122). If the plant is unobservable with the output given by Eq. (5.122), C would be singular, and a reduced-order observer cannot be designed. The observer state-equation should be such that the estimation error, eo2(0 = x2(0 — x<,2(0, is always brought to zero in the steady state. A possible observer state-equation would appear to be the extension of the full-order observer state-equation (Eq. (5.103)) for the reduced-order observer, written as follows: xiu(0 = Ax0(/) + Bu(/) + L[y(r) - CXCOl (5-127) where the observer gain matrix, L, would determine the estimation error dynamics. On substituting Eq. (5.126) into Eq. (5.127), and subtracting the resulting state-equation for Xo2(0 from Eq. (5.124), we can write the estimation error state-equation as follows: ei 2 ) (r)=A 22 e o2 (r) (5.128) However, Eq. (5.128) indicates that the estimation error is unaffected by the observer gain matrix, L, and solely depends upon the plant's sub-matrix, A22. If A22 turns out to be a matrix having eigenvalues with positive real parts, we will be stuck with an estimation error that goes to infinity in the steady state! Clearly, the observer state-equation given by Eq. (5.127) is unacceptable. Let us try the following reduced-order observer dynamics: = Ly(f) + z(0 (5.129)
  • 286. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 271 where z(r) is the solution of the following state-equation: (5.130) Note that the reduced-order observer gain matrix, L, defined by Eq. (5.129), is of size [(/? — k) x k], whereas the full-order observer gain matrix would be of size (n x k). On differentiating Eq. (5.129) with respect to time, subtracting the result from Eq. (5.124), and substituting z(0 = xo2(0 — Ly(0 = x2(0 — eo2(0 — LCxj(0, the state-equation for estimation error is written as follows: e$(0 = Feo2(0 + (A21 - LCAn + FLC)xi(0 + (A22 - LCA12 - F)x2(0 + (B2 - LCB! - H)u(0 (5.131) Equation (5.131) implies that for the estimation error, eo2(0, to go to zero in the steady state, irrespective of Xi(0, x2(0, and u(0, the coefficient matrices multiplying xi(0, x2(0, and u(0 must vanish, and F must have all eigenvalues in the left-half plane. Therefore, it follows that - A22 - LCA12; = B 2 -LCB i ; G = FL + (A 21 - ~l (5.132) The reduced-order observer design consists of selecting the observer gain matrix, L, such that all the eigenvalues of F are in the left-half plane. Example 5.19 Let us design a reduced-order observer for the inverted pendulum on a moving cart (Example 5.9), based on the measurement of the cart displacement, x ( t ) . The first step is to partition the state-vector into measurable and unmeasurable parts, i.e. x(r) = [xi(0 r ; x2(0r ]T , where xi(0 = x ( t ) , and 0 (1) (0; x ( l ) ( t ) ] T . However, in Example 5.9, the state-vector was expressed as [0(0; *(0; 0 (1) (0; x ( } } ( t ) ] T . We must therefore rearrange the state coefficient matrices (Eq. (5.54)) such that the state-vector is x(0 — [,r(0; 0(0; 0 (1) (0; ^ (1) (01 r and partition them as follows: o o r 0 A = 0 1 0 B 6 10.78 0 0 -i -0.98 0 0 i (5.133) From Eq. (5.133) it is clear that An=0; Ai2 = [0 0 1]; =0 0 A2i = A22 = 10.78 0 B, = (5.134) - 0.98 0 0
  • 287. 271 CONTROL SYSTEM DESIGN IN STATE-SPACE Since the measured output is Xi(0 = ;c(f), the output equation is y(f) = Cxi(f), where C = 1. We have to select an observer gain-matrix, L, such that the eigenvalues of F = (A22 — LCAi2) are in the left-half plane. Let us select the observer poles, i.e. the eigenvalues of F, to be s = -20, s = -20 ± 20i. Then L is calculated by pole-placement as follows: »A12 = [0 0 1]; A22 = [0 1 0; 10.78 0 0; -0.98 0 0]; C = 1; <enter> »v = [ - 2 0 -20+20i -20-201]'; L = (place(A22',A12'*C',v))' <enter> L = -1.64376+003 -1.69876+004 6.00006+001 Therefore, the observer dynamics matrix, F, is calculated as follows: »F = A22 - L*C*A12 <enter> F = 0 1.00006+000 1.64376+003 1.07806+001 0 1.69876+004 -9.80006-001 0 -6.00006+001 Let us verify that the eigenvalues of F are at desired locations: »eig(F) <enter> ans = -2.OOOOe+001+2.OOOOe+001i -2.OOOOe+001-2.OOOOe+001i -2.00006+001 which indeed they are. The other observer coefficient matrices, G and H, are calculated as follows: »A11 = 0; A21 = [00 0]'; B1 = 0; B2 = [0 -1 1]'; H = B2 - L*C*B1 <enter> H = 0 -1 1 »G = F*L + (A21 - L*C*A11)*inv(C) <enter> G = 8.1633e+004 1.00156+006 -1.98926+003
  • 288. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 273 A compensator based on the reduced-order observer can be designed by the separation principle, in a manner similar to the compensator based on the full-order observer. The control-law defining the reduced-order compensator for a tracking system can be expressed as follows, after substituting Eq. (5.126) into Eq. (5.109): u(0 = K[Xd(0 - Xo(01 - = (K - K d )x d (0 K2xo2(0 (5.135) where xd(0 is the desired state-vector, Kd is the feedforward gain matrix, and K is the feedback gain matrix, which can be partitioned into gain matrices that feedback xj(f) and xo2(0, respectively, as K = [ K j ; K2 ]. A schematic diagram of the reduced-order compensator is shown in Figure 5.20. The estimation error dynamics of the reduced-order compensator is described by the following state-equation, obtained by substituting Eq. (5.132) into Eq. (5.131): ^o2 (0 — Feo2(0 (5.136) while the state-equation for the tracking error, e(0 = *d(0 — x(0, is obtained by subtracting Eq. (5.74) from Eq. (5.95), and substituting Eq. (5.135) as follows: - Ae(0 + (Ad - A + BKd)x d (0 - BK[xd(0 - x0(0] (5. 137) On substituting for x0(0 from Eq. (5.126), Eq. (5.137) can be written as follows: e (1) (0 = (A - BK)e(0 + (Ad - A + BK d )x d (0 - BK2eo2(0 (5.138) Hence, the dynamics of the tracking system can be described by Eqs. (5.136) and (5.138). To have the tracking error go to zero in the steady state, irrespective of xd(0, we must select the feedforward gain matrix, Kd, such that (Ad — A + BK<j)xd(0 = 0, and the feedback gain matrix, K, such that the eigenvalues of (A — BK) are in the left-half plane. Since the eigenvalues of (A — BK) are the regulator poles, and eigenvalues of F are Compensator Figure 5.20 Tracking system based on reduced-order compensator
  • 289. 274 CONTROL SYSTEM DESIGN IN STATE-SPACE the reduced-order observer poles, it follows from Eqs. (5.136) and (5.138) that the poles of the tracking system are of observer and regulator poles. (Prove this fact by finding the eigenvalues of the closed-loop system whose state-vector is [e(0r; e<>2(0 r ] r -) According to the separation principle, the design of regulator and observer can be carried out separately by pole-placement. Note from Eqs. (5.136) and (5.138) that the order of the reduced-order tracking system is (2n — k), where k is the number of measurable state- variables. Recall form the previous sub-section that the order of the full-order tracking system was 2n. Thus, the more state-variables we can measure, the smaller will be the order of the tracking system based on reduced-order observer. Example 5.20 Let us re-design the tracking system for the inverted pendulum on a moving cart (Example 5.18), using a reduced-order observer. Recall that it is desired to move the cart by 1 m, while not letting the pendulum fall. We have already designed a reduced-order observer for this plant in Example 5.19, using the measurement of the cart's displacement, ;c(r), such that the observer poles are s = —20, s = -20±20/. In Example 5.18, we were able to make (Ad - A + BKd)Xd(0 = 0 with Kd = 0. It remains to select the regulator gain matrix, K, such that the eigenvalues of (A — BK) are at desired locations in the left-half plane. As in Example 5.18, let us choose the regulator poles to be s = —0.7853 ± 3.2532S/ and 5 = —0.7853 ± 0.7853/. Note that we cannot directly use the regulator gain matrix of Example 5.18, because the state-vector has been re-defined in Example 5.19 to be x(/) = [x(t) 0(0; 0 (1) (0; * (1) (0 ] r , as opposed to x(0 = [0(0; *(0; 0 (1) (0; *(1)(01r of Example 5.18. The new regulator gain matrix would thus be obtained by switching the first and second elements of K calculated in Example 5.18, or by repeating pole-placement using the re-arranged state coefficient matrices as follows: »A = [A11 A12; A21 A22]; B = [B1; B2]; <enter> »v= [ - 0.7853+3.253281 - 0.7853 - 3.253281 - 0.7853+0.78531 -0.7853-0.78531]'; K=place(A,B,v) <enter> place: ndigits= 16 K = -1.40976+000 -2.70906+001 -5.13396+000 -1.99276+000 The partitioning of K results in KI = -1.4097 and K2 = [-27.090; -5.1339; — 1.9927]. The closed-loop error dynamics matrix, ACL* is the state-dynamics matrix obtained by combining Eqs. (5.136) and (5.138) into a state-equation, with the state- vector, [e(0; e02(0 ]r, and is calculated as follows: »K2 = K ( 2 : 4 ) ; ACL = [A-B*K -B*K2; zeros(3,4) F]; <enter>
  • 290. OBSERVERS, OBSERVABILITY, AND COMPENSATORS 275 The eigenvalues of ACL are calculated as follows: »eig(ACL) <enter> ans = - 7.8530e-001+3.2533e+000i -7.8530e-001-3.2533e+000i -7.85300-001+7.85306-0011 -7.85300 -001 - 7.85306 -001i - 2.00000+001+2.00006+001i -2.00000+001-2.00000+0011 -2.00000+001 Note that the closed-loop eigenvalues consist of the regulator and observer poles, as expected. The closed-loop error response (i.e. the solution of Eqs. (5.136) and (5.138)) to Xd(f) = [1; 0; 0; 0]r is nothing else but the initial response to [e(0)r; e,,2(0)7]r = [1; 0; 0; 0; 0; 0; O]7", which is computed as follows: »sysCL=ss(ACL,zeros(7,1) , e y e ( 7 ) , z e r o s ( 7 , 1 ) ) ; [ y , t , e ] = initial(sysCL,[1 z e r o s ( 1 , 6 ) ] ) ; <enter> The estimation error vector, e02(?) is identically zero for this example, while the tracking errors, i.e. elements of e(0, are plotted in Figure 5.21. Note in Figure 5.21 that all the error transients decay to zero in about 7 s. The maximum value for the cart's velocity, x(l)(t), is seen to be about 0.9 m/s, while the angular velocity of the pendulum, 6> ( 1 ) (/)> reaches a maximum value of 0.25 rad/s. The angular displacement of the pendulum, 9(t), is always less than 0.1 rad (5.73°) in magnitude, which is acceptably small for the validity of the linear plant model. -0.5 - Figure 5.21 Tracking error response of closed-loop system consisting of an inverted pendulum on a moving cart and a reduced-order compensator (Example 5.20)
  • 291. 276_ CONTROL SYSTEM DESIGN IN STATE-SPACE _ 5.4.3 Noise and robustness issues If noise is present in the plant, the plant's state-space representation is given by Eqs. (5.26) and (5.27), and the feedback control-law, Eq. (5.109), is modified as follows: u(f) = K[Xd(0 - «o(0] - KdXdCO - K n x n (0 (5.139) where x<i(0 and xn(0 are the desired state-vector and the noise vector, respectively, and Kd and Kn are the feedforward gain matrices. In Eq. (5.139) it is assumed that both Xd(0 and xn(0 can be measured, and thus need not be estimated by the observer. In case Xd(0 and xn(0 are unmeasurable, we have to know the state-space model of the processes by which they are generated, in order to obtain their estimates. While it may be possible to know the dynamics of the desired state- vector, x<j(r), the noise- vector, xn(0, is usually generated by a non-deterministic process whose mathematical model is unknown. In Chapter 7, we will derive observers which include an approximate model for the stochastic processes that generate noise, and design compensators for such plants. In Chapter 7 we will also study the robustness of multivariable control systems with respect to random noise. SIMULINK can be used to simulate the response of a control system to noise, parameter variations, and nonlinearities, thereby giving a direct information about a system's robustness. Example 5.21 Let us simulate the inverted-pendulum on a moving cart with the control system designed in Example 5.18 with a full-order compensator, with the addition of measurement noise modeled as a band limited white noise source block of SIMULINK. White noise is a statistical model of a special random process that we will discuss in Chapter 7. The parameter power of the white noise block representing the intensity of the noise is selected as 10~8. A SIMULINK block-diagram of the plant with full-order compensator with regulator and observer gains designed in Example 5.18 is shown in Figure 5.22. Note the use of matrix gain blocks to synthesize the compensator, and a masked subsystem block for the state-space model of the plant. The matrix gain blocks are named B = B1 for the matrix B, C = C1 for the matrix C, L = LI for the observer gain matrix L, and K = Kl = K2 for the regulator gain matrix, K. The scope outputs thet, x, thdot and xdot are the state- variables 0(0, x(t), 0 ( 1 ) (0> and je (1) (0, respectively, which are demux-ed from the state vector of the plant, and are also saved as variables in the MATLAB workspace. The resulting simulation of 9(t) and x ( t ) is also shown in Figure 5.22. Note the random fluctuations in both 0(0 and x(t) about the desired steady-state values of jcd = 1 m and 0<j = 0. The maximum magnitude of 0(0 is limited to 0.1 rad., which is within the range required for linearizing the equations of motion. However, if the intensity of the measurement noise is increased, the 0(0 oscillations quickly surpass the linear range. The simulation of Figure 5.22 also conforms to our usual experience in trying to balance a stick vertically on a finger.
  • 292. EXERCISES 277 K1 r/txx'n [4x1 J r"i r~ xdot i Xd ; t B1 MM K2 c1 1 K*u s W_ Inverted pendulum Integratorl on a moving cart C V 7 KV 7 A Band-limited white noise Subsystem block for Inverted pendulum on a moving cart 0.2 n i i i i r 0.1 ° -0.1 -0.2 j i 0 8 10 12 14 16 18 20 Time (s) 1.5 1 0.5 0 -0.5 j i I I I 0 10 12 14 16 18 20 Time (s) Figure 5.22 Simulation of the inverted pendulum on a moving cart with a full-order compensator and measurement noise with SIMULINK block-diagram Exercises 5.1. Check the controllability of the plants with the following state-coefficient matrices: *-[? -i]= -[-? ?]
  • 293. 278 CONTROL SYSTEM DESIGN IN STATE-SPACE 0 1 0" "0" (b) A= 25 0 -1 ; B= 1 (5.141) 0 0 0 5 5.2. As discussed in Section 5.1, an unstable plant is said to be stabilizable if all the uncontrollable sub-systems have stable eigenvalues. Check whether the plants given in Exercise 5.1 are stabilizable. 5.3. If a plant is stabilizable (see Exercise 5.2), we can safely ignore the uncontrollable sub- systems by removing the rows and columns corresponding to the uncontrollable states from the state coefficient matrices, A and B. The resulting state-space representation would be controllable, and is called a minimal realization. Find the minimal realization of the state coefficient matrices, A and B for the plants in Exercise 5.1. 5.4. A distillation column in a chemical plant has the following state-coefficient matrices: "-21 0 0 0" "6000 0 0.1 -5 0 0 0 0 A= r 0 re -1.5 n 0 X ,: 0 B= B- " 0 " 2.3 (5.142) 0 -4 0 0 0 0.1 (a) Is the plant controllable? (b) Suppose we would like to control the plant using only one input at a time. Is the plant controllable with only the first input, i.e. with B = [6000; 0; 0; 0]r? Is the plant controllable with only the second input, i.e. with B = [0; 0; 2.3; 0.1 ] r ? 5.5. For the aircraft with lateral dynamics given in Eq. (4.97) in Exercise 4.3: (a) is the aircraft controllable using both the inputs? (b) is the aircraft controllable using only the aileron input, S/^(t)l (c) is the aircraft controllable using only the rudder input, 5.6. Consider the longitudinal dynamics of a flexible bomber airplane of Example 4.7, with the state-space representation given by Eq. (4.71). (a) Is the aircraft controllable using both the inputs, u ( t ) and «2(0? (b) Is the aircraft controllable using only the desired elevator deflection, u(t)l (c) Is the aircraft controllable using only the desired canard deflection, 5.7. For the aircraft in Exercise 5.5, can you design a full-state feedback regulator which places the closed-loop poles of the aircraft at 51,2 = — 1 ± i; , $3 = — 15, s4 = —0.8 using only one of the inputs ? If so, which one, and what is the appropriate gain matrix? 5.8. For the aircraft in Exercise 5.6, design a full-state feedback regulator using both the inputs and the MATLAB (CST) command place, such that the closed-loop poles are located
  • 294. EXERCISES 279 at £ , 2 = — 3 ± 3i, .93,4 = — 1 ± 2i, s5 = -100, st, = -75. Find the maximum overshoots and settling time of the closed-loop initial response if the initial condition vector is x(0) = [0;0.5;0;0;0;0f. 5.9. For the distillation column of Exercise 5.4, design a full-state feedback regulator to place the closed-loop poles at $1.2 = —0.5 ± 0.5i, .53 = —5, ^4 = —21. 5.10. Repeat Exercise 5.9 for the closed-loop poles in a Butterworth pattern of radius, R — 5. Compare the initial response of the first state-variable (i.e. for C = [l;0;0;0] and D = [0; 0]) of the resulting closed-loop system with that of Exercise 5.9 for initial condition, x(0) = [1; 0; 0; 0]r. Which of the two (present and that of Exercise 5.9) regulators requires the larger control input magnitudes for this initial condition? 5.11. Consider the turbo-generator of Example 3.14, with the state-space representation given byEq. (3.117). (a) Is the plant controllable using both the inputs, u ( t ) and wi(0? (b) Is the plant controllable using only the input, W ] ( f ) ? (c) Is the plant controllable using only the input, ui(t)l (d) Design a full-state feedback regulator for the plant using only the input, u ( t ) , such that the closed-loop eigenvalues are at 51,2 = —2.5 ± 2.5/, 53.4 = — 1 ± /, s$ = —10, ^6 =-15. (e) Repeat part (d) using only the input, «2(0- (0 Repeat part (d) using both the inputs, u { ( t ) and « 2 (0, and the MATLAB (CST) command place for designing the multi-input regulator. (g) Re-design the regulators in parts (d)-(f), such that the maximum overshoot and settling time for the output, y i ( t ) , are less than 0.3 units and 6 seconds, respectively, if the initial condition vector is x(0) = [0.1; 0; 0; 0; 0; O] 7 . (h) Re-design the regulators in parts (d)-(f), such that the closed-loop poles are in a Butterworth pattern of radius, R — 10, and compare the closed-loop initial responses and input magnitudes with those of part (g). 5.12. Check the observability of the plants with the following state coefficient matrices: "-1 0 0 (a) A = 0.3 -0.1 0.05 ; C=[0 0 -2] (5.143) 1 0 0 0 0.1 -100 4 -250 -7 3 50 (b) A = 0 0 - 3.3 0.06 ; C = [0 0 1 0] (5.144) 2 0 0 0.25 ,, A (C)A= "0 0 1- Cr f l °1 (5.145) 0 -1 ' ~ -2 0
  • 295. 280 CONTROL SYSTEM DESIGN IN STATE-SPACE 5.13. An unstable plant is said to be detectable if all the unobservable sub-systems have stable eigenvalues. Check whether the plants given in Exercise 5.12 are detectable. 5.14. If a plant is detectable (see Exercise 5.13), we can safely ignore the unobservable sub- systems by removing the rows and columns corresponding to the unobservable states from the state coefficient matrices, A and B. The resulting state-space representation would be observable, and is called a minimal realization. Find the minimal realization of the state coefficient matrices, A and B for the plants in Exercise 5.12. 5.15. For the distillation column of Exercise 5.4, the matrices C and D are as follows: „ |~0 0 1 0~| _ fO 0"| ,_,.,. c= [ o o o ij ; D= [ o oj (5 146) ' (a) Is the plant observable? (b) Is the plant observable if only the first output was measured, i.e. C = [0; 0; 1; 0], D = 0? (c) Is the plant observable if only the second output was measured, i.e. C = [0; 0; 0; 1], D = 0? 5.16. For the aircraft with lateral dynamics given in Eq. (4.97) in Exercise 4.3: (a) is the aircraft observable with the output vector, y(t) = [p(t); r(r)] r ? (b) is the aircraft observable with the output vector, y(f) = [p(t) <f>(t)]T1 (c) is the aircraft observable with the bank-angle, 4>(t), being the only measured output? (d) is the aircraft observable with the sideslip-angle, fi(t), being the only measured output? (e) design a full-order observer for the aircraft using only one of the state-variables as the output, such that the observer poles are placed at s.2 = —2 ± 2/, sj, = —16, 54 = —2. (f) design a full-order compensator based on the regulator of Exercise 5.7, and the observer designed in part (e). Calculate and plot the initial response, 0(r), of the compensated system if the initial condition is x(0) = [0.5; 0; 0; 0]r. 5.17. Consider the longitudinal dynamics of a flexible bomber airplane of Example 4.7. (a) Is the aircraft observable using both the outputs, y(t) and >'2(0? (b) Is the aircraft observable with only the normal acceleration, y(t), as the measured output? (c) Is the aircraft observable with only the pitch-rate, y2(t), as the measured output? (d) Design a full-order observer for the aircraft using only the normal acceleration output, y(t), such that the observer poles are placed at s.2 = — 4 ± 4 / , 534 = — 3 ± 3 / , 55 = -100, 56 = -75. (e) Design a full-order compensator for the aircraft with the regulator of Exercise 5.8 and the observer of part (d). Compute the initial response of the compensated system
  • 296. EXERCISES 281 with the initial condition given by x(0) = [0; 0.5; 0; 0; 0; 0]r, and compare with that obtained for the regulated system in Exercise 5.8. Also compare the required inputs for the regulated and compensated systems. 5.18. For the distillation column of Exercise 5.15, design a two-output, full-order observer using the MATLAB (CST) command place such that the observer poles are placed at 5i,2 = — 2 ± 2i, 53 = —5, $4 = —21. With the resulting observer and the regulator designed in Exercise 5.9, design a full-order compensator and find the initial response of the compensated system for the initial condition x(0) = [l;0;0;0] r . What are the control inputs required to produce the compensated initial response? 5.19. Consider the turbo-generator of Example 3.14, with the state-space representation given by Eq. (3.117). (a) Is the plant observable with both the inputs, y ( t ) and y?(f)? (b) Is the plant observable with only the output, y(t)l (c) Is the plant observable with only the output, >'2(0'-; (d) Design a full-order observer for the plant using only the output, y(t), such that the observer poles are placed at 51,2 = —3.5 ± 3.5i, $3,4 = —5 ± 5/, $5 = —10, s^ = —15. (e) Repeat part (d) using only the output, >'2(0- (f) Repeat part (d) using both the outputs, y { ( t ) and y2(t), and the MATLAB (CST) command place for designing the two-output full-order observer. (g) Re-design the observers in parts (d)-(f), and combine them with the corresponding regulators designed in Exercise 5.1 l(g) to form compensators, such that the maximum overshoot and settling time for the compensated initial response, y ( t ) , are less than 0.3 units and 6 seconds, respectively, if the initial condition vector is x(0) = [0.1; 0; 0; 0; 0; 0]r. How do the input magnitudes compare with the required inputs of the corresponding regulators in Exercise 5.11(g)? 5.20. Design a reduced-order observer for the aircraft of Exercise 5.16 using the bank-angle, 4>(t), as the only output, such that the observer poles are in a Butterworth pattern of radius, R = 16, and combine it with the regulator of Exercise 5.7, to form a reduced- order compensator. Compare the initial response, 0(r), and the required inputs of the reduced-order compensated system to that of the full-order compensator in Exercise 5.16 (f) with the initial condition x(0) = [0.5; 0; 0; 0] r . 5.21. Design a reduced-order observer for the aircraft of Exercise 5.17 with normal acceleration, y (t), as the only output, such that the observer poles are in a Butterworth pattern of radius, R = 100, and combine it with the regulator of Exercise 5.8, to form a reduced-order compensator. Compare the initial response and the required inputs of the reduced-order compensated system to that of the full-order compensator in Exercise 5.17(e) with the initial condition x(0) = [0; 0.5; 0; 0; 0; 0]r.
  • 297. 282 CONTROL SYSTEM DESIGN IN STATE-SPACE 5.22. For the distillation column of Exercise 5.15, design a two-output, reduced-order observer using the MATLAB (CST) command place such that the observer poles are placed in Butterworth pattern of radius, R = 21. With the resulting observer and the regulator designed in Exercise 5.9, form a reduced-order compensator and compare the initial response and required inputs of the compensated system for the initial condition x(0) = [1; 0: 0; 0]r, with the corresponding values obtained in Exercise 5.18. 5.23. Using SIMULINK, simulate the tracking system for the inverted pendulum on a moving cart with the reduced-order compensator designed in Example 5.20, including a measurement white noise of intensity (i.e. power parameter in the band-limited white noise block) when the desired plant state is Xj = [0; 1; 0; 0]r. 5.24. Using SIMULINK, test the robustness of the full-order compensator designed (using linear plant model) in Example 5.18 in controlling the plant model described by the nonlinear state-equations of Eqs. (3.17) and (3.18) when the desired plant state is xj = [0; 1; 0; 0]r. (Hint: replace the subsystem block in Figure 5.22 with & function M-file for the nonlinear plant dynamics.) References 1. Kreyszig, E. Advanced Engineering Mathematics. John Wiley & Sons, New York, 1972. 2. Friedland, B. Control System Design -An Introduction to State-Space Methods. McGraw-Hill International Edition, Singapore, 1987. 3. Kautsky, J. and Nichols, N.K. Robust Eigenstructure Assignment in State Feedback Control. Numerical Analysis Report NA/2/83, School of Mathematical Sciences, Flinders University, Australia, 1983.
  • 298. Linear Optimal Control 6.1 The Optimal Control Problem After designing control systems by pole-placement in Chapter 5, we naturally ask why we should need to go any further. Recall that in Chapter 5 we were faced with an over- abundance of design parameters for multi-input, multi-output systems. For such systems, we did not quite know how to determine all the design parameters, because only a limited number of them could be found from the closed-loop pole locations. The MATLAB M-file place.m imposes additional conditions (apart from closed-loop pole locations) to deter- mine the design parameters for multi-input regulators, or multi-output observers; thus the design obtained by place.m cannot be regarded as pole-placement alone. Optimal control provides an alternative design strategy by which all the control design parameters can be determined even for multi-input, multi-output systems. Also in Chapter 5, we did not know a priori which pole locations would produce the desired performance; hence, some trial and error with pole locations was required before a satisfactory performance could be achieved. Optimal control allows us to directly formulate the performance objectives of a control system (provided we know how to do so). More importantly - apart from the above advantages - optimal control produces the best possible control system for a given set of performance objectives. What do we mean by the adjective optimal! The answer lies in the fact that there are many ways of doing a particular thing, but only one way which requires the least effort, which implies the least expenditure of energy (or money). For example, we can hire the most expensive lawyer in town to deal with our inconsiderate neighbor, or we can directly talk to the neighbor to achieve the desired result. Simi- larly, a control system can be designed to meet the desired performance objectives with the smallest control energy, i.e. the energy associated with generating the control inputs. Such a control system which minimizes the cost associated with generating control inputs is called an optimal control system. In contrast to the pole-placement approach, where the desired performance is indirectly achieved through the location of closed-loop poles, the optimal control system directly addresses the desired performance objectives, while minimizing the control energy. This is done by formulating an objective function which must be minimized in the design process. However, one must know how the performance objectives can be precisely translated into the objective function, which usually requires some experience with a given system. If we define a system's transient energy as the total energy of the system when it is undergoing the transient response, then a successful control system must have a transient energy which quickly decays to zero. The maximum value of the transient energy indicates
  • 299. 284 LINEAR OPTIMAL CONTROL the maximum overshoot, while the time taken by the transient energy to decay to zero indicates the settling time. By including the transient energy in the objective Junction, we can specify the values of the acceptable maximum overshoot and settling time. Similarly, the control energy must also be a part of the objective function that is to be minimized. It is clear that the total control energy and total transient energy can be found by integrating the control energy and transient energy, respectively, with respect to time. Therefore, the objective function for the optimal control problem must be a time integral of the sum of transient energy and control energy expressed as functions of time. 6.1.1 The general optimal control formulation for regulators Consider a linear plant described by the following state-equation: (6.1) Note that we have deliberately chosen a time-varying plant in Eq. (6.1), because the optimal control problem is generally formulated for time-varying systems. For simplicity, suppose we would like to design a full-state feedback regulator for the plant described by Eq. (6. 1 ) such that the control input vector is given by u(r) = -K(r)x(0 (6.2) The control law given by Eq. (6.2) is linear. Since the plant is also linear, the closed-loop control system would be linear. The control energy can be expressed as u T (f)R(Ou(f), where R(0 is a square, symmetric matrix called the control cost matrix. Such an expression for control energy is called a quadratic form, because the scalar function, u T (f)R(?)u(r), contains quadratic functions of the elements of u(r). Similarly, the transient energy can also be expressed in a quadratic form as xT(f )Q(r)x(r), where Q(f) is a square, symmetric matrix called the state weighting matrix. The objective Junction can then be written as follows: J(t,tf)= / / [x T (T)Q(r)x(r)+u T (r)R(r)u(r)]t/r (6.3) where t and tf are the initial and final times, respectively, for the control to be exercised, i.e. the control begins at r = t and ends at r = tf, where r is the variable of integration. The optimal control problem consists of solving for the feedback gain matrix, K(/), such that the scalar objective function, J(t, tf), given by Eq. (6.3) is minimized. However, the minimization must be carried out in such a manner that the state-vector, x(f), is the solution of the plant's state-equation (Eq. (6.1)). Equation (6.1) is called a constraint (because in its absence, x(r) would be free to assume any value), and the resulting minimization is said to be a constrained minimization. Hence, we are looking for a regulator gain matrix, K(f), which minimizes J ( t , t f ) subject to the constraint given by Eq. (6.1). Note that the transient term, x T (r)Q(r)x(r), in the objective function implies that a departure of the system's state, x(r), from the final desired state, x(/y) = 0, is to be minimized. In other words, the design objective is to bring x(r) to a constant value of zero at final
  • 300. _ THE OPTIMAL CONTROL PROBLEM_ 285 time, T = tf. If the final desired state is non-zero, the objective function can be modified appropriately, as we will see later. By substituting Eq. (6.2) into Eq. (6.1), the closed-loop state-equation can be written as follows: f) - AcL(r)x(f) (6.4) where ACL(^) — [A(0 — B(t)K(t )], the closed-loop state-dynamics matrix. The solution to Eq. (6.4) can be written as follows: x(0 = 4>cL(' , ro)x(fo) (6.5) where 4>ci,(f » ?o) is the state-transition matrix of the time- varying closed-loop system represented by Eq. (6.4). Since the system is time-varying, 3>cL(t, to), is not the matrix exponential of ACL(^ ~~ to), but is related in some other way (which we do not know) to ACL(O- Equation (6.5) indicates that the state at any time, x(t), can be obtained by post- multiplying the state at some initial time, x(t0), with <I>CL(^ to)- On substituting Eq. (6.5) into Eq. (6.3), we get the following expression for the objective function: J ( t , tf) = x ( O O L ( r , /)[Q(r) + K(r)R(T)K(r)]cf> C L (T, t)x(t) dr (6.6) or, taking the initial state-vector, x(t), outside the integral sign, we can write J(t,tf) = T(t)M(t,tf)x(t) (6.7) where M(f, tf) = < I > L ( r , r)[Q(r) + K(T)R(r)K(r)]<D C L(r, t)di (6.8) Equation (6.7) shows that the objective function is a quadratic function of the initial state, x(t). Hence, the linear optimal regulator problem posed by Eqs. (6.1)-(6.3) is also called the linear, quadratic regulator (LQR) problem. You can easily show from Eq. (6.8) that M(t, tf) is a symmetric matrix, i.e. M T (r, tf) = M(t, tf), because both Q(0 and R(t) are symmetric. On substituting Eq. (6.5) into Eq. (6.6), we can write the objective function as follows: tf x T (r)[Q(r) + K T (T)R(r)K(r)]x(r) dr (6.9) / On differentiating Eq. (6.9) partially with respect to the lower limit of integration, t, according to the Leibniz rule (see a textbook on integral calculus, such as that by Kreyszig [1]), we get the following: d J ( t , tf)/dt = -xT(0[Q(0 + KT(t)R(t)K(t)]x(t) (6.10) where 9 denotes partial differentiation. Also, partial differentiation of Eq. (6.7) with respect to t results in the following: dJ(t,tf)/dt = [x(l)(t)]'M(t,tf)x(t) +x1(t)[dM(t,tf)/dt]x(t) +xl(t)M(t,tf)x(l}(t) (6.11)
  • 301. 286 UNEAR OPTIMAL CONTROL On substituting x (1) (0 = AciXOxCO from Eq. (6.4) into Eq. (6.11), we can write dJ(t, tf)/dt = x T (0[Aj L (r)M(f, //) + 3M(f, tf)/dt + M(r, r/)ACL(01x(/) (6.12) Equations (6.10) and (6.12) are quadratic forms for the same scalar function, 37(r, //)/3/ in terms of the initial state, (t). Equating Eqs. (6.10) and (6.12), we get the following matrix differential equation to be satisfied by M(f , //): -[Q(0 + K T (r)R(r)K(r)] = Aj L (r)M(r, //) + 3M(r, tf)/dt + M(r, r/)A CL (0 (6.13) or -3M(f, //)/3/ = Aj L (OM(r, tf) + M(t, f/)A C L(0 + [Q(0 + K T (f)R(/)K(r)] (6.14) Equation (6.14) is a first order, matrix partial differential equation in terms of the initial time, /, whose solution M(t, tf) is given by Eq. (6.8). However, since we do not know the state transition matrix, 4>cL(^ 0» of the general time-varying, closed-loop system, Eq. (6.8) is useless to us for determining M (/, //). Hence, the only way to find the unknown matrix M(r, tf) is by solving the matrix differential equation, Eq. (6.14). We need only one initial condition to solve the first order matrix differential equation, Eq. (6.14). The simplest initial condition can be obtained by putting t = tf in Eq. (6.8), resulting in M(r/,r/) = 0 (6.15) The linear optimal control problem is thus posed as finding the optimal regulator gain matrix, K(t), such that the solution, M(t, tf), to Eq. (6.14) (and hence the objective function, J(t, tf)) is minimized, subject to the initial condition, Eq. (6.15). The choice of the matrices Q(f) and R(t) is left to the designer. However, as we will see below, these two matrices specifying performance objectives and control effort, cannot be arbitrary, but must obey certain conditions. 6.1.2 Optimal regulator gain matrix and the Riccati equation Let us denote the optimal feedback gain matrix that minimizes M(t,tf) by K<>(0. minimum value of M(f, tf) which results from the optimal gain matrix, KO(')> is denoted by Mo(r, tf), and the minimum value of the objective function is denoted by J0(t, tf). For simplicity of notation, let us drop the functional arguments for the time being, and denote M(r, tf) by M, /(/,//) by J , etc. Then, according to Eq. (6.7), the minimum value of the objective function is the following: J0 = XT(t)M0(t) (6.16) Since J0 is the minimum value of J for any initial state, x(/), we can write J0 < 7, or x r (r)M 0 x(r) < T(t)M(t) (6.17)
  • 302. _ THE OPTIMAL CONTROL PROBLEM_ 287 If we express M as follows: M = M0 + m (6.18) and substitute Eq. (6.18) into Eq. (6.17), the following condition must be satisfied: T (/)M0x(f ) < x r (r)MoX(O + T (r)mx(r ) (6.19) or xr(»mx(r)>0 (6.20) A matrix, m, which satisfies Eq. (6.20), is called a positive semi-definite matrix. Since x(f) is an arbitrary initial state-vector, you can show that according to Eq. (6.20), all eigenvalues of m must be greater than or equal to zero. It now remains to derive an expression for the optimum regulator gain matrix, KO(?)» such that M is minimized. If M0 is the minimum value of M, then M0 must satisfy Eq. (6.14) when K(f) = K«,(0, i.e. -dM0/dt = A L ( f ) M o + MoAciXO + [Q(0 + K(OR(OKo(0] (6.21) Let us express the gain matrix, K(f), in terms of the optimal gain matrix, K0(0, as follows: K(0 = Ko(0 + k(r) (6.22) On substituting Eqs. (6.18) and (6.21) into Eq. (6.14), we can write -3(Mo + m)/dt = AjL(0(Mo + m) + (M0 + m)ACL(0 + [Q(0 + {Ko(0 + k(r)} T R(0{Ko(0 + k(r)}] (6.23) On subtracting Eq. (6.21) from Eq. (6.23), we get -dm/dt = Aj L (/)m + mACL(0 + S (6.24) where T T T S - [K(r)R(r) - MoB(0]k(0 + k(0[R(r)K 0 (r) - B(OM 0 ] + k(r)R(r)k(r) (6.25) Comparing Eq. (6.24) with Eq. (6.14), we find that the two equations are of the same form, with the term [Q(f) + K T (/)R(f)K(0] in Eq. (6.14) replaced by S in Eq. (6.24). Since the non-optimal matrix, M, in Eq. (6.14) satisfies Eq. (6.8), it must be true that m satisfies the following equation: f m(t, tf) = 4>J L (r, r)S(r, r/)4>cL(r, 0 dr (6.26) Recall from Eq. (6.20) that m must be positive semi-definite. However, Eq. (6.26) requires that for m to be positive semi-definite, the matrix S given by Eq. (6.25) must be positive
  • 303. 288 LINEAR OPTIMAL CONTROL semi-definite. Looking at Eq. (6.25), we find that S can be positive semi-definite if and only if the linear terms in Eq. (6.25) are zeros, i.e. which implies Kj(f )R(f ) - MoB(r ) = 0 (6.27) or the optimal feedback gain matrix is given by = R- 1 (r)B T (f)M 0 (6.28) Substituting Eq. (6.28) into Eq. (6.21), we get the following differential equation to be satisfied by the optimal matrix, MQ: ~1 -dM0/dt = A ( r ) M 0 + MoA(r) - M 0 B(OR~(OB(r)M 0 + Q(/) (6.29) Equation (6.29) has a special name: the matrix Riccati equation. The matrix Riccati equation is special because it's solution, M0, substituted into Eq. (6.28), gives us the optimal feedback gain matrix, K<,(f). Exact solutions to the Riccati equation are rare, and in most cases a numerical solution procedure is required. Note that Riccati equation is a first order, nonlinear differential equation, and can be solved by numerical methods similar to those discussed in Chapter 4 for solving the nonlinear state-equations, such as the Runge-Kutta method, or other more convenient methods (such as the one we will discuss in Section 6.5). However, in contrast to the state-equation, the solution is a matrix rather than a vector, and the solution procedure has to march backwards in time, since the initial condition for Riccati equation is specified (Eq. (6.15)) at the final time, t = //, as follows: M0(r/,//)=0 (6.30) For this reason, the condition given by Eq. (6.30) is called the terminal condition rather than initial condition. Note that the solution to Eq. (6.29) is M<,(?, f/) where t < //. Let us defer the solution to the matrix Riccati equation until Section 6.5. In summary, the optimal control procedure using full-state feedback consists of specifying an objective function by suitably selecting the performance and control cost weighting matrices, Q(r) and R(r), and solving the Riccati equation subject to the terminal condition, in order to determine the full-state feedback matrix, K<,(r). In most cases, rather than solving the general time-varying optimal control problem, certain simplifications can be made which result in an easier problem, as seen in the following sections. 6.2 Infinite-Time Linear Optimal Regulator Design A large number of control problems are such that the control interval, (// — t), is infinite. If we are interested in a specific steady-state behavior of the control system, we are interested in the response, x(r), when // —>• oo, and hence the control interval is infinite. The approximation of an infinite control interval results in a simplification in the optimal control problem, as we will see below. For infinite final time, the quadratic objective
  • 304. _ INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN_ 289 function can be expressed as follows: oo [x T (r)Q(T)x(r) + u T (T)R(r)u(T)]dr (6.31) / where Joo(t) indicates the objective function of the infinite final time (or steady-state) optimal control problem. For the infinite final time, the backward time integration of the matrix Riccati equation (Eq. (6.29)), beginning from M0(oo, oo) = 0, would result in a solution, M0(?, oo), which is either a constant, or does not converge to any limit. If the numerical solution to the Riccati equation converges to a constant value, then 9M0/3? = 0, and the Riccati equation becomes 0 - A ( r ) M 0 + MoA(r) - M 0 B(OR~(OB(OM 0 + Q(?) (6.32) Note that Eq. (6.32) is no longer a differential equation, but an algebraic equation. Hence, Eq. (6.32) is called the algebraic Riccati equation. The feedback gain matrix is given by Eq. (6.28), in which M0 is the (constant) solution to the algebraic Riccati equation. It is (relatively) much easier to solve Eq. (6.32) rather that Eq. (6.29). However, a solution to the algebraic Riccati equation may not always exist. What are the conditions for the existence of the positive semi-definite solution to the algebraic Riccati equation? This question is best answered in a textbook devoted to optimal control, such as that by Bryson and Ho [2], and involves precise mathematical conditions, such as stabilizability, detectability, etc., for the existence of solution. Here, it suffices to say that for all practical purposes, if either the plant is asymptotically stable, or the plant is controllable and observable with the output, y(0 = C(/)x(0, where CT(?)C(0 = Q(t), and R(0 is a symmetric, positive definite matrix, then there is a unique, positive definite solution, M0, to the algebraic Riccati equation. Note that C T (f)C(?) = Q(0 implies that Q(r) must be a symmetric and positive semi-definite matrix. Furthermore, the requirement that the control cost matrix, R(0> must be symmetric and positive definite (i.e. all eigenvalues of R(f) must be positive real numbers) for the solution, M0 to be positive definite is clear from Eq. (6.25), which implies that S (and hence m) will be positive definite only if R(/) is positive definite. Note that these are sufficient (but not necessary) conditions for the existence of a unique solution to the algebraic Riccati equation, i.e. there may be plants that do not satisfy these conditions, and yet there may exist a unique, positive definite solution for such plants. A less restrictive set of sufficient conditions for the existence of a unique, positive definite solution to the algebraic Riccati equation is that the plant must be stabilizable and detectable with the output, y(t) = C(f)x(0, where C T (r)C(r) = Q(f), and R(t) is a symmetric, positive definite matrix (see Bryson and Ho [2] for details). While Eq. (6.32) has been derived for linear optimal control of time-varying plants, its usual application is to time -invariant plants, for which the algebraic Riccati equation is written as follows: 0 = ATM0 + M0A - MoBR-^Mo + Q (6.33)
  • 305. 290 LINEAR OPTIMAL CONTROL In Eq. (6.33), all the matrices are constant matrices. MATLAB contains a solver for the algebraic Riccati equation for time-invariant plants in the M-file named are.m. The command are is used as follows: »x = are(a,b,c) <enter> where a = A, b = BR-1BT, c = Q, in Eq. (6.33), and the returned solution is x = MQ. For the existence of a unique, positive definite solution to Eq. (6.33), the sufficient conditions remains the same, i.e. the plant with coefficient matrices A, B must be controllable, Q must be symmetric and positive semi-definite, and R must be symmetric and positive definite. Another MATLAB function, ric, computes the error in solving the algebraic Riccati equation. Alternatively, MATLAB's Control System Toolbox (CST) provides the functions Iqr and Iqr2 for the solution of the linear optimal control problem with a quadratic objective function, using two different numerical schemes. The command Iqr (or Iqr2) is used as follows: »[Ko,Mo,E]= lqr(A,B,Q,R) <enter> where A, B, Q, R are the same as in Eq. (6.33), Mo = M«, the returned solution of Eq. (6.33), Ko = KQ= R~ ! B T M 0 the returned optimal regulator gain matrix, and E is the vector containing the closed-loop eigenvalues (i.e. the eigenvalues of ACL = A — BK<>). The command Iqr (or Iqr2) is more convenient to use, since it directly works with the plant's coefficient matrices and the weighting matrices. Let us consider a few examples of linear optimal control of time-invariant plants, based upon the solution of the algebraic Riccati equation. (For time-varying plants, the optimal feedback gain matrix can be deter- mined by solving the algebraic Riccati equation at each instant of time, t, using either Iqr or Iqr2 in a time-marching procedure.) Example 6.1 Consider the longitudinal motion of a flexible bomber aircraft of Example 4.7. The sixth order, two input system is described by the linear, time-invariant, state-space representation given by Eq. (4.71). The inputs are the desired elevator deflection (rad.), u i (0, and the desired canard deflection (rad.), W2(0> while the outputs are the normal acceleration (m/s2), y (t), and the pitch-rate (rad./s), yi(t). Let us design an optimal regulator which would produce a maximum overshoot of less than ±2 m/s2 in the normal-acceleration and less than ±0.03 rad/s in pitch-rate, and a settling time less than 5 s, while requiring elevator and canard deflections not exceeding ±0.1 rad. (5.73°), if the initial condition is 0.1 rad/s perturbation in the pitch-rate, i.e. x(0) = [0;0.1;0:0;0;0] r . What Q and R matrices should we choose for this problem? Note that Q is a square matrix of size (6 x 6) and R is a square matrix of size (2 x 2). Examining the plant model given by Eq. (4.71), we find that while the normal acceleration, yi(f), depends upon all the six state variables, the pitch-rate, V2(0, is equal to the second state-variable. Since we have to enforce the maximum overshoot limits on y ( t ) and , we must, therefore, impose certain limits on the maximum overshoots of all
  • 306. INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN 291 the state variables, which is done by selecting an appropriate state weighting matrix, Q. Similarly, the maximum overshoot limits on the two input variables, u(t) and U2(t], must be specified through the control cost matrix, R. The settling time would be determined by both Q and R. A priori, we do not quite know what values of Q and R will produce the desired objectives. Hence, some trial and error is required in selecting the appropriate Q and R. Let us begin by selecting both Q and R as identity matrices. By doing so, we are specifying that all the six state variables and the two control inputs are equally important in the objective function, i.e. it is equally important to bring all the state variables and the control inputs to zero, while minimizing their overshoots. Note that the existence of a unique, positive definite solution to the algebraic Riccati equation will be guaranteed if Q and R are positive semi-definite and positive definite, respectively, and the plant is controllable. Let us test whether the plant is controllable as follows: »rank(ctrb(A,B) ) <enter> ans= 6 Hence, the plant is controllable. By choosing Q = I, and R = I, we are ensuring that both are positive definite. Therefore, all the sufficient conditions for the existence of an optimal solution are satisfied. For solving the algebraic Riccati equation, let us use the MATLAB command Iqr as follows: »[Ko,Mo,E]=lqr(A,B,eye(6),eye(2)) <enter> Ko= 3.3571e+000 -4.25096-001 -6.25386-001 -7.34416-001 2.81906+000 1.57656+000 3.81816+000 1.02746+000 -5.47276-001 -6.80756-001 2.10206+000 1.85006+000 MO= 1.74296+000 2 8 7 6 - 001 .63 1.10596-002 -1.41596-002 4.47616-002 3.81816-002 2.86736-001 4.14866-001 1.00946-002 -2.15286-003 -5.66796-003 1.02746-002 1.10596-002 1.00946-002 1.00536+000 4.42176-003 -8.33836-003 -5.47276-003 -1.41596-002 -2.15286-003 4.42176-003 4.90476-003 -9.79216-003 -6.80756-003 4.47616-002 -5.66796-003 -8.3383e-003 -9.79216-003 3.75866-002 2.10206-002 3.81816-002 1.02746-002 -5.47276-003 -6.80756-003 2.10206-002 1.85006-002 - 2.21496+002+2.03386+0021 - 2.21496+002 - 2.0338e+002i -1.25616+002 -1.84836+000+1.33836+0001 -1.84836+000-1.33836+0001 -1.00116+000 To see whether this design is acceptable, we calculate the initial response of the closed-loop system as follows: »sys1=ss(A-B*Ko,zeros(6,2),C,zeros(2,2));<enter> »[Y1 ,t1 ,X1]=initial(sys1,[0.1 zeros(1,5) ] ' ) ; u1 = -Ko*X1'; <enter>
  • 307. 292 UNEAR OPTIMAL CONTROL Let us try another design with Q = 0.0 II, and R = I. As compared with the previous design, we are now specifying that it is 100 times more important to minimize the total control energy than minimizing the total transient energy. The new regulator gain matrix is determined by re-solving the algebraic Riccati equation with Q = 0.011 and R = I as follows: »[Ko,Mo,E] = lqr(A,B,0.01*eye(6),eye(2)) <enter> Ko= 1.07806+000 -1.66776-001 -4.69486-002 -7.56186-002 5.98236-001 3.53026-001 1.37856+000 3.45026-001 -1.31446-002 -6.52606-002 4.70696-001 3.09416-001 Mo= 4.19136-001 1.20576-001 9.27286-003 -2.27276-003 1.43736-002 1.37856-002 1.20576-001 1.03366-001 6.19066-003 -3.91256-004 -2.22366-003 3.45026-003 9.27286-003 6.19066-003 1.06496-002 9.70836-005 -6.25976-004 -1.31446-004 -2.27276-003 -3.91256-004 9.70836-005 1.77646-004 -1.00826-003 -6.52606-004 1.43736-002 -2.22366-003 -6.25976-004 -1.00826-003 796603 .74-0 476603 .09-0 1.37856-002 3.45026-003 -1.31446-004 -6.52606-004 4.70696-003 3.09416-003 E = -9.18036+001 - 7.87486+001+5.06256+001i -7.87486+001 -5.06256+001 i -1.16026+000+1.73286+0001 -1.16026+000-1.73286+OOOi -1.05606+000 The closed-loop state-space model, closed-loop initial response and the required inputs are calculated as follows: »sys2=ss(A-B*Ko,zeros(6,2),C,zeros(2,2)); <enter> »[Y2,t2,X2] = initial(sys2,[0.1 zeros(1,5) ]'); u2=-Ko*X2'; <enter> Note that the closed-loop eigenvalues (contained in the returned matrix E) of the first design are further inside the left-half plane than those of the second design, which indicates that the first design would have a smaller settling time, and a larger input requirement when compared to the second design. The resulting outputs, yi(/) and j2(0> for the two regulator designs are compared with the plant's initial response to the same initial condition in Figure 6.1. The plant's oscillating initial response is seen in Figure 6.1 to have maximum overshoots of —20 m/s2 and —0.06 rad/s, for vi(/) and y2(0, respectively, and a settling time exceeding 5 s (actually about 10 s). Note in Figure 6.1 that while the first design (Q = I, R = I) produces the closed-loop initial response of y2(0, i/i(r), and U2(t) within acceptable limits, the response of y(t) displays a maximum overshoot of 10 m/s2 (beginning at —15 m/s2 at / = 0, and shooting to —25 m/s2), which is unacceptable. The settling time of the first design is about 3 s, while that of the second design (Q = 0.011, R = I) is slightly less than 5 s. The second design produces a maximum overshoot of yi(r) less than 2 m/s2 and that of yi(t) about —0.025 rad/s, which is acceptable. The required control inputs, u ( t ) and U2(t), for the two designs are plotted in Figure 6.2. While the first design requires a maximum
  • 308. INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN 293 20 0 Open-loop plant -20 Regulator with Q = I, R = I Regulator with Q = 0.011, R = 1 -40 0 2 3 Time (s) U. 1 V 0.05 0 ^-*crr^~- _ . - - - *- * ** r» i * -*u si i n i Regulator with Q = 0.011, R - 1 n * 1 1 2 3 Time (s) Figure 6.1 Open and closed-loop initial response of the regulated flexible bomber aircraft, for two optimal regulator designs I I I I ;_ Q = I, R = I 0.04 r Q = 0.01I,R = 0.02 — ^, n fo ^^r^^7 , i 0 1 2 3 4 5 Time (s) I I I I -0.05 ^^ -0.1 Q = 6.011, R = |- -0.15 i I I ) 1 2 3 4 5 Time (s) Figure 6.2 Required initial response control inputs of the regulated flexible bomber aircraft, for two optimal regulator designs value of elevator deflection, u(t), about 0.045 rad., the second design is seen to require a maximum value of u (t) less than 0.02 rad. Similarly, the canard deflection, U2(t), for the second design has a smaller maximum value (—0.04 rad) than that of the first design (—0.1 rad.). Hence, the second design fulfills all the design objectives.
  • 309. 294 LINEAR OPTIMAL CONTROL In Example 6.1, we find that the total transient energy is more sensitive to the settling time, than the maximum overshoot. Recall from Chapter 5 that if we try to reduce the settling time, we have to accept an increase in the maximum overshoot. Conversely, to reduce the maximum overshoot of y(t}, which depends upon all the state variables, we must allow an increase in the settling time, which is achieved in the second design by reducing the importance of minimizing the transient energy by hundred-fold, as compared to the first design. Let us now see what effect a measurement noise will have on the closed- loop initial response. We take the second regulator design (i.e. Q = 0.011, R = I) and simulate the initial response assuming a random error (i.e. measurement noise) in feeding back the pitch-rate (the second state-variable of the plant). The simulation is carried out using SIMULINK block-diagram shown in Figure 6.3, where the measurement noise is simulated by the band-limited white noise block with a power parameter of 10~4. Note the Normal tion acceleration fa Pitch-rate (yi) I I(y2) K*Lh> J ^^ Measure Measurement noise in pitch-rate 0 8 10 12 14 16 18 20 Time (s) 0.15 0.1 0.05 0 -0.05 8 10 12 14 16 18 20 Time (s) Figure 6.3 Simulation of initial response of the flexible bomber with a full-state feedback regulator and measurement noise in the pitch-rate channel
  • 310. INFINITE-TIME LINEAR OPTIAAAL REGULATOR DESIGN 295 manner in which the noise is added to the feedback loop through the matrix gain block. The simulated initial response is also shown in Figure 6.3. Note the random fluctuations in both normal acceleration, y ( t ) , and pitch-rate, j2(0- The aircraft crew are likely to have a rough ride due to large sustained fluctuations (±10 m/s2) in normal acceleration, y ( t ) , resulting from the small measurement noise! The feedback loop results in an amplification of the measurement noise. If the elements of the feedback gain matrix, K, corresponding to pitch-rate are reduced in magnitude then the noise due to pitch-rate feedback will be alleviated. Alternatively, pitch-rate (or any other state-variable that is noisy) can be removed from state feedback, with the use of an observer based compensator that feeds back only selected state-variables (see Chapter 5). Example 6.2 Let us design an optimal regulator for the flexible, rotating spacecraft shown in Figure 6.4. The spacecraft consists of a rigid hub and four flexible appendages, each having a tip mass, with three torque inputs, u(t), U2(t), u^(t), and three angular rotation outputs in rad., yi(t), y2(t), yi(t). Due to the flexibility of the appendages, the spacecraft is a distributed parameter system (see Chapter 1). However, it is approximated by a lumped parameter, linear, time-invariant state-space representa- tion using a finite-element model [3]. The order of the spacecraft can be reduced to 26 for accuracy in a desired frequency range [4]. The 26th order state- vector, x(r), of the spacecraft consists of the angular displacement, y(t), and angular velocity of the rigid hub, combined with individual transverse (i.e. perpendicular to the appendage) displacements and transverse velocities of three points on each appendage. The state-coefficient matrices of the spacecraft are given as follows: A B =[-M°'K J] =[M°'d] where M, K, and d are the mass, stiffness, and control influence matrices, given in Appendix C. Figure 6.4 A rotating, flexible spacecraft with three inputs, ( u ] , u?, ua), and three outputs (01,6*2,03)
  • 311. 296 UNEAR OPTIMAL CONTROL The eigenvalues of the spacecraft are the following: »damp(A) <enter> Eigenvalue Damping Freq.(rad/sec) 9.42996-013+7.61636+0031 -6.12306-017 7.61636+003 9.42996-013-7.61636+0031 -6.12306-017 7.61636+003 8.17126-013+4.75656+0041 -6.12306-017 4.75656+004 8.17126-013-4.75656+0041 -6.12306-017 4.75656+004 8.05396-013+2.53666+0031 -2.83276-016 2.53666+003 8.05396-013-2.53666+0031 -2.83276-016 2.53666+003 7.48676-013+4.75886+0041 -6.12306-017 4.75886+004 7.48676-013-4.75886+0041 -6.12306-017 4.75886+004 7.12766-013+2.59826+0041 -6.12306-017 2.59826+004 7.12766-013-2.59826+0041 -6.12306-017 2.59826+004 5.20546-013+1.48716+0041 -6.12306-017 1.48716+004 5.20546-013-1.48716+0041 -6.12306-017 1.48716+004 4.81106-013+2.09866+0021 -2.28176-015 2.09866+002 4.81106-013-2.09866+0021 -2.28176-015 2.09866+002 4.48126-013+2.60096+0041 -6.12306-017 2.60096+004 4.48126-013-2.60096+0041 -6.12306-017 2.60096+004 3.13876-013+7.57836+0031 -6.12306-017 7.57836+003 3.13876-013-7. 57836+0031 -6.12306-017 7.57836+003 2.44546-013+3.79526+0021 -7.27366-016 3.79526+002 2.44546-013-3.79526+0021 -7.27366-016 3.79526+002 0 -1.00006+000 0 0 -1.OOOOe+000 0 -9.95046-013+2 .47156+0031 3.82866-016 2.47156+003 -9.95046-013-2 .47156+0031 3.82866-016 2.47156+003 -1.17666-012+1 .48926+0041 1.60816-016 1.48926+004 -1.17666-012-1 .48926+0041 1.60816-016 1.48926+004 Clearly, the spacecraft is unstable due to a pair of zero eigenvalues (we can ignore the negligible, positive real parts of some eigenvalues, and assume that those real parts are zeros). The natural frequencies of the spacecraft range from 0 to 47 588 rad/s. The nonzero natural frequencies denote structural vibration of the spacecraft. The control objective is to design a controller which stabilizes the spacecraft, and brings the transient response to zero within 5 s, with zero maximum overshoot, while requiring input torques not exceeding 0.1 N-m, when the spacecraft is initially perturbed by a hub rotation of 0.01 rad. due to the movement of astronauts. The initial condition corresponding to the initial perturbation caused by the astronauts' movement is x(0) = [0.01; zeros(l,25)]r. Let us see whether the spacecraft is controllable: »rank(ctrb(A,B)) <enter> ans= 6
  • 312. INFINITE-TIME LINEAR OPTIMAL REGULATOR DESIGN 297 Since the rank of the controllability test matrix is less than 26, the order of the plant, it follows that the spacecraft is uncontrollable. The uncontrollable modes are the structural vibration modes, while the unstable mode is the rigid-body rotation with zero natural frequency. Hence, the spacecraft is stabilizable and an optimal regulator can be designed for the spacecraft, since stabilizability of the plant is a sufficient condition for the existence of a unique, positive definite solution to the algebraic Riccati equation. Let us select Q = 2001, and R = I, noting that the size of Q is (26 x 26) while that of R is (3 x 3), and solve the Riccati equation using Iqr as follows: » [ K o 5 M o , E ] = l q r ( A , B , 2 0 0 * e y e ( 2 6 ) , e y e ( 3 ) ) ; <enter> A positive definite solution to the algebraic Riccati equation exists for the present choice of Q and R, even though the plant is uncontrollable. Due to the size of the plant, we avoid printing the solution, Mo, and the optimal feedback gain matrix, Ko, here, but the closed-loop eigenvalues, E, are the following: E = -1.7321e+003+4.7553e+004i -1.73216+003-4.75536+0041 -1.75026+003+4.75296+0041 -1.75026+003-4.75296+0041 -1.89706+003+2.59436+0041 -1.89706+003 -2.59436+0041 -1.89916+003+2.59166+0041 -1.89916+003-2.59166+0041 -1.80816+003+1.45696+0041 -1.80816+003 -1.45696+0041 -1.81476+003+1.45506+0041 -1.81476+003-1.45506+0041 -7.37436+002+7.65366+0031 - 7.37436+002 -7.65366+0031 - 7.33286+002+7.61426+0031 - 7.33286+002-7.61426+0031 -2.67946+002+2.53486+0031 -2.67946+002-2.53486+0031 -2.58086+002+2.46986+0031 -2.58086+002 -2.46986+0031 -3.91906+001+3.77446+0021 -3.91906+001-3.77446+0021 -1.14826+000+4.31656-0011 -1.14826+000-4.31656-0011 -1.80666+001+2.09116+0021 -1.80666+001-2.09116+0021 All the closed-loop eigenvalues (contained in the vector E) have negative real-parts, indicating that the closed-loop system is asymptotically stable, which is a bonus! Let us check whether the performance objectives are met by this design by calculating the closed-loop initial response as follows:
  • 313. 298 LINEAR OPTIMAL CONTROL »sysCL=ss(A-B*Ko,zeros(26,3),C,D); <enter> >> ty,t,X] = initial(sysCL, [0.01 zeros(1, 25)]'); u = -Ko*X'; <enter> The closed-loop outputs, y(t), y2(t), and j3(/), and the required torque inputs, ui(t), U2(t), and ui(t), are plotted in Figure 6.5. We see from Figure 6.5 that all the three outputs settle to zero in 5 s, with zero overshoot, and that the input torque magnitudes are smaller than 0.1 N-m, as desired. Therefore, our design is successful in meeting all the performance objectives and input effort limits. 0.05 o -0.05 U2(0, "3(0 £ -0.1 0 Time (s) Figure 6.5 Closed-loop initial response and required inputs of the regulated flexible spacecraft for optimal regulator designed with Q = 2001 and R = I Examples 6.1 and 6.2 illustrate two practical problems, one with a controllable plant, and the other with an uncontrollable plant, which are successfully solved using linear optimal control. Note the ease with which the two multi-input problems are solved when compared with the pole-placement approach (which, as you will recall, would have resulted in far too many design parameters than can be fixed by pole-placement). We will now consider the application of optimal control to more complicated problems. 6.3 Optimal Control of Tracking Systems Consider a linear, time-varying plant with state-equation given by Eq. (6.1). It is required to design a tracking system for this plant if the desired state-vector, Xd(/), is the solution of the following equation: (6.35)
  • 314. _ OPTIMAL CONTROL OF TRACKING SYSTEMS_ 299 Recall from Chapter 5 that the desired state dynamics is described by a homogeneous state-equation, because Xd(f) it is unaffected by the input, u(0- Subtracting Eq. (6.1) from Eq. (6.35), we get the following state-equation for the tracking-error, e(0 = xj(/) 0 + [Ad(0 - A(/)]xd(?) - B(f)u(0 (6.36) The control objective is to find the control input, u(t), such that the tracking-error, e(f ), is brought to zero in the steady-state. To achieve this objective by optimal control, we have to first define the objective function to be minimized. Note that, as opposed to the regulator problem in which the input u(0 = — K(t)x(t), now the control input will also depend linearly on the desired state-vector, x d (f). If we express Eqs. (6.1) and (6.35) by a combined system of which the state-vector is x c (f) = [e(07; Xd(t)T]T, then the control input must be given by the following linear control-law: u(f) - -Kc(0xc(0 = -K c (?)[e(0 r ; xd(07Y (6.37) where Kc(0 's the combined feedback gain matrix. Note that Eqs. (6.35) and (6.36) can be expressed as the following combined state-equation: x c (1) (0 = A c (/)x c (0 + B c (0u(r) (6.38) where Since Eqs. (6.1) and (6.2) are now replaced by Eqs. (6.38) and (6.37), respectively, the objective function for the combined system can be expressed as an extension of Eq. (6.3) as follows: r*f J ( t , t f ) = I [x c T (r)Q c (T)x c (T)+u T (r)R(T)u(r)]</r (6.40) Note that although we desire that the tracking error, e(0 = xd(0 — x(0» be reduced to zero in the steady-state (i.e. when t -> oo), we cannot pose the tracking system design as an optimal control problem with infinite control interval (i.e. tf = oo). The reason is that the desired state-vector, Xd(0 (hence xc(0), may not go to zero in the steady-state, and thus a non-zero control input, u(t), may be required in the steady-state. Also, note that the combined system described by Eq. (6.38) is uncontrollable, because the desired state dynamics given by Eq. (6.35) is unaffected by the input, u(0- Therefore, the combined system's optimal control problem, represented by Eqs. (6.37)-(6.40) is not guaranteed to have a unique, positive definite solution. Hence, to have a guaranteed unique, positive definite solution to the optimal control problem, let us exclude the uncontrollable desired state-vector from the objective function, by choosing the combined state-weighting matrix as follows:
  • 315. 300 UNEAR OPTIMAL CONTROL which results in the following objective function: 7(My) = J / [e T (r)Q(T)e(T) + u T (r)R(r)u(r)]rfr (6.42) which is the same as Eq. (6.3), with the crucial difference that u(r) in Eq. (6.42) is given by Eq. (6.37), rather than Eq. (6.2). By choosing Q(0 and R(0 to be positive semi- definite and positive definite, respectively, we satisfy the remaining sufficient conditions for the existence of a unique, positive definite solution to the optimal control problem. Note that the optimal feedback gain matrix, Koc(0, is given by the following extension of Eq. (6.28): Koc(0 = R"1(r)Bj(r)Moe (6-43) where MOC is the solution to the following Riccati equation: -dMw/dt = Aj(f)Moc + MocAc(r) - H^OR ' (OB?(OH* + Qc(0 (6-44) subject to the terminal condition, MOC(//, r/) = 0. Since MOC is symmetric (see Section 6.1), it can be expressed as 1 (6.45) where Moi and Mo2 correspond to the plant and the desired state dynamics, respectively. Substituting Eqs. (6.45) and (6.39) into Eq. (6.43), we can express the optimal feedback gain matrix as follows: Koc(0 = -[R~I(OBT(OM0i; R~1(/)BT(OMo2] (6.46) and the optimal control input is thus obtained by substituting Eq. (6.46) into Eq. (6.37) as follows: u(0 = R~' (OBT(OMoie(0 + R-1 (OBT(OMo2Xd(0 <6-47) Note that Eq. (6.47) does not require the sub-matrix, M^. The individual matrix differ- ential equations to be solved for M<>i and M<,2 can be obtained by substituting Eqs. (6.39) and (6.45) into Eq. (6.44) as follows: = AT(OMoi + MoiA(0 - M0,B(r)R-1 (r)BT(f )Moi+Q(0 (6.48) = MozAdCO + Moi[Ad(r) - A(0] + [AT(/) - M«iB(r)R-1 (OBT(f)]Mo2 (6.49) Note that Eq. (6.48) is identical to the matrix Riccati equation, Eq. (6.29), which can be solved independently of Eq. (6.49), without taking into account the desired state dynamics. Once the optimal matrix, Moi, is obtained from the solution of Eq. (6.48), it can be substituted into Eq. (6.49), which can then be solved for M02. Equation (6.49) is a linear, matrix differential equation, and can be written as follows: = Mo2Ad(/) + Moi[Ad(f) - A(0] + A L (r)M« 2 (6.50)
  • 316. _ OPTIMAL CONTROL OF TRACKING SYSTEMS_ 301 where AciXO — A(0 — B(r)R~ 1 (OB T (OM 0 i, the closed-loop state-dynamics matrix. The solution of the optimal tracking system thus requires the solution of the linear differential equation, Eq. (6.50), in addition to the solution of the optimal regulator problem given by Eq. (6.48). The solutions of Eqs. (6.48) and (6.49) are subject to the terminal condition, Moc(f/» r /) — 0» which results in M 0 i(/y, tf) =0, and Mo20/, //) — 0. Often, it is required to track a constant desired state- vector, xd(0 — x^, which implies Ad(0 = 0. Then the matrices M0i and M02 are both constants in the steady-state (i.e. tf -> oo), and are the solutions of the following steady-state equations (obtained by setting dM0i/dt = dMo2/dt = 0 and A d (0 = 0 in Eqs. (6.48) and (6.49)): 0 = AT(OMol + M«,iA(f) - M 0 iB(OR~ 1 (OB T (f)Moi + Q(f) (6.51) 0 = -MoiA(f) + AjL(f )M«2 (6.52) We immediately recognize Eq. (6.51) as the algebraic Riccati equation (Eq. (6.32)) of the steady-state, optimal regulator problem. From Eq. (6.52), we must have Mo2 = [AjL(0]-1MolA(0 (6.53) where M0i is the solution to the algebraic Riccati equation, Eq. (6.51). Note, however, that even though M0i and M02 are finite constants in the steady-state, the matrix Moc is not a finite constant in the steady-state, because as x(r/) tends to a constant desired state in the limit tf -> oo, the objective function (Eq. (6.42)) becomes infinite, hence a steady-state solution to Eq. (6.44) does not exist. The only way M^ can not be a finite constant (when both M0i and M02 are finite constants) is when M03 (the discarded matrix in Eq. (6.45)) is not a finite constant in the steady-state. Substituting Eq. (6.53) into Eq. (6.47), we get the following input for the constant desired state vector, x^: u(f) = R-1(OBT(r)M01e(0 + R- 1 (OB T (/)[Aj L (0]" l M 0 iA(?)x^ (6.54) Substituting Eq. (6.54) into Eq. (6.36), we get the following closed-loop tracking error state-equation with Ad(0 = 0 and xd(0 — x£: e(1)(0 = ACL(Oe(0 - [A(r) + B(OR-1(?)BT(0{AjL(r)}-1M01A(r)]xd (6.55) From Eq. (6.55), it is clear that the tracking error can go to zero in the steady-state (i.e. as t -> oo) for any non-zero, constant desired state, x^, if ACL(^) is asymptotically stable and A(0 + B(OR- 1 (OB T (r){Aj L (0}~ 1 M ol A(0 = 0 (6.56) or M01A(0 = - (6.57)
  • 317. 302 UNEAR OPTIMAL CONTROL Equation (6.57) can be expanded to give the following equation to be satisfied by for the steady-state tracking error to be zero: MolA(0 - -AT(f){B(OR~1(OBT(Or' A(f) + M.iA(0 (6.58) which implies that A T (0{B(OR~ I (OB T (0}~ I A(0 = 0, or {B(r)R- 1 (r)B T (r)}-'= 0. Clearly, this is an impossible requirement, because it implies that R(f) = 0. Hence, we cannot have an optimal tracking system in which the tracking error, e(r), goes to zero in the steady-state for any constant desired state-vector, xj. As in Chapter 5, the best we can do is to have e(0 going to zero for some values of x|j. However, if we want this to happen while satisfying the optimality condition for M02 given by Eq. (6.53), we will be left with the requirement that [A(0 + B(OR~1(OBT(0{AjL(0}~1M0iA(0]x5= 0 for some non-zero x|j, resulting in {B(r)R~ 1 (OB T (r)}" 1 A(r)Xj = 0, which implies that {B(OR~1(OBT(0}~1 must be a singular matrix - again, an impossible requirement. Therefore, the only possible way we can ensure that the tracking error goes to zero for some desired state is by dropping the optimality condition on Mo2 given by Eq. (6.53). Then we can write the input vector as follows: u(f) - R- 1 (OB T (r)M ol e(/) - Kd(0*S <6-59) where K<i(0 is the (non-optimal) feedforward gain matrix which would make e(0 zero in the steady-state for some values of x|j. Substituting Eq. (6.59) into Eq. (6.36) we get the following state-equation for the tracking error: e (!) (0 = AciXOe(0 - [A(0 - B(r)Kd(f)]«J (6-60) Equation (6.60) implies that for a zero steady-state tracking error, K<i(0 must be selected such that [A(0 — B(OKd(0]x<i = ®- ^e closed-loop state-dynamics matrix, ACL, in Eq. (6.60) is an optimal matrix given by ACL(') = A(0 - B(r)R~ I (f)B T (f)M 0 i, where Moi is the solution to the algebraic Riccati equation, Eq. (6.51). Hence, the design of a tracking system does not end with finding a unique, positive definite solution, Moi, to the algebraic Riccati equation (which would make ACL(') asymptotically stable); we should also find a (non-optimal) feedforward gain matrix, K<j(0> such that [A(0 — B(OKd(0]xjj = 0 for some values of the constant desired state-vector, x^. Note that if the plant has as many inputs as there are state variables, then B(r) is a square matrix, and it would be possible to make e(0 zero in the steady-state for any arbitrary x[j, by choosing K<i(0 = B~'(OA(0 (provided B(0 is non-singular, i.e. the plant is controllable.) Example 6.3 Consider the amplifier-motor of Example 3.7, with the numerical values given as J = 1 kg.m2, R = 1000 ohms, L = 100 henry, a = 0.3 kg.m2/s2/Ampere, and KA = 10. Recall from Example 3.7 that the state-vector of the amplifier-motor is x(0 = [0(0; 0 (1) (0; i ( t ) ] T , where 0(0 is the angular position of the load on the motor, and i(0 is the current supplied to the motor. The input vector is u(0 = [i>(0; TKO]7", where v(t) is the input voltage to the amplifier and 7"L(0 is the torque applied by the load on the motor. It is desired to design a tracking system
  • 318. OPTIMAL CONTROL OF TRACKING SYSTEMS 303 such that the load on the motor moves from an initial angular position, $(0) = 0, to desired angular position 0$(t} = 0.1 rad. in about six seconds, and comes to rest at the desired position. The maximum angular velocity of the load, 0 ( l ) ( t ) , should not exceed 0.05 rad/s. After the load comes to rest at the desired position, the current supplied to the motor should be zero. The desired state-vector is thus x£ = [0.1; 0; O]7. The plant's state coefficient matrices are the following: 0 1 0 '0 0 A= 0 -0.01 0.3 B= 0 -1 0 -0.003 -10 0.1 0 0 0 0 0 The eigenvalues of the linear, time-invariant plant are calculated as follows: »damp(A) <enter> Eigenvalue Damping Freq. (rad/sec) 0 -1.0000 0 -0.0101 1.0000 0.0101 -9.9999 1.0000 9.9999 The plant is stable, with an eigenvalue at the origin. Since the plant is time-invariant, the controller gain matrices must be constants. Let us first find the optimal feedback gain matrix, K0i = — R~1BTM0i by choosing Q = I and R = I, and solving the algebraic Riccati equation as follows: »[Ko1,Mo1,E] = lqr(A,B,eye(3),eye(2)) <enter> Ko1 = 0.0025 0.0046 0.0051 -1.0000 -1.7220 -0.0462 M01 = 1.7321 1.0000 0.0254 1.0000 1.7220 0.0462 0.0254 0.0462 0.0513 E = -10.0004 -0.8660 + 0.5000i -0.8660 - O.SOOOi The closed-loop eigenvalues are all in the left-half plane, as desired for asymptotic stability of the tracking error dynamics. Next, we calculate the feedforward gain matrix, K^, which will make the steady-state tracking error zero for the specified constant desired state, x|j. This is done by selecting Kd such that Axjj = BKdX^ as follows:
  • 319. 304 LINEAR OPTIMAL CONTROL if. _ f (6.62) |_ -0.1 Kd4 (6.63) Therefore, Ax|j = BKdXJj implies that Kd = 0 and Kd4 = 0. We can also choose the remaining elements of Kj as zeros, and still satisfy Ax|j = BKdXJj. Hence, K<| = 0, and the control input is given by u(f) = Koie(f). Let us obtain the tracking error response of the system to the initial tracking error, e(0) = x£—x(0) = xjj (since x(0) = 0) as follows: »t=0:0.05:6; sysCL=ss(A-B*Ko1, z e r o s ( 3 , 2 ) , C , D ) ; [ y , t , e ] = initial(sysCL, [0.1 0 0]'); <enter> Then, the state-vector, x(r), of the closed-loop system can be calculated using x(r) = Xj — e(0 as follows: »n=size(t, 1); for i=1:n; X d ( i , : ) = [ 0 . 1 0 0]; end; X=Xd-e; <enter> while the input vector, u(f), is calculated as »u = Ko1*e'; <enter> The calculated state variables, 0(t), 0(1)(0, i'(^). the input voltage, u(f), and the loading torque, Ti(t), are plotted in Figure 6.6. Note that all the state variables reach their desired values in about 6 s, with a maximum overshoot in angular Figure 6.6 Closed-loop initial response of the tracking system for amplifier-motor, with constant desired state, 0(f) = 0.1 rad, 0 ( 1 ) (f) = 0 rad, and i(f) = 0 amperes
  • 320. OPTIMAL CONTROL OF TRACKING SYSTEMS 305 velocity, 9 ( l ) ( t ) , of about 0.04 rad/s, and the maximum overshoot in current, /(?), of —12.5 x 10~6 A. The maximum input voltage, v ( t ) , is 2.5 x 10~4 V and the maximum loading torque is —0.1 N-m. Using SIMULINK, let us now investigate the effect of an uncertainty in the amplifier gain, KA, on the tracking system. A SIMULINK block-diagram of the closed-loop tracking system is shown in Figure 6.7. The uncertainty in the amplifier gain, A.KA, affects only the third state-variable, i ( t ) , and is incorporated into the Xd T , 1 1 / ^ Uiwta i <7<*U< 1 I r 1 1 i^-ft * , >l ' theta dot ^ r*- + S 1 . B — Amplifier-motor '—>- 1'—1' IT 1—1 [oni]i </£ /XdelKA -*-1 ' Uncertainty in delKA nr —l rO 1 i< 1 V 20 I I I 1 1 1 < 0 f IJfMpflPP If ""fWII'rf WBPf ' W W Pw * nr i i i i i i i 4 -20 ) 1 2 3 4 5 6 7 8 9 10 0.2 l l l l i l l 1 0.1 0 ^-^^ I l l I i l l J 1 2 3 4 5 6 7 8 9 10 0.1 l I l l I I I E i 2? 01 / l l I I i l l "" 0 1 2 3 4 5 6 7 8 9 1 0 Time (s) Figure 6.7 Simulation of the tracking system for amplifier-motor, with uncertainty in the amplifier gain, KA
  • 321. 306 LINEAR OPTIMAL CONTROL plant dynamics model using the band-limited white noise block output, A K A , multi- plied with the vector [0; 0; i ( t ) ] T , and added to the summing junction, which results in the plant dynamics being represented as x (1) (/) = (A + AA)x(r) + Bu(f), where 0 0 0 AA = 0 0 0 (6.64) 0 0 The simulated values of AA^, 6(t), and T^(t) are shown in Figure 6.7. Note that despite a random variation in KA between ±10, the tracking system's performance is unaffected. This signifies a design which is quite robust to variations in KA. Example 6.4 For a particular set of flight conditions, the lateral dynamics of an aircraft are described by a linear, time-invariant state-space representation with the following coefficient matrices: "-9.75 0 -9.75 0" 20 2.77 0 -0.8 8 0 0 -3 A = B= (6.65) 0 -1 -0.8 0 0 0 1 0 0 0_ 0 0 The state-vector consists of the roll-rate, p ( t ) , yaw-rate, r ( t ) , side-slip angle, and bank angle, 0(0, and is written as x(f) = [p(t); r(r); 0(r); 0(f)] r . The input vector consists of the aileron deflection angle, 8(t), and rudder deflection angle, <$R(J), i.e. u(f) = [SA(t)',8R(t)]T. It is desired to execute a steady turn with a constant yaw-rate, r^(t) = 0.05 rad/s, a constant bank angle, <&/(/) = 0.02 rad, and zero roll-rate and sideslip angle, pd(t) = 0</(0 = 0. The desired state-vector is thus Xj = [0; 0.05; 0; 0.02]7. The desired state must be reached in about two seconds, with a maximum roll-rate, p(t), less than 0.1 rad/s and the control inputs (<5A(r) and <$R(O) not exceeding 0.3 rad. Let us first select a feedforward gain matrix, K<|, which satisfies Axjj = BK<ixjj as follows: Kd=r (6.66) 20(0.05 Kaz + 2.77(0.05^6 + 0.02A:d8) (6.67) Equation (6.67) indicates that, to make Ax|j = BKdXJj, we must have 0.05 KAb + 0.02tfd8 = 0 and 0.05^2+0.02^4=0, which can be satisfied by selecting Kd=0. It now remains for us to calculate the optimal feedback gain matrix, K«i, by solving the algebraic Riccati equation. Note that the plant is stable with the following eigenvalues:
  • 322. OPTIMAL CONTROL OF TRACKING SYSTEMS 307 »damp(A) <enter> Eigenvalue Damping Freq. (rad/sec) 0 -1.0000 0 -0.8000 + 2.8284i 0.2722 2.9394 -0.8000 - 2.8284i 0.2722 2.9394 -9.7500 1.0000 9.7500 Let us select R — I. After experimenting with several values of Q, we select the following which satisfies the desired transient response and input limitations: 20 0 0 0 0 10 0 0 Q= 0 0 1 0 (6.68) 0 0 0 200 With this combination of Q and R, the algebraic Riccati equation is solved as follows: »[Ko1,Mo1,E] = <enter> K01 = 4.1351 0.3322 -0.2935 14.0420 0.5229 -2.7651 -1 .1575 1 .6797 Mo1 = 0.2068 0.0166 -0.0147 0.7021 0.0166 0.9370 0.3723 0 . 0884 -0.0147 0.3723 3.6355 -0.0908 0.7021 0.0884 -0.0908 65.7890 C _ -90.7740 -8.4890 -3.1456 -1.3872 The initial response of the tracking error, e(r), to x(0) = 0 is calculated as follows: »sysCL=ss(A-B*Ko1,zeros(4,2),eye(4),zeros(4,2)); <enter> »t=0:0.001:2; [y,t,e]=initial(sysCL,[0 0.05 0 0 . 0 2 ] ' , t ) ; <enter> and the state-vector and control input vector are then calculated as »n = size(t,1); for i=1:n; X d ( i , : ) = [0 0.05 0 0.02]; end; X = X d - e ; u = -Ko1*e'; <enter> The calculated state-vector, x(f), and input vector, u(0, are plotted in Figures 6.8 and 6.9, respectively. Note that all the transients settle to their desired values in about two seconds, with a maximum overshoot in roll-rate, p(t), of less than 0.06 rad/s, and a small maximum side-slip angle, fi(t). The aileron and rudder deflections are seen in Figure 6.9 to be less than 0.3 rad. as desired.
  • 323. 308 LINEAR OPTIMAL CONTROL l I Yaw-rate, r{t) (rad./s) r—Roll-rate, p(t) (rad./s) V Bank angle, 0(0 (rad-) s _ s ..--••• "" N .-••" .-V Side-slip angle, /?(f) (rad.) 0.5 1 1.5 Time (s) Figure 6.8 Response of the tracking system for aircraft lateral dynamics for a desired steady turn with turn-rate, r(f) = 0.05 rad. and bank angle, 0(r) = 0.02 rad I I l 0.1 * Rudder input, <5R(f) (rad.) 0.05 0 V -0.05 T |~ Aileron input, 5A(f) (rad.) -0.15 L -0.2 h -0.25 __n o i i i Time (s) Figure 6.9 Aileron and rudder inputs of the aircraft lateral dynamics tracking system for achieving a desired steady turn with turn-rate, r(f) = 0.05 rad. and bank angle, 0(f) = 0.02 rad 6.4 Output Weighted Linear Optimal Control Many times it is the output, y(t), rather than the state-vector, x(t), which is included in the objective function for minimization. The reason for this may be either a lack of physical understanding of some state variables, which makes it difficult to assign weightage to them, or that the desired performance objectives are better specified in terms of the measured output; remember that it is the output of the system (rather than the state} which indicates the performance to an observer (either a person or a mathematical device
  • 324. _ OUTPUT WEIGHTED LINEAR OPTIMAL CONTROL_ 309 discussed in Chapter 5). When the output is used to define the performance, the objective function can be expressed as follows: J(t, tf) = I ' [y T (r)Q(r)y(r) + u T (r)R(r)u(r)l dr (6.69) Jt where Q(t ) is now the output weighting matrix. Substituting the output equation given by y(0 = C(t)x(t) + D(0u(f ) (6.70) into Eq. (6.69), the objective function becomes the following: J ( t , t f ) = / >/ [x T (T)C T (r)Q(r)C(r)x(r) +x T (r)C T (T)Q(r)D(r)u(T) Jt + u T (r)D T (r)Q(r)C(r)x(r) + u T (r){R(t) + D T (T)Q(r)C(r)}u(r)] dr (6.71) or J ( t , tf) = I / [x T (T)Q G (r)x(r) + x T (r)S(T)u(r) + u T (r)S T (T)x(T) Jt + u T (r)R G (T)u(r)]fl?r (6.72) where Q G (r) = C T (r)Q(T)C(r), S(r) = C T (r)Q(r)D(T), and R G (r) = R(T) + D T (T)Q(r)C(r). You can show, using steps similar to Sections 6.1 and 6.2, that the optimal regulator gain matrix, K«,(0, which minimizes J ( t , //•) given by Eq. (6.72) can be expressed as Ko(0 = R£1(f)[BT(f)M0 + ST(01 = {R(0 + D T (r)Q(r)C(?)}~ 1 [B T (f)M 0 + D T (r)Q(r)C(r)] (6.73) where M 0 (f, ?/) is the solution to the following matrix Riccati equation: -dM0/dt = Aj(OMo + M 0 A G (r) - M 0 B(OR G 1 a)B T (r)M 0 + [Qc(0 - S(OR G -'(OS T (r)] (6.74) where AG(0 = A(f) — E(t)R^l(t)ST(t). Equation (6.74) can be solved numerically in a manner similar to that for the solution to Eq. (6.29), with the terminal condition Mo(f/,f/)=0. The steady-state optimal control problem (i.e. when tf -» oo) results in the following algebraic Riccati equation: 0 = Aj(OM0 + MoAeCO - M0B(ORG1(OBT(r)M0 + [QG(0 - S(ORGV)ST(0] (6.75) The sufficient conditions for the existence of a unique, positive definite solution, M0, to Eq. (6.75) are similar to those for Eq. (6.32), i.e. the system - whose state coefficient matrices are AG(0 and B(f) - is controllable, [QG(0 — S(?)RG1(?)ST(f)l is a positive
  • 325. 310 LINEAR OPTIMAL CONTROL semi-definite matrix, and Rc(0 is a positive definite matrix. However, note that for a plant with state-equation given by Eq. (6.1), these conditions are more restrictive than those for the existence of a unique, positive definite solution to Eq. (6.32). Solution to the algebraic Riccati equation, Eq. (6.75), can be obtained using the MATLAB function are or CST function Iqr, by appropriately specifying the coefficient matrices AG(0 and B(r), and the weighting matrices [Qc(0 - S(OR£!(OST(/)] and RG(?) at each instant of time, t. However, MATLAB (CST) provides the function Iqry for solving the output weighted linear, quadratic optimal control problem, which only needs the plant coefficient matrices A(r), B(0, C(f), and D(r), and the output and control weighting matrices, Q(r) and R(/X respectively, as follows: »[K,Mo,E] = lqry(sys,Q,R) <enter> where sys is the state-space LTI object of the plant. The Iqry command is thus easier to use than either are or Iqr for solving the output weighted problem. Example 6.5 Let us design an optimal regulator for the flexible bomber aircraft (Examples 4.7, 6.1) using output weighting. Recall that the two outputs of this sixth-order, time- invariant plant are the normal acceleration in m/s2, yi(f), and the pitch-rate in rad./s, y2(0- Our performance objectives remain the same as in Example 6.1, i.e. a maximum overshoot of less than ±2 m/s2 in the normal-acceleration and less than ±0.03 rad/s in pitch-rate, and a settling time less than 5 s, while requiring elevator and canard deflections (the two inputs) not exceeding ±0. 1 rad. (5.73°), if the initial condition is 0.1 rad/s perturbation in the pitch-rate (x(0) = [0; 0.1; 0; 0; 0; 0]r). After some trial and error, we find that the following weighting matrices satisfy the performance requirements: ?]' Mi ?] which result in the following optimal gain matrix, K«(0, the solution to algebraic Riccati equation, M0, and the closed-loop eigenvalue vector, E: »sys=ss(A,B,C,D);[Ko,Mo,E] = lqry(sys, [0.0001 0; 0 1 ] , e y e ( 2 ) ) <enter> Ko= 1.25256+001 -2.36156-002 3.35576-001 -3.76726-003 1.04266+001 4.47686+000 6.66016+000 3.34496-001 1.82386-001 -1.12276-002 5.96906+000 2.60426+000 Mo= 1.15576+000 4.6221e-0012.1004e-002 7.22816-003 1.67006-001 6.66016-002 4.62216-001 1.17156+0001.38596-002 1.29806-002-3.14876-004 3.34496-003 2.10046-002 1.38596-0027.34556-004 1.98236-004 4.47426-003 1.82386-003 7.22816-003 1.29806-002 1.98236-004 1.94696-004 -5.02296-005 -1.12276-004 1.67006-001 -3.14876-0044.47426-003-5.02296-005 1.39026-001 5.96906-002 6.66016-002 3.34496-003 1.82386-003 -1.12276-004 5.96906-002 2.60426-002
  • 326. OUTPUT WEIGHTED LINEAR OPTIMAL CONTROL 311 -1.12006+003 -9.4197e+001 -1.53856+000+ 2.20066+OOOi -1.5385e+000- 2.20066+OOOi -1.00376+000+ 6.2579e-0011 -1.00376+000- 6.2579e-001i The closed-loop initial response and required control inputs are calculated as follows: » s y s C L = s s ( A - B * K o , z e r o s ( 6 , 2 ) , C , D ) ; [y, t, X]=initial(sysCL, [0 0.1 0 0 0 0 ] ' ) ; u = -Ko*X'; <enter> Figure 6.10 shows the plots of the calculated outputs and inputs. Note that all the performance objectives are met, and the maximum control values are —0.035 rad. for both desired elevator and canard deflections, u(t) and «2(0» respectively. 5 0.1 0 0.05 0 -10 -15 -0.05 0 2 4 2 4 Time (s) Time (s) 0.02 Desired canard deflection, u2(f) S ° DC -0.02 -0.04 0 2 3 Time (s) Figure 6*10 Closed-loop initial response and required inputs for the flexible bomber aircraft, with optimal regulator designed using output weighting Let us simulate the closed-loop initial response of the present design with the regulator designed in Example 6.1 using state-weighting. We use the same SIMULINK block- diagram as shown in Figure 6.3, with the measurement noise modeled by the band- limited white noise block of power 10"4. The resulting simulated response is shown in Figure 6.11. Note that the fluctuations in both y(t) and j2(0 are about an order of magnitude smaller than those observed in Figure 6.3, which indicates that a better robustness with respect to measurement noise has been achieved using output-weighted optimal control.
  • 327. 312 UNEAR OPTIMAL CONTROL 5 0 -5 -10 -15 10 4 5 6 Time (s) 0.15 f(0 — 0.05 .w -0.05 4 5 6 10 Time (s) Figure 6. 11 Simulated initial response of the flexible bomber with an output-weighted optimal regulator including measurement noise in the pitch channel (SIMUUNK block-diagram of Figure 6.3) 6.5 Terminal Time Weighting: Solving the Matrix Riccati Equation Thus far, we have considered the optimal control problems in which the closed-loop system is brought to a desired state by minimizing the deviation of the transient response from the desired state. However, sometimes it is also important to minimize the deviation of the system from the desired state at a specified final time, tf. In other words, it is not only important to reach the final state, but to reach there in a specified final time, r/, called the terminal time. By assigning a weightage to the state of the system at the terminal time, x(f/), in the objective function to be minimized, we can specify the relative importance of minimizing the deviation from the final state. The objective function with terminal time weighting can be expressed as follows: J ( t , t f ) = /> [x T (r)Q(T)x(r) +u T (r)R(r)u(r)]dr + x T (r / )Vx(f / ) (6.77) Jt where V is the constant terminal time weighting matrix. For minimizing the objective func- tion given by Eq. (6.77) for the optimal regulator problem (i.e. when u(t ) = — Ko(f )x(f )), it can be shown using steps similar to those in Section 6. 1 , that the optimal feedback gain matrix is given by = R~ 1 (OB T (f)M 0 (6.78)
  • 328. TERMINAL TIME WEIGHTING: SOLVING THE MATRIX RICCATI EQUATION 313 where M0 is the solution to the matrix Riccati equation, Eq. (6.29), repeated here as follows: -BMo/Bt = AT(OM0 + M0A(0 - M 0 B(r)R~ 1 (OB T (r)M 0 + Q(t) (6.79) subject to the following terminal condition: M 0 (r/,f/) = V (6.80) Hence, the terminal time weighted problem differs from the standard problem of Section 6.1 only in the non-zero terminal condition for the matrix Riccati equation. Note that the terminal time weighted optimal control cannot be simplified in a manner similar to the infinite time control, which results in an algebraic Riccati equation. In other words, we cannot avoid taking the bull by the horns anymore; we have to solve the matrix Riccati equation if we want to solve the terminal time control problem. For simplicity, let us confine ourselves to time-invariant plants only, (t) = A, B(f) = B, and Q(t) = Q, R(0 = R, where A, B,Q, and R are constants. Then the matrix Riccati equation becomes -BMo/Bt = ATM0 + M0A - M0BR~1BTM0 + Q (6.81) which is to be solved with the terminal condition given by Eq. (6.80). We remarked in Section 6.1 on the difficulty of solving the matrix Riccati equation, owing to its nonlinear nature. However, if we look carefully at Eq. (6.81), we find that by expressing M0 in the following manner Mo(r, tf) = E(t, tfW~l(t, tf) (6.82) where E(t, tf) and F(r, tf) are two unknown matrices, we can write Eq. (6.81), as the following set of coupled, linear differential equations: [ d¥(t, tf)/dt ] r A -BR-'BT 1 r F<r, tf) -I [dE(t,tf)/dt-[-Q -AT [E(t,tf) (6 83) ' If we define a matrix H, called the Hamiltonian, as follows H = [_Q ^RAT] (6.84) then we can write the solution to the homogeneous set of first order, matrix differ- ential equation, Eq. (6.83), as an extension of the solution given by Eq. (4.16) to the homogeneous, vector state-equation. Hence, we can write where exp{H(f — tf)} is a matrix exponential which can be calculated by the methods of Chapter 4. To satisfy the terminal condition, Eq. (6.80), we can choose E(r/, tf) — V, and F(f/,r/) = I. Thus, for a given time, t, the matrices E ( t , t f ) and ¥(t,tf) can be
  • 329. 314 LINEAR OPTIMAL CONTROL calculated using Eq. (6.85), where the matrix exponential, exp{H(f — ff)}, is calculated by an appropriate algorithm, such as expm, expml, expm2, or expmS of MATLAB. However, care must be taken to select Q and R matrices, such that the calculated matrix F(/, //) is non-singular, otherwise M0 cannot be computed using Eq. (6.82). A MATLAB M- file called matricc.m, which solves the matrix Riccati equation for linear, time-invariant systems using Eq. (6.85) is given in Table 6.1, and can be called as follows: »Mo = matricc(A,B,Q,R,V,t,tf ,dt) <enter> where A, B, Q, R, V, t, and f/(f/) are the same as in Eq. (6.77), dt is the time-step, and Mo(M0) is the returned solution of the matrix Riccati equation, Eq. (6.81). For solving the terminal time weighted optimal control problem, it is clear that while the matrix Riccati equation is solved by marching backwards in time using Eq. (6.85) - starting with the terminal condition, Eq. (6.82) - the state-equation of the closed-loop system must be solved by marching forwards in time using the methods of Chapter 4, starting with the initial condition, x(r0) = xo. Hence, the solution requires marching in both forward and backward direction (in time), beginning from the conditions specified at the two time boundaries, i.e. the terminal time, //, and initial time, ?o- For this reason, the general optimal control problem is referred to as two-point boundary-value problem. We can write a computer program combining the solution to the matrix Riccati equation and the solution to the closed-loop state-equation. Such a program is given in Table 6.2 as an M-file called tpbvlti.m, which solves the two-point boundary-value Table 6.1 Listing of the M-file matricc.m for the solution of the terminal-time weighted, linear optimal control problem matricc.m function M=matricc(A J B,Q,R J V,t > tf); % Program for solving the Matrix Riccati equation resulting % from the terminal-time weighted optimal control problem for % linear, time-invariant systems. % A = State dynamics matrix of the plant % B = Input coefficient matrix of the plant % Q = State weighting matrix % R = Control weighting matrix % V = Terminal state weighting matrix % t = present time % tf = terminal time % M = returned solution of the Matrix Riccati equation % Copyright(c)2000 by Ashish Tewari % % Construct the Hamiltonian matrix:- H=[A -B*inv(R)*B';-Q -A']; % Solve the Matrix Riccati equation using the matrix exponential:- n=size(A,1); FE=expm2(H*(t-tf))*[eye(n);V]; F=FE(1:n,:);E=FE(n+1:2*n,:); M=E*inv(F);
  • 330. _ TERMINAL TIME WEIGHTING: SOLVING THE MATRIX RICCATI EQUATION_ 315 Table 6.2 Listing of the M-file tpbvlti.m for solving the two-point boundary value problem associated with the solution of the closed-loop state-equations with a terminal-time weighted, linear time-invariant, optimal regulator tpbvlti.m function [u,X,t] = tpbvltiCA.B.Q.RjVjtO.tf ,XO) % Time-marching solution of the two-point boundary-value problem % resulting from the terminal- time weighted, optimal regulator % for a linear, time- invariant system. % A= State dynamics matrix of the plant % B= Input coefficient matrix of the plant % Q= State weighting matrix % R= Control weighting matrix % V= Terminal state weighting matrix % tO= initial time; tf= terminal time (tf-tO should be small for % convergence) % X0= initial state vector; t= time vector % u=matrix with the ith input stored in the ith column, and jth row % corresponding to the jth time point % X= returned matrix with the ith state variable stored in the ith column, % and jth row corresponding to the jth time point % copyright (c)2000 by Ashish Tewari [w,z]=damp(A) ; mw=max(w) ; if mw==0 ; dt=(tf-tO)/20; else dt=1 /max(w) ; end t=tO:dt:tf ; n=size(t,2) ; % initial condition :- X(1,:)=XO'; % solution of the matrix Riccati equation for t=tO:- M=matricc(A,B,Q,R,V,tO,tf ) ; % calculation of input vector for t=tO:- u(1 , : )=-X(1, : )*M*B*inv(R); % beginning of the time-loop: - for i=1 :n-1 % solution of the matrix Riccati equation : - M=matricc(A,B,Q,R,V,t(i),tf ) ; % calculation of the closed-loop state-dynamics matrix Ac=A-B*inv(R)*B'*M; % conversion of system from continuous-time to digital [ad,bd]=c2d(Ac,B,dt); % solution of digitized closed-loop state-equations % updating the input vector for time t=t(i):- u(i+1 , : ) = - X ( i + 1 , : ) * M * B * i n v ( R ) ; end
  • 331. 316 UNEAR OPTIMAL CONTROL problem for a linear, time-invariant plant using matricc.m for the solution of matrix Riccati equation. This M-file can be used as follows: »[u,X,t] = tpbvltMA.B.Q^V.tO.tf ,XO) <enter> where A, B, Q, R, V, t, and tf(tf) have their usual meanings, fO is the initial time at which the initial condition vector, xO, is specified, and u, x, and t contain the returned input, state and time vectors, respectively. However, the usage of this M-file is restricted to small value of the interval tf — to. For larger time intervals, a time-marching procedure of Chapter 4 could be used, employing // — IQ as the time step. Example 6.6 Terminal time weighting is very common in problems where two objects are desired to be brought together in a specified final time, such as missile guidance to a target, a rendezvous (or docking) of two spacecraft, or a rendezvous of an aircraft and a tanker aircraft for refuelling. When posing the optimal guidance strategy for such problems, usually the state variables are the relative distance between the two objects, x(t), and the relative velocity (also called the closure velocity), X2(t). At some specified final time, r/, it is desired that the relative distance becomes zero, i.e. x(tf) = 0. Whereas in a rendezvous problem, it is also desired that the final closure velocity also becomes zero, i.e. *2(//) = 0, such a condition is not imposed on guiding a missile to its target. If x (tf) / 0, a miss is said to occur, and the miss distance, x(tf), is a measure of the success (or failure) of either the rendezvous or the missile intercept. The linear, time-invariant state-equation for a missile guidance or a rendezvous problem can be written in terms of the state variables, ATI (t ) and X2(0> and single input, u(t} - which is the normal acceleration provided to the object - with the following state coefficient matrices: When we do not care how the missile (or spacecraft) moves before the intercept (or rendezvous) occurs, we may not wish to assign any weightage to the tran- sient response by choosing Q = 0, and R = 1 . In such cases, the matrix Riccati equation can be solved analytically, and you may refer to Bryson and Ho [2] for the resulting exact solutions. However, it is generally desired that the plant adheres to certain limitations in its transient response, while proceeding from the initial time to the final time, hence Q is appropriately chosen to be non-zero. Let us consider a spacecraft docking (rendezvous) problem. The initial relative distance and closure velocity between the two spacecraft are 100 m and —10 m/s, respec- tively. It is desired to complete the rendezvous in 10 seconds, with the closure velocity never exceeding a magnitude of 50 m/s, while requiring a maximum normal acceleration input magnitude of less than 50 m/s2. The docking will be considered successful if the final magnitudes of relative distance, x ( t f ) , and relative velocity, X2(tf), are less than 0.15 m and 0.5 m/s, respectively. Since both relative distance,
  • 332. TERMINAL TIME WEIGHTING: SOLVING THE MATRIX RICCATI EQUATION 317 x (0, and closure velocity, X2(t), are required to be minimized at the terminal time, the terminal time weighting matrix, V, should assign weightage to both the state variables. The following choice of Q, R, and V is seen to meet the performance requirements: i o 10 0 (6.87) V = 0 0 0 0 and the two-point boundary-value problem is solved using tpbvlti.m as follows: » [ u , X , t ] = tpbvlti(A,B, [1 0; 0 0 ] , 3 , [ 1 0 0; 0 0 ] , 0 , 1 0 , [100 - 1 0 ] ' ) ; <enter> The calculated state variables, *i(0 and X2(t), and the input, u(t), are plotted in Figure 6.12. Note that the performance objectives are met quite successfully. The calculated values of x(tf) and X2(t/) are not exactly zeros, but —0.1438 m and 0.3610 m/s, respectively; however, these are small enough to be acceptable. 100 i i i Relative distance, x^( 50 0 Closure velocity, x2(t) (m/s) -50 0 4 6 8 10 Time (s) Figure 6.12 Closed-loop docking of spacecraft with terminal time weighted, optimal regulator Example 6.7 Suppose it is desired to bring both normal acceleration, y(t), and the pitch-rate, y2(f), of the flexible bomber aircraft (Example 6.5) to zero in exactly 0.2 seconds, after encountering a perturbation in the pitch-rate of 0.1 rad/s, regardless of the maximum overshoot and settling time of the transient response. Since we do not care what happens to the transient response, we can choose Q = 0. Then the choice of
  • 333. 318 LINEAR OPTIMAL CONTROL R and V matrices that achieves the desired performance is R = 101, and V = 9071, and the closed-loop response is calculated using tpbvlti as follows: »[u,X,t] = tpbvlti(A,B,zeros(6),10*eye(2),907*eye(6),0,0.2, [0 0.1 0 0 0 0 ] ' ) ; y = C*X'; <enter> The resulting outputs y(t} and 72(0. and the required inputs, u(t) and 1*2(1), are plotted in Figure 8.13. Note that both y(t) and ^(O are minimized in 0.2 seconds, as desired. The maximum input magnitudes do not exceed ±0.3 rad.(17°). This design has been carried out after experimenting with various values of u, where V = vl, and settling with the one (v = 907) that gives the minimum magnitudes of y(tf) and V2(f/), which are —0.009 m/s2 and —1.4 x 10~4 rad., respectively. 50 0.1 Normal Pitch-rate acceleration 0.05 I ^ -50 -100 -0.05 0 0.1 0.2 0.1 0.2 Time (s) Time (s) 0.2 Desired elevator deflection, 0 -0.2 Desired canard deflection, -0.4 0 0.05 0.1 0.15 0.2 Time (s) Figure 6.13 Closed-loop response of the flexible bomber aircraft with terminal-time weighted, optimal regulator (tf = 0.2 s) Exercises 6.1. Design an optimal, full-state feedback regulator for the distillation column whose state- space representation is given in Exercises 5.4 and 5.15, using Q = 1 x 10~4I and R = I. Determine the initial response of the regulated system to the initial condition, x(0) = [1; 0; 0; 0]r. Calculate the inputs required for the closed-loop initial response. 6.2. Re-design the optimal regulator for the distillation column in Exercise 6.1, choosing Q and R such that the settling time of the closed-loop initial response to x(0) = [ 1; 0; 0; 0]r
  • 334. EXERCISES 319 is less than 10 seconds, and the maximum overshoot magnitudes of both the outputs are less than 1 x 10"3 units. Calculate the inputs required for the closed-loop initial response. 6.3. For the aircraft lateral dynamics given in Exercise 4.3, design a two-input optimal regulator with Q SB I and R = I. Calculate and plot the initial response, p(t), of the regulated system if the initial condition is x(0) = [/?(()); r(0); 0(0); 0(0)]r = [0.5; 0; 0; 0]r. What are the settling time and the maximum overshoot of the closed-loop initial response? What are the largest input magnitudes required for the closed-loop initial response? 6.4. For the turbo-generator of Example 3.14, with the state-space representation given by Eq. (3.117), design a two-input optimal regulator with Q = I and R = I. Calculate and plot the initial response of the regulated system if the initial condition is x(0) = [0.1; 0; 0; 0; 0; 0]r. What are the settling time and the maximum overshoots of the closed- loop initial response? What are the largest control input magnitudes required for the closed-loop initial response? 6.5. Re-design the regulator in Exercise 6.4 using output-weighted optimal control such that the maximum overshoot magnitudes of both the outputs in the initial response to x(0) = [0.1; 0; 0; 0; 0; 0]r is less than 0.035 units, with a settling time less than 0.6 second, and the required input magnitudes of u ( t } and «a(0 should not exceed 0.05 units and 0.4 units, respectively. 6.6. Re-design the regulator for the distillation column to the specifications of Exercise 6.2 using output weighted optimal control. 6.7. Repeat Exercise 6.3 using output weighted optimal control with Q = I and R = I. Compare the initial response and input magnitudes of the new regulator with that designed in Exer- cise 6.3. 6.8. It is required that the bank-angle, 0(f), of the aircraft in Exercise 6.3 must track a desired bank-angle given by <j>d(t) = 0.1 rad. Design an optimal tracking system to achieve the desired bank angle in less than 5 seconds with both the input magnitudes less than 0.1 rad., and plot the closed-loop tracking error, (f>d(t) — <p(t), if the initial condition of the airplane is zero, i.e. x(0) = 0. Use SIMULINK to investigate the robustness of the tracking system to a random measurement noise in feeding back the roll-rate, p(t). 6.9. Can you design a tracking system for the aircraft in Exercise 6.3 to track a desired constant roll-rate, pd(t)l 6.10. Can you design a tracking system for the turbo-generator of Exercise 6.4 such that a desired state vector is d(t) = [10; 0; 0; 0; 0; 0]r?
  • 335. 320 UNEAR OPTIMAL CONTROL 6.11. The angular motion of a tank-gun turret [5] is described by the following state-coefficient matrices: "0 1 0 0 0 0 0 0" 0 0 1 0 0 0 0 0 0 1071 -46 -1071 0 0 0 0 0 0 4,7 -94.3 0 0 0 0 A= 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 947 -17.3 -947 0 0 0 0 0 0 -7.5 -101 " 0 0 " 0 0 0 0 94 3 0 (6.88) 0 0 0 0 0 0 0 94.3 The state-vector is given by x(r) = [x(t); X2(t); • • • ;*s(0]r, where x(t) is the turret azimuth angle, X2(t) is the turret azimuth angular rate, x$(t) is the turret azimuth angular acceleration, x^(t} is the azimuth control hydraulic servo-valve displacement, jcs(0 is the turret elevation angle, X(,(t) is the turret elevation angular rate, Xj(t) is the turret elevation angular acceleration, and JCg(f) is the elevation control hydraulic servo- valve displacement. The input vector, u(0 = [u(t); U2(t)]T, consists of the input to the azimuth control servo-valve, u ( t ) , and the input to the elevation control servo-valve, u2(t). Design an optimal tracking system for achieving a constant desired state-vector, x/ = [1.57; 0; 0; 0; 0.5; 0; 0; 0]r, in less than seven seconds, if the initial condition is zero, i.e. x(0) = 0, with the control inputs not exceeding five units. Plot the initial response and the required control inputs. Using SIMULINK, study the robustness of the tracking system with respect to the following: (a) measurement noise in the turret azimuth angular acceleration, x$(t), channel. (b) measurement noise in the turret elevation angular acceleration, xi(t). (c) saturation limits on the two servo-valves, u(t) and U2(t). 6.12. Design a terminal-time weighted optimal regulator for the tank-gun turret if it is desired to move the turret to a zero final state in exactly 0.2 seconds, beginning with an initial condition of x(0) = [0.05; 0; 0; 0; 0.01; 0; 0; 0]r. Plot the azimuth and elevation angles of the turret, x(t), and x2(t), respectively, and the required control inputs. What are the maximum control input magnitudes? 6.13. For the turbo-generator of Exercise 6.4, design a terminal-time weighted optimal regulator such that the system is brought to a zero final state in exactly 1 second, beginning with the initial condition x(0) = [10; 0; 0; 0; 0; 0]r. Plot the outputs and the required control inputs.
  • 336. REFERENCES 321 6.14. For the amplifier-motor of Example 6.3, design a terminal-time weighted optimal regulator such that the load angle, 6(t), is brought to zero in exactly 0.5 seconds, beginning with the initial condition x(0) = [0.1; 0; 0]r. Plot the outputs and the required control inputs. What is the maximum overshoot of the angular velocity, 6> (1) (0, and what is the final value of 0 (1) (0? References 1. Kreyszig, E. Advanced Engineering Mathematics. John Wiley & Sons, New York, 1972. 2. Bryson, A.E. and Ho, Y.C. Applied Optimal Control. Hemisphere, New York, 1975. 3. Junkins, J.L. and Kim, Y. Introduction to Dynamics and Control of Flexible Structures. AIAA Education Series, American Institute of Aeronautics and Astronautics, Washington, DC, 1993. 4. Tewari, A. Robust model reduction of a flexible spacecraft. J. of Guidance, Control, and Dynamics, Vol. 21, No.5, 1998, 809-812. 5. Loh, N.K. Cheok, K.C. and Beck, R.R. Modern control design for gun-turret control system. Paper 1/5, Southcon/85 Convention Record, Atlanta, GA, 1983.
  • 337. This page intentionally left blank
  • 338. Kalman Filters 7.1 Stochastic Systems We defined deterministic systems in Chapter 1 as those systems whose governing physical laws are such that if the state of the system at some time (i.e. the initial condition) is specified, then one can precisely predict the state at a later time. Most (if not all) natural processes are non-deterministic systems (i.e. systems that are not deterministic). Non- deterministic systems can be divided into two categories: stochastic and random systems. A stochastic (also called probabilistic) system has such governing physical laws that even if the initial conditions are known precisely, it is impossible to determine the system's state at a later time. In other words, based upon the stochastic governing laws and the initial conditions, one could only determine the probability of a state, rather than the state itself. When we flip a perfect coin, we do not know if head or tail will come up; we only know that both the possibilities have an equal probability of 50%. The disturbances encountered by many physical systems - such as atmospheric turbulence and disturbance due to an uneven ground - are produced by stochastic systems. A random system is one which has no apparent governing physical laws. While it is a human endeavour to ascribe physical laws to observed natural phenomena, some natural phenomena are so complex that it is impossible to pin down the physical laws obeyed by them. The human brain presently appears to be a random system. Environmental temperature and rainfall are outputs of a random system. It is very difficult to practically distinguish between random and stochastic systems. Also, frequently we are unable to practically distinguish between a non-deterministic (stochastic or random) system, and a deterministic system whose future state we cannot predict based upon an erroneous measurement of the initial condition. A double pendulum (Figure 1.5) is a classic example of unpredictable, deterministic systems. For all practical purposes, we will treat all unpredictable systems - deterministic or non- deterministic - (stochastic or random) as stochastic systems, since we have to employ the same statistical methods while studying such systems, regardless of the nature of their physical governing laws. For the same reason, it is a common practice to use the words random, stochastic, and unpredictable interchangeably. While we are unable to predict the state of a random process, we can evolve a strategy to deal with such processes when they affect a control system in the form of noise. Such a strategy has to be based on a branch of mathematics dealing with unpredictable systems, called statistics. Since the initial state, x(?o), of a stochastic system is insufficient to determine the future state, x(0, we have to make an educated guess as to what the future state might be, based upon a statistical analysis of many similar systems, and taking the average of
  • 339. 324 KAIMAN FILTERS their future states at a given time, t. For example, if we want to know how a stray dog would behave if offered a bone, we will offer N stray dogs N different bones, and record the state variables of interest, such as intensity of the sound produced by each dog, the forward acceleration, the angular position of the dog's tail, and, perhaps, the intensity of the dog's bite, as functions of time. Suppose x/(f) is the recorded state-vector of the /th dog. Then the mean state-vector is defined as follows: (7.1) Note that x m (f) is the state- vector we would expect after studying N similar stochastic systems. Hence, it is also called the expected value of the state-vector, x(f), and denoted by xm(0 = £[*(/)]• The expected value operator, £[•], has the following properties (which are clear from Eq. (7.1)): (a) E{random signal] = mean of the random signal. (b) E[deterministic signal] = deterministic signal. (c) E[x,(r) + x 2 (r)l = £[xi(01 + E[x2(t)]. (d) £[Cx(?)] - CE[x(/)]; C = constant matrix. (e) £[x(OC] = E[x(0]C; C = constant matrix. (f) £[x(/)y(0] = E[x(r)]y(r); x(f) = random signal; y(t) = deterministic signal. (g) E[y(t)(t)] = y(f)£[x(f)]; x(0 = random signal; y(t) = deterministic signal. We can define another statistical quantity, namely a correlation matrix of the state-vector as follows: N R,(f, r) = ( l / A O x K O x f O r ) (7.2) The correlation matrix, R x (f,-r), is a measure of a statistical property called correla- tion among the different state variables, as well as between the same state variable at two different times. For two scalar variables, x(t) and *2(r), if the expected value of *i (0*200 is zero, i.e. E[x(t)x2(r)] = 0, where T is different from t, then x(t) and jt2(0 are said to be uncorrelated. Comparing Eqs. (7.1) and (7.2), it is clear that the correlation matrix is the expected value of the matrix x,(r)xf (r), or Rx(t, r) = E[x,(r)xf (r)]. When t = T, the correlation matrix, Rx(t, r) = E[Xj(t)T(t)], is called the covariance matrix. It is obvious that the covariance matrix, Rx(t, r), is symmetric. If R*(/,r) is a diag- onal matrix, it implies that all the state variables are uncorrelated, i.e. E[Xi(t)xj(r)] = 0, where i ^ j. You are referred to a textbook on probability and statistics, such as that by Papoulis [1], for further details on expected values, correlation and covariance matrices. There are special stochastic systems, called stationary systems, for which all the statis- tical properties, such as the mean value, x m (/), and correlation matrix, R x (r, r), do not
  • 340. STOCHASTIC SYSTEMS 325 change with a translation in time, i.e. when time, t, is replaced by (t + 0). Hence, for a stationary system, xm(t + 0) = x m (0 — constant, and R x (f + 9, T + 0) = R x (r, r) for all values of 0. Expressing R x (f, r) — R x (/, t + a) where r = t + a, we can show that for a stationary system, R x (f — a,t) = R x (f, t + a), which implies that for a stationary system, the correlation matrix is only a function of the time-shift, a, i.e. Rx(t, t -fa) = R x (a). Many stochastic systems of interest are assumed to be stationary, which greatly simplifies the statistical analysis of such systems. The expected value, xm(0, and the correlation matrix, R x (£, r), are examples of ensemble statistical properties, i.e. properties of an ensemble (or group) of N samples. Clearly, the accuracy by which the expected value, x m (/), approximates the actual state- vector, x ( t ) , depends upon the number of samples, N. If N is increased, the accuracy is improved. For a random system, an infinite number of samples are required for predicting the state-vector, i.e. N = oo. However, we can usually obtain good accuracy with a finite (but large) number of samples. Of course, the samples must be taken in as many different situations as possible. For example, if we confined our sample of stray dogs to our own neighborhood, the accuracy of ensemble properties would suffer. Instead, we should pick the dogs from many different parts of the town, and repeat our experiment at various times of the day, month, and year. However, as illustrated by the stray dog example, one has to go to great lengths merely to collect sufficient data for arriving at an accurate ensemble average. Finding an ensemble average in some cases may even be impossible, such as trying to calculate the expected value of annual rainfall in London - which would require constructing N Londons and taking the ensemble average of the annual rainfall recorded in all the Londons! However, we can measure annual rainfall in London for many- years, and take the time average by dividing the total rainfall by the number of years. Taking a time average is entirely different from taking the ensemble average, especially if the system is non-stationary. However, there is a sub-class of stationary systems, called ergodic systems, for which a time average is the same as an ensemble average. For those stationary systems that are not ergodic, it is inaccurate to substitute a time average for the ensemble average, but we still do so routinely because there is no other alternative (there is only one London in the world). Hence, we will substitute time averaged statistics for ensemble statistics of all stationary systems. For a stationary system, by taking the time average, we can evaluate the mean, x m , and the correlation matrix, R x (r), over a large time period, T -» oo, as follows: ,772 / x(t)dt (7.3) J-T/2 r/2 If T x(t)'(t + r) dt (7.4) J-T/2 Note that since the system is stationary, the mean value, xm, is a constant, and the correlation matrix, R x (r), is only a function of the time-shift, T. For frequency domain analysis of stochastic systems, it is useful to define a power spectral density matrix, Sx(<w), as the Fourier transform of the correlation matrix, R x (r), given by {i)Q"iandr (7.5)
  • 341. 326 KALMAN FILTERS where u> is the frequency of excitation (i.e. the frequency of an oscillatory input applied to the stochastic system). The power spectral density matrix, Sx(o>), is a measure of how the power of a random signal, x(f), varies with frequency, a>. The Fourier transform of the random signal, x(r), is given by X(ia)) = /_' (t)e-ia"dt :,-») = I (7.6) It can be shown from Eqs. (7.4)-(7.6) that Sx(o>) = X(ia>)XT(-ia)) (7.7) The correlation matrix, R x (r), can be obtained by calculating the inverse Fourier transform of the power spectral density matrix, Sx(o>), as follows: R x (r) = (1/27T) I Sx(a))eia>Tda> (7.8) J—oc Comparing Eqs. (7.4) and (7.8), we find that at r = 0, the correlation matrix becomes the covariance matrix, given by • r/2 772 roc x(t)xT(t)dt = (1/23T) / S,(w)e"wrrfo> (7.9) / -r/2 •T/2 J-x or £ = 2nms (7.10) where x^, called the mean-square value of x(f), is the following: .r/2 /. / x(Ox T (r)^ (7.11) -T/2 J- Usually, the state-vector, x(r), is available at discrete time points, rather than as a continuous function of time. The discrete Fourier transform of a discrete time state- vector, (j Ar), where A/ is the time step size and j = 1, 2, . . . , N, is calculated by the following expression: N where Aw = 2n/(N&t) is the frequency step size. Similarly, the inverse discrete Fourier transform can be calculated as follows: N (7.13) When the discrete Fourier transform is used to calculate the power spectral density, the result must be divided by N, the number of frequency points in X(fcA&>) as follows: (7.14)
  • 342. STOCHASTIC SYSTEMS 327 The discrete Fourier transform of a signal, x ( t ) , can be calculated by using the MATLAB command for discrete Fourier transform,^, as follows: »X = f f t ( x , n ) <enter> where x is the returned n-point discrete Fourier transform of x. If n is not specified, an N- point Fourier transform is calculated, where N is the number of discrete time points in the matrix x. x has as many rows as there are time points, and as many columns as there are variables. Thus, each column of x is the Fourier transform of the corresponding column of x. The inverse discrete Fourier transform is similarly calculated using the MATLAB command if ft as follows: »x = ifft(X,n) <enter> Example 7.1 Consider a scalar random signal, x(t), which is generated using the MATLAB command randn as follows: »t=0:0.1:10; randn('seed',0); x=randn(size(t)); <enter> The command randn generates a random number, according to a special random process with a zero mean value, called normal(or Gaussian) probability distribution [1]. The 'seed' of the random number generator, randn, is set to zero to initialize the generating process to the value when MATLAB is started. The random signal, jc(0, is generated in time steps of 0.1 seconds, for 10 seconds - a total of 101 time points. The full-order discrete Fourier transform of x(t) is calculated as follows: »X=fft(x); <enter> The discrete frequencies, a>, at which the Fourier transform of x(t) is calculated are calculated and stored in vector w as follows: »w = (0: l e n g t h ( X ) - 1 ) ' * 2 * p i / ( 0 . l * l e n g t h ( X ) ) ; <enter> The power spectral density, Sx(co), of the discrete random signal, x(t), is calculated as follows: »S = X . * c o n j ( X ) / l e n g t h ( X ) ; <enter> The correlation function, RX(T) is calculated by taking the inverse Fourier transform of S(&>) with the help of the MATLAB command iffi as follows: »Rx = i f f t ( S ) ; <enter> The scalar plots *(?), X(co), Sx(a>), and Rx(t) are shown in Figure 7.1. Note the special shape of the Sx (&>) plot - it is symmetrical about the mid-point frequency a) = 51 Aw = 31.1 rad/s. This is a characteristic of the normal distribution.
  • 343. 328 KALMAN FILTERS Figure 7.1 Random signal, x(f), its Fourier transform magnitude, X(co), power spectral density, Sx(co), and correlation function, RX(T) The mean value of x(t) can be obtained using the MATLAB command mean as follows: »mean(x) <enter> ans = 0.0708 which is very close to zero as expected (the mean value of x(t) will be exactly zero only if the number of sample points, i.e. the length of x(t), is infinity). The covariance, RX(G) can be read from the plot of RX(T} to be approximately 0.9, or obtained more precisely using the MATLAB command cov as follows: »cov(x) <enter> ans = 0.9006 The mean-square of jc(f), xms, can be calculated as follows: »xms = mean(x.*x) <enter> ans = 0.8967 Note that xms is equal to the mean value of the power spectral density Sx (&>) plot, calculated as follows: »mean(S) <enter> ans = 0.8967
  • 344. FILTERING OF RANDOM SIGNALS 329 You can repeat Example 7.1 using a different MATLAB random number generator called rand, which follows another stochastic process called uniform probability distribu- tion. Definition and discussion of probability distributions of random processes is beyond the scope of this book, but can be found in a textbook on probability, such as that by Popoulis [1J. 7.2 Filtering of Random Signals When random signals are passed through a deterministic system, their statistical properties are modified. A deterministic system to which random signals are input, so that the output is a random signal with desired statistical properties is called a filter. Filters can be linear or nonlinear, time-invariant or time varying. However, for simplicity we will usually consider linear, time-invariant filters. Linear, time-invariant filters are commonly employed in control systems to reduce the effect of measurement noise on the control system. In such systems, the output is usually a superposition of a deterministic signal and a random measurement noise. Often, the measurement noise has a predominantly high- frequency content (i.e. its power spectral density has more peaks at higher frequencies). To filter-out the high-frequency noise, a special filter called a low-pass filter is employed, which blocks all signal frequencies above a specified cut-off frequency, o>o. The output of a low-pass filter thus contains only lower frequencies, i.e. a> < OJQ, which implies a smoothening of the input signal fed to the filter. Sometimes, it is desired to block both high- and low-frequency contents of a noisy signal. This is achieved by passing the signal through a band-pass filter, which allows only a specified band of frequencies, a) < a> < a>2, to pass through as the output signal. Similarly, a high-pass filter blocks all frequencies below a specified cut-off frequency, COQ, and has an output containing only the higher frequencies, i.e. a> > &>(>. Since it is impossible for a filter to perfectly block the undesirable signals, it is desired that the magnitude of signal above or below a given frequency decays rapidly with frequency. Such a decay of signal magnitude with frequency is called attenuation, or roll-off. The output of a filter not only has a frequency content different from the input signal, but also certain other characteristics of the filter, such as a phase-shift or a change in magnitude. In other words, the signal passing through a filter is also distorted by the filter, which is undesirable. It is inevitable that a filter would produce an output signal based upon its characteristics, described by the transfer-function, frequency response, impulse response, or a state-space representation of the filter. However, a filter can be designed to achieve a desired set of performance objectives - such as cut-off frequencies, desired attenuation (roll-off) of signals above or below the cut-off frequencies, etc., with the minimum possible distortion of the signals passing through the filter. Usually, it is observed that a greater attenuation of noise also leads to a greater distortion of the filtered signal. It is beyond the scope of this book to discuss the many different approaches followed in filter design, and you may refer to Parks and Burrus [2] for details. It suffices here to state that the numerator and denominator polynomials of the filter's transfer function, or coefficient matrices of the filter's state-space model, can be selected by a design process to achieve the conflicting requirements of maximum noise attenuation and minimum signal distortion.
  • 345. 330 KAIMAN FILTERS Example 7.2 Consider a single-input, single-output filter with the following transfer function: <WO) (7.15) This is the simplest possible low-pass filter with cut-off frequency, O>Q. Let us pass the following signal - which is a deterministic system's output (sin(lOf)) corrupted by a normally distributed random noise - through this low-pass filter: u(t) = sin(lOr) + Q.2*randn(t) (7.16) where randn(t) denotes the random noise generated by the MATLAB random number generator with a normal distribution (see Example 7.1). The random input signal is generated as follows: » t=0: 0.001 :1 ;randn( 'seed' ,0) ;u=sin(10*t)+0.2*randn(size(t) ) ; <enter> To block the high-frequency random noise, a cut-off frequency COQ = 10 rad/s is initially selected for the low-pass filter, and the Bode plot of the filter is obtained as follows: » n = 10; d = [1 10]; sys=tf(n,d); [mag, phase.w] = bode(sys); <enter> The filter is re-designed with cut-off frequency values, COQ = 40 and 100 rad/s. The Bode plots of the low-pass filter with cut-off frequency values WQ = 10, 40, and 100 rad/s, are plotted in Figure 7.2. Note that the magnitude of the filter decays with frequency at a) > COQ, providing noise attenuation for frequencies above (OQ. The filter does not totally block the frequencies above the cut-off frequency, but decreases the magnitude (attenuates) almost linearly with the logarithmic frequency. The ideal roll-off (i.e. slope of decreasing magnitude with frequency) for filtering noise is 20 dB per 10 divisions of logarithmic frequency scale in rad/s (called 20 dB per decade). The smaller the value of the cut-off frequency, the earlier would noise attenuation begin, and smaller will be the noise content of the filtered signal. It can be seen in the magnitude plot of Figure 7.2 that the filter with CDQ = 10 rad/s achieves a roll-off of 20 dB per decade at frequencies above 20 rad/s, while the other two filters achieve the same roll-off at much higher frequencies. The phase plot in Figure 7.2 shows that the low-pass filter decreases the phase of the input signal. Hence, a first order low-pass filter is also said to act as a phase-lag device. However, the phase of filter with CDQ — 10 and 40 rad/s begins to change at frequencies below 10 rad/s, which implies that the deterministic part of the random input signal, sin(lOr), would be appreciably distorted (i.e. changed in wave-form) by these two filters, which is undesirable. The phase of the filter with (OQ = 100 rad/s is relatively unchanged until 10 rad/s, indicating little distortion of the deterministic signal. A simulation of the filter's output is obtained using Control System Toolbox (CST) function Isim as follows: »[y,t,X]=lsim(sys,u,t) ; <enter>
  • 346. FILTERING OF RANDOM SIGNALS 331 = 1 0 rad/s --- = 40 rad/s = 1 00 rad/s 10 10 102 Frequency (rad/s) O) 0) T3 -50 CO 0~ -100 10 102 103 Frequency (rad/s) Figure 7.2 Bode plots of a first-order, low-pass filter with cut-off frequency, O)Q = 10, 40, and TOO rad/s CO O) i -1 a: _2 0.2 0.4 0.6 0.8 Time (s) = 40 rad/s X - = 10 rad/s i 0.2 0.4 0.6 0.8 Time (s) Figure 7.3 Raw signal and filtered signals after passing through a first-order, low-pass filter with cut-off frequency, 1 0, 40, and 1 00 rad/s, respectively The input, u(t), (i.e. raw signal) and the output, y ( t ) (i.e. the filtered signal) for o)() = 10, 40, and 100 rad/s are plotted in Figure 7.3. Note in Figure 7.3 that the filtered signals are smoother than the raw signal, but have an appreciable distortion in the wave-form, compared to the desired noise-free signal sin(lOO). Among the
  • 347. 332 KALMAN FILTERS three filter designs, for the filter with <WQ = 10 rad/s the distortion is maximum, but the filtered signal is the smoothest. For the filter with COQ = 100 rad/s, the wave- form distortion is minimum, but the filtered signal is the roughest indicating that the filter has allowed a lot of noise to pass through. An intermediate value of the cut- off frequency, COQ = 40 rad/s, provides a good compromise between the conflicting requirements of smaller signal distortion and greater noise attenuation. Example 7.3 Let us consider filtering a random signal which consists of a linear superposition of a deterministic signal, sin(20r) + sin(50f), with a random noise given by u(t) = sin(20r) + sin(50r) + Q.5*randn(t) (7.17) where randn(t) denotes the random noise generated by the MATLAB's normal distribution random number generator. To filter the noise with least possible distor- tion, a sophisticated low-pass filter, called elliptic filter, is used with the following state-space representation: "-153.34 -94.989 0 0 94.989 0 0 0 -153.34 104940 -62.975 -138.33 0 0 138.33 "120" 0 120 0 C = [-1.2726x 10~5 8.7089 x 10~3 -5.2265 x 10~6 1.0191 x 10~3] D = 9.9592 x 10~6 The Bode plot of the fourth order elliptic filter, shown in Figure 7.4, is obtained as follows: »sfilt=ss(A,B,C,D); bode(sfilt) <enter> Figure 7.4 shows a cut-off frequency of 120 rad/s, a roll-off of about 100 dB per decade between the cut-off frequency and 1000 rad/s, and ripples in the magnitude for frequency greater than 1000 rad/s. The passband, i.e. the band of frequencies which the filter lets pass (<w < 120 rad/s), is seen to be flat in magnitude, which implies a negligible magnitude distortion of the deterministic part of the filtered signal. The stopband, i.e. the band of frequencies which the filter is supposed to block (&»120 rad/s), is seen to have ripples at —100 dB magnitude. As this magni- tude is very small, there is expected to be a negligible influence of the ripples on the filtered signal. The phase plot shows a gradual 180° phase change in the passband, and rapid phase changes in the stopband above 1000 rad/s.
  • 348. FILTERING OF RANDOM SIGNALS 333 a -so - -100 - -150 10 102 103 10" Frequency (rad/sec) 180 c J3 -180 - -360 - 102 103 104 Frequency (rad/sec) Figure 7.4 Bode plot of a fourth-order, low-pass elliptic filter with cut-off frequency 120 rad/s (Example 7.3) i 1 1 Filtered signal, y(f), by low-pass elliptic filter Deterministic signal, sin(20t) + sin(50t) Figure 7.5 Raw random plus deterministic signal, and filtered signal after passing through a fourth-order, low-pass elliptic filter with cut-off frequency 120 rad/s The filter output is simulated using MATLAB command Isim as follows: >:> [ y j t , X ] = l s i m ( s f i l t , u , t ) ; <enter> Figure 7.5 shows time-plots of the raw signal, u(t), and the filtered signal, y compared with the desired deterministic output, sin(20f) + sin(50/). The filtered signal is seen to be smooth, and with only a phase-lag as the signal distortion, when compared with the desired deterministic signal.
  • 349. 334 KAIMAN FILTERS 7.3 White Noise, and White Noise Filters In the previous section, we saw how random signals can be generated using a random number generator, such as the MATLAB command randn, which generates random numbers with a normal (or Gaussian) probability distribution. If we could theoretically use a random number generator to generate an infinite set of random numbers with zero mean value and a normal probability distribution, we would have a stationary random signal with a constant power spectral density [1]. Such a theoretical random signal with zero mean and a constant power spectral density is called a stationary white noise. A white noise vector, w(f), has each element as a white noise, and can be regarded as the state-vector of a stochastic system called a white noise process. For such a process, we can write the mean value, wm = 0, and the power spectral density matrix, S(o>) = W, where W is a constant matrix. Since the power spectral density of a white noise is a constant, it follows from Eq. (7.9) that the covariance matrix of the white noise is a matrix with all elements as .infinities, i.e. R w (0) = oo. Also, from Eq. (7.8) we can write the following expression for the correlation matrix of the white noise process (recall that the inverse Laplace (or Fourier) transform of a constant is the constant multiplied by the unit impulse function, 8(t)): (7.18) Equation (7.18) re-iterates that the covariance of white noise is infinite, i.e. Rw(0) = oo. Note that the correlation matrix of white noise is zero, i.e. R w (r) = 0, for r 7^ 0, which implies that the white noise is uncorrelated in time (there is absolutely no correlation between w(r) and w(r + r)). Hence, white noise can be regarded as perfectly random. However, a physical process with constant power spectral density is unknown; all physical processes have a power spectrum that tends to zero as u> —>• oo. All known physical processes have a finite bandwidth, i.e. range of frequencies at which the process can be excited (denoted by peaks in the power spectrum). The white noise, in contrast, has an infinite bandwidth. Hence, the white noise process appears to be a figment of our imagination. However, it is a useful figment of imagination, as we have seen in Chapters 5 and 6 that white noise can be used to approximate random disturbances while simulating the response of control systems. Let us see what happens if a linear, time-invariant system is placed in the path of a white noise. Such a linear system, into which the white noise is input, would be called a white noise filter. Since the input is a white noise, from the previous section we expect that the output of the filter would be a random signal. What are the statistical properties of such a random signal? We can write the following expression for the output, y(t), of a linear system with transfer matrix, G(s), with a white noise input, w(f), using the matrix form of the superposition integral of Eq. (2.120), as follows: y(0 = I g(r-r)w(r)rfr (7.19) J—oc where g(/) is the impulse response matrix of the filter related to the transfer matrix, G(s). by the inverse Laplace transform as follows:
  • 350. WHITE NOISE, AND WHITE NOISE FILTERS 335 g(f) = / G(s)Gstds (7.20) Jo The lower limit of integration in Eq. (7.19) can be changed to zero if the white noise, w(/), starts acting on the system at t = 0, and the system is causal, i.e. it starts producing the output only after receiving the input, but not before that (most physical systems are causal). Since the input white noise is a stationary process (with mean, wm = 0), and the filter is time-invariant, we expect that the output, y ( t ) , should be the output of a stationary process, and we can determine its mean value by taking time average as follows: 772 fT/2 fT/ _ fT/2 2 r ft / y(t)dt = imT^OG(]/T) I / g(r — r)w(r) dr dt -7/2 J-T/2 J-T/2 U- J-T/2 U-oo = / g(r-r)|limr->c»(l/r) / w(t)dt]dT = f J-oo L -T/2 J-T2 J J J- (7.21) Hence, the mean of the output of a linear system for a white noise input is zero. The correlation matrix of the output signal, R y (r) can be calculated as follows, using the properties of the expected value operator, £"[•]: R y (r) = £[y(OyT(* + T)] = E f g(t- a)w(a) da • f wT(£)gT(f + r - ft) dft .J — CO J~ OC *t rt+r ft+T -i ~E / g(r - a)w(a)wT(^)gT(f + T - ft) da dft ' — oo J-oo J—oo J dft (7.22) — OO J — OO Using the fact that £[w(a)w(/3)] = R w (a - ft) = W8(p - a), we can write R y< T > = / / 8(? - a)ViS(ft - oc)gT(t + r - ft), da dft J — OO J —OO t ft+T g(t - cOWgT(? + r-a)da= I g(A)Wg T (A + r) dX (7.23) / -OO J — OC Since y(t) is the output of a stationary process, we can replace the upper limit of integra- tion in Eq. (7.23) by oo, provided y(t) reaches a steady-state as r -> oo, i.e. the filter is asymptotically stable. Therefore, the correlation matrix of the output of an asymptotically stable system to the white noise can be written as follows: (7.24) / -
  • 351. 336 KALMAN FILTERS The power spectral density matrix, Sy(a)), for the output, y(r), can then be obtained by taking the Fourier transform of the correlation matrix, R y (r), as follows: oo r /«oo -| / g(^)WgT(X + r) d X e~icaTdT (7.25) / -oo L''— oo J Inverting the order of integration in Eq. (7.25), we can write oo r /-oo -i g(*)W / gT(A + r)e-imdT dX (7.26) / -oc _J-oo J The inner integral in Eq. (7.26) can be expressed as follows: oo /*oc gT(X + T)e~ia)Tdr = I gT($)e-iw(*-»d$ = e /wX G T (io>) (7.27) / -oc J —oo where G(/o>) is the frequency response matrix of the filter, i.e. G(IOJ) = G(s = iay). Substituting Eq. (7.27) into Eq. (7.26), we get the following expression for the power spectral density matrix: Sy(o>) = I I g(A)e' wX rfX 1 WGT(/o>) = G(-/o>)WGT(/o>) (7.28) Equation (7.28) is an important result for the output of the white noise filter, and shows that the filtered white noise does not have a constant power spectral density, but one which depends upon the frequency response, G(/o>), of the filter. Example 7.4 Let us determine the power spectral density of white noise after passing through the first order low-pass filter of Eq. (7.15). The frequency response of this single-input, single-output filter is the following: G(i(o) = coQ/(ia) + WQ) (7.29) Using Eq. (7.28), we can write the power spectral density as follows: (a>2 + a>20) (7.30) Equation (7.30) indicates that the spectrum of the white noise passing through this filter is no longer flat, but begins to decay at a) = O)Q. For this reason, the filtered white noise is called colored noise whose 'color' is indicated by the frequency, o)Q. The correlation function is obtained by taking the inverse Fourier transform of Eq. (7.30) as follows: J? V (T) = (1/27T) (r > 0) (7.31)
  • 352. _ WHITE NOISE, AND WHITE NOISE FILTERS_ 337 Since for a stationary process, RV(—T) = Rv(r), we can write a general expression for Ry(r) valid for all values of i as follows: Ry(T) = (W« 0 /2) exp(-<oo|r|) (7.32) Finally, the covariance matrix of the filtered white noise, Ry(0), is given by flv(0) = (Wcov/2) (7.33) Example 7.5 Atmospheric turbulence is a random process, which has been studied extensively. A semi -empirical model of vertical gust velocity, x(t), caused by atmospheric turbu- lence is the Dryden spectrum with the following expression for the power spectral density: Sx(a>) = a2T[ + 3(<yr) 2 ]/[l + (a)T)2]2 (7.34) where a and T are constants. The correlation function, RX(T), of the Dryden spec- trum can be calculated by taking the inverse Fourier transform of Sx (&>) according to Eq. (7.8), either analytically or using MATLAB. It can be shown that the analytical expression of Rx(t) is the following: Rx(r) = a2( - 0.5|r|/r)e- |T| / r (7.35) It is customary to express stochastic systems as filters of white noise. What is the transfer function of a filter through which white noise must be passed to get the filtered output as the Dryden turbulence? We can employ Eq. (7.28) for the relationship between the power spectral density, Sx((o), and the filter transfer function, G(s), which can be written for the scalar case as follows: Sx(a)) = G(-ia))WG(i(D) = WG(-ia))G(ia)) (7.36) Comparing Eqs. (7.34) and (7.36), we see that a factorization of the power spectral density, Sx(co), given by S.,(w) = a2T[ - j3T(i(o)][l + ^/3T(iM)}/{[ - T(ia>}}2[ + T(ico)]2} = WG(-ia))G(i(jo) (7.37) leads to the following possibilities for G(s): G(s) = a(T/W)l/2( ± ^3Ts)/( ± Ts)2 (7.38) Since we want a stable filter (i.e. all poles of G(s) in the left-half plane), we should have a '+' sign in the denominator of G(s) in Eq. (7.38). Also, we do not want a zero in the right-half plane, because it leads to an undesirable phase plot of G(iaj), called non-minimum phase. A stable transfer function with all zeros in the left-half
  • 353. 338 KALMAN FILTERS plane is called minimum phase. Hence, the following choice of G(s) would yield a stable and minimum phase filter: G(s) = a(T/ W0 1/2 (l + 7375)7(1 4- Ts)2 (7.39) Such a method of obtaining the filter's transfer function through a factorization of the power spectral density is called spectral factorization, and is commonly employed in deriving white noise filter representations of stochastic systems. For W = 1 and a = 1, we can obtain a state-space representation of the filter with T = 1 s using MATLAB as follows: » T=1; n = sqrt(T)*[T*sqrt(3) 1]; d = conv([T 1 ] , [ T 1 ] ) ; sysfilt = tf (n,d) <enter> Transfer function: 1.732 s+1 s"2+2 s+1 A simulated response of the filter to white noise, representing the vertical gust velocity, *(/), due to Dryden turbulence, can be obtained using MATLAB as follows: »t=0:0.001:1; u = randn(size(t)); [ x , t , X ] = lsim(sysfilt,u,t); <enter> Figure 7.6 shows the Dryden turbulence power spectrum, S((o)/a2 plotted against coT, the Bode plots of the white noise filter transfer function, G(s), for T = 0.1, 1.5 0.5 10- 10° 102 CD -50 "o 1 £ -100 10- 10° 102 (rad/s) Figure 7.6 Power spectrum, white noise filter Bode plots, and simulated gust vertical velocity of the Dryden turbulence model
  • 354. THE KALMAN FILTER 339 1, and 10 s, and simulated vertical gust velocity, x ( t ) , of the filtered white noise with T — 0.1, 1, and 10 s. Note that the maximum value of S(CD) is 1.125a2 which occurs near a>T = 1. Note from the Bode plots of the filter with various T values, that the white noise filter for Dryden turbulence acts as a low-pass filter with a cut- off frequency, 1/T. Consequently, as T increases the filtered output (representing turbulence) becomes smoother, because more high-frequency noise is blocked by the filter. 7.4 The Kalman Filter In the previous section we saw how we can represent stochastic systems by passing white noise through linear systems. Such a representation of stochastic systems is useful for dealing with a plant which we cannot model accurately using only a deterministic model, because of the presence of modeling uncertainties (called process noise) and measurement noise. A noisy plant is thus a stochastic system, which is modeled by passing white noise through an appropriate linear system. Consider such a plant with the following linear, time-vary ing state-space representation: F(/)v(0 (7.40) z(0 (7.41) where v(0 is the process noise vector which may arise due to modeling errors such as neglecting nonlinear or higher-frequency dynamics, and z(t) is the measurement noise vector. By assuming (t) and z(t) to be white noises, we will only be extending the methodology of the previous section for a description of the stochastic plant. However, since now we are dealing with a time-varying system as the plant, our definition of white noise has to be modified. For a time-varying stochastic system, the output is a non-stationary random signal. Hence, the random noises, v(r) and z(0, could in general be non-stationary white noises. A non-stationary white noise can be obtained by passing the stationary white noise through an amplifier with a time-varying gain. The correlation matrices of non-stationary white noises, v(t) and z(/), can be expressed as follows: ) (7.42) ) (7.43) where V(t) and Z(f) are the time-vary ing power spectral density matrices of v(f) and z ( t ) , respectively. Note that Eqs. (7.42) and (7.43) yield infinite covariance matrices, R v (r, t) and R z (?, r), respectively, which can be regarded as a characteristic of white noise - stationary or non-stationary. For designing a control system based on the stochastic plant, we cannot rely on full-state feedback, because we cannot predict the state-vector, x(f), of the stochastic plant. There- fore, an observer is required for estimating the state-vector, based upon a measurement of the output, y(r), given by Eq. (7.41) and a known input, u(t). Using the pole-placement methods of Chapter 5 we can come up with an observer that has poles at desired loca- tions. However, such an observer would not take into account the power spectra of the
  • 355. 340 KALMAN FILTERS process and measurement noise. Also, note the difficulty encountered in Chapter 5 for designing observers for multi-input, multi-output plants, which limits the pole-placement approach of observer design largely to single-output plants. To take into account the fact that the measured output, y(f), and state-vector of the plant, x(f), are random vectors, we need an observer that estimates the state-vector based upon statistical (rather than deterministic) description of the vector output and plant state. Such an observer is the Kalman Filter. Rather than being an ordinary observer of Chapter 5, the Kalman filter is an optimal observer, which minimizes a statistical measure of the estimation error, e 0 (r) = x(0 — x<,(0, where x«(r) is the estimated state-vector. The state-equation of the Kalman filter is that of a time-varying observer (similar to Eq. (5.103)), and can be written as follows: x^(0 = A(r)io(r) + B(r)u(r) + L(r)[y(0 - C(f)x 0 (r) - D(r)u(»] (7.44) where L(f) is the gain matrix of the Kalman filter (also called the optimal observer gain matrix). Being an optimal observer, the Kalman filter is a counterpart of the optimal regulator of Chapter 6. However, while the optimal regulator minimizes an objective function based on transient and steady-state response and control effort, the Kalman filter minimizes the covanance of the estimation error, Re(r, 0 = E[e0(r)eo(OL Why is it useful to minimize the covariance of estimation error? Recall that the state-vector, x(r), is a random vector. The estimated state, Xo(r), is based on the measurement of the output, y(0, for a finite time, say T, where t > T. However, a true statistical average (or mean) of x(0 would require measuring the output for an infinite time (i.e. taking infinite number of samples), and then finding the expected value of x(r). Hence, the best estimate that the Kalman filter could obtain for x(0 is not the true mean, but a conditional mean, xm(0, based on only a finite time record of the output, y ( t ) , for T < t, written as follows: x m (r) = £[x(r) : y(D, T < t] (7.45) There may be a deviation of the estimated state- vector, x«(r), from the conditional mean, x m (f), and we can write the estimated state- vector as follows: Xo(0 = Xm(0 + Ax(r) (7.46) where Ax(r) is the deviation from the conditional mean. The conditional covariance matrix (i.e. the covariance matrix based on a finite record of the output) of the estimation error is given by R.(f , 0 = £[eo(0ej(0 : y(T), T < t] = £[{x(r) - x«(r)}{xT(r) - xj(r)} : y(D, T < t] (7.47) Equation (7.47) can be simplified using Eq. (7.45) as follows: , 0 = £[x(r)x(r)] - X o O x r ) - x(/)x m (» + Xo(0*(0 (7-48) Finally, substituting Eq. (7.46) into Eq. (7.48) and simplifying, we get Re(/, 0 = E[x(r)xT(0] - x m (r)xl(f) + Ax(r)Ax T (r) (7.49)
  • 356. THE KALMAN FILTER 341 From Eq. (7.49) it is clear that the best estimate of state-vector, implying Ax(?) — 0 (i.e. x0(0 = x m (f)), would result in a minimization of the conditional covariance matrix, R e (r, /). In other words, minimization of R e (f, t) yields the optimal (i.e. the best) observer, which is the Kalman filter. Let us derive the expression for the gain matrix of the Kalrnan filter, L(0, which mini- mizes Re(t, t), i.e. which makes the estimated state-vector equal to the conditional mean vector. The optimal estimation error is thus e0(0 = x(t) — x m (0- Subtracting Eq. (7.44) from Eq. (7.40) and substituting Eq. (7.41), we can write the following state-equation for the optimal estimation error: ei'Hr) = [A(0 - L(f)C(f)]eo(0 + F(f)v(0 - L(r)z(r) (7.50) Note that since v(f) and z(f) are white noises, the following vector is also a (non- stationary) white noise (7.51) To find the covariance of the estimation error, we must somehow find an expression for the solution of Eq. (7.50), which is a linear, time-varying system excited by a non-stationary white noise, w(0- Let us write Eqs. (7.50) and (7.51) as follows: 6^(0 - A0(0eo(0 + w(r) (7.52) where A0(0 = [A(?) — L(/)C(0]- The solution to Eq. (7.52) for a given initial condition, e0(?oX can be expressed as follows: /' <> in (7.53) where 4>(/, ?o) is the state-transition matrix of the time- varying estimation error state- equation, Eq. (7.52). Then the conditional covariance of estimation error can be written as follows (dropping the notation y(!T), T < t, from the expected value for convenience): Re(>, 0 - £[e0(r)ej(0] = e0(?0) ! ( (7.54) tQ JtQ tQ Jt or, using the properties of the expected value operator, we can write , r a (fr) I to Jtn If e«(^o) (7.55)
  • 357. 342 KAIMAN FILTERS Since the expected value of white noise is zero, i.e. £[w(/)l = 0, and the correlation matrix of white noise is given by £) (7.56) we can simplify Eq. (7.55) as follows: , t) = <D(r , t0)E [eo(fo)eJ(fo)]<l>T(r, r0) + 4>(f , X)W(X)cDT(r . X) rfX (7.57) If the initial estimation error, e0(fo)> is also a random vector, we can write the initial conditional covariance matrix as follows: (7.58) Substituting Eq. (7.58) into Eq. (7.57), we can write Re(f , 0 - 4>(f , r0)R«(fo, r 0 )4> T (r, f 0 ) + f <*>(>, X)W(X)<D T (r , X) rfx (7.59) •''o Equation (7.59) describes how the optimal estimation error covariance evolves with time. However, the state-transition matrix for the time varying system, <!>(/, to), is an unknown quantity. Fortunately, we have already encountered an integral similar to that in Eq. (7.59) while deriving the optimal regulator gain in Chapter 6. An equivalent integral for the optimal control problem is given in Eq. (6.8) for M(f , //). Comparing Eqs. (7.59) and (6.8) we find that 4>£L(r, r) in Eq. (6.8) is replaced by 4>(/, A) in Eq. (7.59), where r and X are the variables of integration in Eqs. (6.8) and (7.59), respectively. Furthermore, the matrix [Q(r) -f K T (r)R(r)K(r)] in Eq. (6.8) is replaced by W(X) in Eq. (7.59). Also, the direction of integration in time is opposite in Eqs. (6.8) (t —> tf) and (7.59) (fo -> t). Thus, taking a cue from the similarity (and differences) between Eqs. (6.8) and (7.59), we can write a differential equation for Re(/, t) similar to that for M(f, //), Eq. (6.14). as follows: , t)/dt = A 0 (/)R € (r, t) + Re(f , OAj(f ) + W(f ) (7.60) Note that Eq. (7.60) is an ordinary differential equation, rather than a partial differential equation (Eq. (6.14)). Also, due to the fact that time progresses in a forward direction (to —> t) in Eq. (7.60), rather than in a backward direction (tf —>• /) in Eq. (6.14), the negative sign on the left-hand side of Eq. (6.14) is replaced by a positive sign on the left-hand side of Eq. (7.60). Equation (7.60) is called the covariance equation for the Kalman filter, and must be solved with the initial condition given by Eq. (7.58). Note that we do not need to know the state-transition matrix, $>(r , /o), for solving for the optimal covariance matrix. Equation (7.60) is the counterpart of the matrix Riccati equation for the Kalman filter. Substituting Eqs. (7.51), (7.42) and (7.43) into Eq. (7.56), and assuming that the two white noise signals, v(r) and z(r), are uncorrelated with each other, i.e. E[v(/)z T (r)] = E[z(f)v T (r)] = 0, we can write the following expression relating W(/) to the spectral
  • 358. THE KAIMAN FILTER 343 densities of the two white noise signals, V(f) and Z(0, as follows: W(r) = F(r)V(OF T (0 + L(OZ(f)L T (f) (7.61) Substituting Eq. (7.61) into Eq. (7.60) and substituting A 0 (f) = [A(0 -L(f)CU)], we can express the co variance equation as follows: dRe(t, t)/dt = [A(0 - L(OC(r)]Re(r, 0 + R«(r, r))[A(0 - L(r)C(?)] T L(r)Z(f)L T (f ) (7.62) Comparing Eq. (7.62) with Eq. (6.21) and using the steps similar to those of Section 6.1.2, we can write the optimal Kalman filter gain, L°(0, as follows: L°(/) = R°(t, OC T (r)Z-' (t) (7.63) where R°(t, ?) is the optimal Governance matrix satisfying the following matrix Riccati equation'. dR°K(t, t)/dt = A(f)RJ(f , f) + R°e(t, /)A T (0 r, t) +F(r)V(r)F T (0 (7.64) We can derive a more general matrix Riccati equation for the Kalman filter when the two noise signals are correlated with each other with the following cross-correlation matrix: T £[v(Oz(T)j = V(t)8(t - T) (7.65) where fy(t) is the cross-spectral density matrix between v(/) and z(f). Then the optimal Kalman filter gain can be shown to be given by L°(r) = [R°e(t, t)CT(t) + ¥(t)^(t)]Z~t) (7.66) where R"(?, t) is the optimal covariance matrix satisfying the following general matrix Riccati equation'. </R°(r, t)/dt = AG(t)R°e(t, t) + Rju, r)Aj(r) , 0 + F(f)V G (f)F(0 (7.67) with A G (0 - A(0 -V(t)V(t)Z-l(t)C(t) (7.68) VG(0 - V(0 - *(OZ-1(0*T(0 (7-69) For simplicity of notation, we will use L to denote the optimal gain matrix of the Kalman filter, rather than L°(0- The appearance of matrix Riccati equation for the Kalman filter problem is not surprising, since the Kalman filter is an optimal observer. Hence, Kalman filter problem is solved quite similarly to the optimal control problem. Usually, we are interested in a steady Kalman filter, i.e. the Kalman filter for which the covariance matrix converges to a constant in the limit t -> oo. Such a Kalman filter results naturally when the plant is time- invariant and the noise signals are stationary white noises. In such a case, the estimation
  • 359. 344 KAIMAN FILTERS error would also be a stationary white noise with a constant optimal covariance matrix, R°. For the steady-state time-varying problem with non-stationary white noise signals, or the time-invariant problem with stationary white noise signals, the following algebraic Riccati equation results for the optimal covariance matrix, R°: 0= FVGFn (7.70) where the matrices on the right-hand side are either constant (time-invariant), or steady- state values for the time-varying plant. The sufficient conditions for the existence of a unique, positive definite solution to the algebraic Riccati equation (Eq. (7.70)) are the same as those stated in Chapter 6: the system with state-dynamics matrix, A, and observation matrix, C, is detectable, and the system with state-dynamics matrix, A, and controls coef- ficient matrix, B = FV1/2, is stabilizable (V1/2 denotes the matrix square-root of V, which satisfies V1/2(V1/2)r = V). These sufficient conditions will be met if the system with state- dynamics matrix, A, and observation matrix, C, is observable, V is a positive semi-definite matrix, and Z is a positive definite matrix. We can solve the algebraic Riccati equation for steady-state Kalman filter using either the MATLAB command are, or more specifically, the specialized Kalman filter commands Iqe or Iqe2, which are called as follows: »[L,P,E] = lqe(A,F,C,V,Z,Psi) <enter> where A, F, C, are the plant's state coefficient matrices, V is the process noise spectral density matrix, Z is the measurement noise spectral density matrix, and Psi = 4*, the cross-spectral density matrix of process and measurement noises. If Psi is not specified (by having only the first four input arguments in Iqe}, it is assumed that *> = 0. L is the returned Kalman filter optimal gain, P = R", the returned optimal (conditional) covariance matrix of the estimation error, and E is a vector containing the eigenvalues of the Kalman filter (i.e. the eigenvalues of A-LC). The command Iqe2, is used in a manner similar to Iqe, but utilizes a more numerically robust algorithm for solving the algebraic Riccati equation than Iqe. A third MATLAB command, Iqew, is also available, which solves a special Kalman filter problem in which the output equation is y(r) = C(f)x(f) + D(f)u(f) + G(f)v(r) + z(0, where v(r) is the process noise that affects the output through the coefficient matrix, G(f), and is uncorrelated with the measurement noise, z(f). Example 7.6 Let us design a Kalman filter for the fighter aircraft of Example 5.13. It is assumed that only the first two of the three state variables are measured. The state coefficient matrices for the linear, time-invariant model are as follows: -1.7 50 260 -272 0.02 0.1 0.22 -1.4 -32 B= -0.0035 0.004 0 0 -12 14 0 0 D =° (7.71)
  • 360. THE KALMAN FILTER 345 The third-order plant has a single input, two outputs and two process noise variables. The process noise spectral density matrix for the bomber is assumed to be V = FTF, while that for the measurement noise is, Z = 10CCT. Also, assume that the cross- spectral density of process and measurement noise is zero, i.e. *I> = 0. Then the Kalman filter gain is calculated using the MATLAB command Iqe as follows: »A=[-1.7 50 260; 0.22 - 1 . 4 -32;0 0 - 1 2 ] ; F = [ 0 . 0 2 0.1;-0.0035 0.004;0 0 ] ; C=[1 0 0; 0 1 0 ] ; <enter> »[L,P,E] = l q e ( A , F , C , F ) * F J 1 0 * C * C < ) <enter> L = 3.5231 0.2445 0.2445 0.0170 0 0 P = 35.2306 2.4450 0 2.4450 0.1697 0 0 0 0 -12.0000 -4.8700 -1.7700 The Kalman filter is thus stable with eigenvalues at A = —12, A = —4.87, and A = —1.11. Let us simulate the Kalman filter estimation error with v(/) and z(t) generated using randn as follows: »randn('seed',0); t=0:0.01:10; v = randn(size(t,2),2); z = randn(size ( t , 2 ) , 2 ) ; w = F * v ' - L * z ' ; <enter> »[e,X] = l s i m ( A - L * C , e y e ( 3 ) , e y e ( 3 ) , z e r o s ( 3 , 3 ) , w ' , t ) ; <enter> The simulated white noise, representing an element of v(0 or z(0, and the simulated estimation error, e0(Y) = [^01(^)^02(0^03(0]7» are plotted in Figure 7.7. Note that the third element of the estimation error vector, e0(0> is identically zero (because the last row of F is zero), while the first two elements are much smoother and with smaller magnitudes than the noise. The first two elements of the estimation error are random variables with zero mean values. How accurate is our simulated estimation error? Not very accurate, because the noise vector we have simulated does not have exactly the same power spectral density that we have assumed. In fact, the simulated white noise is far from being a perfect white noise, which we can verify by calculating the covariance matrices and mean values of (t) and z(/), as follows: »cov(v) <enter> ans = 1.0621 -0.0307 -0.0307 1.0145
  • 361. 346 KAIMAN FILTERS Simulated white noise (an element of v(t) or z(t)) -0.5 10 Figure 7.7 Simulated white noise and estimation errors of the Kalman filter for a fighter aircraft »cov(z) <enter> ans = 1.0229 0.0527 -0.0133 0.0527 0.8992 0.0131 -0.0133 0.0131 0.9467 »mean(v) <enter> ans = -0.0139 -0.0047 »mean(z) <enter> ans = -0.0125 0.0025 -0.0421 Recall that a white noise vector must have infinite covariance matrix and a zero mean vector. The covariance of the simulated estimation error is the following: »cov(e) <enter> ans = 0.0347 0.0024 0.0024 0.0002 0 0 Note that the simulated estimation error's covariance is different from the optimal covariance matrix, P, obtained as the solution to the algebraic Riccati equation of the Kalman filter. However, the ratios between the elements of P are the same as those between the elements of cov(e). Hence, the matrix P must be scaled by a scalar constant to represent the covariance of estimation error. To reduce the difference
  • 362. THE KALMAN FILTER 347 between the covariance matrices of the simulated and optimal estimation error, we should modify our assumptions of the power spectral densities, or simulate the white noise more accurately using the random number generator, randn. Since the actual noise will almost never be a white noise, there is no point in spending the time to accurately model white noise better on a computer. Instead, we should fine tune the Kalman filter gain by appropriately selecting the spectral densities V, Z, and *I>. After some trial and error, by selecting V = FTF, Z = 0.01 CCT, and * = 0, we get the Kalman filter gain and optimal estimation error covariance as follows: »[L,P,E] = l q e ( A , F , C J F ' * F 3 0 . 0 1 * C * C ' ) <enter> L = 3.5247 0.2446 0.2446 0.0170 0 0 P = 0.0352 0.0024 0 0.0024 0.0002 0 0 0 0 E = -12.0000 -4.8708 -1.7709 and the simulated estimation error is re-calculated as »w = F * v ! - L * z ' ; s y s o b = s s ( A - L * C , e y e ( 3 ) , e y e ( 3 ) , z e r o s ( 3 , 3 ) ) ; [ e , t , X ] = Isim ( s y s o b , w ' , t ) ; <enter> with the simulated estimation error's covariance matrix given by »cov(e) <enter> ans = 0.0347 0.0024 0 0.0024 0.0002 0 0 0 0 which is the same as calculated previously, and quite close to the new optimal covariance, P. The new Kalman filter gain and eigenvalues are not changed by much (indicating little change in the estimation error time response), but the scaling of the optimal covariance of the estimation error is now greatly improved. The mean estimation error vector, eom, is calculated as follows: » mean(e) <enter> ans = 0.0305 0.0021 0
  • 363. 348 KAIMAN FILTERS which is quite close to zero vector, as desired. The accuracy of the mean value will, of course, improve by taking more time points in the simulation, and in the limit of infinite number of time points, the mean would become exactly zero. I The Kalman filter approach provides us with a procedure for designing observers for multivariable plants. Such an observer is guaranteed to be optimal in the presence of white noise signals. However, since white noise is rarely encountered, the power spectral densities used for designing the Kalman filter can be treated as tuning parameters to arrive at an observer for multivariable plants that has desirable properties, such as performance and robustness. The linear Kalman filter can also be used to design observers for nonlinear plants, by treating nonlinearities as process noise with appropriate power spectral density matrix. Example 7.7 Let us design a Kalman filter to estimate the states of a double-pendulum (Example 4.12, Figure 1.5). A choice of the state variables for this fourth order system is jcj(r) = 6>i(r), x2(t) = 02(t), Jt 3 (f) =6> 1 (1) (r); *4(0 = 02n(0, which results in nonlinear state-equations given by Eq. (4.93). The function M-file for evaluating the time derivative of the state-vector, x (1) (f), is called doub.m and is tabulated in Table 4.7. Thus, M-file assumes a known input torque acting on the pendulum given by u(t} = 0.01 sin(5f)Af — m. It is desired to design a linear Kalman filter based on the known input, u(t), and measurement of the angular position and angular velocity of the mass, m, i.e. y(0 = [0(t) 0 1 (1) (/)] r » with the following linearized plant model: *3 (0 = ™2gX2(t) - (mi + (7.72) *4!)(r) = ~[gx2(t) + Lidx3(t)/dt]/L2 + u(t}l(m2L) which results in the following linear state coefficient matrices for the plant: 0 0 1 0 0 0 0 1 A= -(m+m2)gl(mL) m2gl(mL) 0 0 (mi +m 2 )g/(miL 2 ) - 0 0 0 0 c_[i o o ol ro-l (7.73) [o o i o j * L°J
  • 364. THE KAIMAN FILTER 349 The solution of the exact nonlinear state-equations of the plant with zero initial condition, i.e. x(0) = 0, is obtained using the MATLAB Runge-Kutta solver ode45 as follows: »[t,X] = ode45(@doub,[0 20],zeros(4,1)); <enter> However, it is assumed that the state-vector, x(0, solved above, is unavailable for measurement, and only the output, y(t), can be measured, which is calcu- lated by »C = [1 0 0 0; 0 0 1 0 ] ; y = C * X ' ; <enter> The state coefficient matrices, A and B, of the linearized plant are calculated with m = 1 kg, m.2 = 2 kg, L = I m, LI = 2 m, and g = 9.8 m/s2 (same values as those used in doub.m for the nonlinear plant) as follows: »m1=1;m2=2;L1=1;L2=2;g=9.8; A = [0 0 1 0; 0 0 0 1; -(m1+m2)*g/(m1*L1) m2*g/(m1*L1) 0 0; (m1+m2)*g/(m1*L2) - g * ( m 2 / m l + l ) / L 2 0 0] <enter> A = 0 0 1.0000 0 0 0 0 1.0000 -29.4000 19.6000 0 0 14.7000 -14.7000 0 0 »B = [ 0 0 0 1/(m2*L2*L2)]' <enter> B = 0 0 0 0.1250 Since nonlinearities appear as process noise for all the state variables of the linear plant model, the process noise coefficient matrix is assumed to be an identity matrix, i.e. F = I. The linear Kalman filter is to be designed using the spectral densities of process and measurement noise, V, Z, and VP such that the exact state-vector, x(f), is accurately estimated. After some trial and error, we select V =106I, Z = CCT, and * = 0, and calculate the Kalman filter gain as follows: » [ L ) P , E ] = l q e ( A , e y e ( 4 ) , C , 1 e 6 * e y e ( 4 ) , C * C ' ) <enter> I 9.99896+002 -1.38990+001 1.53036+001 1.02566+003 -1.38996+001 1.02026+003 2.16986+001 4.84736+002
  • 365. 350 KAIMAN FILTERS theta 1 1 ,1^ —*• rn s T— i I— theta2 i i Input Dserv sr VLXC a — Sl*t thf >ta 1 c theta 2 dot Measured output 0.02 0.01 0 -0.01 -0.02 -.2 00 10 20 0 10 20 — 02(1)(0; - 0o2(1)(0; 0.05 -0.05 10 20 Time (s) Figure 7.8 Actual (simulated) state-vector, x(f) = [0i(f); 02(f); 6»i(1)(r); ^2(1)(0lr, and esti- mated state-vector, Xo(f) = [00](t); 002(f); 0 ', e(J^(t)]T, with a linear Kalman filter for the nonlinear dynamics of a double pendulum P = 9.9989e+002 1.5303e+001 -1.3899e+001 2.1698e+001 1.53036+001 5.33716+004 1.02566+0032.60276+004 -1.38996+001 1.02566+003 1.02026+0034.84736+002 2.16986+001 2.60276+004 4.84736+002 1.28186+006 E = -1.00006+003+ 1.52026+001i -1.00006+003 - 1.52026+001i -1.87856+001 -1.30396+000
  • 366. _ OPTIMAL (LINEAR, QUADRATIC, GAUSSIAN) COMPENSATORS_ 351 Finally, we calculate the estimated state- vector, x 0 (0» by solving the Kalman filter state-equation (Eq. (7.44) with the known input, u ( t ) , and the measured output vector, y(0, using the SIMULINK block-diagram shown in Figure 7.8. The input, u ( t ) , is calculated in MATLAB work-space as follows, at the same time points previously used for generating the state- vector, x(Y), with ode45: »u = 0.01*sin(5*t ' ) ; <enter> The actual (i.e. generated by solving nonlinear equations through ode45 ) and esti- mated (SIMULINK) state variables are compared in Figure 7.8. Note that the state variables 0(t) and #j (1) (0 are almost exactly estimated, as expected, because these state variables are directly measured. The estimation errors for ^(0 and $2 (0 are appreciable, but reasonable, since we are trying to estimate a nonlinear plant by a linear Kalman filter. 7.5 Optimal (Linear/ Quadratic, Gaussian) Compensators In Chapter 5, we had used the separation principle to separately design a regulator and an observer using pole-placement, and put them together to form a compensator for the plant whose state-vector was unmeasurable. In Chapter 6, we presented optimal control techniques for designing linear regulators for multi-input plants that minimized a quadratic objective function, which included transient, terminal, and control penalties. In the present chapter, we have introduced the Kalman filter, which is an optimal observer for multi- output plants in the presence of process and measurement noise, modeled as white noises. Therefore, using a separation principle similar to that of Chapter 5, we can combine the optimal regulator of Chapter 6 with the optimal observer (the Kalman filter), and end up with an optimal compensator for multivariable plants. Since the optimal compensator is based upon a linear plant, a quadratic objective function, and an assumption of white noise that has a normal, or Gaussian, probability distribution, the optimal compensator is popularly called the Linear, Quadratic, Gaussian (or LQG) compensator. In short, the optimal compensator design process is the following: (a) Design an optimal regulator for a linear plant assuming full-state feedback (i.e. assuming all the state variables are available for measurement) and a quadratic objec- tive function (such as that given by Eq. (6.3)). The regulator is designed to generate a control input, u(0, based upon the measured state-vector, x(0- (b) Design a Kalman filter for the plant assuming a known control input, u(0, a measured output, y(r), and white noises, (t) and z ( t ) , with known power spectral densities. The Kalman filter is designed to provide an optimal estimate of the state-vector, x0(t). (c) Combine the separately designed optimal regulator and Kalman filter into an optimal compensator, which generates the input vector, u(f), based upon the estimated state-vector, x 0 (r), rather than the actual state-vector, x(0, and the measured output vector, y(/).
  • 367. 352 KALMAN FILTERS Since the optimal regulator and Kalman filter are designed separately, they can be selected to have desirable properties that are independent of one another. The closed- loop eigenvalues consist of the regulator eigenvalues and the Kalman filter eigen- values, as seen in Chapter 5. The block diagram and state-equations for the closed- loop system with optimal compensator are the same as those for the pole-placement compensator designed in Chapter 5, except that now the plant contains process and measurement noise. The closed-loop system's performance can be obtained as desired by suitably selecting the optimal regulator's weighting matrices, Q and R, and the Kalman filter's spectral noise densities, V, Z, and V. Hence, the matrices Q, R, V, Z, and 4* are the design parameters for the closed-loop system with an optimal compensator. A state-space realization of the optimal compensator for regulating a noisy plant with state-space representation of Eqs. (7.40) and (7.41) is given by the following state and output equations: Xo(1)(0 = (A - BK - LC + LDK)Xo(r) + Ly(r) (7.74) u(0 = -Kxo(r) (7.75) where K and L are the optimal regulator and Kalman filter gain matrices, respectively. For a corresponding optimal tracking system, the state and output equations derived in Section 5.4.1 should be used with the understanding that K is the optimal feedback gain matrix and L is the optimal Kalman filter gain matrix. Using MATLAB (CST), we can construct a state-space model of the regulating closed- loop system, sysCL, as follows: »sysp=ss(A,B,C,D) ; sysc=ss(A-B*K-L*C+L*D*K,L J K,zeros(size(D > ) )) ; <enter> »sysCL=f eedback ( sysp , sysc ) <enter> where sysp is the state-space model of the plant, and sysc is the state-space model of the LQG compensator. The resulting closed-loop system's state- vector is XCL(') = [xr(0; Xo T (r)] r . Alternatively, MATLAB (CST) provides a readymade command reg to construct a state-space model of the optimal compensator, given a state-space model of the plant, sysp, the optimal regulator feedback gain matrix, K, and the Kalman filter gain matrix, L. This command is used as follows: »sysc= reg(sysp,K,L) <enter> where sysc is the state-space model of the compensator. To find the state-space repre- sentation of the closed-loop system, sysCL, the command reg should be followed by the command feedback as shown above. ( Example 7.8 | Let us design an optimal compensator for the flexible bomber aircraft (Examples 4.7, I 6.1, 6.5, 6.7), with the process noise coefficient matrix, F = B. Recall that the |
  • 368. OPTIMAL (LINEAR, QUADRATIC, GAUSSIAN) COMPENSATORS 353 sixth order, two input system is described by a linear, time-invariant, state-space representation given by Eq. (4.71). The inputs are the desired elevator deflection (rad.), u (f), and the desired canard deflection (rad.), 1*2(1), while the outputs are the normal acceleration (m/s2), y ( t ) , and the pitch-rate (rad./s), yi(t). In Example 6.1, we designed an optimal regulator for this plant to achieve a maximum overshoot of less than ±2 m/s2 in the normal-acceleration, and less than ±0.03 rad/s in pitch-rate, and a settling time less than 5 s, while requiring elevator and canard deflections not exceeding ±0.1 rad. (5.73°), if the initial condition is 0.1 rad/s perturbation in the pitch-rate, i.e. x(0) = [0; 0.1; 0; 0; 0; 0]T. This was achieved with Q = 0.011 and R = I, resulting in the following optimal feedback gain matrix: [1.0780 -0.16677 -0.046948 -0.0756L8 0.59823 0.35302] L 1 - 3785 0.34502 -0.013144 -0.065260 0.47069 0.30941 J ' (7.76) and the following eigenvalues of the regulator (i.e. eigenvalues of A-BK): »eig(A-B*K) <enter> ans = -7.87486+001+ 5.06250+001i -7.87486+001 - 5.06256+001i -9.18036+001 -1.16026+000+ 1.73286+OOOi -1.16026+000 - 1.73286+OOOi -1.05606+000 Note that the dominant regulator pole is at s = — 1.056, which determines the speed of response of the full-state feedback control system. Since the closed-loop eigen- values of the compensated system are the eigenvalues of the regulator and the eigenvalues of the Kalman filter, if we wish to achieve the same performance in the compensated system as the full-state feedback system, ideally we must select a Kalman filter such that the Kalman filter eigenvalues do not dominate the closed- loop system, i.e. they should not be closer to the imaginary axis than the regulator eigenvalues. As the Kalman filter does not require a control input, its eigenvalues can be pushed deeper into the left-half plane without causing concern of large required control effort (as in the case of the regulator). In other words, the Kalman filter can have faster dynamics than the regulator, which is achieved free of cost. However, as we will see in the present example, it is not always possible to push all the Kalman filter poles deeper into the left-half plane than the regulator poles by varying the noise spectral densities of the Kalman filter. In such cases, a judi- cious choice of Kalman filter spectral densities would yield the best recovery of the full-state feedback dynamics. To design the Kalman filter to recover the full-state feedback performance of Example 6.1, the process noise spectral density matrix for the bomber is selected after some trial and error to be V = 0.0007BTB, while the spectral density matrix of the measurement noise is Z = CCT. We also assume that the process and measure- ment noises are uncorrelated, i.e. * = 0. Then the Kalman filter gain is calculated using the MATLAB command Iqe as follows:
  • 369. 354 KAIMAN FILTERS »[L,P,E] = lqe(A,B,C)0.0007*B'*B,C*C') <enter> L = -1.83706-005 5.18246-001 9.85326-004 7.0924e+000 -1.50556-001 -2.61076+001 -3.12916-002 -6.76946+001 -3.07796-002 -1.04036+001 -3.37156-002 1.79546 -001 P = 1.23076+000 5.20936-001 -3.94016+001 5.54616+001 -1.8815e-001 2.76556-002 5.20936-001 6 9 8 6 0 0 -4.06176+000 -6.31126+001 - . 9 8 + 0 5.11636+000 .42+0 585600 -3.94016+001 -4.06176+000 2.80636+004 4.7549e+004 -2.74186+002 -2.30696+002 5.54616+001 -6.31126+001 4.75496+004 6.02816+005 -1.10156+003 -1.79726+003 -1.88156-001 -5.89586+000 -2.74186+002 -1.10156+003 1.20936+002 -2.47026+001 2.76556-002 5.11636+000 -2.30696+002 -1.79726+003 -2.47026+001 3.26036+002 E = -1.47006+002 -8.91126+001 -7.93276+000 -1.95486+000+ 4.1212e+000i -1.95486+000- 4.1212e+000i -5.64536-001 Note that the Kalman filter's dominant pole is at s = —0.56453, which is closer to the imaginary axis than the dominant regulator pole. Thus, the two closed-loop 20 -Full-state feedback control system (Example 6.1) 1 0 • Compensated system with kalman filter -20 i 0.1 i i i r Full-state feedback control system (Example 6.1) 0 Compensated system with kalman filter -0.1 i i i i 0 0.05 u i(0 Compensated system with kalman filter 0 -0.05 2 3 Time (s) Figure 7.9 Closed-loop system's initial response and control inputs for the flexible bomber with optimal (LOG) compensator
  • 370. OPTIMAL (LINEAR, QUADRATIC, GAUSSIAN) COMPENSATORS 355 poles closest to the imaginary axis are the dominant pole the Kalman filter and that of the optimal regulator, and the closed-loop response's speed and overshoots are largely determined by these two poles. We can construct a state-space model of the closed-loop system as follows: »sysp=ss(A,B,C,D); sysc=ss(A-B*K-L*C+L*D*K,L,K,zeros(size ( D ' ) ) ) ; <enter> »sysCL=feedback(sysp,sysc) <enter> You may confirm that the closed-loop eigenvalues are indeed the eigenvalues of the regulator and the Kalman filter using damp(sysCL). The initial response of the closed-loop system to x(0) — [0; 0.1; 0; 0; 0; O]7 and the required control input vector are calculated as follows: »[y,t,X]=initial(sysCL ) [0 0.1 z e r o s ( 1 , 1 0 ) ] ' ) ; u=-K* X ( : , 7 : 1 2 ) ' ; <enter> The closed-loop responses, y(t) and y2(t), are compared to their corresponding values for the full-state feedback control system (Example 6.1) in Figure 7.9. Figure 7.9 also contains the plots of the required control inputs, u(t) and «2(0- Note that the speed of the response, indicated by the settling time of less than five seconds, maximum overshoots, and control input magnitudes are all quite similar to those of the full-state feedback system. This is the best recovery of the full-state feedback performance obtained by varying the Kalman filter's process noise spectral density scaling parameter, p, where V = pBTB. In Example 7.8, we saw how the full-state feedback control system's performance can be recovered by properly designing a Kalman filter to estimate the state-vector in the compensated system. In other words, the Kalman filter part of the optimal (LQG) compensator can be designed to yield approximately the same performance as that of the full-state feedback regulator. Now let us examine the robustness of the designed LQG compensated closed-loop system with respect to measurement noise in comparison with the full-state feedback system of Example 6.1. Such a compar- ison is valid, because both control systems use the same feedback gain matrix, K. A SIMULINK block-diagram and the simulated initial response of the compensated closed-loop system are shown in Figure 7.10. The same white noise intensity (power parameter of 10~8) in the pitch-rate channel is used as in Example 6.1. Comparing Figure 7.10 with Figure 6.3, we observe that the normal acceleration and pitch-rate fluctuations are about half the magnitudes and smaller in frequency than those seen in Figure 6.3. This indicates that the LQG compensated system is more robust with respect to measurement noise than the full-state feedback system of the same regulator gain matrix, K. We have thus far confined our attention to white noise model of disturbances. How robust would an LQG compensator be to actual parameter variations and noise which is not white? This is a crucial question, which is answered in the next section.
  • 371. 356 KAIMAN FILTERS Normal acceleration (yi) LOG compensator 1 s 1' 1' ^ Band-limited white noise -10 -15 -20 4 5 6 10 Time (s) 0.15 0.1 0.05 0 -0.05 4 5 6 10 Time (s) Figure 7.10 Simulated initial response of the flexible bomber with an optimal (LOG) compensator and measurement noise in the pitch-rate channel 7.6 Robust Multivariable LOG Control: Loop Transfer Recovery In Chapter 2, we observed that in principle, the closed-loop systems are less sensitive (or more robust) to variations in the mathematical model of the plant (called process noise and measurement noise in Section 7.5), when compared to the corresponding open-loop systems. It was also observed that the robustness of a single-input, single-output feedback
  • 372. ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY 357 p(s)(process noise) Y(s) Compensator Plant m(s) (measurement noise) Figure 7.11 A mulHvariable feedback control system with compensator transfer matrix, H(s), plant transfer matrix, G(s), process noise, p(s), and measurement noise, rn(s) control system is related to the return difference, I + G ( s ) H ( s ) , where G(s) and H(s) are the transfer functions of the plant and controller, respectively. The larger the return difference of the feedback loop, the greater will be the robustness when compared to the corresponding open-loop system. Consider a linear, time-invariant, multivariable feedback control system with the block- diagram shown in Figure 7.1 1. The control system consists of a feedback controller with transfer matrix, H(^), and a plant with transfer matrix, G(s), with desired output, YdCs). The process noise, p(s), and measurement noise, m(s), are present in the control system as shown. Using Figure 7.1 1, the output, Y(s), can be expressed as follows: Y(J) - - [I- {I + {!-[! + -1 }Yd(s) (7.77) while the control input, U(s), can be expressed as - [I + H(5)G(,s)]-1H(j)m(j) (7.78) From Eqs. (7.77) and (7.78), it is clear that the sensitivity of the output with respect to process and measurement noise depends upon the matrix [I-f-G(s)H(s)]~ l , while the sensitivity of the input to process and measurement noise depends upon the matrix [I + H(5)G(5)]~1. The larger the elements of these two matrices, the larger will be the sensitivity of the output and input to process and measurement noise. Since robustness is inversely proportional to sensitivity, we can extend the analogy to multivariable systems by saying that the robustness of the output is measured by the matrix [I + G(s)H(s)], called the return-difference matrix at the output, and the robustness of the input is measured by the matrix [I + H(s)G(s)], called the return difference matrix at the plant input. Therefore, for multivariable control-systems, there are two return difference matrices to be consid- ered: the return difference at the output, [I + G(s)H(s)], and that at the plant's input, [I + H(j)G(j)]. Alternatively, we can define the return ratio matrices at the plant's output and input, as G(s)H(s) and H(5)G(s), respectively, and measure robustness properties in terms of the return ratios rather than the return differences,
  • 373. 358 KAIMAN FILTERS Continuing our analogy with single-input, single-output systems, we would like to assign a scalar measure to robustness, rather than deal with the two return-difference (or return ratio) matrices. We can define a matrix norm (introduced in Chapter 4) to assign a scalar measure to a matrix. For a complex matrix, M, with n rows and m columns, one such norm is the spectral (or Hilbert) norm, given by = amax (7.79) where <7max is the positive square-root of the maximum eigenvalue of the matrix M H M if n > w, or of the matrix MMH if n < m. Here MH denotes the Hermitian of M defined as the transpose of the complex conjugate of M. In MATLAB, the Hermitian of a complex matrix, M, is calculated by M', i.e. the same command as used for evaluating the transpose of real matrices. All positive square-roots of the eigenvalues of MHM if n > m (or MMH if n < m) are called the singular values of M, and are denoted by a*, k = 1 , 2, .., n, where n is the size of M. The largest among a* is denoted by crmaA, and the smallest among a* is denoted by amjn. If M varies with frequency, then each singular value also varies with frequency. A useful algorithm for calculating singular values of a complex matrix, M, of n rows and m columns is the singular value decomposition, which expresses M as follows: M = USVH (7.80) H H where U and V are complex matrices with the property U U = I and V V = I, and S is a real matrix containing the singular values of M as the diagonal elements of a square sub-matrix of size (n x n) or (m x m), whichever is smaller. MATLAB also provides the function svd for computing the singular values by singular value decomposition, and is used as follows: »[U,S,V] = svd(M) <enter> Example 7.9 Find the singular values of the following matrix: !+/ 2 + 2i 3 + / I-/ 2 - 2i 3 - 5i M= (7.81) 5 4 + i l+2i 7-i 2 3 + 3i Using the MATLAB command svd, we get the matrices U, S, V of the singular value decomposition (Eq. (7.80)) as follows: »[U,S,V] = svd(M) <enter> U = 0.2945+0.06041 0.4008-0.21571 -0.0626-0.23191 -0.5112-0.61921 0.0836-0.42941 -0.0220-0.70521 0.2569+0.14561 0.4269-0.20361 0.5256+0.04311 -0.3392-0.04551 -0.4622-0.53461 0.3230+0.03091 0.6620-0.04251 -0.3236+0.27071 0.5302+0.27281 -0.1615-0.01541
  • 374. ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY 359 S = 12.1277 0 0 0 5.5662 0 0 0 2.2218 0 0 0 V = 0.6739 -0.6043 0.4251 0.4292-0.13181 -0.0562-0.35731 -0.7604-0.29901 0.4793-0.33851 0.6930-0.15401 0.2254+0.31761 Hence, the singular values of M are the diagonal elements of the (3 x 3) sub- matrix of S, i.e. <ri(M) = 2.2218, <r2(M) = 5.5662, and or3(M) = 2.1277, with the largest singular value, amax(M) = 12.1277 and the smallest singular value, crmjn(M) — 2.2218. Alternatively, we can directly use their definition to calculate the singular values as follows: »sigma= sqrt(eig(M'*M)) <enter> sigma = 12.1277+0.OOOOi 5.5662+0.OOOOi 2.2218+0.OOOOi The singular values help us analyze the properties of a multivariable feedback (called a multi-loop) system in a manner quite similar to a single-input, single-output feed- back (called a single-loop) system. For analyzing robustness, we can treat the largest and smallest singular values of a return difference (or return ratio) matrix as providing the upper and lower bounds on the scalar return difference (or return ratio) of an equivalent single-loop system. For example, to maximize robustness with respect to the process noise, it is clear from Eq. (7.77) that we should minimize the singular values of the sensitivity matrix, [I + GCsOHCs)]""1, which implies minimizing the largest singular value, (Tmax[{I -f G(s)H($)}~'], or maximizing the singular values of the return differ- ence matrix at the output, i.e. maximizing ormin[I -f G(s)H(.s)]. The latter requirement is equivalent to maximizing the smallest singular value of the return ratio at the output, crmin[G(s)H(s)]. Similarly, minimizing the sensitivity to the measurement noise requires minimizing the largest singular value of the matrix [I — {I + G($)H(s)}~ ] ], which is equivalent to minimizing the largest singular value of the return ratio at the output, crmax[G(s)H(s)]. On the other hand, tracking a desired output requires from Eq. (7.77) that the sensitivity to Yd(s) be maximized, which requires maximizing crmjn[I —• {1 + GCOHCs)}"1], which is equivalent to maximizing crmin[G(5)H(51)]. Also, it is clear from Eq. (7.77) and the relationship U(s) = H(s)Y(s) that optimal control (i.e. minimization of control input magnitudes) requires minimization of crmax[H(,s){I + GCOHCs)}"1], or alternatively, a minimization of ermax[HCs)]. In summary, the following conditions on the singular values of the return ratio at output result from robustness, optimal control and tracking requirements:
  • 375. 360 KALMAN FILTERS (a) For robustness with respect to the process noise, or,nin[G(s)H(s)] should be maximized. (b) For robustness with respect to the measurement noise, amax[G(s)H(s)] should be minimized. (c) For optimal control, crmax[H(s)] should be minimized. (d) For tracking a changing desired output, ormjn[G(.s)H(.s)] should be maximized. Clearly, the second requirement conflicts with the first and the fourth. Also, since ffmax[G(.s)H(.y)] < o'max[G(5)]crniax[H(5)] (a property of scalar norms), the third requirement is in conflict with the first and the fourth. However, since measurement noise usually has a predominantly high-frequency content (i.e. more peaks in the power spectrum at high frequencies), we achieve a compromise by minimizing ormax[G(.s)H(.s)] (and <7max[H(s)]) at high frequencies, and maximizing amin[G(5)H(5)] at low frequencies. In this manner, good robustness properties, optimal control, and tracking system performance can be obtained throughout a given frequency range. The singular values of the return difference matrix at the output in the frequency domain, cr[I + G(ico)H(ico)], can be used to estimate the gain and phase margins (see Chapter 2) of a multivariable system. One can make singular value plots against frequency, to, in a similar manner as the Bode gain plots. The way in which multivariable gain and phase margins are defined with respect to the singular values is as follows: take the smallest singular value, a^n, of all the singular values of the return difference matrix at the output, and find a real constant, a, such that crmiJI + G(/o>)] > a for all frequencies, co, in the frequency range of interest. Then the gain and phase margins can be defined as follows: Gain margin = 1/(1 ± a) (7.82) 1 Phase margin = ±2 sin" (a/2) (7.83) Example 7.10 Figure 7.12 shows the singular values of the rotating flexible spacecraft of Example 6.2. We observe that the smallest singular value reaches a minimum of —70 dB in the frequency range 0.01-10,000 rad/s at frequency 0.01 rad/s. Hence, a = 10-(70/20) = 3.16 x 10~4. Therefore, the gain margins are 1/(1 + a) = 0.9997 and 1/(1 — a) = 1.0003, and phase margins are ±0.0181° (which are quite small!). These margins are quite conservative, because they allow for simultaneous gain and phase variations of all the controller transfer functions. The present analysis indicates that the control system for the spacecraft cannot tolerate an appreciable variation in the phase of the return difference matrix before its eigenvalue cross into the right-half s-plane. However, the spacecraft is already unstable due to double eigenvalues at s = 0 (see Example 6.2), which the classical measures of gain and phase margins do not indicate (recall from Chapter 2 that gain and phase margins only indicate poles crossing over into right-half s-plane). Hence, gain and phase margins have limited utility for indicating closed-loop robustness.
  • 376. ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY 361 0. _i -20- /t -60- —00 I i l l in"! i i i "nil i i i mill i ' ' IIM|I i i 11 ini i i iiini 10-2 1Q 0 1Q 1 1Q2 103 Frequency (rad/sec) Figure 7.12 Singular value plot of the return difference matrix [I + G(s)H(s)] of the rotating spacecraft For designing a control system in which the input vector is the least sensitive to process and measurement noise, we can derive appropriate conditions on the singular values of the return ratio at the plant's input, H(s)G(s), by considering Eq. (7.78) as follows: (a) For robustness with respect to the process noise, crmin[H(s)G(s)] should be maximized. (b) For robustness with respect to the measurement noise, <rmin[H(s)G(s)] should be maximized. Thus, there is no conflict in achieving the robustness of the plant's input to process and measurement noise. However, Eq. (7.78) indicates that for tracking a changing desired output, crmax[HCs)GCy)] should be minimum, which conflicts with the robustness require- ment. This conflict can again be resolved by selecting different frequency ranges for maximizing and minimizing the singular values. The adjustment of the singular values of return ratio matrices to achieve desired closed-loop robustness and performance is called loop shaping. This term is derived from single-loop systems where scalar return ratios of a loop are to be adjusted. For compensated systems based on an observer (i.e. the Kalman filter), generally there is a loss of robustness, when compared to full-state feedback control systems. To recover the robustness properties associated with full-state feedback, the Kalman filter must be designed such that the sensitivity of the plant's input to process and measurement noise is minimized. As seen above, this requires that the smallest singular value of the return ratio at plant's input, amin[H(5)G(5')l, should be maximized. Theoretically, this maximum value of amin[H(5')G(5)] should be equal to that of the return ratio at the plant's input with full-state feedback. Such a process of designing a Kalman filter based compen- sator to recover the robustness of full-state feedback is called loop transfer recovery
  • 377. 362 KALMAN FILTERS (LTR). Optimal compensators designed with loop transfer recovery are called LQG/LTR compensators. The loop transfer recovery can either be conducted at the plant's the input, as described below, or at the plant's output. The design of optimal (LQG) compensators for loop transfer recovery at the plant's input can be stated as follows: 1. Design a full-state feedback optimal regulator by selecting Q and R matrices such that the desired performance objectives are met, and the singular values of the return ratio at the plant's input are maximized. With full-state feedback, the return ratio at the plant's input is H(s)G(s) = — K(sl — A)~'B, where A, B are the plant's state coefficient matrices and K is the full-state feedback regulator gain matrix. 2. Design a Kalman filter by selecting the noise coefficient matrix, F, and the white noise spectral densities, V, Z, and *I>, such that the singular values of the return ratio at the plant's input, H(s)G(s), approach the corresponding singular values with full-state feedback. Hence, F, V, Z, and W are treated as design parameters of the Kalman filter to achieve full-state feedback return ratio at the plant's input, rather than actual parameters of process and measurement (white) noises. The compensated system's return ratio matrix at plant's input can be obtained by taking the Laplace transform of Eqs. (7.74) and (7.75), and combining the results as follows: U(s) = -K(sl - A C )-'LY(5) (7.84) where Ac = (A — BK — LC + LDK) is the compensator's state-dynamics matrix, L is the Kalman filter's gain matrix, and ¥(5) is the plant's output, written as follows: (7.85) Substituting Eq. (7.85) into Eq. (7.84), we get the following expression for U(s): = -K(sl - Ac)-'L[C(5l - A)~'B + D]U(s) (7.86) Note that the return ratio matrix at the plant's input is the matrix by which U(s) gets pre-multiplied in passing around the feedback loop and returning to itself, i.e. U(.s) = H(s)G(.s) in Figure 7.11 if all other inputs to the control system, Y d (s), p(s), m(^), are zero. Hence, the return ratio at the compensated plant's input is H(s)G(s) = -K(sl - Acr'L[C(sI - A)~ ] B + D] (7.87) There is no unique set of Kalman filter design parameters F, V, Z, and 4> to achieve loop transfer recovery. Specifically, if the plant is square (i.e. it has equal number of outputs and inputs) and minimum-phase (i.e. the plant's transfer matrix has no zeros in the right-half plane), then by selecting the noise coefficient matrix of the plant as F = B, the cross-spectral density as * = 0, the measurement noise spectral density as Z = I, and the process noise spectral density as V = V0 4- pi, where p is a scaling parameter, it can be shown from the Kalman filter equations that in the limit p —> oo, the compensated system's return ratio, given by Eq. (7.87), converges to — K(sl — A)"~'B. the return ratio of the full-state feedback system at the plant input. In most cases, better loop
  • 378. ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY 363 transfer recovery can be obtained by choosing Z = CCT and V = pBTB, and making p large. However, making p extremely large reduces the roll-off of the closed-loop transfer function at high frequencies, which is undesirable. Hence, instead of making p very large to achieve perfect loop transfer recovery at all frequencies, we should choose a value of p which is sufficiently large to approximately recover the return ratio over a given range of frequencies. MATLAB's Robust Control Toolbox [3] provides the command sigma to calculate the singular values of a transfer matrix, G(s = ito), as a function of frequency, a>, as follows: »[sv,w] = sigma(sys) <enter> where sys is an LTI object of G(s) = C(sl — A)~'B -f D, and sv and w contain the returned singular values and frequency points, respectively. The user can specify the set of frequencies at which the singular values of G(s) are to be computed by including the frequency vector, w, as an additional input argument of the command as follows: »[sv,w] = sigma(sys,w) <enter> Also, sigma can calculate the singular values of some commonly encountered functions of G(/o>) by using the command as follows: » [ s v , w ] = sigma(sys,w,type) <enter> where type = 1, 2, or 3 specify that singular values of G"1 (/&>), I + G(iaj), or I + G~'(/ct>), respectively, are to be calculated. (Of course, sigma requires that G(ito) should be a square matrix.) Hence, sigma is a versatile command, and can be easily used to compute singular values of return ratios, or return difference matrices. If you do not have the Robust Control Toolbox, you can write your own M-file for calculating the singular value spectrum using the MATLAB functions svd or eig as discussed above. Example 7.11 Re-consider the flexible bomber airplane of Example 7.8, where we designed an optimal compensator using an optimal regulator with Q = 0.011, R = I, and a Kalman filter with F = B, V = 0.0007BTB, Z = CCT, and V = 0, to recover the performance of the full-state feedback regulator. Let us now see how robust such a compensator is by studying the return ratio at the plant's input. Recall that the return ratio at the plant's input is H(s)G(.s), which is the transfer matrix of a hypo- thetical system formed by placing the plant, G(s), in series with the compensator, H(.s) (the plant is followed by the compensator). Hence, we can find a state-space representation of H(s)G(s) in terms of the state-space model, sysHG, with plant model, sysp, and compensator model, sysc, as follows: »sysp=ss(A,B J C,D);sysc=ss(A-B*K-L*C+L*D*K,L,-K,zeros(size(K,1))); <enter> » sysHG = series(sysp,sysc); <enter>
  • 379. 364 KALMAN FILTERS The singular value spectrum of the return ratio at the plant's input for frequency range lO"2-!^ rad/s is calculated as follows: »w = logspace(-2,4) ; [sv,w] = sigma(sysHG,w) ; <enter> while the singular value spectrum of the return ratio at plant's input of the full-state feedback system is calculated in the same frequency range by »sysfs=ss(A,B, -K,zeros(size(K,1 ; [sv1,w1] = sigma(sysfs,w) ; <enter> The two sets of singular values, sv and svl, are compared in Figure 7.13, which is plotted using the following command: »semilogx(w,20*log10(sv) , ' : ' ,w1 ,20*log10(sv1 ) ) <enter> Note that there is a large difference between the smallest singular values of the compensated and full-state feedback systems, indicating that the compensated system is much less robust than the full-state feedback system. For recovering the full-state feedback robustness at the plant's input, we re-design the Kalman filter using V = /oBTB, Z = CCT, and 4> = 0, where p is a scaling parameter for the process noise spectral density. As p is increased, say, from 10 to 108, the return ratio of the compensated plant approaches that of the full-state feedback system over a larger range of frequencies, as seen in the singular value plots of Figure 7.14. For p = 10, the smallest singular value of the compensated system's return ratio becomes equal to that of the full-state feedback system in the frequency range 1-100 rad/s, while for p = 108 the range of frequencies (or bandwidth) over which 50 oy-100 c CO Full-state feedback system Compensated system -150 with V=0.0007BTB -200 10-2 10-1 10° 101 102 103 10" Frequency (rad/s) Figure 7.13 Singular values of the return ratio matrix, H(s)G(s), at the plant's input of compensated system and full-state feedback system for the flexible bomber
  • 380. ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY 365 50 0 -50 -100 -150 .£ -200 Full-state feedback system Compensated system with V=10BTB -250 Compensated system with V=108BTB -300 10,-2 10€ Frequency (rad/s) Figure 7.14 Comparison of singular values of return ratio matrix at the plant's input of full-state feedback system and compensated system for loop transfer recovery with process noise spectral density, V = 10BTB and V = 108BTB (flexible bomber) the loop transfer recovery occurs increases to 10 2-104 rad/s. At frequencies higher than the loop transfer recovery bandwidth the return ratio is seen to roll-off at more than 50dB/decade. Such a roll-off would also be present in the singular values of the closed-loop transfer matrix, which is good for rejection of noise at high frequen- cies. However, within the loop transfer recovery bandwidth, the roll-off is only about 20dB/decade. Therefore, the larger the bandwidth for loop transfer recovery, the smaller would be the range of frequencies over which high noise attenuation is provided by the compensator. Hence, the loop transfer recovery bandwidth must not be chosen to be too large; otherwise high frequency noise (usually the measurement noise) would get unnecessarily amplified by smaller roll-off provided within the LTR bandwidth. Note that the Kalman filter designed in Example 7.8 with V = 0.0007BTB recovers the performance of the full-state feedback system (with a loss of robustness), whereas the re-designed Kalman filter with V = 108BTB recovers the robustness of the full-state feedback system over a bandwidth of 106 rad/s (with an expected loss of performance). By choosing a large value of the process noise spectral density for loop transfer recovery, a pair of Kalman filter poles comes very close to the imaginary axis and becomes the dominant pole configuration, thereby playing havoc with the performance. Hence, there is a contradiction in recovering both performance and robustness with the same Kalman filter, and a compromise must be made between the two. It is interesting to note that Example 7.11 has a non-minimum phase plant, with a plant zero at s = 2.5034 x 10~7. The loop transfer recovery is not guaranteed for non-minimum phase plants, because it is pointed out above that H(s)G(s) converges to —K(sl — A)~*B in the limit of infinite process noise spectral density, provided
  • 381. 366 KALMAN FILTERS that the plant is square and minimum phase. The reason why LQG/LTR compen- sators generally cannot be designed for non-minimum phase plants is that perfect loop transfer recovery requires placing some poles of the Kalman filter at the zeros of the plant [4]. If the plant is non-minimum phase, it implies that the Kalman filter for perfect loop transfer recovery should be unstable. However, if the right- half plane zeros of a non-minimum phase plant are very close to the imaginary axis (as in Example 7.11), the frequency associated with it lies outside the selected bandwidth for loop transfer recovery, and hence loop transfer recovery in a given bandwidth is still possible, as seen above. Example 7.12 Let us design an optimal LQG/LTR compensator for the flexible, rotating spacecraft of Example 6.2. The spacecraft consists of a rigid hub and four flexible appendages, each having a tip mass, with three torque inputs in N-m, u(t), «2(0, "3(0, and three angular rotation outputs in rad., y(t), y2(t), yi(t). A linear, time-invariant state-space representation of the 26th order spacecraft was given in Example 6.2, where it was observed that the spacecraft is unstable and uncontrollable. The natural frequencies of the spacecraft, including structural vibration frequencies, range from 0-47 588 rad/s. The uncontrollable modes are the structural vibration modes, while the unstable mode is the rigid-body rotation with zero natural frequency. Hence, the spacecraft is stabilizable and an optimal regulator with Q = 2001, and R = I was designed in Example 6.2 to stabilize the spacecraft, with a settling time of 5 s, with zero maximum overshoots, while requiring input torques not exceeding 0.1 N-m, when the spacecraft is initially perturbed by a hub rotation of 0.01 rad. (i.e. the initial condition is x(0) = [0.01; zeros(l, 25)]r). We would like to combine the optimal regulator already designed in Example 6.2 with a Kalman filter that recovers the return ratio at the plant's input in the frequency range 0-50000 rad/s (approximately the bandwidth of the plant). To do so, we select F = B, Z = CCT, W = 0, and V = pBTB, where p is a scaling parameter. By comparing the singular values of H(s)G(.s) with those of —K(.sl — A) -1 B, for various values of p, we find that loop transfer recovery occurs in the desired band- width for p = 1022, for which the Kalman filter gain, covariance, and eigenvalues are obtained as follows (only eigenvalues are shown below): »[L,P,E] = lqe(A,B,C,1e12*B > *B,C*C') <enter> E = -1.09776+008+ 1.0977e+008i -1.09776+008- 1.09776+0081 -1.09776+008+ 1.0977e+008i -1.09776+008- 1.09776+0081 -8.60426+004+ 8.60746+0041 -8.60426+004- 867604 .04+01 -4.60326+000+ 4.58766+0041 -4.60326+000- 4.58766+0041
  • 382. ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY 367 -8.7040e-001+ 2.31936+0041 -8.70406-001- 2.31936+0041 -3.40736-001+ 1.00776+0041 -3.40736-001- 1.00776+0041 -3.57586-002+ 3.71216+0031 -3.57586-002- 3.71216+0031 -1.09756-002+ 4.03866+0021 -1.09756 -002 - 4.03866+0021 -1.27676-004+ 4.58756+0041 -1.27676 -004- 4.58756+0041 -9.38676-005+ 3.71216+0031 -9.38676-005- 3.71216+0031 -7.41726-005+ 1.00776+0041 - 7.41726 - 005 - 1.00776+0041 -5.89666-005+ 2.31936+0041 -5.89666-005- 2.3193e+004i -3.85646-005+ 4.03856+0021 -3.85646-005- 4.03856+0021 Note that the Kalman filter is stable, bmt has some eigenvalues very close to the imaginary axis, which is likely to degrade the performance of the closed-loop system. The singular values of the return ratio at the plant's input, for the compensated system are calculated as follows, with K obtained in Example 6.2: »sysp=ss(A,B,C,D);sysc=ss(A-B*K-L*C+L*D*K,L,-K,zeros(size(K,1))); <enter> » sysHG = series(sysp,sysc); <enter> »w = logspace(-2,6); [sv,w] = sigma(sysHG,w); <enter> The singular values of the full-state feedback return ratio at the plant's input are obtained as follows: » s y s f s = s s ( A , B , - K , z e r o s ( s i z e ( K , 1 ) ) ) ; [sv1,w1] = sigma(sysfs,w); <enter> The two sets of singular values (full-state feedback and compensated system) are compared in Figure 7.15. Note that the smallest singular value of the return ratio is recovered in the range 0-50000 rad/s, as desired, while the other two singular values are recovered in a larger frequency range. The plant has some zeros very close to the imaginary axis (largest real part is 3.3 x 10~8) in the right-half plane, hence, the plant is non-minimum phase and perfect loop transfer recovery is not guaran- teed. Also, due to this nature of the plant, the function Iqe may yield inaccurate results. Owing to the presence of some Kalman filter poles very close to the imagi- nary axis, the closed-loop system would have unacceptable performance. Hence, for improving the closed-loop performance, the loop transfer recovery bandwidth must be reduced. A good compromise between performance and robustness is achieved by choosing p = 106. Figure 7.16 shows the spectrum of the smallest singular value of
  • 383. 368 KALMAN FILTERS 100 i ' I ' I ' Full-state feedback control system Compensated system 50 with V=1022BTB -50 CO -100 -150 10 -2 10° 102 104 106 Frequency (rad/s) Figure 7.15 Singular values of the return ratio matrix at the plant's input of the full-state feedback system compared with those of the compensated plant with V = 1022BTB for the flexible, rotating spacecraft Full-state feedback system -50 -100 -150 Compensated system with V=106BTB -200 -250 -300 2 10- 10° 102 104 106 Frequency (rad/s) Figure 7.16 Smallest singular value of H(s)G(s) of the optimal (LOG) compensated system with V = 106BTB for the flexible rotating spacecraft, compared with that of the full-state feedback system showing loop-transfer recovery in the frequency range 5-500 rad/s H(s)G(.s) which indicates a loop transfer recovery bandwidth of 50-500 rad/s. The performance of the closed-loop system is determined using a SIMULINK simulation of the initial response with x(0) = [0.01; zeros(1, 25)]r) and measurement noise in the hub-rotation angle, y (r), as shown in Figure 7.17. A closed-loop settling time
  • 384. ROBUST MULTIVARIABLE LOG CONTROL: LOOP TRANSFER RECOVERY 369 Tip Tip Hub rotation rotation rotation 1 l angle angle angle LQG compensator 1 _n 1' ' r ' Flexible spacecraft Band-Limited white noise X10-3 10 5 0 -5 3 Time (s) Figure 7.17 Simulated initial response of the LQG compensated flexible rotating spacecraft's hub-rotation angle, y (f), with measurement noise, A/] (f), in the hub-rotation channel of five seconds, with maximum overshoots less than 1% and a steady-state error of 0.002 rad, is observed when the measurement error in y(t} is ±3.5 x 10~5 rad. Comparing with the full-state feedback response with zero noise seen in Figure 6.5, the performance is fairly robust with respect to measurement noise.
  • 385. 370 KALMAN FILTERS Exercises 7.1 Repeat Example 7.1 using the MATLAB's random number generator, rand, which is a random process with uniform probability distribution [1]. What significant differences, if any, do you observe from the normally distributed random process illustrated in Exam- ple 7.1? 7.2. The following deterministic signal, sin(2r), corrupted by a uniformly distributed random noise is input to a low-pass filter whose transfer function is given by Eq. (7.15): u(t) = sin(2/) + Q.5*rand(t) (7.88) where rand is the MATLAB's uniformly distributed random number generator (see Exer- cise 7.1). Determine the filter's cut-off frequency, a>0, such that the noise is attenuated without too much distortion of the output, y ( t ) , compared to the noise-free signal, sin(2r). Generate the input signal, u(t), from t = 0 to t = 10 seconds, using a time step size of 0.01 second, and simulate the filtered output signal, y(r). Draw a Bode plot of the filter. 7.3. Simulate the output to the following noisy signal input to the elliptic filter described in Example 7.3: u(t) = sin(lOr) + sin(lOOr) + 0.5*rand(t) (7.89) How does the filtered signal compare with the desired deterministic signal, sin(lOr) + sin(lOOf)? What possible changes are required in the filter's Bode plot such that the signal distortion and noise attenuation are both improved? 7.4. For a linear system with a state-space representation given by Eqs. (7.40) and (7.41), and the process white noise, (t), as the only input (i.e. u(f) = z(r) = 0), derive the differential equation to be satisfied by the covariance matrix of the output, R y (f, /). (Hint: use steps similar to those employed in deriving Eq. (7.64) for the covariance matrix of the estimation error R<.(r, 0-) 7.5. An interesting non-stationary random process is the Wiener process, w,-(/), defined as the time integral of the white noise, w(t), such that w,- (1) (f) = w(r) (7.90) Consider the Wiener process as the output, y(f) = w,(/), of a linear system, into which white noise, w(0, is input. Using the covariance equation derived in Exercise 7.4, show that the covariance matrix of the Wiener process, Rwi(0> grows linearly with time. 7.6. Design a Kalman filter for the distillation column whose state-space representation is given in Exercises 5.4 and 5.15, using F = B, Z = CCT, * = 0, and V = 0.01BTB. Where are the poles of the Kalman filter in the s-plane?
  • 386. REFERENCES 371 7.7. Design a Kalman filter for the aircraft lateral dynamics given by Eq. (4.97) in Exercise 4.3 using F = I, Z = CCT, * = 0, and V = 0.001 FTF. Where are the poles of the Kalman filter in the 5-plane? 7.8. Design a Kalman filter for the turbo-generator of Example 3.14, using F = B, Z = CC1, * = 0, and V = 0.0001 BTB. Where are the poles of the Kalman filter in the s-plane? 7.9. Design a linear Kalman filter to estimate the nonlinear state of wing-rock model described in Example 4.13, and programmed in the M-file wrock.m which is listed in Table 4.8. Plot the elements of the estimation error vector as functions of time, if the initial condition is x(0) = [0.2; 0; 0; 0; 0]r. Which state variables have the largest estimation error, and what are the magnitudes of the largest estimation errors? 7.10. Re-design a Kalman filter for the distillation column (Exercise 7.6), such that the LQG optimal compensator formed by including the optimal regulator deigned in Exercise 6.2 has loop-transfer recovery at the plant's input in the frequency range 0.01-10 rad/s. What are the largest control input magnitudes required for the resulting LQG/LTR compensator if the initial condition is x(0) = [1; 0; 0; 0] r ? 7.11. Re-design a Kalman filter for the aircraft lateral dynamics (Exercise 7.7), such that the LQG optimal compensator formed by including the optimal regulator deigned in Exercise 6.3 has loop-transfer recovery at the plant's input in the frequency range 0.1-100 rad/s. What are the largest control input magnitudes required for the resulting LQG/LTR compensator if the initial condition is x(0) = [0.5; 0; 0; 0]r? Repeat the simulation of the closed-loop initial response using a measurement noise of ±0.01 rad/s in the roll-rate, p(t), channel. 7.12. Re-design a Kalman filter for the turbo-generator (Exercise 7.8), such that the LQG optimal compensator formed by including the optimal regulator designed in Exercise 6.5 has loop- transfer recovery at the plant's input in the frequency range 0-10 rad/s. What are the largest control input magnitudes required for the resulting LQG/LTR compensator if the initial condition is x(0) = [0.1; 0; 0; 0; 0; 0]r? References 1. Papoulis, A. Probability, Random Variables and Stochastic Processes. McGraw-Hill, New York, 1984. 2. Parks, T.W. and Burrus, C.S. Digital Filter Design. Wiley, New York, 1987. 3. Robust Control Toolbox for use with MATLAB, User's Guide. Math Works, Inc., Natick, MA, 2000. 4. Maciejowski, J.M. Multivariable Feedback Design. Addison-Wesley, New York, 1989.
  • 387. This page intentionally left blank
  • 388. 8 So far, we have confined our attention to continuous time (or analog) systems, i.e. systems whose inputs and outputs are continuous functions of time. However, we often have to deal with systems whose output signals are discontinuous in time. Such systems are called discrete time (or digital) systems. Where are digital systems encountered? Any continuous time signal that is processed (or sampled) by either a human being, or by a machine - mechanical or electrical - becomes a digital signal by the very process of sampling, because a human being or a machine takes some non-zero time, albeit small, to evaluate or record the value of the signal at any given time. Over this non-zero time interval, the current value of the signal is held and analyzed, before the value of the signal at the next time interval is processed. Hence, by sampling a continuous time signal, we essentially convert it into a digital signal, and the sampling process is a digital system. Another type of digital system is the one which produces discontinuous outputs due to the intrinsic nature of its mechanism. Watches and clocks of any type, tick and tock in a discontinuous manner (i.e. the needle or electronic display moves in jerks rather than in a perfectly smooth manner) while trying to simulate a continuous passage of time. The jerks or discontinuities in the motion of a time-piece can be minimized by choosing an appropriate mechanism. However, the time interval between two successive ticks, no matter how small, is non-zero for an atomic clock as well as for a grandfather clock. Hence, we have to deal with inherently digital systems, as well as digital systems obtained by sampling continuous time signals. However, if the sampling interval of the output of a continuous system, or the discontinuity in time of the output of an inherently digital system, is small in comparison to the time constants (i.e. inverse of natural frequencies) of the system, then such a signal, even though digital by nature, can be approximated to be a continuous signal, and we can apply all the methods developed in the previous chapters to study and design a control system that produces such an output. Interestingly, the solution of the state-equations for an analog system requires its approximation by a corresponding digital system, as we saw in Chapter 4! Most mechanical and electrical control systems before the advent of the digital computer had previously been approximated as continuous time (or analog) systems. Nowadays, control systems are invariably based on the digital computer, which is an inherently digital system, because it receives and produces electrical impulses, rather than continuous electrical signals, on which binary arithmetic is based. There are several advantages in having a digital computer as a part of the control system (usually the
  • 389. 374 DIGITAL CONTROL SYSTEMS feedback controller), namely the ease and versatility of implementing complex control laws merely by programming the computer, relative insensitivity to noise, and low cost. Hence, modern control systems employ digital computers in almost all applications, such as automobiles, pacemakers for heart, aircraft and spacecraft, electronic appliances, personal computers, robotic manipulators, chemical and nuclear reactors and industrial processes. Such applications are usually approximated as an analog plant controlled by a digital computer. However, by having a digital computer in the control system for controlling an analog plant, we introduce an additional characteristic to the control system - the sampling rate, i.e. the inverse of the non-zero time interval required by the digital computer to process the analog output at each instant of time. The sampling rate can drastically modify the behavior of a control system - such as stability, performance, and robustness - when compared to an analog control system. In this chapter, we study how to take into account the sampling rate of digital control systems while studying stability, performance, and robustness, and how such control systems can be designed. A system into which a continuous time signal is input and from which a digital signal is output (perhaps due to processing by a digital computer) is called an analog-to-digital converter (or A/D converter). A system which converts digital inputs to analog outputs is called a digital-to-analog (or D/A) converter. Since a digital computer processes only digital input signals and produces digital outputs, while using a digital computer in a feedback control system for controlling an analog plant, we must have both A/D and D/A converters, as shown in Figure 8.1. However, whereas D/A conversion is a simple and continuous time process (where the analog output is a weighted sum of a set of input impulses), the A/D conversion is a digital process consisting of sampling and holding the analog input (as pointed out above), and producing an impulse as the output. We discussed in Chapter 4 how a good approximation of an analog system by a digital system can be obtained if the discrete time step used to solve the digitized state-equations is appropriately small. Conversely, the sampling rate at which an analog signal is sampled is crucial for the successful implementation of a digital control system. The sampling rate must not be smaller than the bandwidth (i.e. the range of frequencies in the power spectrum) of the analog signal, otherwise a distorted digital output will be produced. Thus, we may regard the A/D converter as a low-pass filter (see Example 7.2) with sampling rate as the cut-off frequency. To reduce signal distortion, the cut-off frequency (sampling rate) should be appreciably larger than the bandwidth of the signal we wish to pass through the filter. Generally, the sampling rate should be at least twice the bandwidth yd(0 yw >* I A/D converter Digital D/A Analog "*• controller "*" converter "*" plant •*- Figure 8.1 A block diagram of a negative feedback control system with an analog plant and a digital controller
  • 390. A/D CONVERSION AND THE Z-TRANSFORM 375 (in Hertz) of the analog signal. This minimum value of the sampling rate is known as the Nyquist sampling rate. It is clear from the above discussion that a successful implementation of a digital control system requires a mathematical model for the A/D converter. Since A/D converter is based on two distinct processes - sampling and holding - such a model must include separate models for both of these processes. As with continuous time systems, we can obtain the mathematical model for A/D converter in either frequency domain (using transform methods and transfer function), or in the time domain (using a state-space representation). We begin with the frequency domain modeling and analysis of single-input, single-output digital systems. 8.2 A/D Conversion and the z-Transform The simplest model for the sampling process of the A/D converter is a switch which repeatedly closes for a very short duration, tw, after every T seconds, where l/T is the sampling rate of the analog input, /(?)• The output of such a switch would consist of series of pulses separated by T seconds. The width of each pulse is the duration, tw, for which the switch remains closed. If tw is very small in comparison to 7, we can assume that f ( t ) remains constant during each pulse (i.e. the pulses are rectangular). Thus, the height of the &th pulse is the value of the analog input f ( t ) at t = kT, i.e. f ( k T ) . If tw is very small, the fcth pulse can be approximated by a unit impulse, 8(t — kT), scaled by the area f(kT}tw. Thus, we can use Eq. (2.35) for approximating /(/) by a series of impulses (as shown in Figure 2.16) with T — kT and AT = tw, and write the following expression for the sampled signal, ftw*(t)'- (8-0 Equation (8.1) denotes the fact that the sampled signal, ftw*(t), is obtained by sampling f ( t ) at the sampling rate, l/T, with pulses of duration tw. The ideal sampler is regarded as the sampler which produces a series of impulses, /*(/), weighted by the input value, f ( k T ) as follows: (8.2) k=0 Clearly, the ideal sampler output, f * ( t ) , does not depend upon tw, which is regarded as a characteristic of the real sampler described by Eq. (8.1). The ideal sampler is thus a real sampler with tw = 1 second. Since the sampling process gives a non-zero value of /*(?) only for the duration for which the switch remains closed, there are repeated gaps in f * ( t ) of approxi- mately T seconds, in which /*(?) is zero. The holding process is an interpolation of the sampled input, /*(?), in each time interval, T, so that the gaps are filled. The simplest holding process is the zero-order hold (z.o.h.), which holds the input constant over each time interval, T (i.e. applies a zero-order interpolation to /*(?))• As a result,
  • 391. 376 DIGITAL CONTROL SYSTEMS Ideal sampler f(t) Zero-order WO hold Figure 8.2 Schematic diagram and input, sampled, and output signals of an analog-to-digital (A/D) converter with an ideal sampler and a zero-order hold the held input, //,(?), has a staircase time plot. A block diagram of the ideal sampling and holding processes with a zero-order hold, and their input and output signals, are shown in Figure 8.2. Since the input to the z.o.h. is a series of impulses, /*(/), while the output, //,(f), is a series of steps with amplitude f(kT), it follows that the impulse response, h(t), of the z.o.h. must be a step that starts at / = 0 and ends at t = T, and is represented as follows: = us(t) - us(t - T) (8.3) or, taking the Laplace transform of Eq. (8.2), the transfer function of the z.o.h. is given by -.(l-Q-Ts)/s (8.4) Note that we have used a special property of the Laplace transform in Eq. (8.3) called the time-shift property, which is denoted by £[y(t — T)] = e~Ts£[y(t)]. Similarly, taking the Laplace transform of Eq. (8.2), we can write the Laplace transform of the ideally sampled signal, F*(s), as follows: 00 ~~ 'm (8.5) k=0 If we define a variable z such that z = e , we can write Eq. (8.5) as follows: (8.6) *=0 In Eq. (8.6), F(z) is called the z-transform of f ( k T ) , and is denoted by z{f(kT)}. The z-transform is more useful in studying digital systems than the Laplace transform, because the former incorporates the sampling interval, T, which is a characteristic of digital systems. The expressions for digital transfer functions in terms of the z-transform are easier to manipulate, as they are free from the time-shift factor, e~Ts, of the Laplace transform. In a manner similar to the Laplace transform, we can derive z-transforms of some frequently encountered functions.
  • 392. A/D CONVERSION AND THE Z-TRANSFORM 377 Example 8.1 Let us derive the z-transform of f ( k T ) = u s ( k T ) , the unit step function. Using the definition of the z-transform, Eq. (8.6), we can write z~) (8.7) or F(z) = z / ( z ~ l ) (8.8) Thus, the z-transform of the unit step function, us(kT), is z/(z — 1). (Note that we have used the binomial series expansion in Eq. (8.7), given by (1 — Jt)~' = 1 +x + x2 +x3 + ...). Example 8.2 Let us derive the z-transform of the function f ( k T ) = &~akT , where t > 0. Using the definition of the z-transform, Eq. (8.6), we can write 00 00 F(z) = e-fl*V* - (zeorr* - 1 + (ze"1)"1 + (ze« r r 2 + • - • k=0 k=() = 1/[1 - (ze^r ] - z/(z - ze-"r) 1 (8.9) Thus, zje-^"7"} = z/(z - ze- ar ). The z-transforms of other commonly used functions can be similarly obtained by manipulating series expressions involving z, and are listed in Table 8.1. Some important properties of the z-transform are listed below, and may be verified by using the definition of the z-transform (Eq. (8.6)): (a) Linearity: z{af(kT)}=az[f(kT)} (8.10) z{fi(kT) + /2(*r)} = z{/, (*r)J + z{f2(kT}} (8.1 1) (b) Scaling in the z -plane: z{Q~akrf(kT)} = F(earz) (8.12) (c) Translation in time: z{f(kT + T)} = zF(z) - z/((T) (8. 13) where /(0~) is the initial value of f ( k T ) for k — 0. Note that if f ( k T ) has a jump at k = 0 (such as f ( k T ) = us(kT)), then /(0~) is understood to be the value of f ( k T )
  • 393. 378 DIGITAL CONTROL SYSTEMS Table 8. 1 Some commonly encountered z-transforms Discrete Time z-transform, F(z) Laplace Transform of Function, f ( k T ) Equivalent Analog Function, F(s) us(kT) z/(z - 1) 1/5 kT rz/(c-l)2 I/* 2 e-akT z/(z-e-"T) /(s+a) 1 - Q- akT z(-e-aT)/((z-)(z-e-aT)} a/[s(s+a)] kTe~akT Tze-aT/(z-e-"T)2 /(s+a)2 kT -(1 -e~akT)/a Tz/(z -)2-z(- e~aT)/[a(z - l)(z - e~aT)] a/[s2(s + a)] sin(akT) zsin(aT)/[z2 -2zcos(aT) + 1] a/(s2 +a2) cos(akT) z[z - cos(aT)]/[z2 - 2zcos(aT) + 1] s/(s2+a2) e-akT s i n (££7") ze~aT sin(bT)/[z2 — 2ze~aT cos(bT) — z~2aT] b/((s+a)2+b2} e~akT cos(bkT) [z2 - ze-"T cos(bT)]/[z2 - 2ze~aT cos(bT) - e'^7] (s + a)/((s+a)2+b2] (kT)" lima^0(-)nd''/da"[z/(z - e-"7")] rt!/5" + ' before the jump. Thus, for f ( k T ) = us(kT), /(O ) =0. A negative translation in time is given by z { f ( k T - T)} = z~l F(z) + z/(0~). (d) Differentiation with z: z{kTf(kT)} = -TzdF(z)/dz =- (8.14) (e) Initial value theorem: (8.15) Equation (8.15) holds if and only if the said limit exists. Note that if f ( k T ) has a jump atk = 0 (such as f ( k T ) = us(kT) then /(0 + ) is understood to be the value of f ( k T ) after the jump. Thus, for f ( k T ) = us(kT), /(0+) = 1. (f) Final value theorem: (8.16) Equation (8.16) holds if and only if the said limit exists. Using Table 8.1, and the prop- erties of the z-transform, we can evaluate z-transforms of rather complicated functions. Example 8.3 Let us find the z-transform of f ( k T ) = te~akT sin(bkT - 2T). From Table 8.1, we know that z{sin(Mr)} = zsin(6r)/[z 2 - 2zcos(fer) -I- 1] (8.17) Then, using the linearity property of the z-transform given by Eq. (8.10), we can write z{10sin(Mr)} = (8.18)
  • 394. _ PULSE TRANSFER FUNCTIONS OF SINGLE-INPUT, SINGLE-OUTPUT SYSTEMS 379 Furthermore, the scaling in the z-plane given by Eq. (8.12) yields z{Qe"~akT sin(bkT)} = ]QzeaT sm(bT)/[z2e2aT - 2zeaT cos(bT) + 1] (8.19) Finally, the translation in time given by Eq. (8.13) yields (noting that 10e° sin(O) = 0) akT sin(bkT - 2T)} = Oz~leaT sin(bT)/[z2e2aT - 2z.eaT cos(bT) + 1 ] (8.20) 8.3 Pulse Transfer Functions of Single-Input/ Single-Output Systems In a manner similar to the transfer function in Laplace domain for a single-input, single-output analog system, we can define a pulse transfer function for a single-input, single-output digital system in the z-domain as the z-transform of the output signal divided by the z-transform of the input signal. Finding the pulse transfer functions of digital systems in the z-domain is a useful application of the z-transform. However, before finding the pulse transfer function of a digital system, we must distinguish between an inherently digital system, and an analog system rendered digital due to the process of data sampling, as shown in Figure 8.3. It is clear from Figure 8.3 that while an inherently digital system would always produce a discrete time output, an analog system would produce a continuous time output, even though the input is a digitally sampled signal (recall the continuous time outputs to impulse inputs of analog systems calculated in Chapters 2 and 4). Finding an inherently digital system's pulse transfer function is straightforward, because both input and output are discrete time signals with the same interval, T. On the other hand, taking the z-transform of the transfer function, G(s), of a sampled-data analog system - in which the input is discrete with a sampling interval, T, while the output is a continuous time signal - is quite problematic. However, if we assume that we are only interested in finding the output of a sampled-data analog system at the same U(z) Digital system Y(t) no Imaginary Analog system sampler with sampled input Figure 8.3 Block diagrams of an inherently digital system and a sampled-data analog system rendered digital by an imaginary sampler at the output
  • 395. 380 DIGITAL CONTROL SYSTEMS discrete time points at which the input is sampled, the difficulty in finding the transfer function in the z-domain can be removed. By making such an assumption, we would be disregarding the continuous nature of the output of a sampled-data analog system, and treat the system as if it's output is sampled by an imaginary sampler. By having such an imaginary sampler at the output, the sampled-data analog system effectively becomes an inherently digital system. The ideally sampled input of an analog system is given by Eq. (8.2) as follows: u*(0 = u(nT)8(t -nT) (8.21) n=0 The continuous time output, y(t), is given by the discretized convolution integral of Eq. (2. 11 9) as follows: nT) (8.22) n=0 where g(t — nT) is the impulse response of the analog system to a unit impulse applied at time t = nT. The digitized output, v*(0, resulting from sampling of y(t ) by an imaginary sampler shown in Figure 8.3, with the same sampling interval, T, as that of the input, w*(r), can be written as follows: 00 /"(;) = y(kT) = Y^u(nT)g(kT-nT) (8.23) n=Q Then, the z-transform of the (imaginary) sampled output, y*(f ) = y(kT), can be written as 00 00 Y(z) = z{y(kT)} = Y,Y,»("T)g(kT ~ nT)z'k (8 24) ' k=0 n=0 or, expressing the double summation as a product of two summations, oc oc K( Z ) = £ g(kT - nT)z~k+n ^ u(nT)z~n (8.25) k=0 n=0 Since g(kT — nT) = 0 for fc < n, we can begin the first summation in Eq. (8.25) at k = n instead of k = 0, and defining m = k — n, we can write oc oc Y(z) = ^g(mT)z- ^u(nT)z-n m (8.26) m=0 n=0 or, recognizing the second summation of Eq. (8.26) as the z-transform of the input, (8.27)
  • 396. _ PULSE TRANSFER FUNCTIONS OF SINGLE-INPUT, SINGLE-OUTPUT SYSTEMS 38 1 Comparing Eq. (8.27) with the definition of the pulse transfer function, G(z) — Y(z)/U(z), we can write the pulse transfer function of a sampled-data analog system as follows: (8.28) Equation (8.28) indicates that the pulse transfer function of a sampled-data analog system is the z-transform of the digitized impulse response, g(mT}. This is an important result, which shows that although the output, y ( t ) , of a sampled-data analog system is conti- nuous in time, by having an imaginary sampler at the output (Figure 8.3), the analog system essentially becomes a digital system with the pulse transfer function, G(z). Since the impulse response, g(t), of the analog system is the inverse Laplace transform of its transfer function, G(s), we can directly obtain G(z) from G(s) by using Table 8.1, and denote G(z) by the convenient notation, G(z) = z{G(s)}. Example 8.4 Let us find the pulse transfer function of the z.o.h. The transfer function of z.o.h is given by Eq. (8.4) as G(s) = (1 — Q~TS)/S. We can express G(s) as G(s) = l/s — Q~TS/S, and write G(z) = z { / s ] - z{&"Ts/s] (8.29) From Table 8.1, we note that z{l/5} = z / ( z - l ) (8.30) Furthermore, note that o~Ts/s is the Laplace transform of us(t — T). Therefore, using the time-shift property of the z-transform given by Eq. (8.13), we can write z{e~"A} = z{us(kT - T)} = z- • z{us(kT)} = l/(z - 1) (8.31) Substituting Eqs. (8.30) and (8.31) into Eq. (8.29), we can write the pulse-transfer function of the z.o.h as follows: G(z) = z/(z - 1) ~ l/(z - 0 - (z - l)/(z - 1) = 1 (8.32) Thus, the pulse transfer function of the z.o.h is unity. Example 8.5 Let us find the pulse transfer function of a sampled-data analog system obtained by placing the z.o.h in series with an analog system with transfer function G(s) = s/(s2 + 1). The overall transfer function of the resulting sampled-data analog system is written as G(s) = Gl(s)(] -e-Ts)/s = ( - e - 7 ' v ) / ( J 2 + D (8-33)
  • 397. 382 DIGITAL CONTROL SYSTEMS For finding the pulse transfer function, G(z), we first express G(s) as follows: G(s) = /(s2 + 1) - e'Ts/(s2 + 1) (8.34) Note that l/(s 2 +l) is the Laplace transform of sin(kT). Furthermore, e~Ts/(s2 is the Laplace transform of sin(kT — T). Hence, using the time-shift property of the z-transform and Eq. (8.34), we can write G(z) = z{sin(*r)} - z- - z{sin(*r)} = (1 - z ~ ) • z{sin(kT)} (8.35) or, using Table 8.1, G(z) = (1 - z~')z sin(r)/[z 2 - 2zcos(D + 1] = (z - 1) sin(r)/[z 2 - 2zcos(r) + 1] (8.36) Examples 8.4 and 8.5 indicate that we can obtain the pulse transfer function of a general sampled-data analog system consisting of the z.o.h in series with a system with proper transfer function, GI(S), by expressing the overall transfer function as G(s) = (1 — e ~ T s ) [ G i ( s ) / s ] . Then, using the time-shift property of the z-transform, and noting that s ( t ) = L~}[G(s}/s] is the step response of the system, G(s), with s(0~) = 0, we can write the pulse transfer function, G(z), as follows: G(z) - (1 - z" 1 ) • z{G,(s)/s} - (1 - z'1) • 2{5,(*r)} (8.37) In Chapter 2, we learnt how to calculate the step response, s(t), of a proper transfer function, GI (5), using the partial fraction expansion of G(s)/s, either by hand, or by the M-file stepresp.m. Note that in the M-file stepresp.m, the step response, s (t), is essentially computed at discrete time points, with time interval, dt = T. Hence, stepresp.m gives us the digitized step response, s (kT), which can be thought of as the result of sampling s (t) by an imaginary sampler (Figure 8.3) with a specified sampling interval, T. If only we can compute the z-transform of a discrete time signal, s(kT), by an appropriate M-file, we will have all the necessary tools to compute the pulse transfer function of a general sampled-data system. For the moment, let us confine ourselves to hand calculation of the pulse transfer function. Example 8.6 Let us find the pulse transfer function of the sampled-data analog system consisting of an A/D converter with z.o.h in closed-loop with an analog plant of transfer function, GI(S), as shown in Figure 8.4(a), if GI(S) = (s + l)/[(s + 2)(s + 3)]. To find the pulse transfer function of the closed-loop sampled-data analog system, G(z) = Y(z)/Yd(z), we have to express the block diagram of the system in such a way that both y(t) and ya(t) are digital signals. This is done in Figure 8.4(b) by moving the sampler at the input of z.o.h to outside the feedback loop before
  • 398. PULSE TRANSFER FUNCTIONS OF SINGLE-INPUT, SINGLE-OUTPUT SYSTEMS 383 (a) Xd(0 .TW "V-^ l- p-TSyo GI(S) f Ideal sampler z.o.h Plant yv> /(f) Ts (1 e' )/s GI(S) Ideal i « Imaginary sampler sampler Figure 8.4 Two equivalent block diagrams of closed-loop sampled-data analog system with zero-order hold and analog plant, GI (s) the summing junction, as well as placing an imaginary sampler in the feedback loop. In doing so, we are not changing the essential characteristic of the closed-loop system. Hence, the block-diagrams shown in Figures 8.4(a) and (b) are equivalent. The open-loop transfer function of the system is given by .-TV G 0 (.V) = (1 - (8.38) The pulse transfer function of the closed-loop system is given by G(z) = Y(z)/ Yd(z). From the block-diagram of Figure 8.4(b) it is clear that e*(t) — y^(t) — y*(t), or, taking the z-transform, E(z) = Yd(z) — Y(z). Furthermore, the open-loop pulse transfer function is z{G0(s)} = G 0 (z) = Y(z)/E(z). Therefore, the closed-loop pulse transfer function is G(z) = Y(z)/Yd(z) = G 0 (z)/[l + G 0 (z)], where G 0 (z) is the pulse transfer function of the open-loop system. We can calculate G 0 (z) by finding the z-transform of G 0 (s) by Eq. (8.37) as follows: G 0 (z) = z{G0(s)} = (1 -z (8.39) where z{G,(s)/s} - z{l/(6s) + /[2(s + 2)] - 2/[3(s + 3)]} - z/[6(z - 1)] + z/[2(z - e~ 27 )] - 2z/[3(z - e-37)] (8.40) Substituting Eq. (8.40) into Eq. (8.39) and simplifying, we get G 0 (z) = [z(l + 3e"27 - 4e~ 37 ) + e"57 + 3e~3r -27 (8.41) Finally, the pulse transfer function of the closed-loop system is obtained as follows: = G 0 (z)/[l + G 0 (z)] + z(l + 3e"27 - 4e~ 37 ) + e~57 + 3e~3r - 4e~ 2r ] (8.42)
  • 399. 384 DIGITAL CONTROL SYSTEMS Examples 8.5 and 8.6 show that finding the pulse transfer functions of sampled-data analog systems requires converting the system into an equivalent system in which both output and input appear to be digital signals by appropriate placement of samplers. In doing so, care must be exercised that the characteristics of the system are unchanged. It is clear that the pulse transfer function of a general sampled-data analog system consisting of several analog sub-systems cannot be handled in the same manner as the transfer function of an analog system. For example, the pulse transfer function, G(z), of a sampled-data analog system consisting of two analog sub-systems with transfer functions G(s) and £2(5) m series cannot be written as G(z) = Gi(z)G 2 (z), but only as G(z) = z{Gi(s)G2(s)}. This is due to the fact that, generally, z{Gi(.s)G2(s)} ^Gi(z)G 2 (z). However, if we are dealing with a digital system consisting of digital sub-systems, the pulse transfer Junctions of the sub-systems are handled in precisely the same manner as the transfer functions of analog sub-systems systems. For example, the pulse transfer function of a digital system consisting of two digital sub-systems with pulse transfer functions GI(Z) and G 2 (z) in series is merely G(z) = Gi(z)G 2 (z). All of this shows us that we must be extremely careful in deriving the pulse transfer functions. It always helps to write down the input-output relationships (such as in Example 8.6) of the various sub-systems as separate equations, and then derive the overall input-output relationship from those equations. 8.4 Frequency Response of Single-Input, Single-Output Digital Systems In a manner similar to an analog system with transfer function, G(s), whose frequency response is the value of G(s) when 5 = ico, we can define the frequency response of a digital system with a pulse transfer function, G(z), as the value of G(z) when z = ela)T, or G(e' wr ). In so doing, we can plot the gain and phase of the frequency response, G(e'w7), as functions of the frequency, a>, somewhat like the Bode plots of an analog system. However, the digital Bode plots crucially depend upon the sampling interval, T. For instance, the gain, |G(e /a>r )|, would become infinite for some values of a)T. The frequency response of a digital system is related to the steady-state response to a harmonic input, provided the system is stable (i.e. its harmonic response at large time exists and is finite). The sampling rate of a harmonic output is crucial in obtaining the digital system's frequency response. If a high-frequency signal is sampled at a rate smaller than the signal frequency, then a large distortion and ambiguity occur in the sampled data. For example, if we sample two very different harmonic signals, say sin(0.257Tf/r) and sin(1.757r//r), with the same sampling interval, T, then the two sampled data would be identical. In other words, we lose information about the higher frequency signal by sampling it at a lower rate. This important phenomenon of sampled-data analog systems is known as aliasing. To avoid aliasing, the sampling rate must be at least twice the signal's bandwidth, a)> (i.e. the largest frequency contained in the signal). The minimum acceptable sampling rate is called the Nyquist frequency. The Nyquist frequency in rad/s is thus given by half the required sampling rate, i.e. 2n/T = 2<«b, orn/T = co^, where T is the sampling interval. Hence, the frequency response of a digital system with a given sampling interval, T, is usually calculated only for u> < n/T.
  • 400. FREQUENCY RESPONSE OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS 385 MATLAB's Control System Toolbox (CST) provides the command dbode for computing the frequency response of a digital system, and is used as follows: »[mag,phase,w] = dbode(num,den,T) <enter> where num. and den are the numerator and denominator polynomials of the system's pulse transfer function, G(z), in decreasing powers of z, T is the sampling interval, mag and phase are the returned magnitude and phase (degrees), respectively, of the computed frequency response, G(eia;7), and w is the vector of discrete frequency points (upto the Nyquist frequency) at which the frequency response is computed. The user can optionally specify the desired frequency points as the fourth input argument of the command dbode. When used without the output arguments on the left-hand side, dbode produces the digital Bode plots on the screen. Example 8.7 Let us find the frequency response of a digital system with pulse transfer function, G(z) = z/(z2 + 2), and sampling interval, T = 0.1 second. To get the magnitude and phase of the frequency response, we can use the command dbode as follows: »num = [1 0];den = [ 1 0 2];dbode(num,den,0.1) <enter> The resulting digital Bode magnitude and phase plots are shown in Figure 8.5. Note that the Nyquist frequency is n/T = 31.4159 rad/s, indicated as the highest frequency in Figure 8.5 at which the frequency response is plotted. At the Nyquist frequency, the phase is seen to approach 180°. There is a peak in the gain plot at co = 15.7 rad/s at which the gain is 0 dB and the phase is 90°. A gain of 0 dB o -10 10' Frequency (rad/s) 180 90 - Frequency (rad/s) Figure 8.5 Digital Bode plot of the pulse transfer function, G(z) = z/(z 2 + 2) with a sampling interval, 7 = 0.1 second
  • 401. 386 DIGITAL CONTROL SYSTEMS corresponds to G(eiwT) = 1, or eia>T/(e2iwT + 2)| = 1, which is seen in Figure 8.5 to occur at coT = 1.5708 = n/2. Thus, the value of z at which to 0 dB and the phase is 90° is z = e /7r/2 = i, and the corresponding value of G(z) = G(i') = i. Note that both Nyquist frequency, u> = n/T, and the frequency, co = n/(2T), at which the gain peaks to 0 dB with phase 90°, will be modified if we change the sampling interval, T. 8.5 Stability of Single-Input, Single-Output Digital Systems The non-zero sampling interval, T, of digital systems crucially affects their stability. In Chapter 2, we saw how the location of poles of an analog system (i.e. roots of the denom- inator polynomial of transfer function, G(s)) determined the system's stability. If none of the poles lie in the right-half s-plane, then the system is stable. It would be inter- esting to find out what is the appropriate location of a digital system's poles - defined as the roots of the denominator polynomial of the pulse transfer function, G(z) - for stability. Let us consider a mapping (or transformation) of the Laplace domain on to the z-plane. Such a mapping is defined by the transformation, z = ers. The region of instability, namely the right-half s-plane, can be denoted by expressing s = a + ia), where a > 0. The corresponding region in the z-plane can be obtained by z = e(a+lw)T = eaTela}T = eaT[cos(a>T) + / sin(&>r)], where a > 0. Note that a line with a = constant in the s-plane corresponds to a circle z = eaT[cos(a)T) + i sin(o>r)] in the z-plane of radius eaT centered at z = 0. Thus, a line with or = constant in the right-half s-plane (a > 0) corresponds to a circle in the z-plane of radius larger than unity (eaT > 1). In other words, the right-half s-plane corresponds to the region outside a unit circle centered at the origin in the z-plane. Therefore, stability of a digital system with pulse transfer function, G(z), is determined by the location of the poles of G(z) with respect to the unit circle in the z-plane. If any pole of G(z) is located outside the unit circle, then the system is unstable. If all the poles of G(z) lie inside the unit circle, then the system is asymptotically stable. If some poles lie on the unit circle, then the system is stable, but not asymptotically stable. If poles on the unit circle are repeated, then the system is unstable. Example 8.8 Let us analyze the stability of a digital system with pulse transfer function, G(z) = z/[(z — e~ r )(z 2 + 1)], if the sampling interval is T = 0.1 second. The poles of G(z) are given by z = e"r, and z = ±i. With T = 0.1 s, the poles are z = e~° ' = 0.9048, and z = ±i. Since none of the poles of the system lie outside the unit circle centered at z = 0, the system is stable. However, the poles z = ±i are on the unit circle. Therefore, the system is not asymptotically stable. Even if the sampling interval, T, is made very small, the pole at z = e~ r will approach - but remain inside - the unit circle. Hence, this system is stable for all possible values of the sampling interval, T.
  • 402. _ STABILITY OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS_ 387 Example 8.9 Let us find the range of sampling interval, T, for which the digital system with pulse transfer function, G(z) = 100/(z2 - 5e~7 +4), is stable. The poles of G(z) are given by the solution of the characteristic equation z2 — 5e~r + 4 = 0, or z = ±(5e~r - 4)1/2. If T > 0.51, then |z| > 1.0, indicating instability. Hence, the system is stable for T < 0.51 second. Example 8.10 A sampled-data closed-loop system shown in Figure 8.4 has a plant transfer function, d(s) = s/(s2 + 1). Let us find the range of sampling interval, 7", for which the closed-loop system is stable. In Example 8.6, we derived the pulse transfer function of the closed-loop system to be the following: G(z) = [z(l + 3e~2;r - 4e~3T) + e~5:r + 3e~3;r - 4e~2T]/[6(z - e~27")(z - e~ 3r ) + z(l + 3e"2r - 4e~37) + e"5r + 3e~3r - 4e~ 2r ] (8.43) The closed-loop poles are the roots of the following characteristic polynomial: 6(z - e~ 27 )(z - e~ 3r ) + z(l + 3e~~2r - 4e~ 3r ) + e~5T + 3e-3r - 4e~2r = 0 (8.44) or 6z2 + z(l - 3e"2r - 10e"3r) + 7e"57 + 3e~3r - 4e~2r = 0 (8.45) An easy way of solving Eq. (8.45) is through the MATLAB command roots as follows: »T=0.0001;z=roots([6 1 -3*exp( -2*T) -10*exp( -3*T) 7*exp( -5*T)+3*exp( -3 * T ) - 4 * e x p ( - 2 * T ) ] ) <enter> 7 — 0 . 9998 0.9996 Since the poles of G(z) approach the unit circle only in the limit T -> 0, it is clear that the system is stable for all non-zero values of the sampling interval, T. In a manner similar to stability analysis of the closed-loop analog, single-input, single- output system shown in Figure 2.32 using the Nyquist plot of the open-loop transfer function, G0(s) = G(s)H(s), we can obtain the Nyquist plots of closed-loop digital systems with an open-loop pulse transfer function, G 0 (z), using the MATLAB (CST) command dnyquist as follows: »dnyquist(num,den,T) <enter>
  • 403. 388 DIGITAL CONTROL SYSTEMS where num. and den are the numerator and denominator polynomials of the system's open- loop pulse transfer function, G0(z), in decreasing powers of z, and T is the sampling interval. The result is a Nyquist plot (i.e. mapping of the imaginary axis of the Laplace domain in the G0(z) plane) on the screen. The user can supply a vector of desired frequency points, w, at which the Nyquist plot is to be obtained, as the fourth input argument of the command dnyquist. The command dnyquist obtains the Nyquist plot of the digital system in the G 0 (z) plane. Hence, the stability analysis is carried out in exactly the same manner as for analog systems, using the Nyquist stability theorem of Chapter 2. According to the Nyquist stability theorem for digital systems, the closed-loop system given by the pulse transfer function, G 0 (z)/[l + G0(z)], is stable if the Nyquist plot of G 0 (z) encircles the point —1 exactly P times in the anti-clockwise direction, where P is the number of unstable poles of G 0 (z). Example 8.11 Let us use the digital Nyquist plot to analyze the stability of the closed-loop sampled data analog system shown in Figure 8.4 with the plant, G(s) — l/[(s(s + 1)]. The open-loop transfer function of the system is G0(s) = (1 — e~Ts)/[s2(s + 1)], while the open-loop pulse transfer function can be written as follows: ~T '7" G 0 (z) = [z(T - 1 + e-) + 1 - e- - T e ~ ] / ( ( z - l)(z - e ' ) ] (8.46) For a specific value of the sampling interval, such as T = 0. 1 second, the Nyquist plot is obtained as follows: »T=0.1;num = [T-H-exp(-T) 1 - e x p ( - T ) - T * e x p ( - T ) ] ,den = conv([1 - 1 ] , [ 1 - e x p ( - T ) ] ) <enter> num = 0 . 0048 0 . 0047 den = 1 . 0000 - 1 . 9048 0 . 9048 The poles of G 0 (z) are obtained as follows: »roots(den) <enter> ans = 1.0000 0 . 9048 Thus, G 0 (z) does not have any poles outside the unit circle, hence P = 0. The digital Nyquist plot is obtained in the frequency range 1-10 rad/s as follows: »w=logspace(0, 1 ) ; dnyquist (num,den,T,w) <enter> The resulting Nyquist plot is shown in Figure 8.6. Note that the Nyquist plot of G 0 (z) does not encircle the point —1 in the G 0 (z) plane. Hence, the closed- loop system with pulse transfer function, G 0 (z)/[l + G0(z)], is stable for T = 0.1
  • 404. STABILITY OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS 389 0.5 0.4 0.3 0.2 $ CO 0.1 | 0 'o> | -0.1 -0.2 -0.3 -0.4 -0.5 I I l l I -1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0 Real axis Figure 8.6 Digital Nyquist plot of open-loop pulse transfer function, G0 (z), for the sampled-data closed-loop system of Example 8.10 with sampling interval 7 = 0.1 s second. We can also analyze the stability of the closed-loop system by checking the closed-loop pole locations as follows: »sysp=tf(num,den);sysCL=feedback(sysp,1) <enter> Transfer function: 0.004837Z+0.004679 Z A 2-1.9Z+0.9095 »[wn,z,p]=damp(sysCL); wn, p <enter> wn = 0.9537 0.9537 p= 0.9500+0.08381 0.9500-0.08381 Note that the returned arguments of the CST command damp denote the closed- loop poles, p, and the magnitudes of the closed-loop poles, wn. (Caution: z and wn do not indicate the digital system's damping and natural frequencies, for which you should use the command ddamp as shown below.) Since wn indicates that both the closed-loop poles are inside the unit circle, the closed-loop system is stable.
  • 405. 390 DIGITAL CONTROL SYSTEMS In addition to dbode and dnyquist, MATLAB (CST) provides the command dnichols for drawing the digital Nichols plot. You may refer to the User's Guide for Control Systems Toolbox [1] for details about this as well as other digital frequency response commands. 8.6 Performance of Single-Input, Single-Output Digital Systems Performance of a digital system can be studied by obtaining the time response to specified inputs. In a manner similar to the inverse Laplace transform for analog systems, we can use the definition of the z-transform to find the inverse z-transform of the output, K(z), denoted by z~l{Y(z)}, to find the discrete time response of a single-input, single-output digital system with pulse transfer function, G(z), and input, U(z). From Eq. (8.6) it is clear that the inverse z-transform, z ~ } { Y ( z ) } , yields the discrete time output, y(kT). The method of finding the inverse z-transform of a function, F(z), is quite similar to that followed in finding the inverse Laplace transform, and involves expressing F(z) as a partial fraction expansion in z (there is an alternative method of using power series expansion in z, but we will not consider it due to its complexity). However, examining the z-transforms given in Table 8.1, it is clear that z is usually present as a numerator factor in most z-transforms. Hence, to find the inverse z-transform of F(z), it will be useful to express F(z) as the following expansion: F(z) = *iz/(z - zi) + K2z/(z - z 2 ) + • • • + KHz/(z - z n ) (8.47) where zi, Z 2 , • • • , zn are the poles of F(z) and K, KI, ..., Kn are the residues of the following partial fraction expansion: F(z) = ATi/(z - zi) + K2/(z - Z 2 ) + • • • + K*/(z ~ z«) (8-48) (Note that, for simplicity, we have assumed that all the poles of F(z) are distinct. If some poles are repeated, we can use the more general partial fraction expansion introduced in Chapter 2.) Taking the inverse z-transform of each term on the right-hand side of Eq. (8.47), we can write f ( k T ) = KlZ + K2z + ••• + Knzkn (8.49) We can apply the above strategy to find the discrete time output, y(kT), of a digital system, G(z), with input U(z} and zero initial conditions, by finding the inverse z-transform of Y(z) = G(z)£/(z). Example 8.12 Let us find the discrete time response of G(z) = z/(z 2 — 0.7z + 0.3) to a unit step input, u(kT) = us(kT). The z-transform of us(kT) is z/(z - 1). Hence, Y(z) = G(z)t/(z) = z2/[(z - l)(z 2 - 0.7z + 0.3)]. We begin byfindingthe partial fraction expansion of F(z)/z as follows by using the MATLAB command residue:
  • 406. PERFORMANCE OF SINGLE-INPUT, SINGLE-OUTPUT DIGITAL SYSTEMS 391 »num = [1 0];den = conv([1 -0.7 0.3]); [K,z,c] = residue(num, den)<enter> K = 1 .6667 -0.8333+0.09891 -0.8333-0.09891 z = 1 . 0000 0.3500+0.42131 0.3500-0.42131 Hence, the partial fraction expansion of Y(z)/z is the following: Y(z)/z = z/((z - l)(z2 - 0.7z + 0.3)] = (5/3) /(z - 1) + (-0.8333 + 0.0989/)/[z - (0.3500 + 0.42130] + (-0.8333 - 0.0989* )/[z - (0.3500 - 0.42130] (8.50) or Y(z) = (5/3)z/(z - 1) + (-0.8333 + 0.0989/)z/[z - (0.3500 + 0.42130] + (-0.8333 - 0.0989i)z/[z - (0.3500 - 0.42130] (8.51) 2 Digital step response _ 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0 0.2 0.4 0.6 0.8 kT Figure 8.7 Step response of the digital system of Example 8.11 with sampling interval, 7 = 0.1 s
  • 407. 392 DIGITAL CONTROL SYSTEMS Then, taking the inverse z-transform of each term on the right-hand side of Eq. (8.51), we get the discrete time output at the fcth sampling instant as follows: f ( k T ) = 5/3 + (-0.8333 + 0.09890 (0.3500 + 0.42130* + (-0.8333 - 0.09890(0.3500 - 0.42130* (8.52) The step response, f(kT), calculated by Eq. (8.52) is plotted in Figure 8.7 for T = 0.1 seconds using the following MATLAB command: »for k = 1 : 1 1 ; f ( k ) = K ( l ) + K ( 2 ) * z ( 2 ) A ( k - 1 ) + K ( 3 ) * z ( 3 ) A ( k - 1 ) ; t ( k ) = 0 . 1 * (k-1);end;plot(t,f) <enter> Note that the step response has a maximum overshoot of 13% with a steady state value of about 1.67. The peak time and the settling time are defined for the digital response as occurring after so many sampling intervals. The peak time occurs for k = 3, while the settling time occurs for k = 5. With T = 0.1 second, the peak time is 0.3 second, while the settling time is 0.5 second. MATLAB M-files can be written to compute step and impulse responses of digital systems using the inverse z-transform of partial fraction expansion (such as impresp.m and stepresp.m for impulse and step responses, respectively, of analog systems in Chapter 2). The steady state value of the response, K(z), can be directly obtained using the final- value theorem given by Eq. (8.16), as follows: >'(oo) = limpid - z ~ l ) Y ( z ) = limpid - z~l)G(z)U(z) (8.53) (Of course, the existence of the steady-state limit in Eq. (8,53) translates into the require- ment that all the poles of G(z)U(z) should lie inside the unit circle.) The steady state value of the response can thus be found using Eq. (8.53), without having to compute and plot the response. Let us use Eq. (8.53) to find the steady state value of the step response of a digital system with pulse transfer function, G(z), as follows: y(oo) = limpid - z~l)Y(z) = limpid - z~l)G(z)U(z) = limpid - z- ! )[z/(z - l)]G(z) = limz_>, G(z) (8.54) Thus, the steady state value of the step response of G(z) is given by lim,^! G(z) called the digital DC gain of G(z). However, instead of having to calculate the limit in Eq. (8.54) by hand, we can use the MATLAB (CST) command ddcgain to find the digital DC gain as follows: »ddcgain(num,den) <enter> where num and den are the numerator and denominator polynomials of the pulse transfer function, G(z), in decreasing powers of z. Let us find the steady state value of the step response in Example 8.12 using ddcgain as follows: »num = [1 0];den = [1 -0.7 0.3];ddcgain(num,den) <enter> ans = 1.6667
  • 408. CLOSED-LOOP COMPENSATION TECHNIQUES 393 Note that we can find the steady state value of response to an arbitrary input, t/(z), by calculating the digital DC gain of the pulse transfer function (1 — z~l)G(z)U(z). Also, an idea about a digital system's response can be obtained from the location of the dominant poles with respect to the unit circle in the z-domain. The MATLAB command ddamp is quite useful in determining the natural frequencies and damping ratios associated with the poles of a digital system, and is used in a manner similar to the command damp for analog systems, with the difference that the sampling interval, T, is specified as the second input argument: »[mag,wn,z] = ddamp(den,T) <enter> where den is the denominator polynomial of the system's pulse transfer function, T is the sampling interval, mag is the magnitude of the pole in the z-domain, wn is the equivalent natural frequency in the s-plane, and z is the equivalent damping ratio. The command ddamp used without the sampling interval as the second input argument gives only the magnitudes of the poles of the system. When used without the output arguments on the left-hand side, the magnitudes, natural frequencies, and damping ratios are printed on the screen. Instead of den, you can input the z-plane pole locations as a vector, and get the returned damping ratios and natural frequencies associated with the poles. Let us determine the natural frequencies and damping ratios of the digital system of Example 8.12 when the sampling interval is T = 0.1 second as follows: »ddamp([1 - 0 . 7 0 . 3 ] , 0 . 1 ) <enter> Eigenvalue Magnitude Equiv. Damping Equiv. FrEq. (rad/sec) 0.3500+0.4213i 0.5477 0.5657 10.6421 0.3500-0.4213i 0.5477 0.5657 10.6421 A damping ratio of £ = 0.5657 indicates a well damped response, as seen in Figure 8.7. For systems of order greater than two, we can identify the dominant poles which are the closest to the unit circle in the z-domain. The performance of such systems is primarily determined by the location of the dominant poles. 8.7 Closed-Loop Compensation Techniques for Single-Input, Single-Output Digital Systems For improving the performance of digital systems, we can apply closed-loop compensation techniques similar to analog systems discussed in Section 2.12, by placing a compensator with pulse-transfer function, //(z), in closed-loop with a digital plant, G(z), as shown in Figure 8.8. However, we have to be mindful of the dependence of the closed-loop digital system's properties on the sampling interval, T, and the properties of the z-transform, while designing compensators in the z-domain. Let us consider an example of closed-loop digital compensation. Just as in continuous systems, we can have the ideal proportional-integral-derivative (PID) control of digital systems. The digital equivalent of a PID compensator's transfer
  • 409. 394 DIGITAL CONTROL SYSTEMS figure 8.8 A single-input, single-output digital feedback control system with controller pulse transfer function, H(z), and plant pulse transfer function, G(z) function is obtained by combining the proportional term with the z-transform of the derivative term and the z-transform of the integral term. Note that the time deriva- tive of the error in Figure 8.8, e (1) (f), is approximated by the digital equivalent of a first order difference as e(1)(0 = [e(kT) — e(kT — T ) ] / T , whose ^-transform is obtained using the time-shift property of z-transform (Eq. (8.13)) as (1 — z~l)E(z)/T. Thus, the derivative term of PID compensator has the form K&( — z"1). The z-transform of the integral term, K/s, is Kz/(z — 1) according to Table 8.1. The PID compensator's pulse transfer is thus given by H(z) = KP + KD(l - z"1) + Kz/(z - 1), or //(z) = [(KP + Kn +tfi)z2- (KP - 2KD)z + KD]/(z2 - z). Example 8.13 Consider a digital system with the following pulse-transfer function and a sampling interval, T = 0.2 second: G(z) = O.OOOKz - l)/(z 2 + 1.97z + 0.99) (8.55) The poles, natural frequencies and damping ratios of the system are obtained as follows: »ddamp([1 1.97 0.99], 0.2) <enter> Eigenvalue Magnitude Equiv. Damping Equiv. FrEq. (rad/sec) -0. 9850+0. 1406i 0.9950 0.0017 14.9990 -0. 9850-0. 1406i 0.9950 0.0017 14.9990 A damping ratio of £ = 0.0017 indicates a lightly damped response, which is unacceptable. It is desired to increase the closed-loop damping to £ = 0.7 while keeping the natural frequency unchanged at a)n = 15 rad/s, through a proportional- integral (PI) compensator in the closed-loop configuration of Figure 8.8. With //(z) = Kp + Kz/(z — 1), the closed-loop pulse-transfer function is given by Y(z)/Yd(z) = = 0.0001 [KP(z - 1) + #iz]/[z2 + {1.97 + 0.0001 (tf P + + 0.99- 0.0001 KP] (8.56) The closed-loop poles are the roots of z2 + {1.97 + 0.0001 (KP + K{)}z + 0.99 - 0.0001 Kp = Q, and must be the same as the desired pole locations z.2 =
  • 410. CLOSED-LOOP COMPENSATION TECHNIQUES 395 ± i sin{^r(l - C) 1 / 2 }]. Plugging f = 0.7 and ct>M = 15 rad/s in the desired characteristic polynomial, z2 — 2exp(—t;co n T)cos{a) n T(l — £2)[/2}z + exp(—2^co n T), and comparing the coeffi- cients with those of the denominator polynomial Eq. (8.56), we get Kp = 9750 and K — —28 125. Let us check whether the closed-loop poles are at desired locations as follows: »Kp=9750;Ki=-28125;sysGH=tf(0.0001*[Kp+Ki-Kp],[1 1.97 0.99]); sysCL=feedback(sysGH,1) <enter> Transfer function: -1 .838Z-0.975 z~2+0.1325z+0.015 »ddamp([1 0.1325 0.015], 0.2) <enter> Eigenvalue Magnitude Equiv. Damping Equiv. Freq. (rad/s) -6.63e-002+1 .03e-001i 1 .226-001 7.00e-001 1.506+001 -6. 636-002-1. 03e-001i 1.22e-001 7.006-001 1 .506+001 which confirms that the desired closed-loop damping and natural frequency have been achieved. The steady-state error of the stable closed-loop system shown in Figure 8.8 to a unit step desired output can be obtained from the final value theorem (Eq. (8.16)) as follows: e(oo) = lim^a - z ~ l ) E ( z ) = limpid - z~l)Yd(z)/U + G(z}H(z)} + G(z)H(z)] (8.57) or the steady state error is the digital DC gain of the pulse transfer function 1/[1 + G(z)H(z)]. For the system of Example 8.13, the steady-state error is computed as follows: »num=0.0001*[Kp+Ki -Kp];den=[1 1 .97 0.99] ;a=ddcgain(num,den) ; e=1 /(1+a) <enter> e = 3.4510 which is very large. The closed-loop steady state error to a step desired output can be reduced to zero by a compensator which has two poles at z = 1, such a