System Identification Toolbox For Use with MATLAB Lennart Ljung Computation Visualization Programming User's Guide Version 5
Computation Visualization Programming User’s Guide Lennart Ljung System Identification Toolbox For Use with MATLAB® Version 5
Contents Preface Using This Guide Typographical Conventions Related Products About the author The System Identification Problem Common Terms Used in System Identification Basic Information About Dynamic Models 1-6 The Signals 1-6 The Basic Dynamic Model -7 Variants of Model Descriptions How to Interpret the Noise Source 1-8 Terms to Characterize the Model Properties 1-10 The Basic Steps of System Identification 1-12 A Startup Identification Procedure 1-14 Step 1: Looking at the Data 1-14 Step 2: Getting a Feel for the Difficulties Step 3: Examining the Difficulties 1-15 Step 4: Fine Tuning Orders and Disturbance Structures 1-16 Multivariable Systems 1-18 Reading More About System Identification 1-21
i Contents Preface Using This Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Related Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv 1 The System Identification Problem Common Terms Used in System Identification . . . . . . . . . . 1-4 Basic Information About Dynamic Models . . . . . . . . . . . . . . 1-6 The Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 The Basic Dynamic Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Variants of Model Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 How to Interpret the Noise Source . . . . . . . . . . . . . . . . . . . . . . . 1-8 Terms to Characterize the Model Properties . . . . . . . . . . . . . . 1-10 The Basic Steps of System Identification . . . . . . . . . . . . . . . 1-12 A Startup Identification Procedure . . . . . . . . . . . . . . . . . . . . 1-14 Step 1: Looking at the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14 Step 2: Getting a Feel for the Difficulties . . . . . . . . . . . . . . . . 1-14 Step 3: Examining the Difficulties . . . . . . . . . . . . . . . . . . . . . . 1-15 Step 4: Fine Tuning Orders and Disturbance Structures . . . . 1-16 Multivariable Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18 Reading More About System Identification . . . . . . . . . . . . 1-21
The Graphical User Interface The model and data boards .2-2 The Working Data 2-3 The views The validation Data 2-4 The work flow 2-4 2-4 Workspace Variables 2-5 Help Texts 6 Handling Data 2-7 Getting Input-Output Data into the GUI Taking a Look at the Data 2-10 Preprocessing Data 2-11 Checklist for Data Handling 2-13 Simulating Data 2-13 Estimati 2-15 The basics 2-15 Direct Estimation of the Impulse Response 2-15 Direct Estimation of the Frequency Response 2-16 Estimation of parametric models 2-17 ARX Models ARMAX, Output- Error and box-Jenkins Models 2-23 State-Space Models 2-25 User Defined Model structures 2-26 Examining Models Views and models 2-28 The plot windows 2-29 Frequency Response and Disturbance Spectra Transient Response 2-31 Poles and zeros 2-31 Compare Measured and Model Output 2-32 Residual Analysis 2-32 Text Information LTI Viewer Further Analysis in the maTLAB Workspace 2-34
ii Contents 2 The Graphical User Interface The Model and Data Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 The Working Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 The Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 The Validation Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 The Work Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 Management Aspects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 Workspace Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 Help Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Handling Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Getting Input-Output Data into the GUI . . . . . . . . . . . . . . . . . . 2-8 Taking a Look at the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Preprocessing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 Checklist for Data Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Simulating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Estimating Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 Direct Estimation of the Impulse Response . . . . . . . . . . . . . . . 2-15 Direct Estimation of the Frequency Response . . . . . . . . . . . . . 2-16 Estimation of Parametric Models . . . . . . . . . . . . . . . . . . . . . . . 2-17 ARX Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20 ARMAX, Output-Error and Box-Jenkins Models . . . . . . . . . . . 2-23 State-Space Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25 User Defined Model Structures . . . . . . . . . . . . . . . . . . . . . . . . . 2-26 Examining Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-28 Views and Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-28 The Plot Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-29 Frequency Response and Disturbance Spectra . . . . . . . . . . . . 2-30 Transient Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-31 Poles and Zeros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-31 Compare Measured and Model Output . . . . . . . . . . . . . . . . . . . 2-32 Residual Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-32 Text Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33 LTI Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34 Further Analysis in the MATLAB Workspace . . . . . . . . . . . . . 2-34
Some Further GUI Topics 2-35 Mouse Buttons and Hotkeys 2-35 Troubleshooting in Plots Layout Questions and idprefs mat 2-36 Customized plots 2-37 What Cannot be Done Using the GUI 2-37 Tutorial 3 The toolbox commands An Introductory Example to Command Mod The System Identification Problem .3-9 Impulse Responses, Frequency Functions, and Spectra 3-9 Polynomial Representation of Transfer Functions State-Space Representation of Transfer Functions 3-13 Continuous-Time State-Space Models 3-14 Estimating Impulse Responses 3-1 Estimating Spectra and Frequency Functions 3-15 Estimating Parametric Models 3-16 Subspace Methods for Estimating State-Space Models 3-17 Data Representation and Nonparametric Model estimation 3-18 Data Representation Correlation Analysis 3-19 Spectral Analysis 3-19 More on the Data Representation in iddata 3-21 Parametric Model estimation 3-25 ARX Model AR Models 3-26 General Polynomial Black-Box Models State-Space Models 3-28 Optional Variables
iii Some Further GUI Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35 Mouse Buttons and Hotkeys . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35 Troubleshooting in Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-36 Layout Questions and idprefs.mat . . . . . . . . . . . . . . . . . . . . . . 2-36 Customized Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-37 What Cannot be Done Using the GUI . . . . . . . . . . . . . . . . . . . 2-37 3 Tutorial The Toolbox Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 An Introductory Example to Command Mode . . . . . . . . . . . . 3-5 The System Identification Problem . . . . . . . . . . . . . . . . . . . . . 3-9 Impulse Responses, Frequency Functions, and Spectra . . . . . . 3-9 Polynomial Representation of Transfer Functions . . . . . . . . . 3-11 State-Space Representation of Transfer Functions . . . . . . . . . 3-13 Continuous-Time State-Space Models . . . . . . . . . . . . . . . . . . . 3-14 Estimating Impulse Responses . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 Estimating Spectra and Frequency Functions . . . . . . . . . . . . . 3-15 Estimating Parametric Models . . . . . . . . . . . . . . . . . . . . . . . . . 3-16 Subspace Methods for Estimating State-Space Models . . . . . . 3-17 Data Representation and Nonparametric Model Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 Data Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 Correlation Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19 Spectral Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19 More on the Data Representation in iddata . . . . . . . . . . . . . . . 3-21 Parametric Model Estimation . . . . . . . . . . . . . . . . . . . . . . . . . 3-25 ARX Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26 AR Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26 General Polynomial Black-Box Models . . . . . . . . . . . . . . . . . . . 3-27 State-Space Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28 Optional Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-30
Defining Model Structures Polynomial Black-Box Models: The idpoly Model 3-36 Multivariable arx models: The idarx mode Black-Box State-Space Models: the idss Model 3-3 Structured State-Space Models with Free Parameters: the idss model State-Space Models with Coupled Parameters State-Space Structures: Initial Values and Numerical Derivatives 3-47 Examining Models 349 Parametric Models: idmodel and its children 3-49 Frequency Function Format: the idfrd model 3-55 Graphs of Model Properti 3-56 Transformations to Other Model Representations 3-59 Discrete and Continuous Time models Model structure selection and validation Comparing Different Structures 3- Impulse Response to Determine Delays 3-66 Checking Pole-Zero Cancellations Residual analysis 3-66 Model error models 3-67 Noise- Free simulations Assessing the Model Uncertainty 368 Comparing Different Models 3-70 Selecting Model Structures for Multivariable Systems 3-70 Dealing with Data Offset levels 3-74 Outliers and Bad Data; Multi-Experiment Data 3-74 Missing Data 3-75 Filtering Data: Focus 3-75 Feedback in Data 376 Delays
iv Contents Defining Model Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-35 Polynomial Black-Box Models: The idpoly Model . . . . . . . . . . 3-36 Multivariable ARX Models: The idarx Model . . . . . . . . . . . . . . 3-37 Black-Box State-Space Models: the idss Model . . . . . . . . . . . . 3-39 Structured State-Space Models with Free Parameters: the idss Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-42 State-Space Models with Coupled Parameters: the idgrey Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-44 State-Space Structures: Initial Values and Numerical Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-47 Examining Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-49 Parametric Models: idmodel and its children . . . . . . . . . . . . . . 3-49 Frequency Function Format: the idfrd model . . . . . . . . . . . . . 3-55 Graphs of Model Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-56 Transformations to Other Model Representations . . . . . . . . . 3-59 Discrete and Continuous Time Models . . . . . . . . . . . . . . . . . . . 3-60 Model Structure Selection and Validation . . . . . . . . . . . . . . 3-63 Comparing Different Structures . . . . . . . . . . . . . . . . . . . . . . . . 3-63 Impulse Response to Determine Delays . . . . . . . . . . . . . . . . . . 3-66 Checking Pole-Zero Cancellations . . . . . . . . . . . . . . . . . . . . . . . 3-66 Residual Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-66 Model Error Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-67 Noise-Free Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-68 Assessing the Model Uncertainty . . . . . . . . . . . . . . . . . . . . . . . 3-68 Comparing Different Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-70 Selecting Model Structures for Multivariable Systems . . . . . . 3-70 Dealing with Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-74 Offset Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-74 Outliers and Bad Data; Multi-Experiment Data . . . . . . . . . . . 3-74 Missing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-75 Filtering Data: Focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-75 Feedback in Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-76 Delays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-77