<<

Faculty of Technology and Science Department of Physics and Electrical Engineering

Paluri Suraj and Patluri Sandeep

A Study of Impulse Response System Identification

Degree Project of 10 credit points Master Program in Electrical Engineering

Date/Term: 07-06-14 Supervisor: Magnus Mossberg Examiner: Magnus Mossberg

Karlstads universitet 651 88 Karlstad Tfn 054-700 10 00 Fax 054-700 14 60 [email protected] www.kau.se A Study of Impulse Response System Identification

Abstract:

In system identification, different methods are often classified as parametric or non- parametric methods. For parametric methods, a parametric model of a system is considered and the model parameters are estimated. For non-parametric methods, no parametric model is used and the result of the identification is given as a curve or a function.

One of the non-parametric methods is the impulse response analysis. This approach is dynamic simulation. This thesis introduces a new paradigm for dynamic simulation, called impulse-based simulation. This approach is based on choosing a Dirac function d (t) as input, and as a result, the output will be equal to the impulse response. However, a Dirac function cannot be realized in practice, and an approximation has to be used. As a consequence, the output will deviate from the impulse response. Once the impulse response is estimated, a parametric model can be fitted to the estimation.

This thesis aims to determine the parameters in a parametric model from an estimated impulse response. The process of investigating the models is a critical aspect of the project. Correlation analysis is used to obtain the weighting function from the estimates of covariance functions.

Later, a relation formed between the parameters and the estimates (obtained by correlation analysis) in the form of a of equations. Furthermore, simulations are carried out using Monte Carlo for investigating the properties of the two step approach, which involves in correlation analysis to find h-parameters and least squares and total least squares methods to solve for the parameters of the model. In order to evaluate the complete capability of the approach to the noise variation a study of signal to noise ratio and mean, mean square error and variances of the estimated parameters is carried out.

The results of the Monte Carlo study indicate that two-step approach can give rather accurate parameter estimates. In addition, the least squares and total least squares methods give similar results.

1 ACKNOWLEDGEMENT

This thesis project is a compulsory part of the International Master’s programs that the authors attend, and it leads to the degree of Master of Science in Electrical Engineering.

First of all, we would like to take this opportunity to express our sincere gratitude to our supervisor Dr.Magnus Mossberg for giving the opportunity of doing our Master Thesis Project and have given us invaluable expertise throughout the project.

In addition, we would also like to thank Dr.Andreas Jakobsson for his invaluable support and kind consideration.

Finally, we would like to thank our parents, friends and well wishers for their moral and unconditional support.

2 Contents

1 Introduction 5 1.1 System Identification 5 1.2 System 5 1.3 Model Structure 5 1.4 Modelling a dynamic system 6 1.5 Types of models 6 1.6 System Identification Procedure 7

2 Types of System Identification Methods 8 2.1 Parametric Methods 8 2.2 Least Squares 8 2.3 Prediction Error Method (PEM) 8 2.4 Instrumental Variable Method 9 2.5 Total Least Squares 9

3 Non-Parametric Methods 10 3.1 Transient Analysis 10 3.1.1 10 3.1.2 Impulse Response 10 3.2 Freqency Analysis 12 3.3 Correlation Analysis 13 3.4 Spectral Analysis 15

4 Estimation of Parameters 16 4.1 Task1 16 4.2 Task 2 17 4.3 Task 3 19 4.4 Task 4 20 4.5 Two-Step Approach 21

5 Monte Carlo 23 5.1 Simulation and Results 26

Conclusions 35

References 36

Appendix 37

3 Overview:

The purpose of this thesis is to develop a model which has a weighting function that coincides with an estimated sequence. A parametric model is determined from the impulse response for this study. Methods such as parametric and non parametric way of estimation are used. To conduct this study we use correlation technique among the non- parametric methods. This leads to estimating the weighting function.

Initially, we introduce system identification and its importance in science and engineering. Also, basic model structures involved are discussed. Later, different types of methods in system identification such as parametric and non-parametric methods are explained in detail. Our interest is on impulse response system identification, which is a non-parametric method.

Later, a series of tasks involving polynomial formulation and impulse response are undergone to effectively estimate the parameters. A Monte Carlo study is done to investigate the properties of the two-step procedure, which involves correlation analysis for finding the h-parameters. These h-parameters are plugged into a linear system of equation of the form AX=B. Later least squares and total least squares are performed to solve for X (will be studied in chapter 4 and 5).

Further investigations of the parameters include impulse based simulations modeled with increased noise and the plots for signal to noise (SNR) ratio versus mean, mean square error (MSE) and variances of the estimated parameters in order to achieve a model that is best suited to the system.

4 1. Introduction:

In control and systems engineering, system identification methods are used to get appropriate models for design of prediction algorithm, or simulation. In applications, models obtained by system identification are used for spectral analysis, fault detection, pattern recognition, adaptive filtering, linear prediction and other purposes.

In recent times, system identification techniques have delivered powerful methods and tools for data-based system modeling. While the theory for identification of linear systems has become very mature, the challenges for the field are in modeling and developing of more complex dynamical systems (nonlinear, distributed, hybrid, large scale), and in task-oriented issues (identification for control, diagnosis etc).They also have wide applications in non-technical fields such as biology, environmental sciences and econometrics to develop models for increasing scientific knowledge on the identified object, or for prediction and control.

1.1 System Identification:

