A Toolbox for Recursive Identifi- cation of Dynamical Systems Ľuboš Čirka, Miroslav Fikar Abstract The dynamical system IDentification TOOLbox (IDTOOL) for MATLAB/Simulink is presented. This toolbox implements blocks for continuous-time and discrete-time recursive least squares parameter estimation methods, respectively. The work- house routine used is LDDIF. Key words: Identification, LDDIF, MATLAB, Simulink Introduction The most often used estimation methods nowadays are based on minimisation of squares of errors between meas- ured and estimated process output – the least squares method (LS). Main advantages include the possibility of recursivity of calculations, possibility to track time variant parameters, and various modifications to make the algo- rithm robust. Originally the method was derived for estima- tion of parameters of discrete-time systems. Modifications are also possible for continuous-time systems. This paper describes the use of the dynamical system IDen- tification TOOLbox (IDTOOL). The toolbox contains blocks for the identification of SISO (MIMO) linear time invariant systems. The development is based on the work published in [1], [2]. The toolbox supports only polynomial (transfer function) representation. Previous versions of IDTOOL used S-function representa- tion implemented in MATLAB for all blocks. However, this is not an option in some cases. For example real-time envi- ronment dSPACE can only use S-function in programming language C. Therefore, one of the new features of this ver- sion is C representation of blocks. 1. Algorithm The identification method used as a work-house routine is LDDIF – recursive least squares algorithm with exponential and directional forgetting [2]. To improve the tracking per- formance, the corrections as suggested by Bittanti [1] are implemented. In the principle, the corrections influence the covariance matrix of the estimated parameters by adding some multiple of identity matrix. This recursive estimation algorithm for given observation vector ) (t φ and parameter vector ) 1 ( − t Θ can be de- scribed by the equations: ) 1 ( ) ( ) ( ) ( − − = t t t t T Θ φ y ε ) ( ) 1 ( ) ( ) ( t t t t r T φ P φ − = ) ( 1 ) ( ) 1 ( ) ( t r t t t + − = φ P k ⎪ ⎩ ⎪ ⎨ ⎧ = > − − = 0 ) ( 1 0 ) ( ) ( 1 ) ( t r if t r if t r t λ λ β I P φ φ P P P δ β + + − − − − = − ) ( ) ( ) 1 ( ) ( ) ( ) 1 ( ) 1 ( ) ( 1 t r t t t t t t t T ) ( ) ( ) 1 ( ) ( t t t t ε k Θ Θ + − = where λ is exponential forgetting. The initial values for the algorithm are usually 985 . 0 = λ , I P 6 10 ) 0 ( = , 01 . 0 = δ . 2. Implementation This algorithm has been implemented in Simulink as M- function lddif_s.m and C-MEX-function lddif_c.dll with the inputs being observation vector ) (t φ and actual process output ) (t y , states being the estimated parameter matrix ) (t Θ and the covariance matrix ) (t P , and outputs being the same as states. As Simulink allows only for vectors and not matrices of signals, all I/S/O vectors/matrices are stacked into corresponding column vectors. This formulation of a parameter estimation method is fairly general and thus any other method can be used in the place of LDDIF. Of course, there are some parameters significant to LDDIF only ( δ , λ ) that are needed as well. Furthermore, in the actual implementation, it is possible to specify a priori knowledge about the parameters and their covariance ma- trix. For a more precise description of the LDDIF implemen- tation see the manual 1 . 2.1 Discrete-time Case Consider a discrete-time multi-input multi-output (MIMO) system of the form ) ( ) ( ) ( ) ( 1 1 t z t z u B y A − − = (1) where ] [ n n × A and ] [ m n × B are polynomial matrices given as 1 http://www.kirp.chtf.stuba.sk/~cirka/idtool 44 AT&P journal PLUS2 2007 MODELLING, SIMULATION, AND IDENTIFICATION OF PROCESSES