Control System Toolbox For Use with MATLAB ® Computation Visualization Programming Getting Started Version 5 How to Contact The MathWorks: 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 Mail http://www.mathworks.com Web Anonymous FTP server Newsgroup ftp.mathworks.com comp.soft-sys.matlab [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] Technical support Product enhancement suggestions Bug reports Documentation error reports Subscribing user registration Order status, license renewals, passcodes Sales, pricing, and general information Getting Started with the Control System Toolbox COPYRIGHT 2000 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal government of the United States. By accepting delivery of the Program, the government hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR Part 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part 252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertain to the government’s use and disclosure of the Program and Documentation, and shall supersede any conflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to MathWorks. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Language Compiler is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders. Printing History: September 2000 First printing New for MATLAB 6.0 (Release 12) Contents Introduction 1 What Is the Control System Toolbox? . . . . . . . . . . . . . . . . . . . 1-2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Using the Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Related Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Typographic Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Building Models 2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Linear Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Linear Model Representations . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 SISO Example: the DC Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 Constructing SISO Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Discrete Time Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Adding Delays to Linear Models . . . . . . . . . . . . . . . . . . . . . . . . 2-11 LTI Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 MIMO Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . MIMO Example: Jet Transport Aircraft . . . . . . . . . . . . . . . . . Constructing MIMO Transfer Functions . . . . . . . . . . . . . . . . . Accessing I/O Pairs in MIMO Systems . . . . . . . . . . . . . . . . . . 2-13 2-13 2-15 2-17 Arrays of Linear Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-18 Model Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21 i Interconnecting Linear Models . . . . . . . . . . . . . . . . . . . . . . . . 2-22 Feedback Interconnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23 Continuous/Discrete Conversions . . . . . . . . . . . . . . . . . . . . . 2-24 Discrete DC Motor Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 Model Order Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26 Example: Gasifier Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26 Analyzing Models 3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 LTI Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Example: Time and Frequency Responses of the DC Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Right-Click Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 Displaying Response Characteristics on a Plot . . . . . . . . . . . . . 3-8 Changing Plot Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11 Showing Multiple Response Types . . . . . . . . . . . . . . . . . . . . . . 3-13 Comparing Multiple Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 ii Contents Functions for Time and Frequency Response . . . . . . . . . . . Time and Frequency Responses . . . . . . . . . . . . . . . . . . . . . . . . Plotting MIMO Model Responses . . . . . . . . . . . . . . . . . . . . . . . Data Markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Plotting and Comparing Multiple Systems . . . . . . . . . . . . . . . Creating Custom Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 3-18 3-20 3-23 3-24 3-27 Simulink LTI Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the Simulink LTI Viewer . . . . . . . . . . . . . . . . . . . . . . . . Comparing Linear and Nonlinear Models . . . . . . . . . . . . . . . . Bode Plots of Linearized Models . . . . . . . . . . . . . . . . . . . . . . . . Specifying Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . 3-30 3-30 3-31 3-38 3-43 Designing Compensators 4 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 The SISO Design Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Opening the SISO Design Tool . . . . . . . . . . . . . . . . . . . . . . . . . . Importing Models into the SISO Design Tool . . . . . . . . . . . . . . . Feedback Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Loop Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 4-3 4-5 4-6 4-7 Bode Diagram Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 Example: DC Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 Adjusting the Compensator Gain . . . . . . . . . . . . . . . . . . . . . . . . 4-8 Right-Click Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Adjusting the Bandwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Adding an Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12 Adding a Lead Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14 Moving Compensator Poles and Zeros . . . . . . . . . . . . . . . . . . . 4-17 Changing Units on a Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19 Adding a Notch Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20 Root Locus Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example: Electrohydraulic Servomechanism . . . . . . . . . . . . . . Changing the Compensator Gain . . . . . . . . . . . . . . . . . . . . . . . Adding Poles and Zeros to the Compensator . . . . . . . . . . . . . . Editing Compensator Pole and Zero Locations . . . . . . . . . . . . Exporting the Compensator and Models . . . . . . . . . . . . . . . . . Storing and Retrieving Intermediate Designs . . . . . . . . . . . . . 4-24 4-25 4-30 4-31 4-36 4-39 4-40 Functions For Compensator Design . . . . . . . . . . . . . . . . . . . Root Locus Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pole Placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Linear-Quadratic-Gaussian (LQG) Design . . . . . . . . . . . . . . . . Example: LQG Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example: LQG Design for Set Point Tracking . . . . . . . . . . . . . 4-42 4-42 4-42 4-46 4-51 4-55 iii Learning More 5 iv Contents Demos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting Plot Preferences and Properties . . . . . . . . . . . . . . . . . . . The MathWorks Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 5-2 5-3 5-4 1 Introduction What Is the Control System Toolbox? . . . . . . . . . 1-2 Installation . . . . . . . . . . . . . . . . . . . . 1-3 Using the Documentation . . . . . . . . . . . . . . 1-4 Related Products . . . . . . . . . . . . . . . . . . 1-6 Typographic Conventions . . . . . . . . . . . . . . 1-8 1 Introduction What Is the Control System Toolbox? MATLAB® has a rich collection of functions immediately useful to the control engineer or system theorist. Complex arithmetic, eigenvalues, root-finding, matrix inversion, and FFTs are just a few examples of MATLAB’s important numerical tools. More generally, MATLAB’s linear algebra, matrix computation, and numerical analysis capabilities provide a reliable foundation for control system engineering as well as many other disciplines. The Control System Toolbox builds on the foundations of MATLAB to provide functions designed for control engineering. The Control System Toolbox is a collection of algorithms, written mostly as M-files, that implements common control system design, analysis, and modeling techniques. Convenient graphical user interfaces (GUI’s) simplify typical control engineering tasks. Control systems can be modeled as transfer functions, in zero-pole-gain, or state-space form, allowing you to use both classical and modern control techniques. You can manipulate both continuous-time and discrete-time systems. Conversions between various model representations are provided. Time responses, frequency responses, and root loci can be computed and graphed. Other functions allow pole placement, optimal control, and estimation. Finally, the Control System Toolbox is open and extensible. You can create custom M-files to suit your particular application. 1-2 Installation Installation Instructions for installing the Control System Toolbox can be found in the MATLAB Installation Guide for your platform. We recommend that you store the files from this toolbox in a directory named control off the main matlab directory. To determine if the Control System Toolbox is already installed on your system, check for a subdirectory named control within the main toolbox directory or folder. The Control System Toolbox provides demonstration files that show how to use the toolbox to perform control design tasks in various settings. To launch these demos, type demo at the MATLAB prompt and select “Control System Toolbox” under the “Toolboxes” heading. In addition, “Design Case Studies” in the online documentation contains detailed examples of various design problems. 1-3 1 Introduction Using the Documentation If you are a new user, this manual, Getting Started with the Control System Toolbox, is written for you. Specifically, you will learn: • How to build and manipulate linear time-invariant models of dynamical systems • How to analyze such models and plot their time and frequency responses • How to design compensators using root locus and pole placement techniques In addition, this guide discusses model order reduction, linear quadratic Gaussian (LQG) techniques and presents examples that show how to use these techniques. This guide is available online under “Control System Toolbox.” The rest of the toolbox documentation is also available online; click “Control System Toolbox” to open its product page, which is a road map with links to the Control System Toolbox documentation online and to PDF versions of the same documentation. If you are an experienced toolbox user, see the online documentation for detailed discussions of control system design topics, including the following: • “Release Notes” — For details on the latest release • “Creating and Manipulating Models” — In-depth information on how to create and manipulate linear models and LTI (linear time-invariant) arrays, which are data objects that you can use to store collections of linear models in one variable • “Customization” — Setting plot properties, including how to set preferences that persist from session to session • “Design Case Studies” — Worked examples, including Kalman filtering and MIMO design • “Reliable Computations” — Numerical stability and accuracy issues • “GUI Reference” — Complete descriptions of the LTI Viewer and SISO Design Tool, which are graphical user interfaces (GUI’s) that you can use to analyze systems and design SISO compensators All toolbox users should use the online “Control System Toolbox Function Reference” for reference information on functions and tools. For functions, reference descriptions include a synopsis of the function’s syntax, as well as a 1-4 Using the Documentation complete explanation of options and operation. Many reference descriptions also include helpful examples, a description of the function’s algorithm, and references to additional reading material. For GUI-based tools, the descriptions include options for invoking the tool. 1-5 1 Introduction Related Products The MathWorks provides several associated products that are especially relevant to the kinds of tasks you can perform with the Control System Toolbox. For more information about any of these products, see either: • The online documentation for that product, if it is installed or if you are reading the documentation from the CD • The MathWorks Web site, at http://www.mathworks.com; see the “products” section The table below lists MathWorks products that complement the functionality of the Control System Toolbox. 1-6 Product Description Fuzzy Logic Toolbox Tools for developing fuzzy logic algorithms Linear Matrix Inequality Toolbox Convex optimization algorithms for solving linear matrix inequalities (LMI), with application to robust control, multi-objective control, and gain scheduling Model Predictive Control Toolbox A complete set of tools for implementing model predictive control strategies. µ-Analysis and Synthesis Toolbox Computational algorithms for the structured singular value, µ, applicable to robustness and performance analysis for systems with modeling and parameter uncertainties Nonlinear Control Design Blockset An optimization-based approach to control system design that tunes parameters based on user-defined time-domain performance constraints Robust Control Toolbox Tools for modeling, analysis, and design of “robust” multivariable feedback control systems using H∞ techniques Related Products Product Description Simulink A comprehensive environment for modeling, simulating, and analyzing dynamical systems in block diagram format System Identification Toolbox Tool for building linear models of dynamical systems from noisy time series (input-output data) 1-7 1 Introduction Typographic Conventions This manual uses some or all of these conventions. Item Convention to Use Example Example code Monospace font To assign the value 5 to A, enter A = 5 Function names/syntax Monospace font The cos function finds the cosine of each array element. Syntax line example is MLGetVar ML_var_name Keys Boldface with an initial Press the Return key. capital letter Literal strings (in syntax descriptions in Reference chapters) Mathematical expressions MATLAB output Monospace bold for f = freqspace(n,'whole') literals Italics for variables Standard text font for functions, operators, and constants Monospace font This vector represents the polynomial p = x2 + 2x + 3 MATLAB responds with A = 5 1-8 Menu names, menu items, and controls Boldface with an initial capital letter Choose the File menu. New terms Italics An array is an ordered collection of information. String variables (from a finite list) Monospace italics sysc = d2c(sysd, 'method') 2 Building Models Introduction . . . . . . . . . . . . . . . . . . . . 2-2 Linear Models . . . . . . . . . . . . . . . . . . . 2-3 MIMO Models . . . . . . . . . . . . . . . . . . . 2-13 Arrays of Linear Models Model Characteristics . . . . . . . . . . . . . . 2-18 . . . . . . . . . . . . . . . 2-21 Interconnecting Linear Models . . . . . . . . . . . 2-22 Continuous/Discrete Conversions . . . . . . . . . . 2-24 Model Order Reduction . . . . . . . . . . . . . . . 2-26 2 Building Models Introduction This chapter discusses how to build models of linear, time invariant (LTI) dynamical systems using functions from the Control System Toolbox. It begins by developing a simple single-input, single-output (SISO) model of a DC motor and describes the various model representations possible, including: • Transfer functions • State-space • Zero/pole/gain • Frequency response data This chapter then describes how to build multiple-input multiple-output (MIMO) models by presenting a jet transport model. It also discusses topics related to creating general LTI models, including: • How to access model characteristics • Conversions between model representations • Building larger models from smaller ones • Accessing and manipulating I/O pairs • LTI objects, which are MATLAB objects that store multiple linear models in a single variable This chapter also discusses discrete-time systems, including analog to discrete-time conversion, sample time specification, and how to introduce time delays in your linear system. The last section describes functions that perform model order reduction and presents an example of how to perform a model order reduction. 2-2 Linear Models Linear Models Typically, control engineers begin by developing a mathematical description of the dynamical system that they want to control. This to-be-controlled system is called a plant. As an example of a plant, this section uses the DC motor. This section develops the differential equations that describe the electromechanical properties of a DC motor with an inertial load. It then shows you how to use the Control System Toolbox to build linear models based on these equations. Linear Model Representations The Control System Toolbox supports the following model representations: • State-space models (SS) of the form dx ------ = Ax + Bu dt y = Cx + Du where A, B, C, and D are matrices of appropriate dimensions, x is the state vector, and u and y are the input and output vectors. • Transfer functions (TF), for example, s+2 H ( s ) = --------------------------2 s + s + 10 • Zero-pole-gain (ZPK) models, for example, ( z + 1 + j ) ( z + 1 – j )H ( z ) = 3 -------------------------------------------------( z + 0.2 ) ( z + 0.1 ) • Frequency response data (FRD) models, which consist of sampled measurements of a system’s frequency response. For example, you can store experimentally collected frequency response data in an FRD model. Note The design of FRD models is a specialized subject that this guide does not address. See “Frequency Response Data (FRD) Models” under “Creating and Manipulating Models” in the online documentation for a discussion of this topic. 2-3 2 Building Models SISO Example: the DC Motor A simple model of a DC motor driving an inertial load shows the angular rate of the load, ω ( t ) , as the output and applied voltage, v app ( t ) , as the input. The ultimate goal of this example is to control the angular rate by varying the applied voltage. This picture shows a simple model of the DC motor. i(t) R + L vapp(t) + vemf(t) - - I Load L Inertial DC Motor Kfω(τ) Viscous friction Load J τ(t) Torque ω(t) Angular rate Figure 2-1: A Simple Model of a DC Motor Driving an Inertial Load In this model, the dynamics of the motor itself are idealized; for instance, the magnetic field is assumed to be constant. The resistance of the circuit is denoted by R and the self-inductance of the armature by L. If you are unfamiliar with the basics of DC motor modeling, consult any basic text on physical modeling. The important thing here is that with this simple model and basic laws of physics, it is possible to develop differential equations that describe the behavior of this electromechanical system. In this example, the relationships between electric potential and mechanical force are Faraday’s law of induction and Ampère’s law for the force on a conductor moving through a magnetic field. 2-4 Linear Models Mathematical Derivation The torque τ seen at the shaft of the motor is proportional to the current i induced by the applied voltage, τ ( t ) = Km i( t ) where Km, the armature constant, is related to physical properties of the motor, such as magnetic field strength, the number of turns of wire around the conductor coil, and so on. The back (induced) electromotive force, v emf , is a voltage proportional to the angular rate ω seen at the shaft, v emf ( t ) = K b ω ( t ) where Kb, the emf constant, also depends on certain physical properties of the motor. The mechanical part of the motor equations is derived using Newton’s law, which states that the inertial load J times the derivative of angular rate equals the sum of all the torques about the motor shaft. The result is this equation, dω J = τi = – Kf ω ( t ) + Km i ( t ) dt å where K f ω is a linear approximation for viscous friction. Finally, the electrical part of the motor equations can be described by v app ( t ) – v emf ( t ) = L di + Ri ( t ) dt or, solving for the applied voltage and substituting for the back emf, v app ( t ) = L di + Ri ( t ) + K b ω ( t ) dt This sequence of equations leads to a set of two differential equations that describe the behavior of the motor, the first for the induced current, Kb di R 1 = – ---- i ( t ) – ------- ω ( t ) + ---- v app ( t ) dt L L L 2-5 2 Building Models and the second for the resulting angular rate. 1 dω 1 = – --- K f ω ( t ) + --- K m i ( t ) J dt J State-Space Equations for the DC Motor Given the two differential equations derived in the last section, you can now develop a state-space representation of the DC motor as a dynamical system. The current i and the angular rate ω are the two states of the system. The applied voltage, v app , is the input to the system, and the angular velocity ω is the output. R Kb – ---- – ------1 d i L L ⋅ i + ---- ⋅ v = L app ( t ) dt ω Km Kf ω 0 -------- – -----J J y ( t ) = 0 1 ⋅ i + [ 0 ] ⋅ v app ( t ) ω Figure 2-2: State-Space Representation of the DC Motor Example Constructing SISO Models Once you have a set of differential equations that describe your plant, you can construct SISO models using simple commands in the Control System Toolbox. The following sections discuss: • Constructing a state-space model of the DC motor • Converting between model representations • Creating transfer function and zero/pole/gain models directly • LTI objects, the data containers for linear models 2-6 Linear Models Constructing a State-Space Model of the DC Motor Listed below are nominal values for the various parameters of a DC motor. R= L= Km Kb Kf J= 2.0 % Ohms 0.5 % Henrys = .015 % Torque constant = .015 % emf constant = 0.2 % Nms 0.02 % kg.m^2/s^2 Given these values, you can construct the numerical state-space representation using the ss function. A = [-R/L -Kb/L; Km/J -Kf/J] B = [1/L; 0]; C = [0 1]; D = [0]; sys_dc = ss(A,B,C,D) This is the output of the last command. a = x1 x2 x1 -4 0.75 x1 x2 u1 2 0 y1 x1 0 y1 u1 0 x2 -0.03 -10 b = c = x2 1 d = 2-7 2 Building Models Converting Between Model Representations Now that you have a state-space representation of the DC motor, you can convert to other model representations, including transfer function (TF) and zero/pole/gain (ZPK) models. Transfer Function Representation. You can use tf to convert from the state-space representation to the transfer function. For example, use this code to convert to the transfer function representation of the DC motor. sys_tf = tf(sys_dc) Transfer function: 1.5 -----------------s^2 + 14 s + 40.02 Zero/Pole/Gain Representation. Similarly, the zpk function converts from state-space or transfer function representations to the zero/pole/gain format. Use this code to convert from the state-space representation to the zero/pole/ gain form for the DC motor. sys_zpk = zpk(sys_dc) Zero/pole/gain: 1.5 ------------------(s+4.004) (s+9.996) Note The state-space representation is best suited for numerical computations. For highest accuracy, convert to state space prior to combining models and avoid the transfer function and zero/pole/gain representations, except for model specification and inspection. See “Reliable Computations” online for more information on numerical issues. 2-8 Linear Models Constructing Transfer Function and Zero/Pole/Gain Models In the DC motor example, the state-space approach produced a set of matrices that represents the model. If you choose a different approach, you can construct the corresponding models using tf, zpk, ss, or frd. sys sys sys sys = = = = tf(num,den) zpk(z,p,k) ss(a,b,c,d) frd(response,frequencies) % % % % Transfer function Zero/pole/gain State-space Frequency response data For example, if you want to create the transfer function of the DC motor directly, use these commands. s = tf('s'); sys_tf = 1.5/(s^2+14*s+40.02) The Control System Toolbox builds this transfer function. Transfer function: 1.5 -------------------s^2 + 14 s + 40.02 Alternatively, you can create the transfer function by specifying the numerator and denominator with this code. sys_tf = tf(1.5,[1 14 40.02]) Transfer function: 1.5 -----------------s^2 + 14 s + 40.02 To build the zero/pole/gain model, use this command. sys_zpk = zpk([],[-9.996 -4.004], 1.5) This is the resulting zero/pole/gain representation. Zero/pole/gain: 1.5 ------------------(s+9.996) (s+4.004) 2-9 2 Building Models Discrete Time Systems The Control Systems Toolbox provides full support for discrete time systems. You can create discrete systems in the same way that you create analog systems; the only difference is that you must specify a sample time period for any model you build. For example, sys_disc = tf(1, [1 1], .01); creates a SISO model in the transfer function format. Transfer function: 1 ----z + 1 Sampling time: 0.01 Adding Time Delays to Discrete-Time Models You can add time delays to discrete-time models by specifying an input or output time delay when building the model. The time delay must be a nonnegative integer that represents a multiple of the sampling time. For example, sys_delay = tf(1, [1 1], 0.01,'outputdelay',5); produces a system with an output delay of 0.05 second. Transfer function: 1 z^(-5) * ----z + 1 Sampling time: 0.01 For a complete description of time delays, see “Adding Time Delays to Models” online under the Control System Toolbox. 2-10 Linear Models Adding Delays to Linear Models You can add time delays to linear models by specifying an input or output delay when building a model. For example, to add an input delay to the DC motor, use this code. sys_tfdelay = tf(1.5, [1 14 40.02],'inputdelay',0.05) The Control System Toolbox constructs the DC motor transfer function, but adds a 0.05 second delay. Transfer function: 1.5 exp(-0.05*s) * -----------------s^2 + 14 s + 40.02 For a complete description of adding time delays to models, see “Time Delays” online under “Creating and Manipulating Models.” LTI Objects For convenience, the Control System Toolbox uses custom data structures called LTI objects to store model-related data. For example, the variable sys_dc created for the DC motor example is called an SS object. There are also TF, ZPK, and FRD objects for transfer function, zero/pole/gain, and frequency data response models respectively. The four LTI objects encapsulate the model data and enable you to manipulate linear systems as single entities rather than as collections of vectors or matrices. To see what LTI objects contain, use the get command. This code describes the contents of sys_dc from the DC motor example. get(sys_dc) a: b: c: d: e: StateName: Ts: ioDelay: InputDelay: OutputDelay: [2x2 double] [2x1 double] [0 1] 0 [] {2x1 cell} 0 0 0 0 2-11 2 Building Models InputName: OutputName: InputGroup: OutputGroup: Notes: UserData: {''} {''} {0x2 cell} {0x2 cell} {} [] You can manipulate the data contained in LTI objects using the set command; see the Control System Toolbox online reference pages for descriptions of set and get. For more information on LTI properties, type ltiprops at the MATLAB prompt. For a complete description of LTI objects, see “Creating and Manipulating Models” online under the Control System Toolbox. 2-12 MIMO Models MIMO Models You can use the same functions that apply to SISO systems to create multiple-input, multiple-output (MIMO) models, including arbitrary MIMO transfer functions and zero/pole/gain models. This section begins with an example of how to build a MIMO system. It then discusses how to build MIMO transfer functions by concatenating SISO transfer functions and how to access and manipulate individual SISO transfer functions contained in a MIMO model. MIMO Example: Jet Transport Aircraft This example shows how to build a MIMO model of a jet transport. Since the development of a physical model for a jet aircraft is lengthy, only the state-space equations are presented here. See any standard text in aviation for a more complete discussion of the physics behind aircraft flight. The jet model during cruise flight at MACH = 0.8 and H = 40,000 ft. is A = [-0.0558 0.5980 -3.0500 0 B = [ 0.0073 -0.4750 0.1530 0 C = [0 0 1 0 D = [0 0 0 0]; -0.9968 -0.1150 0.3880 0.0805 0.0802 -0.0318 -0.4650 1.0000 0.0415 0 0 0]; 0 0.0077 0.1430 0]; 0 0 0 1]; Use the following commands to specify this state-space model as an LTI object and attach names to the states, inputs, and outputs. states = {'beta' 'yaw' 'roll' 'phi'}; inputs = {'rudder' 'aileron'}; outputs = {'yaw rate' 'bank angle'}; 2-13 2 Building Models sys_mimo = ss(A,B,C,D,'statename',states,... 'inputname',inputs,... 'outputname',outputs); You can display the LTI model by typing sys_mimo. sys_mimo a = beta yaw roll phi beta -0.0558 0.598 -3.05 0 yaw -0.9968 -0.115 0.388 0.0805 beta yaw roll phi rudder 0.0073 -0.475 0.153 0 aileron 0 0.0077 0.143 0 yaw rate bank angle beta 0 0 yaw 1 0 rudder 0 0 aileron 0 0 roll 0.0802 -0.0318 -0.465 1 phi 0.0415 0 0 0 roll 0 0 phi 0 1 b = c = d = yaw rate bank angle Continuous-time model. The model has two inputs and two outputs. The units are radians for beta (sideslip angle) and phi (bank angle) and radians/sec for yaw (yaw rate) and roll (roll rate). The rudder and aileron deflections are in degrees. 2-14 MIMO Models As in the SISO case, use tf to derive the transfer function representation. tf(sys_mimo) Transfer function from input "rudder" to output... -0.475 s^3 - 0.2479 s^2 - 0.1187 s - 0.05633 yaw rate: --------------------------------------------------s^4 + 0.6358 s^3 + 0.9389 s^2 + 0.5116 s + 0.003674 0.1148 s^2 - 0.2004 s - 1.373 bank angle: --------------------------------------------------s^4 + 0.6358 s^3 + 0.9389 s^2 + 0.5116 s + 0.003674 Transfer function from input "aileron" to output... 0.0077 s^3 - 0.0005372 s^2 + 0.008688 s + 0.004523 yaw rate: --------------------------------------------------s^4 + 0.6358 s^3 + 0.9389 s^2 + 0.5116 s + 0.003674 0.1436 s^2 + 0.02737 s + 0.1104 bank angle: --------------------------------------------------s^4 + 0.6358 s^3 + 0.9389 s^2 + 0.5116 s + 0.003674 Constructing MIMO Transfer Functions MIMO transfer functions are two-dimensional arrays of elementary SISO transfer functions. There are two ways to specify MIMO transfer function models: • Concatenation of SISO transfer function models • Using tf with cell array arguments Concatenation of SISO models Consider the following single-input, two-output transfer function. s–1 -----------s+1 H(s ) = s+2 ---------------------------2 s + 4s + 5 You can specify H ( s ) by concatenation of its SISO entries. For instance, 2-15 2 Building Models h11 = tf([1 -1],[1 1]); h21 = tf([1 2],[1 4 5]); or, equivalently, s = tf('s') h11 = (s-1)/(s+1); h21 = (s+2)/(s^2+4*s+5); can be concatenated to form H ( s ). H = [h11; h21] This syntax mimics standard matrix concatenation and tends to be easier and more readable for MIMO systems with many inputs and/or outputs. See “Model Interconnection Functions” in “Creating and Manipulating Models” online for more details on concatenation operations for LTI systems. Using the tf Function with Cell Arrays Alternatively, to define MIMO transfer functions using tf, you need two cell arrays (say, N and D) to represent the sets of numerator and denominator polynomials, respectively. See the “Structures and Cell Arrays” in MATLAB’s online documentation for more details on cell arrays. For example, for the rational transfer matrix H ( s ) , the two cell arrays N and D should contain the row-vector representations of the polynomial entries of N(s) = s – 1 s+2 D(s) = s+1 s2 + 4s + 5 You can specify this MIMO transfer matrix H ( s ) by typing N = {[1 -1];[1 2]}; % Cell array for N(s) D = {[1 1];[1 4 5]}; % Cell array for D(s) H = tf(N,D) The Control System Toolbox responds with Transfer function from input to output... s - 1 #1: ----s + 1 2-16 MIMO Models #2: s + 2 ------------s^2 + 4 s + 5 Notice that both N and D have the same dimensions as H. For a general MIMO transfer matrix H ( s ), the cell array entries N{i,j} and D{i,j} should be row-vector representations of the numerator and denominator of H ij ( s ), the ijth entry of the transfer matrix H ( s ) . Accessing I/O Pairs in MIMO Systems Once you have defined a MIMO system, you can access and manipulate I/O pairs by specifying input and output pairs of the system. For instance, if sys_mimo is a MIMO system with two inputs and three outputs, sys_mimo(3,1) extracts the subsystem mapping the first input to the third output. Row indices select the outputs and column indices select the inputs. Similarly, sys_mimo(3,1) = tf(1,[1 0]) redefines the transfer function between the first input and third output as an integrator. 2-17 2 Building Models Arrays of Linear Models You can specify and manipulate collections of linear models as single entities using LTI arrays. For example, if you want to vary the Kb and Km parameters for the DC motor and store the resulting state-space models, use this code. K = [0.1 0.15 0.2]; % Several values for Km and Kb A1 = [-R/L -K(1)/L; K(1)/J -Kf/J]; A2 = [-R/L -K(2)/L; K(2)/J -Kf/J]; A3 = [-R/L -K(3)/L; K(3)/J -Kf/J]; sys_lti(:,:,1)= ss(A1,B,C,D); sys_lti(:,:,2)= ss(A2,B,C,D); sys_lti(:,:,3)= ss(A3,B,C,D); (Note that Kb and Km must be equal, so K represents both parameters in the state-space equations.) The number of inputs and outputs must be the same for all linear models encapsulated by the LTI array, but the model order (number of states) can vary from model to model within a single LTI array. The LTI array sys_lti contains the state-space models for each value of K. Type sys_lti to see the contents of the LTI array. Model sys_lti(:,:,1,1) ====================== a = x1 x2 x1 -4 5 x2 -0.2 -10 x1 -4 7.5 x2 -0.3 -10 . . . Model sys_lti(:,:,2,1) ====================== a = x1 x2 . . . 2-18 Arrays of Linear Models Model sys_lti(:,:,3,1) ====================== a = x1 x2 x1 -4 10 x2 -0.4 -10 . . . 3x1 array of continuous-time state-space models. You can manipulate the LTI array like any other object in the Control System Toolbox. For example, step(sys_lti) produces a plot containing step responses for all three state-space models. Figure 2-3: Step Responses for an LTI Array Containing Three Models 2-19 2 Building Models LTI arrays are useful for performing batch analysis on an entire set of models. For more information, see “Handling Multiple Models” online. 2-20 Model Characteristics Model Characteristics The Control System Toolbox contains commands to query model characteristics such as the I/O dimensions, poles, zeros, and DC gain. These commands apply to both continuous- and discrete-time model. Their LTI-based syntax is summarized in the table below. Table 2-1: Commands to Query Model Characteristics Command Description size(model_name) Number of inputs and outputs ndims(model_name) Number of dimensions isct(model_name) Returns 1 for continuous systems isdt(model_name) Returns 1 for discrete systems hasdelay(model_name) True if system has delays pole(model_name) System poles zero(model_name) System (transmission) zeros dcgain(model_name) DC gain norm(model_name) System norms (H2 and L∞) covar(model_name,W) Covariance of response to white noise 2-21 2 Building Models Interconnecting Linear Models You can perform simple operations on LTI models, such as addition, multiplication, or concatenation. Addition performs a parallel interconnection. For example, typing tf(1,[1 0]) + tf([1 1],[1 2]) % 1/s + (s+1)/(s+2) produces this transfer function. Transfer function s^2 + 2 s + 2 ------------s^2 + 2 s Multiplication performs a series interconnection. For example, typing 2 * tf(1,[1 0])*tf([1 1],[1 2]) % 2*1/s*(s+1)/(s+2) produces this cascaded transfer function. Transfer function: 2 s + 2 --------s^2 + 2 s If the operands are models of different types, the resulting model type is determined by precedence rules; see “Precedence Rules” under “Creating and Manipulating Models” online for more information. State-space models have highest precedence while transfer functions have lowest precedence. Hence the sum of a transfer function and a state-space model is always a state-space model. Other available operations include system inversion, transposition, and pertransposition; see “Arithmetic Operations” online under “Creating and Manipulating Models.” The Control System Toolbox also supports matrix-like indexing for extracting subsystems; see “Extracting and Modifying Subsystems” online for more information. 2-22 Interconnecting Linear Models You can also use the series and parallel functions as substitutes for multiplication and addition, respectively. Table 2-2: Equivalent Ways to Interconnect Systems Operator Function Resulting Transfer Function sys1 + sys2 parallel(sys1,sys2) Systems in parallel sys1 * sys2 series(sys2,sys1) Cascaded systems Feedback Interconnection You can use the feedback and lft functions to derive closed-loop models. For example, sys_f = feedback(tf(1,[1 0]), tf([1 1],[1 2]) computes the closed-loop transfer function from r to you for the feedback loop shown in Figure 2-4. The result is Transfer function: s + 2 ------------s^2 + 3 s + 1 This figure shows the interconnected system in block diagram format. r + Σ − 1-s y s+1 -----------s+2 Figure 2-4: Feedback Interconnection You can use the lft function to create more complicated feedback structures. This function constructs the linear fractional transformation of two systems. See the online reference page for more information. 2-23 2 Building Models Continuous/Discrete Conversions The commands c2d, d2c, and d2d perform continuous to discrete, discrete to continuous, and discrete to discrete (resampling) conversions, respectively. sysd = c2d(sysc,Ts) sysc = d2c(sysd) sysd1= d2d(sysd,Ts) % Discretization w/ sample period Ts % Equivalent continuous-time model % Resampling at the period Ts Various discretization/interpolation methods are available, including zero-order hold (default), first-order hold, Tustin approximation with or without prewarping, and matched zero-pole. For example, sysd = c2d(sysc,Ts,'foh') sysc = d2c(sysd,'tustin') % Uses first-order hold % Uses Tustin approximation Discrete DC Motor Model You can digitize the DC motor plant using the c2d function and selecting an appropriate sample time. Choosing the right sample time involves many factors, including the performance you want to achieve, the fastest time constant in your system, and the speed at which you expect your controller to run. For this example, choose a time constant of 0.01 second. See “SISO Example: the DC Motor” on page 2-4, for the construction of the SS object sys_dc. Ts=0.01; sysd=c2d(sys_dc,Ts) a = x1 x2 x1 0.96079 0.006994 x1 x2 u1 0.019605 7.1595e-005 b = 2-24 x2 -0.00027976 0.90484 Continuous/Discrete Conversions c = y1 x1 0 y1 u1 0 x2 1 d = Sampling time: 0.01 Discrete-time model. To see the discrete-time transfer function for the digital DC motor, use tf to convert the model. fd=tf(sysd) Transfer function: 7.16e-005 z + 6.833e-005 -----------------------z^2 - 1.866 z + 0.8694 Sampling time: 0.01 2-25 2 Building Models Model Order Reduction You can derive reduced-order models with the following commands. Model Order Reduction balreal Input/output balancing minreal Minimal realization (pole/zero cancellation) modred State deletion in I/O balanced realization sminreal Structurally minimal realization Use minreal to delete uncontrollable or unobservable state dynamics in state-space models, or cancel pole/zero pairs in transfer functions or zero-pole-gain models. Use sminreal to remove any states that are structurally decoupled from the inputs or outputs. For already minimal models, you can further reduce the model order using a combination of balreal and modred. Example: Gasifier Model This example presents a model of a gasifier, a device that converts solid materials into gases. The original model is nonlinear. To load a linearized version of the model, type load ltiexamples at the MATLAB prompt; the gasifier example is stored in the variable named gasf. If you type size(gasf) MATLAB responds with State-space model with 4 outputs, 6 inputs, and 25 states. Before attempting model order reduction, inspect the pole and zero locations by using pzmap(gasf) and then zooming in near the origin. If you don’t know how to use the zoom feature on plots, see “Zooming” on page 4-28 for an example. 2-26 Model Order Reduction This figure shows the results. Figure 2-5: Pole-Zero Map of the Gasifier Model (Zoomed In) Since the model displays near pole-zero cancellations, it’s a good candidate for model reduction. SISO Model Order Reduction As an illustration of the model order reduction tools, this example focuses on a single input/output pair of the gasifier, input #5 to output #3. sys35 = gasf(3,5); To enhance the numerical stability, first scale the system realization with ssbal. sys1 = ssbal(sys35); Then use minreal to eliminate uncontrollable or unobservable states. sys1 = minreal(sys1); size(sys1) 2-27 2 Building Models MATLAB responds with State-space model with 1 output, 1 input, and 15 states. The result is a 15th order system. Use this command bode(sys35,sys1); to compare the Bode magnitude and phase of the 25th order model to the reduced order model. This figure shows the result. Figure 2-6: Comparison of Full 25 State Model to the 15 State Reduced Order Models As the figure shows, there is very little difference in the responses. Finally, try eliminating states that are weakly affecting the I/O map by using the balreal and modred functions. First, attempt a balanced realization. [sys1,G] = balreal(sys1); Use format short e to view the Hankel singular values stored in variable G. 2-28 Model Order Reduction G = 4.5468e+003 2.6009e+003 1.8601e+003 2.5140e+002 1.5081e+002 1.1993e+001 1.1524e+001 1.0940e+001 2.8766e+000 1.3706e+000 3.5426e-001 2.2556e-002 1.2496e-002 1.0725e-002 6.2703e-005 Small Hankel singular values indicate that the associated states are weakly coupled. You can try discarding the last five states (associated with the five smallest Hankel singular values). sys2 = modred(sys1,11:15); size(sys2) % Down to 10 states MATLAB responds with State-space model with 1 output, 1 input, and 10 states. Type bode(sys35,sys2); to compare the magnitude and phase of the 10th order model to the 25th order model. 2-29 2 Building Models This figure shows the result. Figure 2-7: Comparison of 25 and 10 State Models The figure shows good agreement until the frequency reaches 5 rad/sec. This may be acceptable since gasifiers are often low bandwidth systems, and since the models still agree at smaller frequencies. Try experimenting with discarding more Hankel values. With each further reduction, the match to the 25th order model will continue to degrade. MIMO Model Order Reduction You can choose not to restrict yourself to individual input/output pairs. The following code does model order reduction on the full MIMO gasifier model. sys1 = ssbal(gasf) % Scaling % Compute the minimal realization and balance the model sys2 = minreal(sys1); % Down to 17 states [sys3,G] = balreal(sys2); 2-30 Model Order Reduction % Discard smallest entry of G by using modred sys3 = modred(sys3,17); % Down to 16 states After you get to 16 states, the reduced-order MIMO model begins to deteriorate when compared to the full 25 state MIMO model. Try reducing the model further to see which channels suffer the most degradation. The MathWorks would like to thank ALSTOM Power UK for kindly permitting us to use their gasifier model for this example. This model was issued as part of the ALSTOM Benchmark Challenge on Gasifier Control; for more details see Dixon, R., (1999), “Advanced Gasifier Control,” Computing & Control Engineering Journal, IEE, Vol. 10, No. 3, pp. 93-96. 2-31 2 Building Models 2-32 3 Analyzing Models Introduction . . . . . . . . . . . . . . . . . . . . 3-2 LTI Viewer . . . . . . . . . . . . . . Example: Time and Frequency Responses of the DC Motor . . . . . . . . . . Right-Click Menus . . . . . . . . . . . Displaying Response Characteristics on a Plot Changing Plot Type . . . . . . . . . . Showing Multiple Response Types . . . . . Comparing Multiple Models . . . . . . . . . . . . . . 3-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Functions for Time and Frequency Response Time and Frequency Responses . . . . . . . . Plotting MIMO Model Responses . . . . . . . Data Markers . . . . . . . . . . . . . . . Plotting and Comparing Multiple Systems . . . Creating Custom Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 . 3-18 . 3-20 . 3-23 . 3-24 . 3-27 Simulink LTI Viewer . . . . . . . Using the Simulink LTI Viewer . . . . Comparing Linear and Nonlinear Models Bode Plots of Linearized Models . . . Specifying Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . 3-30 . 3-30 . 3-31 . 3-38 . 3-43 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 3-6 3-8 3-11 3-13 3-14 3 Analyzing Models Introduction This chapter shows how you can analyze models using tools provided by the Control System Toolbox. It begins by introducing the LTI Viewer, a graphical user interface (GUI) that simplifies the analysis of linear, time-invariant systems. The chapter continues with a discussion of commands provided by the Control System Toolbox for plotting the time and frequency responses of linear models. This set of commands provides an open and extensible environment for the analysis of control systems. You can use these commands when you need more flexibility than the LTI Viewer provides. Finally, this chapter discusses the Simulink LTI Viewer, for use with Simulink. You can use this tool to linearize models or parts of models, analyze linearized models, and compare linear and nonlinear models. The LTI Viewer is a GUI for viewing and manipulating the response plots of linear models. You can display the following plot types for linear models using the LTI Viewer: • Step and impulse responses • Bode and Nyquist plots • Nichols plots • Singular values of the frequency response • Pole/zero plots • Response to a general input signal • Unforced response starting from given initial states (only for state-space models) Note that time responses and pole/zero plots are available only for transfer function, state-space, and zero/pole/gain models. 3-2 Introduction Note The LTI Viewer displays up to six different plot types simultaneously. You can also analyze the response plots of several linear models at once. However, all models must have the same input and output sizes. If your models have unequal input or output sizes, you must display them in different LTI Viewers. 3-3 3 Analyzing Models LTI Viewer This picture shows an LTI Viewer with two response plots. Use the File menu to import models and the Edit menu to delete existing ones. Right-click anywhere in a plot region to open a menu of options for that plot. Left-click directly on a curve for information about the curve at that particular point. Figure 3-1: The LTI Viewer with Step Response and Bode Plots The next section presents an example that shows you how to import a system into the LTI Viewer and how to customize the viewer to fit your requirements. Example: Time and Frequency Responses of the DC Motor The section entitled “SISO Example: the DC Motor” on page 2-4 presented a DC motor example. If you have not yet built that example, type load ltiexamples at the MATLAB prompt. This loads several LTI models, including a state-space representation of the DC motor called sys_dc. 3-4 LTI Viewer Opening the LTI Viewer To open the LTI Viewer, type ltiview This opens an LTI Viewer with an empty step response plot window by default. Importing Models into the LTI Viewer To import the DC motor model, select Import under the File menu. This opens the LTI Browser dialog box, which lists all the models available in your MATLAB workspace. Figure 3-2: The LTI Browser with the DC Motor Model Selected Select sys_dc from the list of available models and click OK to close the browser. This imports the DC motor model into the LTI Viewer. To select more than one model at a time, do the following: • To select individual (noncontiguous) models, select one model and hold down the Ctrl key while selecting additional models. To deselect any models, hold down the Ctrl key while you click on the highlighted model names. • To select a list of contiguous models, select the first model and hold down the Shift key while selecting the last model you want in the list. 3-5 3 Analyzing Models The picture below shows the LTI Viewer with a step response for the DC motor example. The steady-state value of the step response The status bar describes the last action you have taken. It also provides information about accessing LTI Viewer menu options. Figure 3-3: Step Response for the DC Motor Example in the LTI Viewer Alternatively, you can open the LTI Viewer and import the DC motor example directly from the MATLAB prompt. ltiview('step', sys_dc) See the ltiview reference page for a complete list of options. Right-Click Menus The LTI Viewer provides a set of controls and options that you can access by right-clicking your mouse. Once you have imported a model into the LTI Viewer, the options you can select include: • Plot Type — Change the plot type. Available types include step, impulse, Bode, Bode magnitude, Nichols, Nyquist, and sigma plots. • Systems — Select or deselect any models that you included when you created the response plot. 3-6 LTI Viewer • Characteristics — Add information about the plot. The characteristics available change from plot to plot. For example, Bode plots have stability margins available, but step responses have rise time and steady-state values available. • Zoom — Zoom in and out of plot regions. • Grid — Add grids to your plots. • Properties — Open the Property Editor. You can use this editor to customize various attributes of your plot. See “Setting Plot Properties a nd Preferences” in the Control System Toolbox online documentation for a full description of the Property Editor. Alternatively, you can open the Property Editor by double-clicking in an empty region of the response plot. 3-7 3 Analyzing Models Displaying Response Characteristics on a Plot For example, to see the rise time for the DC motor step response, right-click your mouse and select Rise Time under Characteristics, as this picture illustrates. Figure 3-4: Using Right-Click Menus to Display the Rise Time for a Step Response The rise time is defined as the amount of time it takes the step response to go from 10% to 90% of the steady-state value. 3-8 LTI Viewer The LTI Viewer calculates and displays the rise time for the step response. The dot marks the 90% value for the rise time. This line shows when the response reaches 10% of its steady-state value. This line shows when the response reaches 90% of its steady-state value. Figure 3-5: DC Motor Step Response with the Rise Time Displayed To display the values of any plot characteristic marked on a plot, place your mouse on the blue dot that marks the characteristic. This opens a data marker with the relevant information displayed. To make the marker persistent, left-click on the blue dot. 3-9 3 Analyzing Models For example, this picture shows the rise time value for the DC motor step response. Place your cursor over the blue dot to display a data marker with the system name and the 90% rise time value. Left-click on the blue dot to make the data marker persistent. Figure 3-6: Using Your Mouse to Get the Rise Time Values Note that you can left-click anywhere on a particular plot line to see the response values of that plot at that point. You must either place your cursor over the blue dot or left-click, however, if you want to see the rise time value. For more information about data markers, see “Data Markers” on page 3-23. 3-10 LTI Viewer Changing Plot Type You can view other plots using the right-click menus in the LTI Viewer. For example, if you want to see the open loop Bode plots for the DC motor model, select Plot Type and then Bode from the right-click menu. Figure 3-7: Changing the Step Response to a Bode Plot 3-11 3 Analyzing Models Selecting Bode changes the step response to a Bode plot for the DC motor model. Figure 3-8: Bode Plot for the DC Motor Model 3-12 LTI Viewer Showing Multiple Response Types If you want to see, for example, both a step response and a Bode plot at the same time, you have to reconfigure the LTI Viewer. To view different response types in a single LTI Viewer, select Plot Configurations under the Edit menu. This opens the Plot Configurations dialog box. Select Response type for each pane in the selected arrangement. Figure 3-9: Using the Plot Configurations Dialog Box to Reconfigure the LTI Viewer You can select up to six plots in one viewer. Choose the Response type for each plot area from the right-hand side menus from eight available plot types: • Step • Impulse • Bode (magnitude and phase) • Bode Magnitude (only) • Nyquist • Nichols • Sigma • Pole/zero 3-13 3 Analyzing Models Comparing Multiple Models This section shows you how to import and manipulate multiple models in one LTI Viewer. For example, if you have designed a set of compensators to control a system, you can compare the closed-loop step responses and Bode plots using the LTI Viewer. A sample set of closed-loop transfer function models is included (along with some other models) in the MAT-file ltiexamples.mat. Type load ltiexamples to load the provided transfer functions. The three closed-loop transfer function models, Gcl1, Gcl2, and Gcl3, are for a satellite attitude controller. In this example, you analyze the response plots of the Gcl1 and Gcl2 transfer functions. Initializing the LTI Viewer with Multiple Plots To load the two models Gcl1, and Gcl2 into the LTI Viewer, select Import under the File menu and select the desired models in the LTI Browser. See “Importing Models into the LTI Viewer” on page 3-5 for a description of how to select groups of models. If necessary, you can reconfigure the viewer to display both the step responses and Bode plots of the two systems using the Viewer Configuration dialog box. See “Showing Multiple Response Types” on page 3-13 for a discussion of this feature. Alternatively, you can open an LTI Viewer with both systems and both the step responses and Bode plots displayed. Type ltiview({'step';'bode'},Gcl1,Gcl2) to do this. 3-14 LTI Viewer Either approach opens the following LTI Viewer. Place your cursor on a curve to see which system it represents. The information displays in the status panel at the bottom of the LTI Viewer. Two response curves are plotted on each plot region. Figure 3-10: Multiple Response Plots in a Single LTI Viewer Inspecting Response Characteristics To mark the settling time on the step responses presented in this example, do the following: • Right-click anywhere in the plot region of the step response plots. This opens the right-click menu list in the plot region. • Place your mouse pointer on the Characteristics menu item, and select Settling Time with your left mouse button. To mark the stability margins of the Bode plot in this example, open the right-click menu and select Stability Margins (min) under the Characteristics menu item. 3-15 3 Analyzing Models Your LTI Viewer should now look like this. Place your cursor on the blue or green dots to see phase margin data. Figure 3-11: Multiple Plots with Response Characteristics Added The minimum stability margins, meaning the smallest magnitude phase and gain margins, display as green and blue markers on the Bode phase diagram. If you want to see all the gain and phase margins of a system, select Stability Margins (all) under the Characteristics menu item. 3-16 LTI Viewer Toggling Model Visibility If you have imported more than one model, you can select and deselect which models to plot in the LTI Viewer using right-click menus. For example, if you import the following three models into the viewer, you can choose to view any combination of the three you want. s=tf('s'); sys1=1/(s^2+s+1); sys2=1/(s^2+s+2); sys3=1/(s^2+s+3); This picture shows how to deselect the second of the three models using right-click menu options. Select/deselect the systems you want to add or remove from the LTI Viewer under Systems in the right-click menu. The menu lists only systems that you have imported into the LTI Viewer. Figure 3-12: Using Right-Click Menus to Select/Deselect Plotted Systems The Systems menu lists all the imported models. A system is selected if a check mark is visible to the left of the system name. 3-17 3 Analyzing Models Functions for Time and Frequency Response The Control System Toolbox provides the LTI Viewer, a GUI that is suitable for a wide range of applications. There are situations, however, where you may want a more open and extensible environment. The Control System Toolbox provides a set of functions that provide the basic time and frequency domain analysis plots used in control system engineering. These functions apply to any kind of linear model (continuous or discrete, SISO or MIMO, or arrays of models). You can only apply the frequency domain analysis functions to FRD models. Use the LTI Viewer when a GUI-driven environment is desirable. On the other hand, use functions when you want customized plots. If you want to include data unrelated to your models, you must use functions instead of the LTI Viewer (which only plots model data) The next sections discuss time and frequency response functions and how to use these functions to create customized plots of linear model responses. Time and Frequency Responses Time responses investigate the time-domain transient behavior of linear models for particular classes of inputs and disturbances. You can determine such system characteristics as rise time, settling time, overshoot, and steady-state error from the time response. The Control System Toolbox provides functions for step response, impulse response, initial condition response, and general linear simulations. For example, you can simulate the response to white noise inputs using lsim and the MATLAB function randn. In addition to time-domain analysis, the Control System Toolbox provides functions for frequency-domain analysis using the following standard plots: • Bode plots • Nichols plots • Nyquist plots • Singular value plots 3-18 Functions for Time and Frequency Response This table lists available time and frequency response functions and their use. Table 3-1: Functions for Frequency and Time Response Functions Description bode Bode plot evalfr Computes the frequency response at a single complex frequency (not for FRD models) freqresp Computes the frequency response for a set of frequencies gensig Input signal generator (for lsim) impulse Impulse response plot initial Initial condition response plot lsim Simulation of response to arbitrary inputs margin Computes and plots gain and phase margins nichols Nichols plot nyquist Nyquist plot pzmap Pole-zero map step Step response plot These functions can be applied to single linear models or LTI arrays. The functions step, impulse, and initial automatically generate an appropriate simulation horizon for the time response plots. Their syntax is step(model_name) impulse(model_name) initial(model_name,x0) % x0 = initial state vector where model_name is any continuous or discrete LTI model or LTI array. Frequency-domain plots automatically generate an appropriate frequency range as well. 3-19 3 Analyzing Models Plotting MIMO Model Responses For MIMO models, time and frequency response functions produce an array of plots with one plot per I/O channel (or per output for initial and lsim). For example, h = [tf(10,[1 2 10]) , tf(1,[1 1])] step(h) produces the following plot. Figure 3-13: Step Responses for a MIMO Model The simulation horizon is automatically determined based on the model dynamics. You can override this automatic mode by specifying a final time, step(h,10) % Simulates from 0 to 10 seconds or a vector of evenly spaced time samples. t = 0:0.01:10 step(h,t) 3-20 % Time samples spaced every 0.01 second Functions for Time and Frequency Response Right-Click Menus All the time and frequency response functions provide right-click menus that allow you to customize your plots. This picture shows the plots from Figure 3-13, Step Responses for a MIMO Model, on page 3-20, with the right-click menu open. Figure 3-14: Using the Right-Click Menu in a Step Response Plot The options you can select include: • Systems — Select or deselect any models that you included when you created the response plot. • Characteristics — Add information about the plot. The characteristics available change from plot to plot. For example, Bode plots have stability margins available, but step responses have rise time and steady-state values available. 3-21 3 Analyzing Models • Axes Grouping — Change the grouping of your plots. Available options are All, None, Inputs, and Outputs. You can group all the plots together, place each in a separate plot region (none), or group the inputs or outputs together. • I/O Selector — Open the I/O Selector Window. Use this window to select/deselect which inputs and outputs to plot. • Zoom — Zoom in and out of plot regions. • Grid — Add grids to your plots. • Properties — Open the Property Editor, which you can use to customize various attributes of your plot. See “Customization” in the Control System Toolbox online documentation for a full description of the Property Editor. Alternatively, you can open the Property Editor by double-clicking in an empty region of the response plot. 3-22 Functions for Time and Frequency Response Data Markers In addition to right-click menus, the Control System Toolbox provides plot data markers. These allow you to identify key data points on your plots. This figure, using the same plot as Figure 3-13, shows markers on the plots. Place your cursor on an active characteristic, shown as a blue dot here, to see its name and numerical value. Left-click anywhere on a plot to see the system name, I/O labels, time, and value at that point. Figure 3-15: Using Plot Markers to Identify Data Points You can move a data marker by: • Grabbing the black located at the corner of the marker • Dragging the marker with your mouse The time and amplitude values will change as you move the marker. This does not apply to markers that display plot characteristics (e.g., peak value or rise time). In the case of plot characteristic data markers, you can view them by placing your cursor over the dot that represents the active characteristic. To make the data marker persistent, left-click on the marker. 3-23 3 Analyzing Models Note Data markers do not apply to the SISO Design Tool, which displays data about plot characteristics in the status panel at the bottom of the SISO Design Tool window. Right-Click Menus Right-click on any data marker to open a property menu for the marker. Property options for the marker include: • Font Size — Change the font size. • Alignment — Change the position of the marker. Available options are top-right, top-left, bottom-right, and bottom-left. • Interpolation — By default, data markers linearly interpolate between points along the plotted curve. Select None to force the markers to snap to nearest points along the plotted curve. • Raise — If two markers overlap, raise brings the selected marker to the front. • Delete — Delete the selected marker. Alternatively, left-click anywhere in the empty plot region to delete all markers in the plot. Plotting and Comparing Multiple Systems You can use the command line response-plotting functions to plot the response of continuous and discrete linear models on a single plot. To do so, invoke the corresponding command line function using the list sys1,..., sysN of models as the inputs. step(sys1,sys2,...,sysN) impulse(sys1,sys2,...,sysN) 3-24 Functions for Time and Frequency Response ... bode(sys1,sys2,...,sysN) nichols(sys1,sys2,...,sysN) ... All models in the argument lists of any of the response plotting functions (except for sigma) must have the same number of inputs and outputs. To differentiate the plots easily, you can also specify a distinctive color/linestyle/ marker for each system just as you would with the plot command. For example, bode(sys1,'r',sys2,'y--',sys3,'gx') plots sys1 with solid red lines, sys2 with yellow dashed lines, and sys3 with green x markers. You can plot responses of multiple models on the same plot. These models do not need to be all continuous-time or all discrete-time. Example: Comparing Continuous and Discretized Systems The following example compares a continuous model with its zero-order-hold discretization. sysc = tf(1000,[1 10 1000]) sysd = c2d(sysc,0.2) % ZOH sampled at 0.2 second step(sysc,'--',sysd,'-') % Compare step responses 3-25 3 Analyzing Models These commands produce the plot shown below. Figure 3-16: Comparison of a Continuous Model to Its Discretized Version Use this command to compare the Bode plots of the two systems. bode(sysc,'--',sysd,'-') 3-26 % Compare Bode responses Functions for Time and Frequency Response The Control System Toolbox creates this plot. Figure 3-17: Comparison of Bode Plots for a Continuous Model and Its Discretized Version A comparison of the continuous and discretized responses reveals a drastic undersampling of the continuous-time system. Specifically, there are hidden oscillations in the discretized time response and aliasing conceals the continuous-time resonance near 300 rad/sec. Creating Custom Plots Time and frequency response commands are useful for creating custom plots. You can mix model response plots with other data views using response commands together with plot, subplot, and hold. Example: Custom Plots For example, the following sequence of commands displays the Bode plot, step response, pole/zero map, and some additional data in a single figure window. 3-27 3 Analyzing Models h = tf([4 8.4 30.8 60],[1 4.12 17.4 30.8 60]); subplot(221) bode(h) subplot(222) step(h) subplot(223) pzmap(h) subplot(224) plot(rand(1, 100)) % Any data can go here title('Some noise') Your plot should look similar to this illustration. Figure 3-18: Example of Model and Nonmodel Data Plotted in One Window For information about plot, subplot, hold, and other options for plotting general data, see “Basic Plotting Commands” and the individual entries for functions in the “MATLAB Function Reference.” These documents are available in MATLAB’s online help. 3-28 Functions for Time and Frequency Response Note Each of the plots generated by response analysis functions in Figure 3-18 (bode, step, and pzmap) has its own right-click menu (similar to those in the LTI Viewer). To activate the right-click menus, place your mouse in the plot region and right-click. The menu contents depend on what type of plot you have selected. 3-29 3 Analyzing Models Simulink LTI Viewer If you have Simulink, you can use the Simulink LTI Viewer, a version of the LTI Viewer that performs linear analysis on any portion of a Simulink model. The Simulink LTI Viewer features: • Drag-and-drop blocks that identify the location for the inputs and outputs of the portion of a Simulink model you want to analyze. • The ability to specify the operating conditions about which the Simulink model is linearized for analysis in the LTI Viewer. • Access to all time and frequency response analysis tools featured in the LTI Viewer. • The ability to compare a set of (linearized) models obtained by varying either the operating conditions or some model parameter values. Using the Simulink LTI Viewer To learn about the Simulink LTI Viewer, this section presents an example that shows you how to linearize a portion of the Simulink model for an F14 jet aircraft. To open the F14 jet aircraft model, type f14 at the MATLAB prompt. 3-30 Simulink LTI Viewer This opens the following diagram. Figure 3-19: Nonlinear Model of F14 Aircraft Pitch Axis This Simulink model, f14, contains static nonlinearities. You can use the Simulink LTI Viewer to analyze linearized versions of this model. Comparing Linear and Nonlinear Models Suppose you want to compare the linearized step response between the Stick Input to the Pitch Rate, q, to the step response of the original nonlinear model. The basic procedure for carrying out this type of analysis is outlined in the remaining sections of this chapter, which present the F14 example in detail. 3-31 3 Analyzing Models Opening the Simulink LTI Viewer To open a Simulink LTI Viewer linked to the f14 Simulink model: 1 Go to the Tools menu on the Simulink model 2 Select Linear Analysis When you select Linear Analysis, two new windows open, an empty Simulink LTI Viewer window and a Simulink diagram called Model_Inputs_and_Outputs, which contains Input Point and Output Point blocks. This figure shows how to open the Model_Inputs_and_Outputs diagram. Select Linear Analysis from the Simulink model Tools menu to open the Simulink LTI Viewer and the Model_ Inputs_and_Outputs window. This set of Simulink blocks opens when you select Linear Analysis . Use these blocks to specify the inputs and outputs of the portion of the Simulink model you want to analyze. Your Tools menu may differ from this one, depending on which MathWorks products you have installed. Figure 3-20: Opening the Model_Inputs_and_Outputs Dialog Box from Simulink The next section shows how you can select inputs and outputs for the linearized model. 3-32 Simulink LTI Viewer Specifying the Simulink Model Portion for Analysis To specify the portion of the Simulink model you want to analyze, mark its input and output signals on the Simulink model using the Input Point and Output Point blocks in the Model_Inputs_and_Outputs window. This defines an input/output relationship that is linearized and analyzed by the LTI Viewer. This to-be-linearized portion of your model is called the analysis model. To designate the input and output signals of your analysis model, insert Input Point and Output Point blocks on the corresponding signal lines in your Simulink diagram. To set up the analysis model for the f14 Simulink model: 1 Insert an Input Point block on the line going to the Stick Input. 2 Insert an Output Point block on the line labeled q (the pitch rate). 3-33 3 Analyzing Models This picture illustrates the procedure for adding linearization input and output points to the f14 model. . Select an Input Point block, drag it, and release it on the Simulink model. Place it on the Stick Input line. This point will be the input to the linearized model. Select an Output Point block and place it in the F14 model on the q (pitch rate) line. Figure 3-21: Selecting Input and Output Points for the Linearized Portion of the F14 Model 3-34 Simulink LTI Viewer Keep the following in mind when using the Input Point and Output Point blocks to specify analysis models: • You can place the Input Point and Output Point blocks on any scalar or vector signal line in the Simulink model, with the exception of signal lines connected to any block in the Power System Blockset. • You can insert Input Point and Output Point blocks at different levels of a Simulink model hierarchy. • There is no limit on the number of these blocks you can use. If you have multiple input and/or output points in your model, you can find each I/O system listed under the Systems menu available by right-clicking in the plot region. Default Operating Conditions The operating conditions are the values of the state and input vectors about which the linearization of the analysis model occurs. Initial conditions are the values of the state and input vectors at time t=0. By default, Simulink sets the initial conditions to zero; for more information on setting initial conditions in Simulink, see the Using Simulink manual. The Simulink LTI Viewer by default assumes that the operating conditions are the initial conditions set in Simulink for the model. This is the case in the F14 example, where the initial and operating conditions are set to zero. You can, however, select any operating conditions you require; see “Specifying Operating Conditions” on page 3-43 for more information. Performing Linear Analysis Once you have specified your analysis model, and (optionally) set the operating conditions, you are ready to analyze it with the Simulink LTI Viewer. 3-35 3 Analyzing Models To perform the linearization and import your linearized f14 model into the LTI Viewer, select Get Linearized Model on the Simulink menu on the LTI Viewer. This produces the following response plot. The Simulink LTI Viewer displays the selected response plot for the linearized model. The default plot type is a step response. Figure 3-22: Step Response from Stick Input to Pitch Rate for the Linearized F14 Model Each time you select Get Linearized Model in the LTI Viewer’s Simulink menu, the LTI Viewer relinearizes the model and adds the new analysis model to the list of models available to the viewer. The Simulink LTI Viewer maintains a history of the linearized models, which is useful for comparing models when varying parameters. You can view the linearized models in the LTI Viewer or change the plot type using the right-click menus. Comparing the Step Response of the Linear and Nonlinear F14 Models To compare the linear and nonlinear step responses, you must generate a step response for the original (nonlinear) f14 model. 3-36 Simulink LTI Viewer To do this, follow these steps: 1 Replace the Signal Generator block with a Step block. Set the Step time to 0 in this block. 2 Add a Scope block to the line labeled q (pitch rate) in the diagram. 3 Set the Stop time in the Parameters dialog box to 3 seconds. 4 Run the model. The output to the Pitch Rate Scope block is on the left side of this picture. Figure 3-23: Comparison of Step Responses from Stick Input to Pitch Rate for the Nonlinear and Linear F14 Models, Respectively As these two graphs demonstrate, the agreement between the linear and nonlinear models is quite good. 3-37 3 Analyzing Models Bode Plots of Linearized Models You can use the Simulink LTI Viewer to compare Bode plots for various controllers. For example, you can change the gain Ki in the F14 controller shown below and compare the Bode magnitudes. Figure 3-24: F14 Controller 3-38 Simulink LTI Viewer Open-Loop Bode Response for the F14 Model To specify open-loop analysis models, you must understand how Simulink performs linearization on the model. Placing the Input Point and Output Point blocks on your Simulink model does not break any connection or isolate any component. For example, consider the following simple diagram. Delete this line to isolate the plant, P, for open loop analysis. Based on the location of the Input Point and Output Point blocks, you might think that the analysis model specified by these blocks is simply the plant model, P. However, due to the feedback loop, this analysis model is actually the closed-loop transfer function P ⁄ ( 1 + PK ) . If you want to analyze the (open-loop) plant P instead, you need to open the loop, for example, by deleting the line between the Sum and Input Point blocks. By default, the Simulink LTI Viewer performs closed-loop analysis whenever your diagram contains feedback loops between your Input and Output Point blocks. If you want an open loop Bode response plot, you must open the feedback path somewhere in the model by removing feedback lines. 3-39 3 Analyzing Models In the F14 example, one way to create an open-loop model is to delete the feedback lines from pitch rate, q, and angle of attack, Alpha, back to the F14 controller. This picture shows the f14 model with the feedback paths deleted. This picture shows the deletion of the alpha and q feedback loops to create an open-loop analysis model. Compare this to Figure 3-19, Nonlinear Model of F14 Aircraft Pitch Axis, on page 3-31. Figure 3-25: F14 Model with the Pitch Rate, q, and Angle of Attack, Alpha, Feedback Paths Removed Once you have removed the feedback paths, you can proceed with open-loop analysis of your linearized model. Comparing Bode Magnitudes in the Simulink LTI Viewer The Simulink LTI Viewer maintains a history of plots, so you can vary Ki in the controller and compare the changes in the Bode response. Each time you change Ki, select Get Linearized Model under the Simulink menu and the 3-40 Simulink LTI Viewer viewer will plot the new results. This picture shows the open-loop Bode magnitude for three values of Ki. K1= -20.0 K1=-3.8640 K1=-10.0 Figure 3-26: Open-Loop Bode Magnitudes for Three Values of K1 This example compares Bode magnitudes for several values of a parameter. You can, however, alter other elements of your analysis model for comparison. These elements include: • Any of the analysis model parameters • The operating conditions • The location of any of the Input Point or Output Point blocks 3-41 3 Analyzing Models Saving Analysis Models The analysis models obtained each time you select Get Linearized Model are stored only in the Simulink LTI Viewer workspace. You can save these models into the main MATLAB workspace by selecting Export from the Simulink LTI Viewer File menu. Selecting Export opens the window shown below. Stores the selected analysis model in a MAT-file. Stores the selected analysis model in the MATLAB workspace. Lists all the analysis models currently in the Simulink LTI Viewer workspace. Figure 3-27: Exporting Analysis Models From the LTI Viewer Workspace If you save models to a MAT-file, MATLAB prompts you to name the file. The variable names contained in that file are the same as those you selected from the Export List. The variable names of each model you save to the MATLAB workspace are also the same as those listed in the Export List. It’s up to you to modify the names of these variables after you’ve saved them. Removing Input Points and Output Points There are two ways you can remove Input Point or Output Point blocks from the Simulink model: 1 One by one: Select the Input Point or Output Point block you want to remove and delete it as you would any other Simulink block. 2 All at once: To remove all Input Point and Output Point blocks, select Remove Input/Output Points from the Simulink menu in the LTI Viewer. When you delete an Input Point or an Output Point block, the signal lines coming into and out of this block are automatically reconnected. 3-42 Simulink LTI Viewer Specifying Operating Conditions If you have nonlinear components in your Simulink model, the Simulink LTI Viewer automatically linearizes them when you select Get Linearized Model. The Simulink LTI Viewer uses the initial state values you set in the Simulink diagram as default settings for linearization points for the states in the diagram. You also have the option to linearize about the operating conditions of your choice. If you want your analysis model to be linearized about a zero state, or other state and input operating conditions, you must specify the desired operating points in the Operating Point dialog box before selecting Get Linearized Model. To open the Operating Point dialog box, select Set Operating Point in the Simulink menu. This picture shows the open Operating Point dialog box. Uses initial conditions for the states from the Simulink diagram. This is the default setting. Sets the state values to zero for each linearization. Sets the states to values specified in the Value fields. If you select this option, specify the state values in the Value field. Each state has its own field. Figure 3-28: The Operating Point Dialog Box for Changing Linearization Points 3-43 3 Analyzing Models To change the default operating point behavior, follow these steps: 1 Change the radio button selection (under Linearize about:) from the default to either: - Set all state values for the linearization to zero - Define your own state values for the linearization 2 Use the fields under Value to specify the operating conditions for each input (and state) listed in the Operating Point window. You do not have to specify the states if you choose the Zero state values radio button. Once you have selected new operating conditions, press OK. This action opens a new dialog box, which is pictured below. Select Yes to finish the process. Note the following: • The inputs listed on the Operating Point window correspond to the Inport blocks on the top level of your Simulink model. • All states and inputs in the Simulink diagram are listed in the Operating Point window, not just those associated with your analysis model. • If you want to change the operating conditions, you need only change those values associated with your analysis model. • While the Operating Point window is in the User-defined initial state values mode, the values listed in the window remain in effect throughout your Simulink LTI Viewer session unless you change these. • While the Operating Point window is in the Initial state in Simulink diagram mode, the linearization values used by the Simulink LTI Viewer are updated as you change any state values in your Simulink diagram. 3-44 Simulink LTI Viewer • To change the initial state values of your Simulink diagram: a Select Parameters under the Simulation menu on your Simulink diagram. b Choose the Workspace I/O tab in the Simulation Parameters window. c Load initial states from the MATLAB workspace using the appropriate field. 3-45 3 Analyzing Models 3-46 4 Designing Compensators Introduction . . . . . . . . . . . . . . . . . . . . 4-2 The SISO Design Tool . . . . . . . . . Opening the SISO Design Tool . . . . . . Importing Models into the SISO Design Tool Feedback Structure . . . . . . . . . . . Loop Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bode Diagram Design . . . . . . Example: DC Motor . . . . . . . Adjusting the Compensator Gain . . Right-Click Menus . . . . . . . . Adjusting the Bandwidth . . . . . Adding an Integrator . . . . . . . Adding a Lead Network . . . . . . Moving Compensator Poles and Zeros Changing Units on a Plot . . . . . Adding a Notch Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 . 4-8 . 4-8 . 4-9 . 4-9 . 4-12 . 4-14 . 4-17 . 4-19 . 4-20 Root Locus Design . . . . . . . . . . Example: Electrohydraulic Servomechanism Changing the Compensator Gain . . . . . Adding Poles and Zeros to the Compensator . Editing Compensator Pole and Zero Locations Exporting the Compensator and Models . . Storing and Retrieving Intermediate Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24 . 4-25 . 4-30 . 4-31 . 4-36 . 4-39 . 4-40 Functions For Compensator Design . . Root Locus Design . . . . . . . . . . . Pole Placement . . . . . . . . . . . . Linear-Quadratic-Gaussian (LQG) Design . Example: LQG Design . . . . . . . . . Example: LQG Design for Set Point Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 4-3 4-5 4-6 4-7 4-42 4-42 4-42 4-46 4-51 4-55 4 Designing Compensators Introduction This chapter discusses how to build compensators using functions from the Control System Toolbox. It begins with a description of the SISO Design Tool, a graphical user interface (GUI) that simplifies the task of designing controllers. Through two design examples, a DC motor and an electrohydraulic servomechanism, this chapter shows you how to use the SISO Design Tool to design compensators by root locus and Bode diagram design techniques, and how to analyze the resulting designs. If you need to develop custom applications, or must perform MIMO (multiple input multiple output) design, the Control System Toolbox provides a set of commands that implement a variety of design algorithms, including root locus design, pole placement, and linear quadratic Gaussian (LQG) design. 4-2 The SISO Design Tool The SISO Design Tool The SISO Design Tool is a graphical user interface (GUI) that facilitates the design of compensators for single-input, single-output feedback loops. The SISO Design Tool allows you to iterate rapidly on your designs and perform the following tasks: • Manipulate closed-loop dynamics using root locus techniques • Shape open-loop Bode responses • Add compensator poles and zeros • Add and tune lead/lag networks and notch filters • Inspect closed-loop responses (using the LTI Viewer) • Adjust phase and gain margins • Convert models between discrete and continuous time Opening the SISO Design Tool This section shows how to open the SISO Design Tool with the DC motor example developed in Chapter 2, “Building Models,” imported. If you have not built the DC motor model, type load ltiexamples at the MATLAB prompt. This loads a collection of linear models, including the DC motor. To open the SISO Design Tool and import the DC motor, type sisotool(sys_dc) at the MATLAB prompt. 4-3 4 Designing Compensators This command opens the SISO Design Tool with the root locus and open loop Bode diagrams for the DC motor plotted by default. Click in the Current Compensator panel to edit the compensator. The feedback structure for design. Use the FS button to toggle between feedback structures. Right-click in any of these regions to see design and display options for the SISO Design Tool. Note that the Root Locus and Open-loop Bode Diagrams have different sets of options. This panel displays useful tips about how to use the SISO Design Tool and information about the status of your design. Figure 4-1: SISO Design Tool with the DC Motor Example The SISO Design Tool displays: • Poles as x’s • Zeros as o’s • Gain and phase margins (by default) in the lower left-hand corners of the Bode magnitude and phase plots 4-4 The SISO Design Tool Importing Models into the SISO Design Tool If you type sisotool at the MATLAB prompt, an empty SISO Design Tool opens. You can import the DC motor model by selecting Import Model under the File menu. This opens the Import System Data dialog box, which is shown below. Place the DC motor model ( sys_dc) in the field marked G (Plant). Figure 4-2: Importing the DC Motor Model into the SISO Design Tool Follow these steps to import the DC motor model: 1 Select sys_dc under SISO Models 2 Place it into the G field under Design Model by pressing the right arrow button to the left of G 3 Press OK 4-5 4 Designing Compensators Feedback Structure The SISO Design Tool by default assumes that the compensator is in the forward path, i.e., that the feedback structure looks like this picture. Figure 4-3: The Default Feedback Structure — Compensator in the Forward Path In this picture, the lettered boxes represent the following: • G — plant • H — sensor dynamics • F — prefilter • C — compensator The default values for F, H, and C are all 1. Note that this means that by default, the compensator has unity gain. G contains the DC motor model, sys_dc. Alternative Feedback Structure Clicking the FS button toggles between the default feedback structure and a feedback structure that places the compensator in the feedback path. This picture shows the alternate feedback stucture. Figure 4-4: Alternate Feedback Structure with the Compensator in the Feedback Loop 4-6 The SISO Design Tool Loop Responses As you iterate on a compensator design, you may find it convenient to be able to examine the various loop responses (for example, step or impulse responses). To view, for example, the closed-loop step response, select Plant Output (Step) under Loop Responses from the Tools menu. This opens an LTI Viewer with the closed-loop step response of the DC motor. For instructions on how to operate the LTI Viewer, see “LTI Viewer” on page 3-4. This figure shows the resulting plot. Figure 4-5: LTI Viewer Showing the Step Response for the DC Motor As this plot shows, the step response of the DC motor is about 1.5 seconds, which is too slow for many applications. Also, there is a large steady-state error. The following sections show how to use Bode diagram techniques for improving the response time and steady-state error of the DC motor step response. As you iterate on a design, the LTI Viewer associated with your SISO Design Tool will automatically update the response plots you have chosen. 4-7 4 Designing Compensators Bode Diagram Design One technique for compensator design is to work with Bode diagrams of the open-loop response (loop shaping). Using Bode diagrams, you can design to gain and phase margin specifications, adjust the bandwidth, and add notch filters for disturbance rejection. Example: DC Motor The following sections use the DC motor example to show how create a compensator using Bode diagram design techniques. From “SISO Example: the DC Motor” on page 2-4, the transfer function of the DC motor is Transfer function: 1.5 -----------------s^2 + 14 s + 40.02 For this example, the design criteria are as follows: • Rise time of less than 0.5 second • Steady-state error of less than 5% • Overshoot of less than 10% • Gain margin greater than 20 dB • Phase margin greater than 40 degrees Adjusting the Compensator Gain Figure 4-5 on page 4-7 shows that the closed-loop step response is too slow. The simplest approach to speeding up the response is to increase the gain of the compensator. To increase the gain: 1 Move the mouse pointer over the Bode magnitude line. Notice how the pointer becomes a hand. 2 Grab the Bode magnitude line by holding down the left mouse button when the hand appears. 4-8 Bode Diagram Design 3 Drag the Bode plot line upward. 4 Release the mouse button. The gain and poles changes as the closed-loop set point is recomputed. The SISO Design Tool calculates the compensator gain, and the value appears in the C(s) text box on the GUI. Alternatively, you can set the gain by entering the desired value in the C(s) field in the Current Compensator panel. Right-Click Menus The SISO Design Tool has right-click menus available in any of the plot regions. The menus are customized for each plot type; open the Bode magnitude menu by right-clicking your mouse in the white space of the Bode magnitude plot. This menu appears. Figure 4-6: Right-Click Menu for the Bode Magnitude Plot The right-click menus contain numerous features. The DC motor example makes use of many of the available features; for a complete discussion of the right-click menus, see the online help for the SISO Design Tool in “Tool and Viewer Reference.” Adjusting the Bandwidth Since the design requirements include a 0.5 second rise time, try setting the gain so that the DC crossover frequency is about 3 rad/sec. The rationale for setting the bandwidth to 3 rad/sec is that, to a first-order approximation, this should correspond to about a 0.33 second time constant. To make the crossover easier to see, select Grid from the right-click menu. This creates a grid for the Bode magnitude plot. Left-click on the Bode magnitude 4-9 4 Designing Compensators plot and drag the curve until you see the curve crossing over the 0 dB line (on the y axis) at 3 rad/sec. This changes both the SISO Design Tool display and the LTI Viewer step response. This figure shows the SISO Design Tool. Use the hand to move the Bode magnitude plot up or down. The SISO Design Tool recalculates the compensator gain as you move the hand. Increasing the Compensator gain changed the phase margin from infinity to 120°. The SISO Design Tool adds a brown stem to show the new phase margin. Figure 4-7: Root Locus and Bode Plots for the DC Motor For a crossover at 3 dB, the compensator gain should be about 38. By default, the SISO Design Tool displays gain and phase margin information in the lower left-hand corners of the Bode diagrams. In the Bode magnitude plot, it also tells you if your closed-loop system is stable or unstable. 4-10 Bode Diagram Design This plot shows the associated closed-loop step response in the LTI Viewer. Figure 4-8: Closed-Loop Step Response for the DC Motor with a Compensator Gain = 38 The step response shows that the steady-state error and rise time have improved somewhat, but you must design a more sophisticated controller to meet all the design specifications, in particular, the steady-state error requirement. 4-11 4 Designing Compensators Adding an Integrator One way to eliminate steady-state error is to add an integrator. To do this, select Add and then Integrator from the right-click menu. This figure shows the process. Figure 4-9: Using the Right-Click Menu to Add an Integrator Notice adding the integrator changed the crossover frequency of the system. Readjust the compensator gain to bring the crossover back to 3 dB; the gain should be about 100. 4-12 Bode Diagram Design Once you have added the integrator and readjusted the compensator gain, the SISO Design Tool shows a red ‘x’ at the origin of the root locus plot. Adding an integrator changed the gain margin from infinity to 11.5 dB. The SISO Design Tool displays the gain margin as a brown stem. Figure 4-10: The SISO Design Tool Displays the Integrator on the Root Locus Plot 4-13 4 Designing Compensators This figure shows the closed-loop step response. Use the right-click menu to display the Peak Response and Rise Time (listed under Characteristics). Figure 4-11: The Step Response for the DC Motor with an Integrator in the Compensator The step response is settling around 1, which satisfies the steady-state error requirement. This is because the integrator forces the system to zero steady-state error. The figure shows, however, that the peak response is 1.3, or about 30% overshoot, and that the rise time is roughly 0.4 second. So a compensator consisting of an integrator and a gain is not enough to satisfy the design requirements, which require that the overshoot be less than 10%. Adding a Lead Network Part of the design requirements is a gain margin of 20 dB or greater and a phase margin of 40° or more. In the current compensator design, the gain margin is 11.5 dB and the phase margin is 38.1°, both of which fail to meet the design requirements. So two goals left are to shorten the rise time while improving the stability margins. One approach is to increase the gain to speed up the response, but the system is already underdamped, and increasing the gain will decrease the stability margin as well. You might try experimenting 4-14 Bode Diagram Design with the compensator gain to verify this. The only option left is to add dynamics to the compensator. One possible solution is to add a lead network to the compensator. To make this easier to do on the diagram, zoom in on the x-axis. First, select Zoom In-X from the right-click menu; then select a region of the Bode magnitude plot by left-clicking and dragging your mouse. The range from 1 to about 50 rad/sec is good. This picture shows the process. The SISO Design Tool will zoom in on this region of the x-axis when you release your mouse. Figure 4-12: Zooming in on the X-Axis of the Bode Plots 4-15 4 Designing Compensators To add the lead network, choose Add and then Lead in the right-click menu for the Open-Loop Bode diagram. This figure shows the process of adding a lead network to your controller. Place the lead about here (to the right of the rightmost pole in the diagram). Figure 4-13: Adding a Lead Network to the DC Motor Compensator Using Right-Click Menus Selecting a lead network causes your cursor to change to an ‘x.’ Position this ‘x’ on the Bode magnitude curve slightly to the right of the rightmost pole and 4-16 Bode Diagram Design click. Your SISO Design Tool and LTI Viewer plots should now look similar to these. Figure 4-14: Root Locus, Bode, and Step Response Plots for the DC Motor with a Lead Network The Step Response plot shows that the rise time is now about 0.4 second and peak response is 1.25 rad/sec (i.e., the overshoot is about 25%). Although the rise time meets the requirement, the overshoot is still too large, and the stability margins are still unacceptable, so you must tune the lead parameters. Moving Compensator Poles and Zeros To improve the response speed, move the lead network zero closer to the leftmost (slowest) pole of the DC motor plant (denoted by a blue ‘x’). To do this, just grab the zero and drag it with your mouse. Try positioning the zero near the slowest plant pole. Now try moving the lead network pole to the right. Notice how the gain margin increases as you do this. You can also use the gain to increase the gain margin; grab the Bode magnitude curve and drag it upward with your mouse to see the gain and gain margin increase. 4-17 4 Designing Compensators As you tune these parameters, take a look at the LTI Viewer. You will see the closed-loop step response alter with each parameter change you make. The figure below shows the final values for a design that meets the specifications. You can move red (compensator) poles and zeros by dragging them with your mouse. Figure 4-15: Final Design Parameters for the DC Motor Compensator The values for this final design are as follows: • Poles at 0 and -28 • Zero at -4.3 • Gain = 84 You can use the Edit Compensator dialog box to specify the exact values. Double-click in the Current Compensator panel to open the window. This figure shows that the gain margin is 22 dB, and the phase margin is 66°. To see if the design meets the rise time and overshoot requirements, go to the closed-loop step response, right-click in an empty region of the plot, and select 4-18 Bode Diagram Design Characteristics and then Rise Time and Peak Overshoot. This figure shows the plot with the rise time and overshoot denoted by large dots on the curve. Left-click on the blue dots to display these data markers. Figure 4-16: Step Response for the Final Compensator Design The step response shows that the rise time is 0.45 second, and the peak amplitude is 1.03 rad/sec, or an overshoot of 3%. These results meet the design specifications. Changing Units on a Plot The Control System Toolbox provides editors for setting plot options. If you want, for example, to change the frequency units on all the Bode plots created 4-19 4 Designing Compensators in the SISO Design Tool from rad/sec to Hertz, select SISO Tool Preferences under Edit in the menu bar. This opens the SISO Tool Preferences editor. Figure 4-17: The SISO Tool Preferences Editor Use the menu options on the Units page to make the change. This unit change persists for the entire session. For more information about property and preference setting, see “Customization” online under the Control System Toolbox. Adding a Notch Filter If you know that you have disturbances to your system at a particular frequency, you can use a notch filter to attenuate the gain of the system at that frequency. To add a notch filter, select Add Notch from the right-click menu and place the filter at the frequency you want to attenuate. A black ‘x’ will appear next to the mouse arrow; place it at the frequency you want to attenuate. 4-20 Bode Diagram Design This figure shows the result. See Figure 4-15 for a close look at the notch filter parameters. Figure 4-18: The SISO Tool with a Notch Filter Added to the DC Motor Compensator Note that to add the notch filter it was necessary to zoom out, since the notch frequency is at a higher frequency than Figure 4-15 on page 4-18 displayed. To see the notch filter parameters in more detail, select Zoom X-Y in the right-click menu for the Bode magnitude plot. Left-click and drag your mouse to draw a box around the notch filter. When you release the mouse, the SISO Design Tool will zoom in on the selected region. 4-21 4 Designing Compensators This figure zooms in on the notch filter to show the adjustable parameters. Drag the block diamonds to change the width of the notch. Move the red ⊗ down to deepen the notch. Figure 4-19: Manipulating Notch Filter Parameters To understand how adjusting the notch filter parameters affects the filter, consider the notch filter transfer function. 2 2 s + 2ξ 1 ω n s + ω n -------------------------------------------2 2 s + 2ξ 2 ω n s + ω n The three adjustable parameters are ξ1, ξ2, and ωn. The ratio of ξ2/ξ1 sets the depth of the notch, and ωn is the natural frequency of the notch. This diagram 4-22 Bode Diagram Design shows how moving the red ⊗ and black diamonds change these parameters, and hence the transfer function of the notch filter. ♦ Adjust ωn. ♦ Adjust ξ for ξ2/ξ1 constant (i.e., adjust the width of the notch while holding the notch depth constant). ⊗ Adjust ξ2/ξ1 (depth of the notch). Figure 4-20: A Close Look at Notch Filter Parameters 4-23 4 Designing Compensators Root Locus Design A common technique for meeting design criteria is root locus design. This approach involves iterating on a design by manipulating the compensator gain, poles, and zeros in the root locus diagram. The root locus diagram shows the trajectories of the closed-loop poles of a feedback system as a single system parameter varies over a continuous range of values. Typically, the root locus method is used to tune the loop gain of a SISO control system by specifying a feedback gain the closed-loop pole locations. Consider, for example, the tracking loop r + P(s) y – k H(s) where P ( s ) is the plant, H ( s ) is the sensor dynamics, and k is a scalar gain to be adjusted. The closed-loop poles are the roots of q ( s ) = 1 + k P ( s )H ( s ) The root locus technique consists of plotting the closed-loop pole trajectories in the complex plane as k varies. You can use this plot to identify the gain value associated with a desired set of closed-loop poles. The DC motor design example focused on the Bode diagram feature of the SISO Design Tool. Each of the design options available on the Bode diagram side of the tool have a counterpart on the root locus side. To demonstrate these techniques, this example presents an electrohydraulic servomechanism. The SISO Design Tool’s root locus and Bode diagram design tools provide complementary perspectives on the same design issues; each perspective offers insight into the design process. Since the SISO Design Tool displays both root locus and Bode diagrams, you can also choose to combine elements of both perspectives in making your design decisions. 4-24 Root Locus Design Example: Electrohydraulic Servomechanism A simple version of an electrohydraulic servomechanism model consists of: • A push-pull amplifier (a pair of electromagnets) • A sliding spool in a vessel of high pressure hydraulic fluid • Valve openings in the vessel to allow for fluid to flow • A central chamber with a piston-driven ram to deliver force to a load • A symmetrical fluid return vessel This figure shows a schematic of this servomechanism. Piston-driven ram Figure 4-21: An Electrohydraulic Servomechanism The force on the spool is proportional to the current in the electromagnet coil. As the spool moves, the valve opens, allowing the high pressure hydraulic fluid to flow through the chamber. The moving fluid forces the piston to move in the opposite direction of the spool. Control System Dynamics, by R. N. Clark, (Cambridge University Press, 1996) derives linearized models for the electromagnetic amplifier, the valve spool dynamics, and the ram dynamics; it also provides a detailed description of this type of servomechanism. 4-25 4 Designing Compensators If you want to use this servomechanism for position control, you can use the input voltage to the electromagnet to control the ram position. When measurements of the ram position are available, you can use feedback for the ram position control, as shown in the figure below. Reference Position + C(s) Applied Voltage Gservo(s) Ram Position — Compensator Plant Figure 4-22: Feedback Control Structure for an Electrohydraulic Servomechanism Your task is to design the compensator, C(s). Plant Transfer Function If you have not already done so, type load ltiexamples to load a collection of linear models that include Gservo, which is a linearized plant transfer function for the electrohydraulic position control mechanism. Typing Gservo at the MATLAB prompt displays the servomechanism (plant) transfer function. Gservo Zero/pole/gain from input "Voltage" to output "Ram position": 40000000 ----------------------------s (s+250) (s^2 + 40s + 9e004) Design Specifications For this example, you want to design a controller so that the step response of the closed-loop system meets the following specifications: • The 2% settling time is less than 0.05 second. • The maximum overshoot is less than 5%. 4-26 Root Locus Design The remainder of this section discusses how to use the SISO Design Tool to design a controller to meet these specifications. Opening the SISO Tool Open the SISO Design Tool and import the model by typing sisotool(Gservo) at the MATLAB prompt. This opens the SISO Design Tool with the servomechanism plant imported. Figure 4-23: SISO Design Tool Showing the Root Locus and Bode Plots for the Electrohydraulic Servomechanism Plant 4-27 4 Designing Compensators Zooming Using the right-click menu in the root locus, select X-Y under Zoom. Hold down the mouse’s left button and drag the mouse to select a region for zooming. For this example, reduce the root locus region to about -500 to 500 in both the xand y-axes. This figure illustrates the zooming in process. Hold down your mouse’s left button to select a rectangular region for zooming in. When you let go of the button, the SISO Design Tool replots the root locus with the new axis boundaries. To undo the zoom, select Zoom Out in the right-click menu. Figure 4-24: Zooming in on a Region in the Root Locus Plot Alternatively, you use the zoom icons on the toolbar: • — Zoom in X-Y • — Zoom in X • — Zoom in Y • — Zoom out As in the DC motor example, open an LTI Viewer by selecting Plant Output (Step) in the Loop Responses menu under Tools in the menu bar. You now 4-28 Root Locus Design should have two windows, the SISO Design Tool and the associated LTI Viewer side by side. Figure 4-25: SISO Design Tool and Associated LTI Viewer for the Electrohydraulic Servomechanism The step response plot shows that the rise time is on the order of 2 seconds, which is much too slow given the system requirements. The following sections describe how to use frequency design techniques in the SISO Design Tool to design a compensator that meets the requirements specified in “Design Specifications” on page 4-26 4-29 4 Designing Compensators Changing the Compensator Gain The simplest thing to do is change the compensator gain, which by default is unity. You can change the gain by grabbing the red squares on the root locus plot and moving them along the curve. This figure shows the procedure. Move the red squares to change the compensator gain. The SISO Design Tool calculates the compensator gain C(s) and displays it in the Current Compensator panel. Figure 4-26: Changing the Compensator Gain in the Root Locus Plot Experiment with different gains and view the closed-loop response in the associated LTI Viewer. Alternatively, you can change the compensator gain by entering values into the C(s) field in the Current Compensator panel. Closed-Loop Response Change the gain to 20 by editing the text box next to Gain, and pressing the Enter key. Notice that the locations of the closed-loop poles on the root locus are recalculated for the new gain set point. 4-30 Root Locus Design This figure shows the associated closed-loop step response for the gain of 20. Select Settling Time under Characteristics in the LTI Viewer’s right-click menu to display the settling for this response. Figure 4-27: Step Response with the Settling Time for C(s) = 20 This closed-loop response does not meet the desired settling time requirement (0.05 seconds or less) and exhibits unwanted ringing. The next section shows how to design a compensator so that you meet the required specifications. Adding Poles and Zeros to the Compensator You may have noticed that increasing the gain makes the system underdamped. Further increases force the system into instability, so meeting the design requirements with only a gain in the compensator is not possible. There are three sets of parameters that specify the compensator: poles, zeros, and gain. Once you have selected the gain, you can add poles or zeros to the compensator. 4-31 4 Designing Compensators Adding Poles to the Compensator Try adding a complex conjugate compensator pole pair on the root locus plot: 1 Open the right-click menu and select Add and then Complex Pole. 2 Click on the root locus plot region where you would like to add one of the complex poles. This figure shows these two steps. Select Add/Complex Pole in the right-click menu. Add the poles by placing the ‘x’ on the Bode magnitude plot. The SISO Design Tool places the poles at the location that you mark. Figure 4-28: Adding a Complex Pair of Poles to the Compensator Try placing the ‘x’ somewhere to the left of the complex pole pair near the imaginary axis (the figure above shows a good spot). Once you have added the complex pair of poles, the LTI Viewer response plots change and both the root locus and Bode plots display the new poles. This figure shows the SISO Design 4-32 Root Locus Design Tool with the new poles added. For clarity, you may want to zoom out further, as was done here. The Current Compensator displays the new complex pair of poles. If you see NumC or DenC, widen the GUI to see the full transfer function. The SISO Design Tool displays the new poles as a pair of red x’s on the root locus plot. Figure 4-29: The Result of Adding a Complex Pair of Poles to the Compensator 4-33 4 Designing Compensators Adding Zeros to the Compensator The procedure for adding zeros to the compensator is exactly the same. Try adding a pair of complex zeros just to the left of complex closed-loop poles you just added to the compensator. This figure shows the results. Figure 4-30: Electrohydraulic Servomechanism Example with Complex Zeros Added If your step response is unstable, lower the gain by grabbing a red box in the right-hand plane and moving it into the left-half plane. In this example, the resulting step response is stable, but it still doesn’t meet the design criteria since the 2% settling time is greater than 0.05 second. As you can see, the compensator design process can involve some trial and error. You can try dragging the compensator poles, compensator zeros, or the closed-loop poles around the root locus until you meet the design criteria The next section shows you how to place poles and zeros by specifying their numerical values. It also presents a solution that meets the design specifications for the servomechanism example. 4-34 Root Locus Design Viewing Damping Ratios If you want to place, for example, a pair of complex poles on your diagram at a particular damping ratio, select Design Constraints from the right-click menu in the root locus. This opens the Design Constraints editor. Check Damping Ratio and specify 0.707 to see lines on the root locus corresponding to a 0.707 damping ratio. Figure 4-31: The Design Constraints Editor Applying damping ratios to the root locus plot results in a pair of lines at the desired slope, as this figure shows. Figure 4-32: Root Locus Displaying 0.707 Damping Ratio Lines 4-35 4 Designing Compensators Try moving the complex pair of poles you’ve added to the design so that they are on the 0.707 damping ratio line. You can experiment with different damping ratios to see the effect on the design. Editing Compensator Pole and Zero Locations A quick way to change poles and zeros is simply to grab them with your mouse and move them around the root locus plot region. If you want to specify precise numerical values, however, you should use the Edit Compensator window to change the gain value and the pole and zero locations of your compensator. There are three ways to open the Edit Compensator window from the SISO Design Tool: • Select Edit Compensator under the Edit menu on the menu bar. • Select Edit Compensator in the right-click menu. This option is available in both the root locus and Bode plot right-click menus. • Double-click your mouse in the Current Compensator panel. Whichever method you choose, the following window appears. Toggle between Zero/Pole Location and Damping/Natural Frequency formats. Use these fields to place poles and zeros at exact locations. Use the Gain field to change the compensator gain. Figure 4-33: Use the Edit Compensator Window to Add, Delete and Move Compensator Poles and Zeros You can use the Edit Compensator window to: • Edit the compensator gain • Edit the locations of compensator poles and zeros • Add compensator poles and zeros • Delete compensator poles and zeros 4-36 Root Locus Design For this example, edit the poles to be at – 110 ± 140i and the zeros at – 70 ± 270i . Set the compensator gain to 23.3. Your SISO Design Tool now looks like this. Figure 4-34: SISO Design Tool with the Final Values for the Electrohydraulic Servomechanism Design Example 4-37 4 Designing Compensators To see that this design meets the design requirements, take a look at the step response of the closed-loop system. Figure 4-35: Closed-Loop Step Response for the Final Design of the Electrohydraulic Servomechanism Example The step response looks good. As you can see, the settling time is less than 0.05 second, and the overshoot is less than 5%. You have met the design specifications. 4-38 Root Locus Design Exporting the Compensator and Models Now that you have successfully designed your compensator, you may want to save your design parameters for future implementation. You can do this by selecting Export from the File menu on the SISO Design Tool. The window shown below opens. Double-click on any cell in the Export As column to edit the name for export. Figure 4-36: SISO Tool Export Window The variables listed in the Export As List are either previously named by you (in the Import System Data window) or have default names. To export your compensator to the workspace: 1 Select Compensator C in the Component List. If you want to change the export name, double-click in the cell for compensator C. 2 Click on the Export to Workspace button. If you go to the MATLAB prompt and type who the compensator is now in the workspace, in the variable named C. Type C to see that this variable is stored in zpk format. 4-39 4 Designing Compensators To select multiple components, use the Shift key if they are all adjacent and the Ctrl key if they are not. Selecting Export to Disk opens the window shown below. You can save your models as MAT-files in any directory you want. The default name for the MAT-file is the name of your original model; you can change the name to anything you want. If you save multiple components, they are stored in a single MAT-file. Storing and Retrieving Intermediate Designs You can store and retrieve intermediate compensators while you iterate on your compensator design. To store intermediate designs, select Store under Compensator in the menu bar of the SISO Design Tool. This window opens. The default name is UntitledC_1; the suffix increments when you store additional compensators. You can rename the designs by editing the Store as field. 4-40 Root Locus Design To retrieve intermediate designs, select Retrieve under the Compensator menu. This opens the Compensator Designs window. Figure 4-37: The Compensator Designs Window To retrieve a design, select it from the list of names and press Retrieve. The SISO Design Tool automatically reverts to the selected compensator design. Note that you can rename the stored compensator by editing the name in the selected Name cell. The Compensator Designs window also lists the order of each compensator design, and, if the compensator is digital, the sample time. The default sample time value for continuous-time compensators is 0. You can delete an intermediate design by selecting it and pressing the Delete button. 4-41 4 Designing Compensators Functions For Compensator Design The term control system design refers to the process of selecting feedback gains that meet design specifications in a closed-loop control system. Most design methods are iterative, combining parameter selection with analysis, simulation, and insight into the dynamics of the plant. In addition to the SISO Design Tool, the Control System Toolbox provides a set of commands that you can use for a broader range of control applications, including: • Classical SISO design • Modern MIMO design techniques such as pole placement and linear quadratic Gaussian (LQG) methods Root Locus Design The following table summarizes the commands for designing compensators using root locus design techniques. Function Description pzmap Pole-zero map rlocus Evans root locus plot sgrid Continuous ω n, ζ grid for root locus plots sisotool Root Locus Design GUI zgrid Discrete ω n, ζ grid for root locus plots Pole Placement The closed-loop pole locations have a direct impact on time response characteristics such as rise time, settling time, and transient oscillations. Root locus uses compensator gains to move closed-loop poles to achieve design specifications for SISO systems. You can, however, use state-space techniques to assign closed-loop poles. This design technique is known as pole placement, which differs from root locus in the following ways: • Using pole placement techniques, you can design dynamic compensators. • Pole placement techniques are applicable to MIMO systems. 4-42 Functions For Compensator Design Pole placement requires a state-space model of the system (use ss to convert other model formats to state space). In continuous time, such models are of the form x· = Ax + Bu y = Cx + Du where u is the vector of control inputs, x is the state vector, and y is the vector of measurements. State-Feedback Gain Selection Under state feedback u = – Kx , the closed-loop dynamics are given by x· = ( A – BK ) x and the closed-loop poles are the eigenvalues of A – BK . Using the place command, you can compute a gain matrix K that assigns these poles to any desired locations in the complex plane (provided that ( A, B ) is controllable). For example, for state matrices A and B, and vector p that contains the desired locations of the closed loop poles, K = place(A,B,p); computes an appropriate gain matrix K. State Estimator Design You cannot implement the state-feedback law u = – Kx unless the full state x is measured. However, you can construct a state estimate ξ such that the law u = – Kξ retains similar pole assignment and closed-loop properties. You can achieve this by designing a state estimator (or observer) of the form · ξ = Aξ + Bu + L ( y – Cξ – Du ) The estimator poles are the eigenvalues of A – LC , which can be arbitrarily assigned by proper selection of the estimator gain matrix L , provided that (C, A) is observable. As a rule of thumb, the estimator dynamics should be faster than the controller dynamics (eigenvalues of A – BK ). Use the place command to calculate the L matrix L = place(A',C',q) 4-43 4 Designing Compensators where A and C are the state and output matrices, and q is the vector containing the desired closed-loop poles for the observer. Replacing x by its estimate ξ in u = – Kx yields the dynamic output-feedback compensator · ξ = A – LC – ( B – LD )K ξ + Ly u = – Kξ Note that the resulting closed-loop dynamics are x· = A – BK BK e· 0 A – LC x , e e = x–ξ Hence, you actually assign all closed-loop poles by independently placing the eigenvalues of A – BK and A – LC . Example. Given a continuous-time state-space model sys_pp = ss(A,B,C,D) with seven outputs and four inputs, suppose you have designed: • A state-feedback controller gain K using inputs 1, 2, and 4 of the plant as control inputs • A state estimator with gain L using outputs 4, 7, and 1 of the plant as sensors • Input 3 of the plant as an additional known input You can then connect the controller and estimator and form the dynamic compensator using this code. controls = [1,2,4]; sensors = [4,7,1]; known = [3]; regulator = reg(sys_pp,K,L,sensors,known,controls) 4-44 Functions For Compensator Design Pole Placement Tools The Control System Toolbox contains functions to: • Compute gain matrices K and L that achieve the desired closed-loop pole locations. • Form the state estimator and dynamic compensator using these gains. The following table summarizes the commands for pole placement. Command Description acker SISO pole placement estim Form state estimator given estimator gain place MIMO pole placement reg Form output-feedback compensator given state-feedback and estimator gains The function acker is limited to SISO systems and should only be used for systems with a small number of states. The function place is a more general and numerically robust alternative to acker. Caution Pole placement can be badly conditioned if you choose unrealistic pole locations. In particular, you should avoid: • Placing multiple poles at the same location. • Moving poles that are weakly controllable or observable. This typically requires high gain, which in turn makes the entire closed-loop eigenstructure very sensitive to perturbations. 4-45 4 Designing Compensators Linear-Quadratic-Gaussian (LQG) Design Linear-quadratic-Gaussian (LQG) control is a modern state-space technique for designing optimal dynamic regulators. It enables you to trade off regulation performance and control effort, and to take into account process disturbances and measurement noise. Like pole placement, LQG design requires a state-space model of the plant (use ss to convert other model formats to state space). This section focuses on the continuous-time case (see the reference pages for dlqr and kalman for details on discrete-time LQG design). LQG design addresses the following regulation problem. w (disturbance) y Plant u Regulator y + v (noise) + The goal is to regulate the output y around zero. The plant is subject to disturbances w and is driven by controls u . The regulator relies on the noisy measurements y = y + v to generate these controls. The plant state and measurement equations are of the form x· = Ax + Bu + Gw y = Cx + Du + Hw + v and both w and v are modeled as white noise. The LQG regulator consists of an optimal state-feedback gain and a Kalman state estimator. You can design these two components independently as shown next. 4-46 Functions For Compensator Design Optimal State-Feedback Gain In LQG control, the regulation performance is measured by a quadratic performance criterion of the form J(u) = ∞ ò0 { x T T T Qx + 2x Nu + u Ru } dt The weighting matrices Q, N, and R are user specified and define the trade-off between regulation performance (how fast x ( t ) goes to zero) and control effort. The first design step seeks a state-feedback law u = – Kx that minimizes the cost function J ( u ) . The minimizing gain matrix K is obtained by solving an algebraic Riccati equation. This gain is called the LQ-optimal gain. Syntax. Given the (A,B,C,D) matrices of the system, and the weighting matrices Q, R, and N, use the lqr command to construct the LQ-optimal gain, K. K= lqr(A,B,Q,R,N) If N is omitted, by default its value is 0. Kalman State Estimator As in the case of pole placement, the LQ-optimal state feedback u = – Kx is not implementable without full state measurement. It is possible, however, to derive a state estimate xˆ such that u = – Kxˆ remains optimal for the output-feedback problem. This state estimate is generated by the Kalman filter d ˆ· x = Axˆ + Bu + L ( y – Cxˆ – Du ) dt with inputs u (controls) and y (measurements). The noise covariance data T E ( ww ) = Q n , T E ( vv ) = R n , T E ( wv ) = N n determines the Kalman gain L through an algebraic Riccati equation. The Kalman filter is an optimal estimator when dealing with Gaussian white noise. Specifically, it minimizes the asymptotic covariance T lim E ( ( x – xˆ ) ( x – xˆ ) ) t→∞ 4-47 4 Designing Compensators of the estimation error x – xˆ . u Kalman estimator y xˆ Syntax. Use the kalman function to construct a Kalman filter. [kest,L,P] = kalman(sys_kf,Qn,Rn,Nn); returns a state-space model kest of the Kalman estimator given the plant model sys_kf and the noise covariance data, Qn, Rn, and Nn. The plant model equations are the following. x· = Ax + Bu + Gw y = Cx + Du + Hw + v where w and v are modeled as white noise. L is the Kalman gain and P the covariance matrix. The figure below shows the required dimensions for Qn, Rn, and Nn. If Nn is 0, you can omit it. Length (y) Length (w) Length (w) Length (y) Qn Nn . * Rn Figure 4-38: Required Dimensions for Qn, Rn, and Nn For a complete example of a Kalman filter implementation, see “Kalman Filtering” under “Case Studies” online. 4-48 Functions For Compensator Design LQG Regulator To form the LQG regulator, simply connect the Kalman filter and LQ-optimal gain K as shown below. w Plant y u u –K xˆ + Kalman filter v y + LQG regulator This regulator has state-space equations dˆ x = A – LC – ( B – LD )K xˆ + Ly dt u = – Kxˆ Syntax. Assuming you have constructed the Kalman filter, kest, and the compensator, K, use the lqgreg command to create the LQG regulator. regulator = lqgreg(kest, K); See the example “LQG Regulation” under “Case Studies” online for a more complete discussion of construction LQG regulators. LQG Design Tools The Control System Toolbox contains functions to perform the three LQG design steps outlined above. These functions cover both continuous and 4-49 4 Designing Compensators discrete problems as well as the design of discrete LQG regulators for continuous plants. The following table summarizes the LQG design commands. 4-50 Command Description care Solve continuous-time algebraic Riccati equations dare Solve discrete-time algebraic Riccati equations dlqr LQ-optimal gain for discrete systems kalman Kalman estimator kalmd Discrete Kalman estimator for continuous plant lqgreg Form LQG regulator given LQ gain and Kalman filter lqr LQ-optimal gain for continuous systems lqrd Discrete LQ gain for continuous plant lqry LQ-optimal gain with output weighting Functions For Compensator Design Example: LQG Design As an example of LQG design, consider the regulation problem illustrated below. Plant w 10 --------------s + 10 d + u+d 100 ------------------------------2 s + s + 100 + y u + F( s) y + n LQG regulator Figure 4-39: Simple Regulation Loop The goal is to regulate the plant output y around zero. The input disturbance d is low frequency with power spectral density (PSD) concentrated below 10 rad/sec. For LQG design purposes, it is modeled as white noise driving a low-pass filter with a cutoff at 10 rad/sec, as this picture shows. w (white noise) 10 --------------s + 10 Shaping filter d (colored noise) 4-51 4 Designing Compensators This figure shows the Bode magnitude of the shaping filter. This data marker verifies that 10 rad/sec is the -3 dB point. Figure 4-40: Bode Magnitude of the Low-Pass Filter There is some measurement noise n , with noise intensity given by E ( n 2 ) = 0.01 Use the cost function J(u) = ∞ ò0 ( 10y 2 + u 2 ) dt to specify the trade-off between regulation performance and cost of control. Note that an open-loop state-space model is x· = Ax + Bu + Bd y = Cx + n (state equations) (measurements) where ( A, B, C ) is a state-space realization of 100 ⁄ ( s 2 + s + 100 ) . 4-52 Functions For Compensator Design The following commands design the optimal LQG regulator F ( s ) for this problem. sys = ss(tf(100,[1 1 100])) % state-space plant model % Design LQ-optimal gain K K = lqry(sys,10,1) % u = –Kx minimizes J(u) % Separate control input u and disturbance input d P = sys(:,[1 1]); % input [u;d], output y % Design Kalman state estimator Kest. Kest = kalman(P,1,0.01) % Form LQG regulator = LQ gain + Kalman filter. F = lqgreg(Kest,K) The last command returns a state-space model F of the LQG regulator F ( s ) . Note that lqry, kalman, and lqgreg perform discrete-time LQG design when applied to discrete plants. To validate the design, close the loop with feedback, create and add the lowpass filter in series with the closed-loop system, and compare the open- and closed-loop impulse responses by using the impulse function. 4-53 4 Designing Compensators % Close loop clsys = feedback(sys,F,+1) % Note positive feedback. % Create the lowpass filter and add it in series with clsys. s = tf('s'); lpf= 10/(s+10) ; clsys_fin = lpf*clsys; % Open- vs. closed-loop impulse responses impulse(sys,'r--',clsys_fin,'b-') This figure compares the open- and closed-loop impulse responses for this example. Figure 4-41: Comparison of Open- and Closed-Loop Impulse Response for the LQG Example 4-54 Functions For Compensator Design Example: LQG Design for Set Point Tracking The standard LQG problem is to regulate the plant output around zero. The previous section, “Example: LQG Design,” describes the classical LQG regulation problem. You can also apply the LQG design technique to tracking problems, where the goal is to track a reference input (or set point) to the system. To recast the regulator as a tracking problem, you must compare the output y to the reference signal. The goal is then to drive the error between the output and the reference to zero. A common practice is to add an integrator to the error signal, e = y − r, to drive it to zero. This Simulink block diagram shows a tracking problem in aircraft autopilot design. To open this diagram, type lqrpilot at the MATLAB prompt. Figure 4-42: A Tracking Loop Key features of this diagram to note are the following: • The State Space block in the figure contains the linearized airframe. • sf_aerodyn is an S-Function block that contains the nonlinear equations for (θ,φ) = (0,15°) 4-55 4 Designing Compensators • The error signal between φ and the φ ref is passed through an integrator. This aids in driving the error to zero. State-Space Equations for an Airframe Beginning with the standard state-space equation x· = Ax + Bu where x = [ u, v, w, p, q, r, θ, φ ] T the variables u, v, and w are the three velocities with respect to the body frame, which is shown in the figure below. v u w Figure 4-43: A Body Coordinate Frame for an Aircraft The variables θ and φ are roll and pitch, and p, q, and r are the roll, pitch, and yaw rates, respectively. 4-56 Functions For Compensator Design The airframe dynamics are nonlinear. The equation below shows the nonlinear components added to the state space equation. – g sin θ g cos θ sin φ g cos θ cos φ 0 x· = Ax + Bu + 0 0 0 q cos φ – r sin φ ( q sin φ + r cos φ ) ⋅ tan θ Figure 4-44: Nonlinear Component of the State-Space Equation To see the numerical values for A and B, type load lqrpilot A, B at the MATLAB prompt. Trimming For LQG design purposes, the nonlinear dynamics are trimmed at φ = 15° and p, q, r, and θ set to zero. Since u, v, and w do not enter into the nonlinear term in Figure 4-44, this amounts to linearizing around ( φ, θ ) = ( 0, 15° ) with all remaining states set to zero. The resulting state matrix of the linearized model is called A15. 4-57 4 Designing Compensators Problem Definition The goal to perform a steady coordinated turn, as shown in this figure. θ=60° Figure 4-45: An Aircraft Making a 60° Turn To achieve this goal, you must design a controller that commands a steady turn by going through a 60° roll. In addition, assume that θ , the pitch angle, is required to stay as close to zero as possible. 4-58 Functions For Compensator Design Results To calculate the LQG gain matrix, K, type lqrdes at the MATLAB prompt. Then start the lqrpilot model with the nonlinear model, sf_aerodyn, selected. This figure shows the response of φ to the 60° step command. Figure 4-46: Tracking the Roll Step Command As you can see, the system tracks the commanded 60° roll in about 60 seconds. 4-59 4 Designing Compensators Another goal was to keep θ , the pitch angle, relatively small. This figure shows how well the LQG controller did. Figure 4-47: Minimizing the Displacement in the Pitch Angle, Theta Finally, this figure shows the control inputs. Figure 4-48: The Control Inputs for the LQG Tracking Problem 4-60 Functions For Compensator Design Try adjusting the Q and R matrices in lqrdes.m and inspecting the control inputs and the system states, making sure to rerun lqrdes to update the LQG gain matrix K. Through trial-and-error, you may improve the response time of this design. Also, compare the linear and nonlinear designs to see the effects of the nonlinearities on the system performance. 4-61 4 Designing Compensators 4-62 5 Learning More Demos . . . . . . . . . . . . . . Online Help . . . . . . . . . . . . Setting Plot Preferences and Properties The MathWorks Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 5-2 5-3 5-4 5 Learning More Demos To see more Control System Toolbox examples, type demo at the MATLAB prompt. This opens the MATLAB Demo window. Select “Control System Toolbox” under “Toolboxes” to list the available demos. Alternatively, you can access the demos from MATLAB’s Launch Pad. Select “Demos” under “Control System Toolbox” to see a list of demos. Online Help For a more detailed explanation of any of the topics covered in this book, see the documentation listed under “Control System Toolbox” in the Help Navigator. The Help Navigator supports string searches. You can specify strings and the online manuals that you want to search. To begin a search, click the Search tab. There is also an index available; click the Index tab to view it. Aside from this book, Getting Started with the Control System Toolbox, the online documentation contains the following topics: • “Release Notes” — For details on the latest release, including new features • “Creating and Manipulating Models” — In-depth information on how to create and manipulate linear models and LTI arrays, which are data objects that you can use to store collections of linear models in one variable • “Customization” — A description of the Property and Preference Editors, which you can use to set plot options, such titles, fonts, units, and grids • “Design Case Studies” — Worked examples, including Kalman filtering and MIMO design • “Reliable Computations” — Numerical stability and accuracy issues • “GUI Reference” — Complete descriptions of the LTI Viewer and SISO Design Tool, which are graphical user interfaces (GUI’s) that you can use to analyze systems and design SISO compensators • “Function Reference” — A complete guide to all the functions in the Control System Toolbox. Functions are listed by category and alphabetically. 5-2 Setting Plot Preferences and Properties The Control System Toolbox provides three graphical user interfaces (GUI’s), that give you control over the visualization of time and frequency plots generated by the toolbox: • Toolbox Preferences • Tool Preferences • Plot Properties Preferences refer to global options that you can save from session to session or to any LTI Viewer or SISO Design Tool that you open during a single session; properties are options that apply only to the current window. This section gives an overview of the three GUI’s; see the online help system for a complete descriptions Although you can set plot properties in any response plot, you can use the Toolbox Preferences Editor to set properties for any response plot the Control System Toolbox generates. This figure shows the inheritance hierarchy from toolbox preference to plot properties. Toolbox Preferences Persist across sessions User Preferences Inheritance Tool Preferences Specific to an instance of a tool Inheritance Saved to disk Not saved to disk SISO Tool SISODesign Design Tool LTI Viewer Not saved to disk Plot Properties Specific to an instance of a plot Response Response Plot Plot Response Plot Response Plot Response Response Plot Plot Figure 5-1: Preference and Property Inheritance Hierarchy 5-3 5 Learning More You can activate preference and plot editors by doing the following: • Toolbox preferences — Select Toolbox Preferences under File in either the LTI Viewer or the SISO Design Tool. • Tool preferences — Select SISO Tool Preferences under Edit for the SISO Design Tool and Viewer Preferences under Edit in the LTI Viewer. • Plot properties — Double-click on any response plot created by the Control System Toolbox or select Properties from the right-click menus. For a complete discussion of how to use property and preference editors, see “Setting Plot Properties and Preferences” in the online help under “Control System Toolbox.” The MathWorks Online For the very latest information about the Control System Toolbox and other MathWorks products, point your Web browser to http://www.mathworks.com and use your Internet news reader to access the newsgroup comp.soft-sys.matlab Many books that use MATLAB and the Control System Toolbox to explain control engineering concepts are available from different publishers. A booklet entitled MATLAB Based Books is available from The MathWorks and an up-to-date list is available on the Web site. 5-4 Index B building models MIMO 2-13 SISO 2-6 E estimator gain 4-43 Kalman 4-47 exporting compensators and models 4-39 C cell array 2-16 changing units on a plot 4-19 comparing models in plots 3-24 compensators editing in SISO Design Tool 4-36 exporting 4-39 feedback (state estimator design) 4-44 concatenation, model 2-15 conventions in our documentation (table) 1-8 covariance noise 4-47 F final time. See time response frequency response 3-20 customizing plots 3-27 plotting 3-24 functions time and frequency response 3-18 G gain estimator, Kalman 4-47 selection 4-24 state-feedback 4-47 D data markers 3-23 denominator specification 2-16 design Kalman estimator 4-47 LQG Tracker, example of 4-55 LQG, description of 4-46 LQG, example of 4-51 LQG, syntax 4-49 pole placement 4-42 regulators 4-49 root locus 4-42 state estimator 4-43 state estimator, Kalman 4-47 H Help Navigator 5-2 I input 2-3 input point block 3-35 See also Simulink LTI Viewer installation 1-3 K Kalman estimator continuous 4-47 I-1 Index gain 4-47 steady-state 4-47 Kalmanfilter. See Kalman estimator L linear models comparing multiple models in plots 3-24 exporting 4-39 frequency response. See frequency response model order reduction 2-26 time response. See time response LQG (linear quadratic-gaussian) method continuous LQ regulator 4-47 design See design, LQG gain,optimal state-feedback 4-47 Kalman state estimator 4-47 LQ-optimal gain 4-47 regulator,designing 4-53 regulator,forming 4-49 weighting matrices 4-47 LTI Viewer 3-4 adding plot types 3-13 changing models 3-17 changing plot types 3-11 command line initializing 3-14 comparing multiple models 3-14 importing models 3-5 models, importing 3-5 opening 3-5 plot options, rise time 3-8 plot options, settling time 3-15 right-click menus 3-6 Simulink models. See Simulink LTI Viewer I-2 M markers, data 3-23 MathWorks web site 5-4 MIMO 3-20 Model Inputs and Outputs block set 3-32 model order reduction 2-26 N noise covariance 4-47 white 3-18 numerator specification 2-16 O online help 5-2 operations on LTI models concatenation 2-15 output 2-3 output point block 3-35 See also Simulink LTI Viewer overshoot 3-18 P plotting changing units 4-19 customizing plots 3-27 frequency response. See frequency response multiple systems 3-24 right-click menus 3-21 time responses 3-18 pole placement 4-42 conditioning 4-45 Index R reduced-order models 2-26 regulation 4-46, 4-52 performance 4-47 related products 1-6 Riccati equation 4-47 right-click menus LTI Viewer 3-6 plot responses 3-21 rise time 3-18 root locus compensator gain 4-30 designing 4-42 root locus design 4-24 functions for 4-42 S settling time 3-18 Simulink LTI Viewer 3-30, 3-32 analysis models exporting 3-42 specifying 3-35 opening 3-32 operating conditions, setting 3-43 specifying models for 3-32 SISO Design Tool 4-3 adding a lead network 4-14 adding a notch filter 4-20 adding an integrator 4-12 adding poles and zeros 4-31 changing the compensator gain, Bode magnitude 4-8 changing the compensator gain, root locus 4-30 changing the feedback structure 4-6 compensators, editing 4-36 importing models 4-5 opening 4-3 root locus design 4-24 state estimator 4-43 estimator, Kalman 4-47 vector 2-3 state estimator design regulators/compensators 4-44 state-space models 2-3 steady state error 3-18 T time response 3-18 customizing plots 3-27 final time 3-20 MIMO 3-20 plotting 3-24 time range 3-20 to white noise 3-18 vector of time samples 3-20 transfer functions 2-3 MIMO 2-15 typographic conventions 1-8 U units,changing on a plot 4-19 W white noise 3-18 See also noise I-3 Index Z zero-pole-gain (ZPK) models 2-3 I-4

Download PDF

advertisement