System identification deals with the problem of constructing the mathematical model of a dynamic system based on a given set of experimental data. Several fundamental concepts about system identification are introduced in this section. The procedures of building the estimated model by means of system identification technique are also given.

1.2 System:

To denote a mathematical description of a process we use the word system. In reality that provides the experimental data will generally be referred to as a process. In order to perform a theoretical analysis of the identification methods it is necessary to introduce assumptions on the data. As it is not necessary to know the system, we will use the system concept only for investigating of how different identification methods behave under different circumstances.

1.3 Model Structure:

In many cases while dealing with problems related to system identification we deal with parametric models, such models are characterized by a parameter vector, which we denote by q .The corresponding model will be denoted M(q ).When q is varied over a set of feasible values we obtain a model structure.

Sometimes, we use non-parametric models such a model is described by a curve, function or table. An impulse response is an example. It is curve or function which carries some information about the characteristics of the system, which we later on study in detail.

5 1.4 Modeling a Dynamic System:

A system is an object in which variables of different kinds interact and produce observable signals. The observable signals that are of interest to us are usually called outputs.

The system is also affected by external stimuli. External signals that can be manipulated by the observer are called inputs and others are called disturbances, which are further divided into those that are directly measured and those that are only observed through their influence on the output. The distinction between input and measured disturbance is of less importance for the modeling process.

System identification is a field of modeling dynamic systems from experimental data. A Dynamic system is described in the following figure.

v (t)

w (t)

y (t) u (t)

Figure 1.1 A Dynamic Model

This system has an input u(t), output y(t), measured disturbance w(t), unmeasured disturbance v(t). For a dynamic system the control at time t will influence the time instants s>t.

1.5 Types of Models:

The purpose of a model is to describe how the various variables of the system relate to each other. The relationship among these variables is called a model of the system. Modeling the system of interest is considerably useful in many areas of science as an aid to properly describe the system’s behavior. A good model must reflect all properties of

6 such an unknown system. There are several kinds of models which can be classified as follows: · Mental models which do not involve a mathematical formula. For instance, when driving a car, one is required the knowledge of turning the wheel, pushing the brake, etc. · Graphical models which are also suitable for some certain systems using numerical tables and/or plots. For example, any linear systems can be uniquely described by their impulse, step, or which can be obviously represented in graphical forms. · Mathematical models which describe how the variables relate to each other in terms of mathematical expressions such as differential and difference equations. The mathematical models are useful in practice because they provide a description of the system’s behavior by mathematical expressions, which are simple to examine and analyze. Mathematical models can be derived in two ways:

1. Modeling refers to derivation of models from basic laws in physics, , etc., to describe the dynamic behavior of a phenomenon or a process. It is done by subdividing an unknown system into subsystems, whose properties are well known from the basic laws, and thus combining these subsystems mathematically to obtain the whole system.

2. Identification refers to the determination of dynamic models from experimental data. It consists of the establishment of identification experiment, the determination of a suitable form of a model coupled with its parameters, and a validation of the model.

1.6 System Identification Procedure:

The system identification procedure follows the natural logic, step-by-step approach to the procedure. First collect data, and then choose a model set, then pick the best model set. It is quite likely, though, that the model first obtained will not pass the model validation tests [3].We must then go back and check the various steps of the procedure.

The model may be deficient for a variety of reasons.

1. The numerical procedure failed to find the best model according to the criterion. 2. The criterion was not well chosen. 3. The model set was not appropriate, in that it did not contain any good enough description of the system. 4. The data set was not informative enough to provide guidance in selecting good models.

7 2. Types of System Identification Methods

2.1 Parametric Methods:

The approach of mapping from the recorded data to the estimated parameter vector (discussed previously) and that is used to estimate the model parameters based only on a given set of observed data is often called parametric identification.

2.2 Least Squares

Least squares method is an example of parametric method which is used to estimate the model parameters later sections of this presentation.

Given a set of experimental data, the problem of modeling an unknown system is to find a good estimated model and its parameters which can characterize the system’s behavior as accurately as possible. Having chosen the best estimated model, the next task is to find the values of its parameters. There are many estimators, which possess nearly all properties of an ideal estimator, leading to good estimated parameters, such as Bayes estimator, Maximum Likelihood estimator, Markov estimator and Least Squares estimator [2]. Bayes estimator is the most powerful estimator, but it, however, requires the most a priori information, e.g. a probability density function (p.d.f.) of the unknown parameters and the p.d.f. of the noise on the measurements. On the contrary, the Least squares estimator can still be used even if there is no a priori information available. In this section, we shall then introduce a least squares method. The statistic properties of an ideal estimator are also given.

2.3 Prediction Error Method (PEM)

Prediction-error methods (PEMs) are a broad family of parameter estimation methods that can be applied to quite arbitrary model parameterizations.

Let the input and output to the system be denoted by u and y, respectively. The output at time t will be y(t), and similarly for the input. These signals may be vectors of arbitrary (finite) dimension. Let Z N = {u(1), y(1), u(2), y(2) . . . . u(N), y(N)} collect all past data up to time N. For the measured data, Assume that they have been sampled at discrete time points (for simplicity).

The basic idea behind the prediction error approach is very simple. Describe the model as a predictor of the next output:

Ù t-1 ym (t | t -1) = fZ

8 Ù Here ym (t | t -1) denotes the one-step ahead prediction of the output, and f is an arbitrary function of past, observed data.

