EEM614-1

Embed Size (px)

Citation preview

  • 7/28/2019 EEM614-1

    1/34

    - 1/31

    System Identification, Estimation and

    Filteringy(t)^

    Dr Martin Brown

    Room: E1k, Control Systems CentreEmail: [email protected]

    Telephone: 0161 306 4672

    EEE Intranet

    ControllerPlant

    Model

    u(t)

    u(t)

    y(t)

    d(t)

    ^

  • 7/28/2019 EEM614-1

    2/34

    - 2/31

    Course Resources

    Core texts

    L Ljung, System Identification: Theory for the User, Prentice Hall,1998

    Notes by P. Wellstead, which provide useful background &supplementary information, see course Intranet

    Other resourcesJP Norton, An Introduction to Identification, Academic Press, 1986

    S Haykin, Adaptive Filter Theory, Prentice Hall, 2003

    B Widrow, SD Stearns, Adaptive Signal Processing, Prentice Hall, 1985

    CR Johnson Lectures in Adaptive Parameter Estimation, Prentice Hall,

    1989

    In addition, a lot of relevant material is contained on the Mathworks web-site and have a look at http://ocw.mit.edu/ for open course ware,especially the system identification course.

  • 7/28/2019 EEM614-1

    3/34

    - 3/31

    Course Structure

    Each 3 hourlecture will be organised:

    2*50 minute lectures 50 minute (optional?) laboratory session A19

    I expect that you will complete the laboratory sessions in your owntime, as they reinforce the concepts that we develop in thelectures and will gradually build up to the assignment. Theydevelop your Matlab & Simulink programming skills (W1&2) thatwill be used on the assignments.

    Two assignments EF: set ~W6, submit W9, 17% of total marks

    IS: set ~W8, submit W11, 17% of total marks

    Exam: 3 hours, 4 questions from 6, 66% course marks

  • 7/28/2019 EEM614-1

    4/34

    - 4/31

    Course Topic Areas

    Matlab &

    Simulink

    Recursive

    parameter

    estimation

    Linear

    modelling

    Self-tuning

    control

    Ordinary differential

    /difference equation

    Modelselection

    Linear algebra

    Statistics

    See http://ocw.mit.edu/ for some refresher courses (or any good bookshop)

    Least squaresestimation

  • 7/28/2019 EEM614-1

    5/34

    - 5/31

    Elements of the Course

    The course has five main elements to it:

    1. Introduction to system identification

    2. Non-parametric and parametric modelling

    3. Least squares and recursive parameter estimation

    4. Model selection

    5. Self-tuning control

    These concepts build on each other in the sense that anything that can

    be done on-line, can be performed in an off-line design scenario.

    However, off-line design typically involves a greater range of

    validation and human involvement, whereas on-line is completelyautomatic.

    Well be largely concerned with discrete-time system identification,

    but will dip into continuous-time representation, as necessary.

  • 7/28/2019 EEM614-1

    6/34

    - 6/31

    Lecture 1: Introduction to System

    Identification

    Introduction to system identification

    Input and output signals

    Examples

    Identifying a system using data ARX and least squares parametric modelling

    System identification process

    The aim of this lecture is to give you an introduction andoverview of the main topics in system identification

  • 7/28/2019 EEM614-1

    7/34

    - 7/31

    In order to design a controller, you must have a model

    A model is a system that transforms an input signal into an

    output signal.Typically, it is represented by differential ordifference

    equations.

    A model will be used, either explicitly or implicitly, in control

    design

    Introduction to System Identification

    Controller Plant

    Model

    u(t)

    y(t)

    y(t)^

    u(t)

    d(t)

    r(t)

  • 7/28/2019 EEM614-1

    8/34- 8/31

    Signals & Systems Definitions

    Typically, a system receives an input signal,x(t) (generally a vector)and transforms it into the output signal, y(t). In modelling andcontrol, this is further broken down:

    u(t) is an input signal that can be manipulated (control signal)

    w(t) is an input signal that can be measured (measurabledisturbance)

    v(t) is an input signal that cannot be measured (unmeasurabledisturbance)

    y(t) is the output signal

    Typically, the system may have hidden statesx(t)

    u(t)

    w(t)

    v(t)

    y(t)x(t)

  • 7/28/2019 EEM614-1

    9/34- 9/31

    Example 1: Solar-Heated House (Ljung)

    The sun heats the air in the solar panels

    The air is pumped into a heat storage (box filled with pebbles)

    The stored energy can be later transferred to the house

    Were interested in how solar radiation, w(t), and pump velocity, u(t),affect heat storage temperature, y(t).

  • 7/28/2019 EEM614-1

    10/34- 10/31

    Example 2: Military Aircraft (Ljung)

    Aim is to construct a mathematical model of dynamic behaviour to

    develop simulators, synthesis of autopilots and analysis of itsproperties

    Data below used to build a model of pitch channel, i.e. how pitch rate,

    y(t), is affected by three separate control signals: elevator (aileron

    combinations at the back of wings), canard (separate set of rudders

    at front of wings) and leading flap edge

  • 7/28/2019 EEM614-1

    11/34- 11/31

    How are Models Used?

    Mathematical models are abstractions/simplifications of reality, whichare good enough for the purpose for which they were developed

    In scientific modelling we aim to increase our understanding aboutcause-effect relationships. The models predictive ability can beused to test the model (e.g. Newton, Halley)

    Models can be used forprediction and control. Here the predictive

    ability is a key aspect, but this can be influenced by the modelssimplicity if it has to be estimated from exemplar data (e.g. modelpredictive control).

    Models can be used forstate estimation. Here the aim is to trackvariables which characterize some dynamical behaviour byprocessing observations afflicted errors (e.g. estimating position

    and velocity of Apollo moon landing).Models can be used forfault detection. Here predicted behaviour is

    assessed against the actual behaviour to determine whether theplant is operating normally or not.

    Models can be also be used forsimulation and operator training.

  • 7/28/2019 EEM614-1

    12/34- 12/31

    Identifying a System

    A system is constructed from observed/empirical data

    Models of car behaviour (acceleration/steering) are built fromexperience/observational data

    Generally, there may exist some prior knowledge (often formedfrom earlier observational data) that can be used with theexisting data to build a model. This can be combined in

    several ways: Use past experience to express the equations

    (ODEs/difference equations) of the system/sub-systems anduse observed data to estimate the parameters

    Use past experience to specify prior distributions for theparameters

    The term modelling generally refers to the case whensubstantial prior knowledge exists, the term systemidentification refers to the case when the process is largelybased on observed input-output data.

  • 7/28/2019 EEM614-1

    13/34- 13/31

    Introduction: ARX Model

    Consider a discrete-time ARX model (no disturbances)

    (well fully define these terms later). This can be used for

    prediction using:

    and introducing the vectors:

    the model can be written as

    Note, that the prediction is a function of the estimated

    parameters which is sometimes written as

    )()1()()1()( 11 mtubtubntyatyaty mn ++=+++

    )()1()()1()( 11 mtubtubntyatyaty mn +++=

    [ ]

    [ ]T

    T

    mn

    mtutuntytyt

    bbaa

    )()1()()1()(

    11

    =

    =

    x

    x )()( tty T=

    x )()|( tty T=

  • 7/28/2019 EEM614-1

    14/34- 14/31

    Introduction: Least Squares

    EstimationBy manipulating the control signal u(t) over a period of time 1tN, we

    can collect the data set:

    Lets assume that the data is generated by:

    Where is the true parameter vector and (0,2) generates zero mean,normally distributed measurement noise with standard deviation .

    We want to find the estimated parameter vector, , that best fits this data

    set.

    Note that because of the random noise, we cant fit the data exactly, but

    we can minimise the prediction errors squared using

    Where X is the matrix formed from input vectors (one row per observation,

    one column per input/parameter) and y is the measured output vector

    (one row per observation

    )}(),(,),1(),1({ NyNuyuZN =

    ),0()()( 2+= x tty T

    yXXXTT 1)( =

  • 7/28/2019 EEM614-1

    15/34- 15/31

    Example: First Order ARX model

    Consider the simple, first order, linear difference equation, ARX

    model:

    where 10 data points Z10 = {u(1),y(1), ,u(10),y(10)} are collected.

    This produces the (9*2) input matrix and (9*1) output vector:

    Therefore the parameters =[ab]T can be estimated from

    Using Matlab

    thetaHat = inv(X*X)*X*y

    )1()1()( =+ tbutayty

    =

    =

    )10(

    )3()2(

    )9()9(

    )2()2()1()1(

    y

    yy

    uy

    uyuy

    yX

    yXXX TT 1)( =

  • 7/28/2019 EEM614-1

    16/34- 16/31

    Model Quality and Experimental Design

    The variance/covariance matrix to be inverted

    Strongly determines the quality of the parameter estimates.This is turn is determined by the distribution of the measured

    input data.

    Control signal should be chosen to make the matrix as well-

    conditioned as possible (similar eigenvalues) Number of training data and discrete sample time both affect

    the accuracy and condition of the matrix

    Experimental design is the concept of choosing the

    experiments to optimally estimate the models parameters

    =

    t nt nt n

    t ntt

    t ntt

    T

    txtxtxtxtx

    txtxtxtxtx

    txtxtxtxtx

    )()()()()(

    )()()()()(

    )()()()()(

    2

    21

    2

    2

    212

    121

    2

    1

    XX

  • 7/28/2019 EEM614-1

    17/34- 17/31

    System Identification Process

    In building a model, the designer has

    control over three parts of theprocess

    1. Generating the data setZN

    2. Selecting a (set of) model structure

    (ARX for instance)3. Selecting the criteria (least squares

    for instance), used to specify the

    optimal parameter estimates

    There are many other factors that

    influence the final model, however,

    this course will focus on these three

    factors and the method for

    (recursive) parameter estimationValidate

    Model

    Calculate Model

    Choose

    Criterion

    of Fit

    Choose

    Model Set

    Data

    Experiment

    Design

    Prior

    knowledge

  • 7/28/2019 EEM614-1

    18/34- 18/31

    Lecture 2: Signal and System Representation

    1. Signal representation Continuous and discrete time signals

    Impulse and step signals

    Exponential signals

    Time shifting signals

    2. Systems representation

    Differential equations

    Difference equations Linear/non-linear systems

    Non-parametric system representations

    Signal

  • 7/28/2019 EEM614-1

    19/34- 19/31

    Continuous & Discrete-Time SignalsContinuous-Time (CT) Signals

    Most signals in the real world are

    continuous time, as the scale isinfinitesimally fine.

    Eg voltage, velocity,

    Denote byx(t), where the time intervalmay be bounded (finite) or infinite

    Discrete-Time (DT) Signals

    Some real world and many digitalsignals are discrete time, as they aresampled

    E.g. pixels, daily stock price (anythingthat a digital computer processes)

    Denote byx(k), where kis an integervalue that varies discretely

    Sampled continuous signal

    x(tk) =x(kT) Tis sample time

    Often the notationx(t) is just used,

    and ttakes integer values.

    x(t)

    t

    x(tk)

    tk

    Signal

    Signal

  • 7/28/2019 EEM614-1

    20/34- 20/31

    Discrete Unit Impulse and Step Signals

    The discrete unit impulse signal is defined:

    Critical in convolution as a basis foranalyzing other DT signals

    The discrete unit step signal is defined:

    Note that the unit impulse is the first

    difference (derivative) of the step signal

    Similarly, the unit step is the running sum(integral) of the unit impulse.

    =

    ==0100)()(

    ttttx

    >

    C

    a

    0

    0

    >

    1, stretching if 0

  • 7/28/2019 EEM614-1

    24/34- 24/31

    ODE System Representation

    The signals y(t)=vc(t) (voltage across capacitor) andx(t)=v

    s(t) (source

    voltage) are patterns of variation over time

    Note, we could also have considered the voltage across the resistor orthe current as signals and the corresponding system would be

    different.

    +

    -i(t) vc(t)vs(t)

    R

    C)()(

    )(

    )()(

    )()()(

    tvtvdt

    tdvRC

    dt

    tdvCti

    tvtvtRi

    scc

    c

    cs

    =+

    =

    =

    Step (signal) vs(t) at t=0

    RC= 1 First order (exponential)

    response forvc(t)

    vs,v

    c

    System

    System

  • 7/28/2019 EEM614-1

    25/34- 25/31

    General LTI ODE SystemsA general Nth-order LTI differential equation is:

    This system has the following properties:

    Ordinary differential equation: the system only involves derivatives

    involving a single variable: time.

    Linear: the system is a sum of (weighted) input and outputderivatives only. So ax1(t)+bx2(t)ay1(t)+by2(t)

    Time invariant: the coefficients {ak,bk} are constant and do not

    depend on time. Sox(t)y(t) x(t-T)y(t-T)

    Causal: the system does not respond before an input is applied. Sothe RHS does not include terms likex(t+T), where T>0.

    These LTI ODE systems can represent many electrical and physical

    systems

    Obvious Laplace transform of the CT system

    == =M

    kk

    k

    k

    N

    kk

    k

    kdt

    txd

    bdt

    tyd

    a00

    )()(

    System

    System

  • 7/28/2019 EEM614-1

    26/34- 26/31

    General LTI ODE Solution

    Consider a signal y(t) = Cert (C, rare Complex) and substitute it

    into the left hand side of the (unforced) LTI ODE:

    When r=rk, a root of the above polynomial, this is a solution.

    There are Nsuch solutions, and the overall solution y(t) is a

    linear combination of these solutions. As {ak} are real, then the

    roots rk must be complex or imaginary conjugate pairs, or real

    If all the solutions are exponential decays, Re(rk)0, the system is unstable

    0

    0

    0

    0

    =

    =

    =

    =

    N

    k

    k

    k

    N

    k

    k

    k

    rt

    ra

    raCe

    System

    System

  • 7/28/2019 EEM614-1

    27/34- 27/31

    Discrete Time Difference Equation Systems

    Consider a simple (Euler)

    discretisation of thecontinuous time system

    Discrete-Time Systems

    Discrete time systems

    represent how discrete

    signals are transformed

    via difference

    equationsE.g. discrete electrical

    circuit, bank account,

    ( )( ) ( )

    ( 1) ( )( ) ( )

    ( ) (1 ) ( 1) ( 1)

    cc s

    c cc s

    T Tc c sRC RC

    dv tRC v t v t

    dtv t v t

    RC v t v tT

    v t v t v t

    + =

    + + =

    = +

    First order, linear, time invariant

    difference equation

    y(t)

    t

    System

    System

  • 7/28/2019 EEM614-1

    28/34- 28/31

    General LTI Difference Systems

    A general Nth-order LTI difference equation is

    This system has the following properties:

    Involves a single index (discrete time) t.

    Linear: the system is a sum of (weighted) input and outputderivatives only. So ax

    1(t)+bx

    2(t)ay

    1(t)+by

    2(t)

    Time invariant: the coefficients {ak,b

    k} are constant and do not

    depend on time. Sox(t)y(t) x(t-T)y(t-T)

    Causal: the system does not respond before an input is applied.So the RHS does not include terms likex(t+k), where k>0.

    These LTI difference equation systems can represent many

    electrical and physical systems

    Obvious z-transform representation of the DT system

    == =M

    k

    k

    N

    k

    k ktxbktya10

    )()( a0=1

    System

    System

  • 7/28/2019 EEM614-1

    29/34- 29/31

    General LTI Difference Solution

    Consider a powersignal y(t) = Czt (C, zare Complex) and

    substitute it into the left hand side of the (unforced) diff eqn

    When z=zk, a root of the above polynomial, this is a solution.

    There are Nsuch solutions, and the overall solution y(t) is a

    linear combination of these solutions. As {ak} are real, then

    the roots zkmust be complex or imaginary conjugate pairs, or

    real

    If all the solutions are exponential decays, |zk|1, the system is unstable

    0

    0

    0

    0

    )(

    =

    =

    =

    =

    N

    k

    kN

    k

    N

    k

    kN

    k

    Nt

    za

    zaCz

    y

  • 7/28/2019 EEM614-1

    30/34- 30/31

    L1&2 Conclusions

    Basic introduction to system identification and parametric identification

    Reviewed some basic results about signals

    simple impulse and step basis signals

    linear time transformations of signals

    complex exponential signals

    Reviewed some basic results about systems

    differential and difference equation representation

    basic properties, LTI, stable, causal,

    how to solve the ODE/difference equations

    Much of the course will assume a familiarity with such basic theory.

    Next lectures, have a look at classical system identification

    (impulse/frequency response) and calculating a prediction

  • 7/28/2019 EEM614-1

    31/34- 31/31

    L1&2 Matlab Exercises

    Remember, when starting Matlab, change to the P: drive and turn the

    diary on/save Simulink files.

    1. Create the CT first-order system described on Slide 24 into Simulink

    and check the response

    2. Enter the DT first-order system described on Slide 27 into a Matlab

    function and verify its behaviour (note the stem() function may be

    useful). Try RC=3, with a sample time of=0.1s.

    3. Investigate how you can use the roots() function in Matlab to

    solve (unforced) LTI differential and difference equations

    4. Use the information on slide 16 to identify the parameters of the

    discrete time model described in question (2). Use the eigs()

    function to check the condition/structure of the XTX matrix

    5. Complete any of the programming exercises from the first 4

    Matlab/Simulink labs. It is very important that you are a competent

    Matlab programme and Simulink model developer.

  • 7/28/2019 EEM614-1

    32/34- 32/31

    L1&2 Theory Exercises

    ****

  • 7/28/2019 EEM614-1

    33/34

    - 33/31

    Appendix A: General Complex Exponential Signals

    So far, considered the real and periodic complex exponential

    Now consider when Ccan be complex. Let us express Cis polar formand a in rectangular form:

    So

    Using Eulers relation

    These are damped sinusoids

    0

    jra

    eCC j

    +=

    =

    tjrttjrjat eeCeeCCe )()( 00 ++ ==

    ))sin(())cos(( 00)( 0 teCjteCeeCCe rtrttjrjat +++== +

  • 7/28/2019 EEM614-1

    34/34

    Appendix B: Periodic Complex

    Exponential & Sinusoidal SignalsConsider when a is purely imaginary:

    By Eulers relationship, this can be expressed

    as:

    This is a periodic signals because:

    when T=2/0

    A closely related signal is the sinusoidal

    signal:

    We can always use:

    tjCetx 0)( =

    tjtetj

    00 sincos0 +=

    tj

    Ttj

    etjt

    TtjTte

    0

    0

    00

    00)(

    sincos

    )(sin)(cos

    =+=+++=+

    ( ) += ttx 0cos)( 00 2 f =

    ( ) ( )( ) ( ))(0

    )(

    0

    0

    0

    sin

    cos

    +

    +

    =+

    =+tj

    tj

    eAtA

    eAtA

    T0 = 2/0=

    cos(1)

    T0 is the fundamental

    time period

    0 is the fundamental

    frequency