Parameterize the predictor in terms of a finite-dimensional parameter vector q :

Ù y(t |q ) = f (Z t-1 ,q )

Some regularity conditions may be imposed on the parameterization [3].

Determine an estimate of q (denotedq N ) from the model parameterization and the Ù Ù observed data set Z N , so that the distance between y(1|q ),...... , y(N |q ) and y(1) . . . . . y(N) is minimized in a suitable norm. If the above-mentioned norm is chosen in a Ù particular way to match the assumed probability density functions, the estimate q N will coincide with the maximum likelihood estimate.

2.4 Instrumental variable method

In typical cases the LS will not tend to true value, the reason being correlation between known data-dependent vector and regression vector. To overcome above problem, a new general correlation vector z is introduced instead of regression vector. The elements of general correlation vector are then called instruments or instrumental variables.

-1 Ù IV N N N é 1 T ù é 1 ù q N = arg minVN (q, Z ) = z (t)j (t) z (t)y(t) q ê å ú ê å ú ë N t=1 û ë N t=1 û

2.5 Total Least Squares

It is robust modeling technique, which assumes every variable can have error or noise. It is also often referred as Errors-in-Variables(EIV).

If the data matrices A,B are also noisy (i.e. error in both the dependent and the explanatory variables), the Least Squares solution is no longer optimal. In such cases where orthogonal optimization is acceptable, Total Least Squares offers a proper formulation

9 3. Non-parametric Methods:

The property by which the resulting models are of the form, curve or functions, such a identification method is known to be a non-parametric method. Some of the non- parametric methods which are widely used are described below:

3.1 Transient Analysis:

The input is taken as a step or an impulse and the recorded output constitutes the model. It is simple in application. It is very sensitive to noise.

Generally, in this approach the use of impulse as input is common practice in certain applications. For example, it is used in biomedical applications.

3.1.1 Step Response:

The use of step response in transient analysis as input is to fit a simple-low order model. Where the first and second order systems are described using the model.

Y(s) = G(s)U(s)

Where, Y(s) is the of the output signal y (t), U(s) is the Laplace transform of the input u (t). G(s) is the transfer function of the system.

3.1.2 Impulse Response:

The impulse response of a system is its output when presented with a brief signal, an impulse. While an impulse is a difficult concept to imagine, it represents the limit case of a pulse made infinitely short in time while maintaining its area or integral (thus giving an infinitely high peak).

Consider a system with a scalar input & output signals u(t) & y(t) respectively. If the system is time invariant, its response to a certain time signal does not depend on absolute time. It is linear if its output response to a linear combination of inputs is the same linear combination of the output response of the individual input. It is causal if the output at a certain time depends on the input upto that time only.

It is well known that a linear, time invariant, causal signal can be described by its impulse response or its weighting function g(t ),

10 ¥ y(t) = ò g(t )u(t -t )dt t =0 ¥ From the above equation, knowing that {g(t )}t =0 and knowing the input u(s) for s £ t We can compute the corresponding output y(s), s £ t for any input. The impulse response is a complete characterization of the system.

As we have seen earlier, a Dirac function delta, d (t) is needed as input and output will be equal to the weighting function h(t) of a system. While this is impossible in practice to realize an ideal impulse, it is a useful concept as an idealization, and an approximate impulse must be used

We consider the following example to understand the impulse response. ì1/a 0 £ t < a u(t) = í (1) î0 a £ t

This input satisfies integral òu(t)dt = 1 as the idealized impulse

The above input (1) will give a distortion of output as it can be seen from the simple calculation:

¥ 1 t y(t) = ò h(s)u(t - s)ds = ò h(s)ds » h(t) 0 a max(0,t-a )

If the duration of a of impulse (1) is short compared to the time constants, then the distortion introduced may be negligible. This can be shown in the following way:

Considering the a damped oscillator with transfer function 1 G(s) = s 2 + 0.8s +1

Therefore we calculate the weighting function and the responses to the approximate impulse we have considered above and various values of impulse durationa . It can be seen from the figure that impulse response will deviate very little from the weighting function if alpha is small compared to the oscillation. The different values of a = 0.1, 0.5 &1 respectively as depicted in the plot below.

11 Figure 3.1 Weighting function and impulse responses of the damped oscillator excited by an approximate impulse.

We have discussed the concept of impulse response and seen the results of the weighting function for differenta .

3.2 Frequency Analysis:

For a linear system in steady state the input is considered to be sinusoid and the resulting output will also be the same (a sinusoid). The change in amplitude and the phase will give the frequency response for the used frequency. A large number of frequencies have to be considered to get a good picture of the frequency function.

If the input signal is a sinusoid u(t) = asin(wt) and the system is asymptotically stable. Then in the steady state the output is equivalent to,

y(t) = bsin(wt + j),

12 Where, b = a G(iw)

j = arg G(iw)

The frequency analysis method can be improved by using correlation technique. The output is multiplied bysin(wt) & cos(wt) and the result is integrated over the interval [0, T].

It requires long identification experiments, especially if the correlation feature is included in order to reduce sensitivity to noise. The resulting model is a frequency response. It can be presented as a ‘Bode plot’ or an equivalent representation of the transfer function. A large number of frequencies have to be considered in order to get a good picture of the frequency function.

3.3 Correlation Analysis:

A normalized cross-covariance function between output and input will provide an estimate of the weighting function. It is generally based on white noise as input. It is rather insensitive to additive noise on the output signal.

The model used in correlation analysis is of the form

¥ y(t) = å h(k)u(t - k) + v(t) k=0 h(k) is the weighting sequence and v(t) is the disturbance term. The input is assumed to be a stationary stochastic process, is independent of the disturbances.

The following relation holds good for the covariance function ¥ ryu (t ) = åh(k)ru (t - k) k =0

Where, ryu (t ) = Ey(t +t )u(t) and ru (t ) = Eu(t +t )u(t) now the covariance function for the above equation is estimated from the data as,

Ù 1 N -max(t ,0) (t ) = y(t +t )u(t) t = 0, ±1, ± 2,... r yu å N t=1-min(t ,0) where, N denotes the maximum number of elements that can be used, and where

Ù 1 N -t Ù Ù r u (t ) = åu(t +t )u(t) r u (-t ) = r u (t ) t = 0, 1, 2.... N -t t=1 … (3.25)

13 Ù Then an estimate h(k) of the weighting function h(k) can be determined by solving,

Ù ¥ Ù Ù r yu (t ) = å h(k) r u (t - k) (A) k=0

We arrive at a linear system of infinite dimension. Thus the problem is greatly simplified as we use white noise as input.

h(k) = ryu (k) / ru (0) Ù Ù It is easy to estimate from the above formulation of r yu (t ) & r u (t )

Another approach is finite impulse response (FIR) model in signal processing applications. A simplification of the equation (A) is to consider a truncated weighting function. This leads to a linear system of finite order. Assume that, h (k) = 0 k ³ M

The integer M should be chosen to be large in comparison with the dominant time constant of the system. Then this will be a good approximation.

Using the above approximation (A) becomes

Ù M -1 Ù Ù r yu (t ) = å h(k) r u (t - k) k=0

Writing the above equation for t = 0, 1, 2,..M-1.

The following linear system is obtained,

æ Ù ö æ Ù ö ç r (0) ÷ æ Ù Ù ö h(0) yu r (0) ...... r (M -1) ç ÷ ç ÷ ç u u ÷ ç ÷ : ç Ù ÷ : ç ÷ r (1) . : ç ÷ ç : ÷ ç u ÷ ç : ÷ ç ÷ = ç : . : ÷ ç ÷ …(3.30) ç : ÷ ç ÷ : : . : ç ÷ ç : ÷ ç ÷ ç : ÷ ç Ù Ù ÷ ç Ù ÷ ç Ù ÷ ç ÷ èru (M -1) . . .. ru (0) ø ç ÷ èryu (M -1)ø èh(M -1)ø

This method of determining h (k) can also be applied with more than M different values of t giving rise to an over-determined linear system of equations.

14 3.4 Spectral analysis:

The final non-parametric method to be described is spectral analysis. This approach takes arbitrary values as input. The transfer function is obtained in the form of a ‘bode plot’. Generally, a lag window is used to get an accurate estimate. This leads to a limited frequency resolution.

Consider the following equation, ¥ ryu (t ) = åh(k)ru (t - k) k =0 By taking discrete- to the above relation, Yields,

-iw F yu (w) = H (e )F u (w)

Where,

¥ 1 -itw F yu (w) = å ryu (t )e , 2p t =-¥

¥ 1 -itw Fu (w) = å ru (t )e , 2p t =-¥

¥ H (e-iw ) = å h(k)e-iwk k =0

Now the transfer function H (e-iw ) can be estimated as follows, Ù Ù -iw F yu (w) H (e ) = Ù F u (w)

To use the above equation a straight forward approach would be to take,

Ù ¥ Ù 1 -itw F yu (w) = år yu (t )e 2p t =-¥

15 4. Estimation of Parameters

Having discussed about the different parametric & non-parametric methods, the next step is to estimate its parameters in order to characterize the system of interest. This is known as a key step in system identification.

We now move on to determine the parametric model and deal with the tasks described in Problem 3.11 in [1].

As we have seen earlier about the impulse response and weighting function in chapter 3. ¥ Assuming that we know an impulse response {h(k)} k =1 Then, we consider an nth order parametric model of the form

A (q-1) y (t) = B (q-1) u (t) (1)

Which is to be determined from the impulse response h (k), where

-1 -1 -n A (q ) = 1+a1q +…+anq

-1 -1 -n B (q ) = b1q +…+bnq

4.1 Task 1: ¥ Set H (q -1 ) = å h(k)q -k Show that the above procedure can be described in a k =1 polynomial form as

B (q-1) =A (q-1) H (q-1) + O (q-2n-1)

Solution: Model (1) has a weighting function that coincides with the given sequence for k=1…2n

Consider Equation 2.5 in [1] ¥ y(t) = å h(k)u(t - k) + v(t) k =1

Where h (k) is the weighting function sequence and v (t) is the disturbance which is neglected as a noise-free system is considered. Let u (t) be white noise, of zero mean and variance s 2 which is independent of disturbances.

16 Re-write the above equation as,

2n ¥ y(t) = å h(k)u(t - k) + å h(k)u(t - k) …. Actual output k =1 k=2n+1

By Equation (1) we know, A(q-1)y(t)= B(q-1)u(t)

B(q -1 )u(t) y(t) = ……Model output A(q -1 )

Equating actual output and model output, We have,

B(q -1 )u(t) 2n ¥ = h(k)u(t - k) + h(k)u(t - k) -1 å å A(q ) k=1 k =2n+1

2n ¥ B(q -1 ) u(t) = A(q -1 ) å h(k)q -k u(t) + A(q -1 ) å h(k)q -k u(t) k=1 k =2n+1

¥ Set H (q -1 ) = å h(k)q -k k =1 For k=1,…,2n ¥ B(q-1) = A(q -1 )H (q -1 ) + A(q-1) åh(k)q -k k=2n+1 ¥ A(q-1) åh(k)q -k k=2n+1 Implies, ¥ -1 -n -k -2n-1 (1+a1q +…+anq ) å h(k)q this expansion contains terms of the order q and k=2n+1 higher order delay terms subsequently which are neglected, denote as O (q-2n-1).

\The desired polynomial formulation is obtained

B (q-1) =A (q-1) H (q-1) + O (q-2n-1) (2)

4.2 Task 2:

Show that (2), B (q-1) =A (q-1) H (q-1) + O (q-2n-1) Obtained above is equivalent to the following linear system of equations.

17 é 0 0 ...... 0 1 0 ...... 0ù éa1 ù é h(1) ù ê ú ê ú ê ú ê - h(1) 0 ... 0 0 1 0 ... 0ú ê : ú ê : ú ê - h(2) - h(1) ...... 0 0 1 ... 0ú ê : ú ê : ú ê ú ê ú ê ú ê : - h(1) ...... : ú ê : ú ê : ú ê : - h(1) 0 1ú êa ú ê : ú ê ú ê n ú = ê ú ê : - h(1) ú êb1 ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ê : : 0 ú ê : ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ëê- h(2n -1) ...... h(n) ûú ëêbn ûú ëêh(2n)ûú

Solution:

Consider (2), B (q-1) =A (q-1) H (q-1) + O (q-2n-1)

This can be re-written as H (q-1) [1-A (q-1)] + B (q-1) = H (q-1) + O (q-2n-1) (3)

Now expanding the above equation

-1 -2 -3 -1 -2 -n -1 -2 -n [h (1) q +h(2)q +h(3)q …] [1-(1+a1q +a2q +…+anq )] + [b1q +b2q +…+bnq ] = h(1)q-1+h(2)q-2+h(3)q-3…+h(n)q-n + O(q-2n-1)

Comparing the coefficients of q-1 terms

We get h (1)-h (1) +b1 = h (1) Implies b1=h (1) (a)

Comparing the coefficients of q-2 terms

We get h (2)-h (2)-h (1) a1+b2=h (2)

Implies h (2) = -h (1) a1+b2 (b)

Comparing the coefficients of q-3 terms

We get h (3)-h (3)-a1 h (2)-a2h (1) +b3=h (3)

Implies h (3) = -a1 h (2)-a2h (1) +b3 (c)

Similarly comparing the coefficients of remaining powers of q upto q-n

18 From (a), (b), (c)…. we get the following system of linear equations.

é 0 0 ...... 0 1 0 ...... 0ù éa1 ù é h(1) ù ê ú ê ú ê ú ê - h(1) 0 ... 0 0 1 0 ... 0ú ê : ú ê : ú ê - h(2) - h(1) ...... 0 0 1 ... 0ú ê : ú ê : ú ê ú ê ú ê ú ê : - h(1) ...... : ú ê : ú ê : ú ê : - h(1) 0 1ú êa ú ê : ú ê ú ê n ú = ê ú ê : - h(1) ú êb1 ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ê : : 0 ú ê : ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ëê- h(2n -1) ...... h(n) ûú ëêbn ûú ëêh(2n)ûú

4.3 Task 3: Show that the difference equation (1), A(q-1)y(t)= B(q-1)u(t) is described by the linear system of equations as derived in the previous task using the fact that {h(k)} is the impulse response of the system.

Solution:

A (q-1) y (t) = B (q-1) u (t)

Applying impulse response, the above equation can be re-written as,

A(q -1 )h(t) = B(q -1 )d (t)

Expanding, the above equation,

-1 -2 -n -1 -2 -n (1+a1q +a2q +…+anq ) h (t) = (b1q +b2q +…+bnq )d (t)

For t =1,

h (1) + a1h (0) +a2h (-1) +…= b1 d (0) +b2 d (-1) +b3 d (-2) +…. h (1) =b1, (a1) For t = 2, h (2) +a1h (1) +a2 h (2)+..…… = b1d (1) + b2d (0) + b3 d (-1) +…….

h(2)= -a1 h(1)+ b2, (b1) For t = 3,

19 h(3) = -a1 h(2)-a2h (1) +b3 (c1)

From (a1),(b1),(c1)…. We get the following linear system of equations,

é 0 0 ...... 0 1 0 ...... 0ù éa1 ù é h(1) ù ê ú ê ú ê ú ê - h(1) 0 ... 0 0 1 0 ... 0ú ê : ú ê : ú ê - h(2) - h(1) ...... 0 0 1 ... 0ú ê : ú ê : ú ê ú ê ú ê ú ê : - h(1) ...... : ú ê : ú ê : ú ê : - h(1) 0 1ú êa ú ê : ú ê ú ê n ú = ê ú ê : - h(1) ú êb1 ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ê : : 0 ú ê : ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ëê- h(2n -1) ...... h(n) ûú ëêbn ûú ëêh(2n)ûú

4.4 Task 4: Assume that {h (k)} is the noise free impulse response of an nth-order system

-1 -1 A0 (q ) y (t) =B0 (q ) u (t) Where, A0, B0 are co-prime.

Show that above procedure will give us the following result -1 -1 -1 -1 As, A(q ) = A0 (q ) , B(q ) = B0 (q )

Solution:

-1 -1 Consider the system, A0 (q ) y (t) =B0 (q ) u (t)

As {h (k)} is the noise free impulse response,

-1 -1 B0 (q ) H (q ) = -1 A0 (q )

As we know from the previous results,

B (q-1) =A (q-1) H (q-1) + O (q-2n-1), (2)

-1 -1 -1 B0 (q ) -2n-1 B(q ) = A(q ) -1 + O(q ) A0 (q )

20 Divide both sides by A(q-1) ,

-1 -1 B(q ) B0 (q ) -n-1 -1 = -1 + O(q ) A(q ) A0 (q )

As, the system we considered in this case is of nth order,O(q -n-1 ) Being higher order delay terms, we eliminate and arrive at the following result, -1 -1 B(q ) B0 (q ) -1 = -1 A(q ) A0 (q )

A0, B0 are co-prime

We get,

-1 -1 A(q ) = A0 (q ) ,

-1 -1 B(q ) = B0 (q ) .

4.5 Two-Step Approach:

The two-step approach for a system is to find the h-parameters of that system using the correlation analysis, later substituting these h-parameters into a linear system of equations described in Problem 3.11 in [1] and then finding the a and b parameters using least squares or total least squares. The two step procedure is illustrated below in detail.

Consider a general second order system

A(q-1) y(t) =B(q-1) u(t) +v(t)

-1 -1 -2 -n Where A (q )= 1+a1q +a2q +…+anq -1 -1 -2 -n B (q )= b1q +b2q +…+bnq

The covariance functions are found using the Equation 3.25 (chapter 3)

Ù 1 N -max(t ,0) ryu (t ) = å y(t +t )u(t) t = 0, ±1, ± 2,... N t=1-min(t ,0) where N denotes the maximum number of elements that can be used, and where

Ù 1 N -t Ù Ù r u (t ) = åu(t +t )u(t) r u (-t ) = r u (t ) t = 0, 1, 2.... N -t t=1

21 An estimate of the weighting function {h (k)} is found using the correlation analysis discussed in chapter 3 using the linear system of equation 3.30.

æ Ù ö æ Ù ö ç r (0) ÷ æ Ù Ù ö h(0) yu r (0) ...... r (M -1) ç ÷ ç ÷ ç u u ÷ ç ÷ : ç Ù ÷ : ç ÷ r (1) . : ç ÷ ç : ÷ ç u ÷ ç : ÷ ç ÷ = ç : . : ÷ ç ÷ ç : ÷ ç ÷ : : . : ç ÷ ç : ÷ ç ÷ ç ÷ ç Ù Ù ÷ : ç Ù ÷ ç Ù ÷ ç ÷ èru (M -1) . . .. ru (0) ø ç ÷ èryu (M -1)ø èh(M -1)ø

2n {h(k)} values are found out using the formula in correlation analysis(chapter 3) as k=1 white noise is considered to be input we use

h(k) = ryu (k) / ru (0) Here second order system is considered so only four values of h are obtained

2n Substituting the values of {h(k)} from correlation analysis in the linear system of k=1 equations described in Problem 3.11 in [1].

é 0 0 ...... 0 1 0 ...... 0ù éa1 ù é h(1) ù ê ú ê ú ê ú ê - h(1) 0 ... 0 0 1 0 ... 0ú ê : ú ê : ú ê - h(2) - h(1) ...... 0 0 1 ... 0ú ê : ú ê : ú ê ú ê ú ê ú ê : - h(1) ...... : ú ê : ú ê : ú ê : - h(1) 0 1ú êa ú ê : ú ê ú ê n ú = ê ú ê : - h(1) ú êb1 ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ê : : 0 ú ê : ú ê : ú ê : : ú ê : ú ê : ú ê ú ê ú ê ú ëê- h(2n -1) ...... h(n) ûú ëêbn ûú ëêh(2n)ûú

n

Solving the above linear system of equations for {ai ,bi } using least squares and total i=1 least squares. Later mean values and variances are found. This procedure is referred to as the two-step procedure. The two-step procedure is studied in a Monte Carlo simulation as described in the next chapter.

22 5. Monte Carlo:

Monte Carlo is a numerical modeling procedure that makes use of random numbers to simulate processes, which involves an element of chance. In Monte Carlo simulation, a particular experiment is repeated many times with different randomly determined data to allow statistical conclusions to be drawn. Because of the repetition of algorithms and the large number of calculations involved, Monte Carlo is a method suited to calculation using a computer utilizing many techniques of computer simulation.

A Monte Carlo algorithm is often a numerical method used to find solutions involving mathematics and problems which may have many variables, which cannot easily be solved, for example, by integral calculus, or other numerical methods. For many types of problems, its efficiency is directly proportional to the dimension of the problem. Therefore, relative to other numerical methods this is a better approach towards solving such type of problems.

Broadly, Monte Carlo methods are useful for modeling phenomena with significant uncertainity in inputs, such as the calculation of risk in business (for its use in the insurance industry), also in stochastic modelling where in the model uses random variations to look at the conditions suitable for the process.

We illustrate the use of Monte Carlo by taking the following example into consideration,

Consider a general second-order system,

A (q-1) y (t) = B (q-1) u (t) + v (t)

Where, u (t) is input, y (t) is output, v (t) is disturbance,

-1 -1 -n A (q ) = 1+a1q +…+anq

-1 -1 -n B (q ) = b1q +…+bnq

Consider a1 = 0.8, a2 = 0.7, b1=1, b2 =0.8 and generate data from the above system.

Here, the input is white noise.

23 The generated signal is shown in the figure 5.1 and the noise added to the system is shown in the figure 5.2 below.

6

4

2

0

-2

-4

-6 0 100 200 300 400 500 600 700 800 900 1000

Figure 5.1 Generated signal

6

4

2

0

-2

-4

-6 0 100 200 300 400 500 600 700 800 900 1000

Figure 5.2 Noise signal

24 We find the h-parameters using correlation analysis discussed earlier. We plug-in the four h-parameters (since, a second-order system is considered) h(1),h(2),h(3),h(4) in the linear system of equations which is discussed earlier.

Using least squares method we find a1, a2, b1, b2 parameters in MATLAB, see the appendix (MATLAB CODE).

The above parameters are once again found after increasing noise and this process is carried out a hundred times. This procedure is called Monte Carlo way of simulation. By repeating the same process for hundred times help to get the values close to the actual values considered while generating the system.

The mean values of the parameters which are found from the above Monte Carlo simulation are depicted in the following graphs, also the variances found out are given below in the next section.

25 5.1 Simulations & Results:

Least Squares:

The following are the plots for mean values of the estimated parameters which show how they vary when the same is repeated for hundred times using least squares.

0.9 0.8 0.7

0 10 20 30 40 50 60 70 80 90 100 1 0.8 0.6 0 10 20 30 40 50 60 70 80 90 100 1.5

1

0.5 0 10 20 30 40 50 60 70 80 90 100

1 0.8 0.6 0 10 20 30 40 50 60 70 80 90 100

Figure 5.2 Mean values of the parameters a1, a2, b1, b2 respectively. True values are indicated in the plots Least Squares

Mean Values: a1=0.7970, a2=0.6900, b1=1.0050, b2=0.8067,

Variances: a1v=0.0067, a2v=0.0036, b1v=0.0026, b2v=0.0086

26 Total Least Squares

The plots for the mean values of the estimated parameters are shown below also the variation is observed from the true value which is depicted with a line.

1

0.8

0.6 0 10 20 30 40 50 60 70 80 90 100

0.8

0.6

0 10 20 30 40 50 60 70 80 90 100 1.5

1

0.5 0 10 20 30 40 50 60 70 80 90 100 1

0.8

0.6 0 10 20 30 40 50 60 70 80 90 100

Figure 5.3 Mean values of the parameters a1, a2, b1, b2 respectively. True values are indicated in the plots Total Least Squares

Mean Values: a1=0.8050, a2=0.6925, b1=1.0032, b2=0.8077,

Variances: a1v=0.0067, a2v=0.0045, b1v=0.0019, b2v=0.0078

The plots and the values show that both least squares and total least squares methods yields similar results.

27 Signal to noise ratio:

In engineering, signal-to-noise ratio often abbreviated as ‘SNR’is a term for the power ratio between a signal and the noise added: 2 Psignal æ Asignal ö SNR = = ç ÷ Pnoise è Anoise ø where P is average power and A is root mean square(RMS) amplitude. Both signal and noise power (or amplitude) must be measured at the same or equivalent points in a system, and within the same system bandwidth. Because many signals have a very wide dynamic range, SNRs are usually expressed in terms of the logarithmic decibel scale. In decibels, the SNR is, by definition, 10 times the logarithm of the power ratio. If the signal and the noise is measured across the same impedance then the SNR can be obtained by calculating 20 times the base-10 logarithm of the amplitude ratio:

æ P ö æ A ö ç signal ÷ ç signal ÷ SNR(dB) = 10log10 ç ÷ = 20log10 ç ÷ è Pnoise ø è Anoise ø

28 SNR Plots Using Least Squares:

Plots depicting signal to noise ratio versus mean, MSE & variances of the parameters(a1,a2,b1,b2) using least squares

1.05 a1 1 a2 b1 b2 0.95

0.9

0.85

0.8

0.75

0.7

0.65 -10 -5 0 5 10 15 20

Figure 5.4 SNR Vs Mean of the parameters (a1,a2,b1,b2) Least Squares

All the mean values a1,a2,b1,b2 remain constant throughout the range of SNR. This suggests that least squares yields values close to the true value.

29 0.14 a1 a2 0.12 b1 b2 0.1

0.08

0.06

0.04

0.02

0 -10 -5 0 5 10 15 20

Figure 5.5 SNR Vs MSE of the parameters(a1,a2,b1,b2) Least Squares

The MSE of the parameters starts at a1=0.13, a2=0.057, b1=0.023, b2=0.135 and gradually decay towards zero as SNR is increased and values remain constant when SNR=5.

30 0.14 a1 a2 0.12 b1 b2 0.1

0.08

0.06

0.04

0.02

0 -10 -5 0 5 10 15 20

Figure 5.6 SNR Vs Variance of the parameters(a1,a2,b1,b2) Least Squares

The variances of the parameters starts at a1=0.124, a2=0.056, b1=0.022, b2=0.134 and gradually decay towards zero as SNR is increased and values remain constant when SNR=5.

31 SNR Plots Using Total Least Squares:

Plots for SNR versus mean, MSE &variances of the parameters(a1,a2,b1,b2) using total least squares.

1.05 a1 1 a2 b1 b2 0.95

0.9

0.85

0.8

0.75

0.7

0.65 -10 -5 0 5 10 15 20

Figure 5.7 SNR Vs Mean of the parameters(a1,a2,b1,b2) Total Least Squares

As seen earlier for least squares, mean values a1,a2,b1,b2 remain constant throughout the range of SNR.This suggests that mean values of the parameters using total least squares yields values close to the true value as we consider the data to be noise-free there is not much difference in the values obtained.

32 0.25 a1 a2 b1 0.2 b2

0.15

0.1

0.05

0 -10 -5 0 5 10 15 20

Figure 5.8 SNR Vs MSE of the parameters(a1,a2,b1,b2) Total Least squares

The MSE of the parameters starts at a1=0.21, a2=0.09, b1=0.025, b2=0.17 and gradually decay towards zero as SNR is increased and values remain constant when SNR=5.

33 0.2 a1 0.18 a2 b1 0.16 b2

0.14

0.12

0.1

0.08

0.06

0.04

0.02

0 -10 -5 0 5 10 15 20

Figure 5.9 SNR Vs Variance of the parameters(a1,a2,b1,b2) Total Least Squares

The variances of the parameters starts at a1=0.19, a2=0.09, b1=0.03, b2=0.16 and gradually decay towards zero as SNR is increased and values remain constant when SNR=5.

From the above plots, for a noise-free data the mean,MSE & variances of the parameters yield similar results for least squares as well as total least squares methods.

34 Conclusions:

As known in literature, Dirac function d (t) cannot be realized in practice an approximation is used. In our study, impulse response and weighting function are generated considering a damped oscillator with transfer function G(s) excited by approximate impulses.

A discrete-time system is considered and a parametric model is determined from the impulse response and is shown equivalent to a linear system of equations. This task included the polynomial formulation using the fact that {h(k)} is the impulse response of the system. Other task was to find a perfect model assuming {h(k)} to be noise–free impulse response of an nth-order system.

The two-step approach is used to find the h-parameters using correlation technique. For the purpose, the input is white noise and correlation analysis is performed to obtain {h(k)}. This analysis (correlation) greatly simplified the task of finding the h-parameters from the estimates of covariance functions. Then, these h-parameters are substituted in the linear system equations discussed in two step approach in chapter 4 and found a and b parameters by using least squares and total least squares.

The Monte Carlo simulations are done to find the best suited method for a model. The results and plots of signal to noise ratio versus mean, mean square error and variance have been obtained using least squares and total least squares. Both the methods closely approximated the true value for mean of the parameter. Both the methods yielded almost similar results for variance and mean square error.

35 References:

[1] T. Söderström and P. Stoica. ‘System Identification’. Prentice Hall, Hemel Hempstead, U.K., 1989.

[2] J. Schoukens and R. Pintelon, Identification of Linear Systems: A Practical Guideline to Accurate Modeling, Pergamon Press, Great Britain, 1991.

[3] L. Ljung, ‘System Identification’ - Theory for the User. Edition 2. Prentice Hall, 1999.

36 Appendix (Used in Chapter 5)

close all clear all clc A = [1 0.8 0.7]; B = [1 0.8]; SNR = -10:5:20; MC = 100 for s = 1: length(SNR) for(i=1:MC) u = randn(1000,1); y = filter(B,A,u); Pn = 10^(-SNR(s)/10)* (y'*y)/length(y); noise= sqrt(Pn)* randn(1000,1); y = y + noise;

N=length(y); for to=1:5 ryu(to)=0; ru(to)=0; for t=1:N-to ryu(to)=1/N*y(t+to-1)*u(t)+ryu(to); end

for t=1:N-to ru(to)=1/N*u(t+to-1)*u(t)+ru(to); end end

H=ryu/ru(1);

Q=[0 0 1 0;-H(1) 0 0 1;-H(2) -H(1) 0 0;-H(3) H(2) 0 0];

P=[H(1);H(2);H(3);H(4)]; X(:,i)=Q\P; % For least squares method X(:,i) = tls(Q,P) ; % For total least squares method end

plot(y,'b') % Generated Signal plot(noise,'g') % Noise Signal a1(s)=mean(X(1,:))

37 a2(s)=mean(X(2,:)) b1(s)=mean(X(3,:)) b2(s)=mean(X(4,:)) a1mse(s)=sum((X(1,:)-A(2)).^2)/MC a2mse(s)=sum((X(2,:)-A(3)).^2)/MC b1mse(s)=sum((X(3,:)-B(1)).^2)/MC b2mse(s)=sum((X(4,:)-B(2)).^2)/MC a1v(s) = var(X(1,:))

a2v(s) = var(X(2,:))

b1v(s) = var(X(3,:))

b2v(s) = var(X(4,:)) end figure plot(SNR,a1,SNR,a2,SNR,b1,SNR,b2) legend('a1','a2','b1','b2') figure plot(SNR,a1mse,SNR,a2mse,SNR,b1mse,SNR,b2mse) legend('a1','a2','b1','b2') figure plot(SNR,a1v,SNR,a2v,SNR,b1v,SNR,b2v) legend('a1','a2','b1','b2')

38