You are on page 1of 157

&

, 2010




: . .


. . ,
. ,



(Random Coefficient
Pooled AutoRegressive models with eXogenous input, RCP-ARX)

. :


. ,
.
,
,

.
,


,
. :
.
, RCP MG GLS,
.
,
, , .
RCP

.

1. ....................7
1.1 ...................7
1.2 .........................8
1.3 ..............................................................................................................9
1.4 ...............................................................................10
1.5 ................................................................................................................11
1.6 : .................................................12
1.7 (RCP Models) ...................................................14
1.8 RCP- ARX: .................................................................................................................15
1.9 Mean Group (MG) ..................................................................................................17
1.10
(GLS)..............18
1.11
.................21
1.12
.............................................21

2.
MATLAB .............................23
2.1 ....................................................25
2.2 ........................................28
2.3 - .................48

3.
..........................................................50
3.1 ............................................................................................50
3.2 - .....................................................................................................51
3.3 .............................................................................................................57
4. ..................................................................................................................................58
:
ARX(4,4)- ...................................................................................................................61
RX(4,4)- N ....................................................................................................................65
ARX(10,10)- M ...............................................................................................................69
ARX(10,10)- ................................................................................................................74
ARX(16,16)- M ...............................................................................................................79
ARX(16,16)- ................................................................................................................84
ARX(26,26)- M ...............................................................................................................89
ARX(26,26)- ................................................................................................................94
: MATLAB
MATLAB ........................................................................................100
EXECUTIONCODE.m .101
5

LargeARXCreation.m 105
MPOOLEDMODEL.m 106
NPOOLEDMODEL.m .108
ANALYSIS.m 110
MODALS.m .115
MG.m .116
GLS.m .117
RCPMonteCarlo.m .118
MRESULTS.m .120
NRESULTS.m ..124
FPMC.m .128
MATLAB ..130
ANALYSIS2.m .131
ORDERSELECTION.m ...136
NONPARAMETRIC.m ........................................................................................................138
RCPANALYSIS.m ...............................................................................................................139
MG.m ...............................................................................................................................140
GLS2.m .............................................................................................................................141
RCPMonteCarlo2.m .........................................................................................................142

: ...............................144

1.
1.1
.
- . ,

. :

( , , ),

( , , ),
(, ),
(, , ),
.
,
, (Worden, 2005, Hemez, 2004, Booker
et al., 2004).
,
,
.

. :
, , ,
,
.
, .
, , .

,
. ,
. , .
,
.
. ,
(Michaelidis, Fassois 2009) .

1.4 1.5.

.
state of the art
1.6


, .


,
.


.
.
,
.

1.2
. (Linear Regression):
Ljung (Ljung, System Identification: Theory for the User),
:

(regressor) ,

,


. :



,

.
:




, ,
/. ,


(
) .
I. ARX:
ARX (Autoregressive
Model with Exogenous Excitation, ARX). ARX (n,m)
(. , ):

ARX(n,m)

,

,
( ),

.
; ARX

, .
. ,
(. )
.
ARX.

1.3

. ,
.
. , crosssections
, ..
.

: .
.
cross-section ,
. , ,
. ,
.
,
9

,

(Dielman, 1983).
.
, cross-sectional
(pooled time series cross-sectional data).
( marketing )
(panel data, longitudinal data). ,
,
.
, , TSCS
.

1.4
ARX
, .
;

/ ,
.
, ,
,
(Michaelidis, Fassois 2009). , ,
,
.
, .. .
(

, ).

. ,

. (
) ,
.
,
,
(
,
, ).

10

,
. , .
,
(, ).

, . ,
.
,
,
, ..

1.5


.


.
,
,
/
.
,
.
,
,
.
() .
,
.


.
(statistical parsimony) . ,
,
, .
.
,
.

11

1.6 :
,
.
, ,
, ,
. ,
,

,
. , ,
,
/ , (,
, ).
,
:
T Classical Pooling (CP)
models

(Dielman 1989, Lois 1989, Hooper 1993, Inoue 2003).
,
,
,
. CCP (Constant Coefficient
Pooled),

.
SUR (Seemingly Unrelated Regression models)
, .

,
. (Zellner 1962, Dufour 2002, Greene 1997).
(Dwivendi &
Srivastava 1978, Ravenkar 1976, Telser 1964 ..).
M CP
ANCOVA, LSDV
(Analysis of Covariance (ANCOVA), Least Squares with Dummy Variables (LSDV), Pindyck & Rubinfeld
1976, Wallace & Hussain 1969, Lois 1989, Greene 1997, Dielman 1989).
(dummy variables)
.
,
12

. ,
.
EC (Error Component
models, Variance Component models). ,
. /

.
. EC (CP)
LSDV,
. ,
, .

Stein (1956)

. , F-test
. ,
( )
. ,
/ ,
,

(
, ,
,
status quo ).
LPV (Linear Parameter Variable,
LPV).
,
. .

,

.

,
,
FP (Functionally Pooled). ,

(Sakellariou & Fassois, 2007).
,

Random Coefficient Models
13

(RC) ,
, ,
.

1.7 (RCPM, Random


Coefficient Pooled Models)
,
.
, ,
,
.
,
(Random Coefficient Pooled Models)
.
,
, ,
. ,
, . ,
, RC
.


.
:


. RCM

,
. ,
.

( ) :

,

.
:

. EC,
, .
14


(RCR- Random Coefficient Regression) Swamy
(Swamy 1970, 1971, 1973 & 1974).
.

.
Swamy ,
(Rosenberg, 1973c) ,
ML (Maximum Likelihood) Bayesian
. , Swamy
, (Dielman,
Nantell & Wright (1980), Dielman & Oppenheimer (1984, 1988), Boness & Frankfurter (1972), Feige
& Swamy (1974) ..), (Sheiner, Rosenberg & Melmon (1972)).
,
. ,

.
Swamy, . ,
(M
).
.
(mixed RCR
model) Swamy 1971.
,


(Dielman 1980).

1.8 RCP- ARX: (Michaelidis, Fassois 2010)


RCP-ARX
Swamy (Swamys Random Coefficient Models).
RCP-ARX (m,n) :

15


.
.
RCP-ARX (linear regression
form):

16

1.9 Mean Group (MG)


Mean Group .
, (ARX)
.
,

(Ordinary Least Squares, OLS).
, RCP-ARX,
regressors



, . Pesaran Smith (1995)
,

, .
Mean Group (MG)
:


ARX
. G
.

(Hurwicz 1950, Kiviet & Phillips 1993). ,

Monte Carlo G
(Hsiao, Pesaran & Tahmiscioglu 1999).

,
:

17

1.10
(Generalized Least Squares, GLS)
RCP-ARX
, GLS. ,
(
)
RCP . ,
GLS OLS
.
( ,
) .
G GLS

, :

Swamy GLS


.
,

(Carter & Yang,


1986). (Carter & Yang, 1986)
,


. ,


( ).
GLS,
k :

18




()
.
:

.


.
GLS
:

,
,
:

GLS
ARX :

RC GLS


. ,
,
.
ARX
:

19


,
ARX (
). , ,
. Swamy
:

, : ,
,
.

.
OLS .

,
,
.

. Hsiao (1986, 131-4),

Swamy, ,
.

, Hsiao.
.

. ,

,
.
, ,
,
.
, .
. Beck
& Katz (2001) ,
Swamy, :

Swamy ,

20

.
,
. ,
,
,
/.
RCP-ARX
, (MG GLS)
,
.
,
RCP ,
. ,
.

(shrinkage estimators) .

1.11



. (
)
(Michaelidis, Fassois 2010):
1. Monte Carlo
FRF.
2. Taylor
.

1.12 (FRF)
FRF
Monte Carlo (Michaelidis, Fassois 2010). L
Cholesky (
).




:

21



(FRF)

FRF CCP-ARX
RCP-ARX .

22

2.
MATLAB
RCP MATLAB.


, RCP .

,
(
).
: ,
, .
, Z
.
.
,
, .

.

.
.
,
. ,
,
, .
,
,
. ,

, ,
,
. ,
,

.
, ,

.
,

23

, ,
.

,
. , RCP

.
,
.
.
,

, .
, ( N
),
. RCP
. , ARX
. ,
.
RCP ,
. 1.

1: - RCP

24

2.1
RCPM
,
.
ARX (4,4), ARX(10,10), ARX(16,16) ARX(26,26)
,
1 100 Hz.
, (Input to Noise Ratio,
INR) 10.

, Mean Group (MG) Generalized Least Squares (GLS).
,
( ) (
).
:

.
.
,
.
FRF. Monte Carlo

.
. Monte
Carlo ,
.
. .

().
.
, SpP
(samples per parameter, ).
().
. .


.
,

RCP .
25

,
(
).

,
.
RCPM ,
,
/ (.. VARX).

(.. ), RCP
.

.
; ,
,
,
.
. ,

.
Monte Carlo. :
,

.

Monte Carlo


2:
.

.

(. 2).
MATLAB (. FPMC.m).

,
.

26

1: a1 AR
. Monte Carlo 10,000
.

2: a5 AR
. Monte Carlo 10,000
.

.

.
.
,
.
(
), ( ,
) .

.
. :
,
27

.
, ,
, ,
, :


, ,
,
.
,
.
Cholesky
.


, ,
. , , ,
.

2.2

.
, 1:

1: 4 26 .

28

2: : (FRF) 4 26
.

,
, .
,
.
3:

3:

RCP
.

29

RCP
. ,

,
.
Cholesky Monte Carlo .
:

Monte Carlo
. ,
, ,
. ,
Monte Carlo ,
. , ,
.
,
,
.
4(+)
( ) 4(+) (N ).

4,

4: 4 - MG
GLS ( )
( ). , 80 /. (=720).

30

4,

4: 4 - MG
GLS ( )
( ). , 50 .

31

26,

4: 26 - MG
GLS ( )
( ). , 40 /. (=2120).

26,

32

4: 26 - MG
GLS ( )
( ). , 300 .

,
. , 5
,
, 50 .
,
.
RCP ,
, .
,

(
) ( RCP).

33

, , (;)
RCP
. ( )
,

50 (
). , ( )

,
de facto RCP.


(condition number).

. , (well conditioned)
(ill conditioned).
, :


,

( ) Monte Carlo

MG GLS.

5(+) (
) 5(+) .

4,

34

5: 4 -
( ),
MG GLS ( ).
, 80 /. (=720).

4,

5: 4 -
( ),
MG GLS ( ).
, 50 .

35

26,

(1)

(2)

5: 26 -
( ),
MG GLS ( ).
, 40 /. (=2120).

36

26,

5: 26 -
( ),
MG GLS ( ).
, 300 .

37

,
.
MG GLS,

. , ( 5 4
55 26) GLS
MG, .
,
,
,
. ,

MG GLS. ,

.


(FRF)
RCP
MG GLS.
6(+) ( )
6(+) .
INDEX, 4
. :

MG,

GLS,

MG
GLS
GLS.

1
2
3
4

: Monte
Carlo FRF RCP
Cholesky,
. ,
: ,
.
.

/ (round off/truncation
38

error). , ,
. ,
/ .
GLS ,
,

. MG

GLS.

4,

6: 4 -
() ( /) +/- RCP (/ )
5,10,30 80 . 80 (=720). Monte Carlo 1000
. MG GLS ,
.

INDEX:
-7.2449e-020
0
0
0

-1.3084e-007
0
0
0
39

1
0
0
0

4,

6: 4 -
() ( /) +/ RCP (/ ) 2, 6, 14 30 .
50 . Monte Carlo 1000 .
MG GLS ,
.
INDEX:
0
0
0
0

0
0
0
0

40

0
0
0
0

26,

6: 26 -
() ( /) +/ RCP (/ ) 10,50,200 400 .
40 (=2120). Monte Carlo 1000
. MG GLS ,
.

INDEX:
-4.3494e-018
-2.9423e-019
0
0

-3.3711e-007
-1.0208e-008
0
0
41

1
1
0
0

26,

6: 26 -
() ( /) +/ RCP (/ ) 2, 6, 14 30 .
300 . Monte Carlo 1000 .
MG GLS ,
.
INDEX:
0
0
0
0

0
0
0
0

42

0
0
0
0

RCP- ARX
FRF
.
:

FRF
RCP .
,
. RCP 26
200 400 (
!) . ,
,
, ,
, .
FRF RCP
(-3 ) ,
,
FRF.

.
MG GLS .
, ,
(. 6)



RCP-RX ,
RCP .

,

RCP .
.

,

, 7:

43

7: 26 : 1 (AR) 2 (X) ARX


() RCP
(MG: , GLS: ). : AR, , 10, 50, 200 400 .
40 (=2120). Monte Carlo
1000 . MG GLS ,
.


RCP
.
( ,
) :
,

, , MG
GLS.
8(+) (
) 8(+) .

44

4,

8: 4 - . (6
) 2 . : . :
. /: RCP MG
GLS . 5, 10, 30 80 80 (=720). Monte Carlo 1000
.

4,

8: 4 - . (6
) 2 . : . :
. /: RCP MG
GLS . 50 2, 6, 14 30 . Monte Carlo 1000
.

45

26,

8: 26 - . (6
) 3 . : . :
. /: RCP MG
GLS . 10, 50, 200 400 40 (=2120). Monte Carlo
1000 .

26,

8: 26 - . (6
) 3 . : . :
. /: RCP MG
GLS . 300 2, 6, 14 30 . Monte Carlo 1000
.

46


,
. :

,
.

. ,

,
. ,
,
RCP .

,
RCP ,
.
,
.
,
. ,
RCP .

5 .

,
.
-
. ,
, ,
,

.

47

2.3 -

, (;)
RCP
. ,

. , (
)
,
de facto RCP.

:
I.

.
.
II.

,
.
III.
MG GLS .

:
I.


. .
II.

.
III.
GLS ( )
,
.

:
I.
,
,

.
II.
FRF RCP
(-3 ) ,
,
FRF. , ,

.
III.
MG GLS . ,

.
48

( ):
I.
.

.
( )


.
II.

, .

.
III.
MG GLS .

MG GLS
,
.

.


,
(),
(), (.. AR, MA, ARMA .)
(.. outliers).

.

49

3.




.
,

.

(Michaelidis, Fassois 2010).
.

3.1 (Michaelidis, Fassois 2010)



, .
M8 .


(. 1)

(MB Dynamics
Model 50A),

(PCB 740B02).

1: (a) (b).
R.
(PCB 481)
SigLab 20-42.
8 (S1-S8) 24 ,
(1-10). ,
,
.
, ,
. 17 100Hz,
, .
50

256Hz N=11520
(45 ),
. 1.

S1
S2
S3
S4
S5
S6
S7
S8

E1-E10
E1-E10
E1-E10
E1-E10
E1-E10
E1-E10
E1-E10
E1-E10
:
:
:
:
:
:
:
:
:
. . ( ):
:
:
. .:

1

(C)
15:05-16:06
22.7-23.1
17:58-19:31
21.7-21.9
21:06-21:47
21.5
00:06-00:58
21
02:58-03:43
21-21.1
06:04-06:45
20.8
09:09-09:48
20.9
12:07-12:59
21.3-21.8
800 x 1000 x 2 mm
MB Dynamics Modal 50A electromechanical shaker
PCB 740B02 dynamic strain gauge
Spectral Dynamics SigLab 20-42
PCB 481
80
17-100Hz
Fs = 256Hz
= 11520 (45s)
= 80
(155mm, 865mm)
R (755mm, 52mm)
20.8 23.1C

3.2 -
ARX
. (AR)
(X), .
ARX (n,n)
Bayesian Information Criterion
(BIC), RSS/SSS (Frequency
stabilization plot). MATLAB (. ORDERSELECTION.m).
1 2.

51

1: BIC RSS/SSS ARX. =8000


.

2: ARX.
=8000 .

52

To BIC 105,

, . RSS/SSS
136,
,
. 136 .
.
,
.
8000 80 ,
RCP
(Frequency Response Function, FRF), (modals).

MG GLS.
.
6.5252e19 MG 2.2491e11 GLS.
,
GLS () . ,
26 50
,
, 136, .
Monte Carlo, Cholesky

.
Cholesky .
MG
-4.3689e-016. ,

.
, .
,
,
2.1603e15 6.5252e19. ,
GLS -2.2962e-7. ,
, .
MG.
3 (FRF)
MG GLS
, 3 FRF
FRF Welch:

53

3: (FRF)
() MG ( , ) GLS ( , ).
: , : 3 . = 80 = 8000
. Monte Carlo
1000 .

3: (FRF) Welch
( 2048 , 1800, 256Hz) ()
MG ( , ) GLS ( , ). :
, : 3 . = 80 = 8000 .
Monte Carlo 1000 .

54


. MG GLS
, ,
.
FRF,
.


.
ARX
MG GLS.
.
, ,
(
) , .


.
.
4.

55

4: . (6 ) 6
. : ARX. /: RCP MG
GLS . 80 8000 . Monte Carlo 1000
.

, RCP
,
MG GLS .

56

3.3


,
.
:


.
,
( ),
.
MG GLS .

,
, .
ARX (136)
(26 )
. ,
(J.
Schfer, K. Strimmer, 2005)
.

57

4.
B. Baltagi, L. Matyas, P. Sevestre, 2008, Error Component Models, The Econometrics of Panel
Data, vol 46, ch. 3, pp 49-87.
N. Beck, J. Katz, 2001, Random Coefficient Models for Time-Series-Cross-Section Data, 2001
Annual Meeting of the Society of Political Methodology, Emory University.
J. M. Booker, T.J. Ross, A. C. Rutherford, B. J. Reardon, F. M. Hemez, M. C. Anderson, S. W.
Doebling, C. A. Joslyn, 2004, An Engineering Perspective on UQ for Validation, Reliability and
Certification, Foundations 04 Workshop for Verification, Validation and Accreditation
(VV&A) in the 21st Century, Tempe, Arizona.
T. Dielman, 1972, Small Sample Properties of Random Coefficient Regression Estimators: a
Monte Carlo Simulation, Communications in Statistics- Simulation and Computation,
21:1,103-132.
T. Dielman, 1983, Pooled Cross-Sectional and Time Series Data: A Survey of Current Statistical
Methodology, The American Statistician, vol.37, no.2, pp.111-122.
Fassois S.D., Sakellariou J.S., 2007, Time Series Methods for Fault Detection and
Identification in Vibrating Structures, Journal of the Royal Society, Series A, Vol. 365,
number 1851, pp. 411-448.
B. Hajek, 2009, An Exploration of Random Processes for Engineers, Notes for ECE 534.
F. M. Hemez, 2004, The Myth of Science-based Predictive Modeling, Foundations 04
Workshop for Verification, Validation and Accreditation (VV&A) in the 21st Century, Tempe,
Arizona.
C. Hsiao, M. H. Pesaran, 2004, Random Coefficient Panel Data Models, Cambridge Working
Papers in Economics 0434, Faculty of Economics, University of Cambridge.
L. Ljung, 1996, System Identification: Theory for the User, Prentice-Hall Inc., N.J..
L. Ljung, System Identification Toolbox for Use with Matlab, The Mathworks Inc.
P. G. Michaelides, S.D. Fassois, 2008, "Stochastic Identification of Structural Dynamics from
Multiple Experiments - Experimental Variability Analysis", Proceedings of the International
Conference on Noise and Vibration Engineering (ISMA 2008), Leuven, Belgium, paper ID 131.
P.G. Michaelides, S.D. Fassois, 2010, Stochastic Identification of Uncertain Structural
Dynamics via a Random Coefficient Model Approach, USD 2010 International Conference on
Uncertainty in Structural Dynamics.

58

J. S. Sakellariou, S.D. Fassois, 2007, A Functional Pooling Framework for the Identification of
Systems under Multiple Operating Conditions, Proceedings of the 15th Mediterranean
Conference on Control and Automation, Athens, Greece.
J. Schfer, K. Strimmer, 2005, A Shrinkage Approach to Large-Scale Covariance Matrix
Estimation and Implications for Functional Genomics, Statistical Applications in Genetics and
Molecular Biology Vol. 4, Issue 1, article 32.
P. Swamy, G. Tavlas, 1995, Random Coefficient Models: Theory and Applications, Journal of
Economic Surveys, Blackwell Publishing, vol. 9(2), pages 165-196.
. , 2010,
, ,
, .
. . , 2009, & , .

59

60

ARX (4,4), M-

61

1: MG GLS
( )
( ). , 80 ./ (=720)

2:
( ),
MG GLS ( ).
, 80 (=720).

62

2 ():
( ),
MG GLS ( ).
, 80 (=720).

3: ()
( /) +/- RCP (/ ) 5,10,30 80
. 80 (=720). Monte Carlo 1000
. MG GLS ,
.

63

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 5, 10, 30 80 .
80 (=720). Monte Carlo 1000
. MG GLS ,
.

5: . (6 ) 2
. : . :
. /: RCP MG GLS
. 5, 10, 30 80 80 (=720). Monte Carlo 1000
.

64

ARX (4,4), -

65

1: MG GLS
( )
( ). , 50 .

1 (): MG
GLS ( )
( ). , 50 .

66

2:
( ),
MG GLS ( ).
, 50 .

3: ()
( /) +/- RCP (/ ) 2, 6, 14 30
. 50 . Monte Carlo 1000 .
MG GLS ,
.

67

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 2, 6, 14 30
, 50 . Monte Carlo 1000 .
MG GLS , .

5: . (6 ) 2
. : . :
. /: RCP MG GLS
. 50 2, 6, 14 30 . Monte Carlo 1000
.

68

ARX (10,10), M-

69

1: MG GLS
( )
( ). , 50 ./ (=1050)

1 (): MG GLS
( )
( ). , 50 ./ (=1050)

70

2:
( ),
MG GLS ( ).
, 50 (=1050).

2 ():
( ),
MG GLS ( ).
, 50 (=1050).

71

3: ()
( /) +/- RCP (/ ) 5, 20, 80 150
. 50 (=1050). Monte Carlo 1000
. MG GLS ,
.

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 5, 20, 80 150 .
50 (=1050). Monte Carlo 1000
. MG GLS ,
.

72

5: . (6 ) 3
. : . :
. /: RCP MG GLS
. 5, 20, 80 150 50 (=1050). Monte Carlo 1000
.

73

ARX (10,10), -

74

1: MG GLS
( )
( ). , 100 .

1 (): MG
GLS ( )
( ). , 100 .

75

2:
( ),
MG GLS ( ).
, 100 .

2 ():
( ),
MG GLS ( ).
, 100 .

76

3: ()
( /) +/- RCP (/ ) 2, 6, 14 30
. 100 . Monte Carlo 1000 .
MG GLS ,
.

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 2, 6, 14 30
, 100 . Monte Carlo 1000 .
MG GLS , .

77

5: . (6 ) 3
. : . :
. /: RCP MG GLS
. 100 2, 6, 14 30 . Monte Carlo 1000
.

78

ARX (16,16), M-

79

1: MG GLS
( )
( ). , 50 ./ (=1650).

2:
( ),
MG GLS ( ).
, 50 (=1650).

80

2 ( 1):
( ),
MG GLS ( ).
, 50 (=1650).

2 ( 2):
( ),
MG GLS ( ).
, 50 (=1650).

81

3: ()
( /) +/- RCP (/ ) 10, 20, 100
250 . 50 (=1650). Monte Carlo 1000
. MG GLS ,
.

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 10, 20, 100 250 .
50 (=1650). Monte Carlo 1000
. MG GLS ,
.

82

5: . (6 ) 3
. : . :
. /: RCP MG GLS
. 10, 20, 100 250 50 (=1650). Monte Carlo 1000
.

83

ARX (16,16), -

84

1: MG GLS
( )
( ). , 150 .

1 (): MG
GLS ( )
( ). , 150 .

85

2:
( ),
MG GLS ( ).
, 150 .

2 ( 1):
( ),
MG GLS ( ).
, 150 .

86

3: ()
( /) +/- RCP (/ ) 2, 6, 14 30
. 150 . Monte Carlo 1000 .
MG GLS ,
.

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 2, 6, 14 30
, 150 . Monte Carlo 1000 .
MG GLS , .

87

5: . (6 ) 3
. : . :
. /: RCP MG GLS
. 150 2, 6, 14 30 . Monte Carlo 1000
.

88

ARX (26,26), M-

89

1: MG GLS
( )
( ). , 40 ./ (=2120).

2:
( ),
MG GLS ( ).
, 40 (=2120).

90

2 ( 1):
( ),
MG GLS ( ).
, 40 (=2120).

2 ( 2):
( ),
MG GLS ( ).
, 40 (=2120).

91

3: ()
( /) +/- RCP (/ ) 10, 50, 200
400 . 40 (=2120). Monte Carlo 1000
. MG GLS ,
.

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 10, 50, 200 400 .
40 (=2120). Monte Carlo 1000

92

. MG GLS ,
.

5: . (6 ) 3
. : . :
. /: RCP MG GLS
. 10, 50, 200 400 40 (=2120). Monte Carlo 1000
.

93

ARX (26,26), -

94

1: MG GLS
( )
( ). , 300 .

1 (): MG
GLS ( )
( ). , 300 .

95

2:
( ),
MG GLS ( ).
, 300 .

2 ( 1):
( ),
MG GLS ( ).
, 300 .

96

3: ()
( /) +/- RCP (/ ) 2, 6, 14 30
. 300 . Monte Carlo 1000 .
MG GLS ,
.

4: I 1 (AR) 2 (X) ARX ()


RCP
(MG: , GLS: ). : AR, , 2, 6, 14 30
, 300 . Monte Carlo 1000 .
MG GLS , .

97

5: . (6 ) 3
. : . :
. /: RCP MG GLS
. 300 2, 6, 14 30 . Monte Carlo 1000
.

98


MATLAB

99

I. MATLAB

100

EXECUTIONCODE.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% EXECUTIONCODE.m
%
% Last Update: 24 - 09 - 2010
%
% Description:
% This matlab code is designed to create an ARX model of order (N,N)in a
% similar procedure followed in MODEL.m. In this code, the nominal model
% parameters are perturbed in order to create controlled uncertainty and
% a data set is created every time. From a varying number of data sets
% available with a specidied number of samples -M variability analysis- or
% from a varying length of data samples for a given number of data sets -N
% variability analysis- RCP-ARX models of the same orders as the nominal
% are then identified via the MG or the GLS method (MG.m or GLS.m
% respectively).
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
%-------------------------------------------------------------------------%--------------------- List of Symbols (Entire Code)----------------------% INPUT:
% ARX4/10/16/26 : See MODEL CHARACTERISTICS INPUT
% Fs
: Sampling frequency. Minimum input: 2*fmax.
%
Suggested: ~2.56*fmax.
% sigx
: Excitation signal standard deviation.
% INR
: Input to Noise Ratio
% p1
: See CREATION OF PARAMETER COVARIANCE MATRIX, GAMMA
% p2
: See CREATION OF PARAMETER COVARIANCE MATRIX, GAMMA
% - - - - - - - - - - < M Variability Analysis > - - - - - - - - - - - - % spp
: Samples per parameter for each set.
% Mmax
: Maximum number of sets case.
% M
: Number-of-sets cases to be examined. Given in form
%
(Mmin:Mstep:Mmax).
% - - - - - - - - - - < N Variability Analysis > - - - - - - - - - - - - % M
: Number of sets.
% maxspp
: Maximum number of samples per parameter.
% spp
: Samples per parameter cases to be examined. Given in form
%
(minspp:stepspp:maxspp).
%
% OUTPUT:
% Ts
: Sampling period.
% wn
: Natural frequencies in angular speeds.
% zn
: Natural frequency damping ratios.
% wz
: Antiresonance frequencies.
% zz
: Antiresonance frequency damping ratios.
% Np
: Number of poles (NOT including their conjugates).
% Nz
: Number of zeros (NOT including their conjugates).
% Na
: AR order.
% Nb
: X order (in this code Na=Nb).
% cpoles
: Continuous time poles.
% dpoles
: Discrete time poles.
% den
: Denominator coefficients.
% czeros
: Continuous time zeros.
% dzeros
: Discrete time zeros.
% num
: Numerator coefficients.
% nomtheta0
: Chosen model nominal parameters.
% dim
: Number of model parameters.
% GammaNom
: Nominal/Theoretical parameter covariance matrix.
% L
: Lower diagonal matrix of Cholesky decomp. of GammaNom.
% N
: Number of samples.
% NomCond
: Nominal parameter covariance matrix condition number.
% x
: Excitation signal/input.
% e
: Noise signal.
% P
: Perturbation vector containing vales~N(0,1).
% NOMTHETA
: Perturbed nominal parameter values for all models of set.
% ESTTHETA
: Estimated parameter values for all models of a set.

101

%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%

y
: Output signal for all models of a set.
IT
: Number of Monte Carlo iterations.
thetamg/THETAMG
: MG estimated parameter values for one case/all cases.
thetagls/THETAGLS : GLS estimated parameter values for one case/all cases
GammaSource
: Source nominal parameter covariance matrix.
GammaMG
: MG estimated parameter covariance matrix.
GammaGLS
: GLS estimated parameter covariance matrix.
SourCond
: Source nominal parameter covariance matrix cond. numb.
MGCond
: MG estimated parameter covariance matrix cond. numb.
GLSCond
: GLS estimated parameter covariance matrix cond. numb.
MGPCMSE1
: Mean square error (GammaSource-GammaMG).
MGPCMSE2
: Mean square error (GammaNom-GammaMG).
GLSPCMSE1
: Mean square error (GammaSource-GammaGLS).
GLSPCMSE2
: Mean square error (GammaNom-GammaGLS).
a/amg/agls
: Estimated/MG/GLS AR parameter histogram y-values.
A/AMG/AGLS
: Estimated/MG/GLS AR parameter histogram y-values for all
cases.
xout1/xout11/xout12 : Estimated/MG/GLS AR parameter histogram x-values.
XOUT1/XOUT11/XOUT12 : Estimated/MG/GLS AR parameter histogram x-values
for all cases.
b/bmg/bgls
: Estimated/MG/GLS X parameter histogram y-values.
B/BMG/BGLS
: Estimated/MG/GLS X parameter histogram y-values for all
cases.
xout2/xout21/xout22 : Estimated/MG/GLS X parameter histogram x-values.
XOUT2/XOUT21/XOUT22 : Estimated/MG/GLS X parameter histogram x-values
for all cases.
MAGMGUP
: MG FRF magnitude estimate upper +3 stand. dev. bound.
MAGMGDOWN
: MG FRF magnitude estimate lower -3 stand. dev. bound.
MEANMAGMG
: MG FRF magnitude estimate mean.
MAGGLSUP
: GLS FRF magnitude estimate upper +3 stand. dev. bound.
MAGGLSDOWN
: GLS FRF magnitude estimate lower -3 stand. dev. bound.
MEANMAGGLS
: GLS FRF magnitude estimate mean.
- - - - - - - - - - < M Variability Analysis > - - - - - - - - - - - - N
: Number of samples per set (sample length).
- - - - - - - - - - < N Variability Analysis > - - - - - - - - - - - - Nmax
: Maximum number of samples per set (sample length).

%-------------------------------------------------------------------------%-------------------------------------------------------------------------clear,clc,close all
%---------------------- MODEL CHARACTERISTICS INPUT ----------------------%-------------------------------------------------------------------------% ---------------------------- Input Geometry ----------------------------% 1st row: Natural freq (NF) in Hz,
% 2nd row: Damping ratio (ND) angles in degrees,
% 3rd row: Antiresonance freq (AF) in Hz,
% 4th row: Damping ratio angles of antires. freq.(AD) in degrees
% ------------------------------------------------------------------------%
Order=2*(number of Freq) ------->
%
ARX4: 2 NF
%
% ARX10: 5 NF
%
% ARX16: 8 NF
%
% ARX26: 13 NF
%-------------------------------------------------------------------------% Note: This code utilizes the [1-100Hz] frequency band. You may change it
% to your preference, but be sure to change the sampling frequency
% accordingly.
%-------------------------------------------------------------------------%
%------------------------------ ARX4 -------------------------------------ARX4=[35 68; 80 86; 52 78; 78 65];
%------------------------------ ARX10 ------------------------------------ARX10=[12 24 46 65 89;80 82 86 84 80;18 35 52 74 94;70 50 72 68 40];
%------------------------------ ARX 16 -----------------------------------ARX16=[10 25 40 50 65 78 85 90; 78 82 85 88 88 84 85 82;18 32 45 58 70 82 87 95; 60 70 80 82
80 83 82 50];
%-------------------- ARX 26 (SEE LargeARXcreation.m) --------------------% 35/344
[fns,z,afns,az]=LargeARXcreation(26,256,344);
ARX26=[fns; z; afns; az];

102

%-------------------------------------------------------------------------save('arxoptions')
%-------------------------------------------------------------------------%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------------------------- ARX 4 -----------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FP=[5 10 30 80];
% M ANALYSIS
%
arx, Fs,INR,p1,p2,Nspp,Mmin,Mstep,Mmax,FP)
MPOOLEDMODEL(ARX4,200,10,0.005,0.001,80,5,5,80,FP);
%-------------------------------------------------------------------------FP=[5 10 25 100];
% N ANALYSIS
%
(ARX,Fs,INR ,p1,
p2 ,M,minspp,stepspp,maxspp,FP)
NPOOLEDMODEL(ARX4,200,10,0.005,0.001,50,5,5,100,FP);
ANALYSIS
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------------------------- ARX 10 ----------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
load arxoptions.mat
FP=[5 20 80 150];
%
arx, Fs,INR,p1,p2,Nspp,Mmin,Mstep,Mmax, FP)
MPOOLEDMODEL(ARX10,200,10,0.005,0.001,50,5,5,150,FP);

% M ANALYSIS

%-------------------------------------------------------------------------FP=[5 10 25 100];
% N ANALYSIS
%
(ARX ,Fs, INR ,p1,
p2 ,M ,minspp,stepspp,maxspp,FP)
NPOOLEDMODEL(ARX10,200,10,0.005,0.001,100,5,5,100,FP);
ANALYSIS
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------------------------- ARX 16 ----------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
load arxoptions.mat
FP=[10 20 100 250];
%
arx, Fs,INR,p1,p2,Nspp,Mmin,Mstep,Mmax, FP)
MPOOLEDMODEL(ARX16,200,10,0.005,0.001,50,5,5,250,FP);

% M ANALYSIS

%-------------------------------------------------------------------------FP=[5 10 25 80];
% N ANALYSIS
%
(ARX ,Fs, INR ,p1,
p2 ,M ,minspp,stepspp,maxspp,FP)
NPOOLEDMODEL(ARX16,200,10,0.005,0.001,150,5,5,80,FP);
ANALYSIS
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------------------------- ARX 26 ----------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
load arxoptions.mat
FP=[10 50 200 400];
%
arx, Fs, INR ,p1,
p2, Nspp,Mmin,Mstep,Mmax)
MPOOLEDMODEL(ARX26,200,10,0.005,0.001,40,5,5,400,FP);
%--------------------------------------------------------------------------

103

FP=[5 10 25 80];
%
(ARX,Fs,INR,p1,p2,M,minspp,stepspp,maxspp,FP)
NPOOLEDMODEL(ARX26,200,10,0.005,0.001,300,5,5,80,FP);
ANALYSIS

104

LargeARXcreation.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% LargeARXcreation.m
%
% Last Update: 22 - 09 - 2010
%
% Original author : P. Michailides
% Edited by
: J. Exarchos
%-------------------------------------------------------------------------function [fns,z,afns,az] = LargeARXcreation(Order,Fs,twi)
Nfn=Order/2;
% frequency
Band = [0 Fs/2.56];
bandLength = Band(2)/Nfn;
k = twi;
for ii = 1 : Nfn
k = k + 1;
bands(ii,:) = [(ii-1)*bandLength+1 , ii*bandLength];
rand('twister',k*100)
fns(ii) = bands(ii,1) + 0.5*rand*(bands(ii,2) - bands(ii,1));
rand('twister',k*654)
afns(ii) = bands(ii,1)+0.5*(bands(ii,2) - bands(ii,1)) + 0.5*rand*(bands(ii,2) bands(ii,1));
end
rand('twister',twi+3456789)
z = ((1:length(fns))-round(length(fns)/4*3)).^2;
z = z + mean(z) * rand(size(fns));
z = 0.06*z./max(z)+0.005;
z(1) = 0.8;
rand('twister',twi+345)
az = ((1:length(fns))-round(length(fns)/2)).^2;
az =az + mean(az) * rand(size(fns));
az = 0.12*az./max(az)+0.008;
az(1) = 0.9;
end

105

MPOOLEDMODEL.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% MPOOLEDMODEL.m
%
% Last Update: 23 - 09 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%--------------------------------------------------------------------------

%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%% THIS IS FOR THE M-ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%


%-------------------------------------------------------------------------function MPOOLEDMODEL(ARXORDER,Fs,INR,p1,p2,spp,Mmin,Mstep,Mmax,FP)
sigx=1;
sigma=sigx/INR;
Ts=1/Fs;
wn=2*pi*ARXORDER(1,:);
% Natural frequencies conversion in angular speeds
wz=2*pi*ARXORDER(3,:);
if size(ARXORDER)==[4 13]
zn=ARXORDER(2,:);
zz=ARXORDER(4,:);
else
zn=cosd(ARXORDER(2,:)); % Damping ratios conversion in cos(angle)
zz=cosd(ARXORDER(4,:));
end
Np=length(wn);
Nz=length(wz);
Na=2*Np;
Nb=2*Nz;

% Number of AR parameters
% Number of X parameters

%------------- Poles/Zeros Calculation - Nominal Model Par. -------------cpoles(1:Np,1)=-(zn.*wn)+1i*wn.*sqrt(1-zn.*zn); % Cont. time poles
cpoles(Np+1:2*Np,1)=-(zn.*wn)-1i*wn.*sqrt(1-zn.*zn);
dpoles=exp(cpoles*Ts);
% Conversion to discrete time poles
den=poly(dpoles);
czeros(1:Nz,1)=-(zz.*wz)+1i*wz.*sqrt(1-zz.*zz); % Cont. time zeros
czeros(Nz+1:2*Nz,1)=-(zz.*wz)-1i*wz.*sqrt(1-zz.*zz);
dzeros=exp(czeros*Ts);
% Conversion to discrete time zeros
num=poly(dzeros);
%-------------------------------------------------------------------------nomtheta0=[den num];
nomtheta0(1)=[];
dim=length(nomtheta0);
%------------ CREATION OF PARAMETER COVARIANCE MATRIX, GAMMA -------------%
% The parameter covariance matrix Gamma(i,j) has the following values:
% In the diagonal (i=j): p1% of theta(i)^2
% Everywhere else (i~=j): p2% of theta(i)*theta(j)
% NOTE: Gamma is the theoretical covariance matrix.

106

G=nomtheta0'*nomtheta0;
GammaNom=p1*eye(dim,dim).*G+p2*(ones(dim,dim)-eye(dim,dim)).*G;
L=chol(GammaNom,'lower');
NomCond=cond(GammaNom);
%--------------------------------------------------------------------------

M=(Mmin:Mstep:Mmax);

% M=Number of data sets

N=(Na+Nb+1)*spp;
%----------------------- Excitation and Noise Signals --------------------randn('seed',9)
x=sigx*randn(Mmax,N); % Excitation Signal. Each row-> data set.
randn('seed',10)
e=sigma*randn(Mmax,N); % Noise Signal. Each row-> data set.
%-------------------------------------------------------------------------save('ModeldataM','den','num','Na','Nb','Ts','Mmax','M','GammaNom','L','dim','N','x','e','nomt
heta0','NomCond','spp','sigx','sigma','INR','FP')
%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------------------------------------------------------end

107

NPOOLEDMODEL.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% NPOOLEDMODEL.m
%
% Last Update: 23 - 09 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% See EXECUTIONCODE.m
%-------------------------------------------------------------------------%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%% THIS IS FOR THE N-ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------------------------------------------------------function NPOOLEDMODEL(ARXORDER,Fs,INR,p1,p2,M,minspp,stepspp,maxspp,FP)
sigx=1;
sigma=sigx/INR;
Ts=1/Fs;
wn=2*pi*ARXORDER(1,:);
% Natural frequencies conversion in angular speeds
wz=2*pi*ARXORDER(3,:);
if size(ARXORDER)==[4 13]
zn=ARXORDER(2,:);
zz=ARXORDER(4,:);
else
zn=cosd(ARXORDER(2,:)); % Damping ratios conversion in cos(angle)
zz=cosd(ARXORDER(4,:));
end
Np=length(wn);
Nz=length(wz);
Na=2*Np;
Nb=2*Nz;

% Number of AR parameters
% Number of X parameters

%------------- Poles/Zeros Calculation - Nominal Model Par. -------------cpoles(1:Np,1)=-(zn.*wn)+1i*wn.*sqrt(1-zn.*zn); % Cont. time poles
cpoles(Np+1:2*Np,1)=-(zn.*wn)-1i*wn.*sqrt(1-zn.*zn);
dpoles=exp(cpoles*Ts);
% Conversion to discrete time poles
den=poly(dpoles);
czeros(1:Nz,1)=-(zz.*wz)+1i*wz.*sqrt(1-zz.*zz); % Cont. time zeros
czeros(Nz+1:2*Nz,1)=-(zz.*wz)-1i*wz.*sqrt(1-zz.*zz);
dzeros=exp(czeros*Ts);
% Conversion to discrete time zeros
num=poly(dzeros);
%-------------------------------------------------------------------------nomtheta0=[den num];
nomtheta0(1)=[];
dim=length(nomtheta0);
%------------ CREATION OF PARAMETER COVARIANCE MATRIX, GAMMA -------------%
% The parameter covariance matrix Gamma(i,j) has the following values:
% In the diagonal (i=j): p1% of theta(i)^2
% Everywhere else (i~=j): p2% of theta(i)*theta(j)
% NOTE: Gamma is the theoretical covariance matrix.
G=nomtheta0'*nomtheta0;
GammaNom=p1*eye(dim,dim).*G+p2*(ones(dim,dim)-eye(dim,dim)).*G;
L=chol(GammaNom,'lower');
NomCond=cond(GammaNom);

108

%-------------------------------------------------------------------------spp=(minspp:stepspp:maxspp);

% Samples per parameter cases

Nmax=maxspp*(Na+Nb+1);
%----------------------- Excitation and Noise Signals --------------------randn('seed',9)
x=sigx*randn(M,Nmax); % Excitation Signal. Each row-> data set.
randn('seed',10)
e=sigma*randn(M,Nmax); % Noise Signal. Each row-> data set.
%-------------------------------------------------------------------------save('ModeldataN','den','num','Na','Nb','Ts','maxspp','spp','GammaNom','L','dim','M','x','e','
nomtheta0','NomCond','Nmax','sigx','sigma','INR','FP')
end
%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------

109

ANALYSIS.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% ANALYSIS.m
%
% Last Update: 29 - 09 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
% IMPORTANT NOTE: CHANGE THE PATH/LOCATION IN THE cd AND save COMMAND
% ACCORDINGLY
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%-------------------------------------------------------------------------%% %%%%%%%%%%%%%%%%%%%%%% M VARIABILITY ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------------------------------------------------------clear,clc,close all
load ModeldataM.mat
Nk=0;
orders=[Na Nb+1 Nk];
IT=1000;
SourCond=zeros(1,length(M));% Preallocations
MGPCMSE1=zeros(1,length(M));
MGPCMSE2=zeros(1,length(M));
MGCond=zeros(1,length(M));
THETAMG=zeros(length(M),dim);
GLSPCMSE1=zeros(1,length(M));
GLSPCMSE2=zeros(1,length(M));
GLSCond=zeros(1,length(M));
THETAGLS=zeros(length(M),dim);
W=(0:0.1:100);

% FRF plots frequency resolution

PP=[1 2]; % Enter parameters to plot. Currently: a1,b2


hh=0;
INDEX=zeros(length(FP),3);
MAGMGUP=zeros(length(FP),1001); % Preallocations
MAGMGDOWN=zeros(length(FP),1001);
MAGGLSUP=zeros(length(FP),1001);
MAGGLSDOWN=zeros(length(FP),1001);
MEANMAGMG=zeros(length(FP),1001);
MEANMAGGLS=zeros(length(FP),1001);
randn('seed',21);
P=randn(dim,IT);
[NOMFN]=MODALS(nomtheta0,P,L,Ts,IT,Na);
cd('/home/zeus/Desktop/RUN/DATA')
eval(sprintf('save NomModalsNa%d NOMFN',Na));
cd('/home/zeus/Desktop/RUN')
clear NOMFN
for j=1:length(M)
waitbar(j/length(M))
NOMTHETA=zeros(M(j),dim);
y=zeros(M(j),N);
ESTTHETA=zeros(M(j),dim);
%----------- This is the FRF subplot switch -----------------if M(j)==FP(1)||M(j)==FP(2)||M(j)==FP(3)||M(j)==FP(4)%||M(j)==FP(5)

110

hh=hh+1;
MAG=zeros(M(j),1001);
end
%------------------------------------------------------------for i=1:M(j)
%-----------------------------------------------------------------%-------------------- Output Sample Creation ---------------------%-----------------------------------------------------------------%This part creates the signal used for identification
nomdtheta=L*P(:,i);
nomtheta=nomtheta0+nomdtheta';
NOMTHETA(i,:)=nomtheta;
nomden=[1 nomtheta(1:Na)];
nomnum=nomtheta(Na+1:end);
y(i,:)=filter(nomnum,nomden,x(i,:)) + filter(1,nomden,e(i,:));
clear nomdtheta nomtheta nomden nomnum
%-----------------------------------------------------------------%---------------- Output Sample ARX Identification ---------------%-----------------------------------------------------------------%This part identifies the signal
data=iddata(y(i,:)',x(i,:)',Ts);
m=arx(data,orders);
% ARX model identification of same orders
[estnum,estden]=tfdata(m,'v');
% Estimated model parameters
ESTTHETA(i,:)=[estden(2:end) estnum];
clear data
if M(j)==FP(1)||M(j)==FP(2)||M(j)==FP(3)||M(j)==FP(4)%||M(j)==FP(5)
%---------------------------------------------------------------%---------------------------- FRF -----------------------------%---------------------------------------------------------------[Mag]=ffplot(m,W);
Mag=reshape(Mag,1001,1);
MAG(i,:)=Mag;
end
clear Mag
end
%---------------------------------------------------------------------%-------------------- RCP-ARX Identification ------------------------%---------------------------------------------------------------------GammaSource=cov(NOMTHETA);
% This is the source parameter covariance matrix.
clear NOMTHETA
SourCond(j)=cond(GammaSource);
%---------------------------------------------------------------------%------------------------ MG ESTIMATION ------------------------------%---------------------------------------------------------------------[thetamg, GammaMG]=MG(ESTTHETA); %SEE FUNCTION MG.M
THETAMG(j,:)=thetamg;
MGPCMSE1(j)=mse(GammaSource-GammaMG);
MGPCMSE2(j)=mse(GammaNom-GammaMG);
MGCond(j)=cond(GammaMG);
%------------------------ GLS ESTIMATION -----------------------------[thetagls, GammaGLS]=GLS(M(j),Na,Nb,N,x,y,ESTTHETA); %SEE FUNCTION GLS.M
THETAGLS(j,:)=thetagls;
GLSPCMSE1(j)=mse(GammaSource-GammaGLS);
GLSPCMSE2(j)=mse(GammaNom-GammaGLS);
GLSCond(j)=cond(GammaGLS);
clear y
%--------------------------------------------------------------------%------------------------- RCP FRF PLOTS ----------------------------%--------------------------------------------------------------------if M(j)==FP(1)||M(j)==FP(2)||M(j)==FP(3)||M(j)==FP(4)%||M(j)==FP(5)
eval(['MAG' num2str(hh) '=MAG']);
clc
clear MAG
[amg bmg agls bgls MagMgTHRESH MagGlsTHRESH MeanMagMG MeanMagGLS index MGFN
GLSFN]=RCPMonteCarlo(GammaMG,GammaGLS,dim,Na,IT,Ts,thetamg,thetagls,W,PP);
%SEE FUNCTION RCPMonteCarlo.m
INDEX(hh,:)=index;
MAGMGUP(hh,:)=20*log10(MagMgTHRESH(1,:));

111

MAGMGDOWN(hh,:)=20*log10(MagMgTHRESH(2,:));
MAGGLSUP(hh,:)=20*log10(MagGlsTHRESH(1,:));
MAGGLSDOWN(hh,:)=20*log10(MagGlsTHRESH(2,:));
MEANMAGMG(hh,:)=MeanMagMG;
MEANMAGGLS(hh,:)=MeanMagGLS;
clear MeanMagMG MeanMagGLS MagMgTHRESH MagGlsTHRESH
%---------------------------------------------------------------%-------------------- Parameter Distribution -------------------%---------------------------------------------------------------[a,xout1]=hist(ESTTHETA(:,PP(1)),min(15,M(j)));
[b,xout2]=hist(ESTTHETA(:,Na+1+PP(2)),min(15,M(j)));
[amg,xout11]=hist(amg,length(a));
[bmg,xout21]=hist(bmg,length(b));
[agls,xout12]=hist(agls,length(a));
[bgls,xout22]=hist(bgls,length(b));
cd('/home/zeus/Desktop/RUN/DATA')
eval(sprintf('save abM%dNa%d a xout1 b xout2 amg xout11 bmg xout12 agls xout21 bgls
xout22',hh,Na));
eval(sprintf('save RCPmodalsM%dNa%d MGFN GLSFN',hh,Na));
cd('/home/zeus/Desktop/RUN')
clear a xout1 b xout2 amg xout11 bmg xout21 agls xout12 bgls xout22 MGFN GLSFN
end
cd('/home/zeus/Desktop/RUN/DATA')
eval(sprintf('save estthetaM%dNa%d ESTTHETA',M(j),Na));
cd('/home/zeus/Desktop/RUN')
clear ESTTHETA
waitbar(j/length(M))
end
filename=(['MdataArx',num2str(Na),'INR',num2str(INR),'spp',num2str(spp),'.mat']);
save(filename)
%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------

%-------------------------------------------------------------------------%% %%%%%%%%%%%%%%%%%%%%%% N VARIABILITY ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%%


%-------------------------------------------------------------------------clear,clc,close all
load ModeldataN.mat
Nk=0;
orders=[Na Nb+1 Nk];
IT=1000;
s=length(spp);
randn('seed',21);
P=randn(dim,IT);
NOMTHETA=zeros(M,dim);
ESTTHETA=zeros(M,dim);
SourCond=zeros(1,s);

% Preallocations

MGPCMSE1=zeros(1,s);
MGPCMSE2=zeros(1,s);
MGCond=zeros(1,s);
THETAMG=zeros(s,dim);
GLSPCMSE1=zeros(1,s);
GLSPCMSE2=zeros(1,s);
GLSCond=zeros(1,s);
THETAGLS=zeros(s,dim);
W=(0:0.1:100);

% FRF plots frequency resolution

PP=[1 2]; % Enter parameters to plot. Currently: a1,b2


hh=0;
INDEX=zeros(length(FP),3);
MAGMGUP=zeros(length(FP),1001); % Preallocations

112

MAGMGDOWN=zeros(length(FP),1001);
MAGGLSUP=zeros(length(FP),1001);
MAGGLSDOWN=zeros(length(FP),1001);
MEANMAGMG=zeros(length(FP),1001);
MEANMAGGLS=zeros(length(FP),1001);
MAG=zeros(M,1001);
for j=1:s
waitbar(j/length(M))
N=spp(j)*(Na+Nb+1;
y=zeros(M,N);
%----------- This is the FRF subplot switch -----------------if spp(j)==FP(1)||spp(j)==FP(2)||spp(j)==FP(3)||spp(j)==FP(4)
hh=hh+1;
end
%------------------------------------------------------------for i=1:M
%-----------------------------------------------------------------%-------------------- Output Sample Creation ---------------------%-----------------------------------------------------------------%This part creates the signal used for identification
nomdtheta=L*P(:,i);
nomtheta=nomtheta0+nomdtheta';
NOMTHETA(i,:)=nomtheta;
nomden=[1 nomtheta(1:Na)];
nomnum=nomtheta(Na+1:end);
y(i,:)=filter(nomnum,nomden,x(i,1:N)) + filter(1,nomden,e(i,1:N));
clear nomdtheta nomtheta nomden nomnum
%-----------------------------------------------------------------%---------------- Output Sample ARX Identification ---------------%-----------------------------------------------------------------%This part identifies the signal
data=iddata(y(i,:)',x(i,1:N)',Ts);
m=arx(data,orders);
% ARX model identification of same orders
[estnum,estden]=tfdata(m,'v');
% Estimated model parameters
ESTTHETA(i,:)=[estden(2:end) estnum];
clear data
%-----------------------------------------------------------------%---------------------------- FRF -------------------------------%-----------------------------------------------------------------if spp(j)==FP(1)||spp(j)==FP(2)||spp(j)==FP(3)||spp(j)==FP(4)%||N==FP(5)
[Mag]=ffplot(m,W);
Mag=reshape(Mag,1001,1);
MAG(i,:)=Mag;
end
clear Mag
end
%----------------------------------------------------------------------%-------------------- RCP-ARX Identification -------------------------%----------------------------------------------------------------------GammaSource=cov(NOMTHETA);
% This is the source parameter covariance matrix.
clear NOMTHETA
SourCond(j)=cond(GammaSource);
%------------------------ MG ESTIMATION -----------------------------[thetamg, GammaMG]=MG(ESTTHETA);
THETAMG(j,:)=thetamg;
MGPCMSE1(j)=mse(GammaSource-GammaMG);
MGPCMSE2(j)=mse(GammaNom-GammaMG);
MGCond(j)=cond(GammaMG);
%------------------------ GLS ESTIMATION ----------------------------[thetagls, GammaGLS]=GLS(M,Na,Nb,N,x,y,ESTTHETA);
THETAGLS(j,:)=thetagls;
GLSPCMSE1(j)=mse(GammaSource-GammaGLS);
GLSPCMSE2(j)=mse(GammaNom-GammaGLS);
GLSCond(j)=cond(GammaGLS);
clear y
%----------------------------------------------------------------------%------------------------- RCP FRF PLOTS ------------------------------%----------------------------------------------------------------------if spp(j)==FP(1)||spp(j)==FP(2)||spp(j)==FP(3)||spp(j)==FP(4)%||N==FP(5)
eval(['MAG' num2str(hh) '=MAG']);

113

clc
[amg bmg agls bgls MagMgTHRESH MagGlsTHRESH MeanMagMG MeanMagGLS index MGFN
GLSFN]=RCPMonteCarlo(GammaMG,GammaGLS,dim,Na,IT,Ts,thetamg,thetagls,W,PP);
%SEE FUNCTION RCPMonteCarlo.m
INDEX(hh,:)=index;
MAGMGUP(hh,:)=20*log10(MagMgTHRESH(1,:));
MAGMGDOWN(hh,:)=20*log10(MagMgTHRESH(2,:));
MAGGLSUP(hh,:)=20*log10(MagGlsTHRESH(1,:));
MAGGLSDOWN(hh,:)=20*log10(MagGlsTHRESH(2,:));
MEANMAGMG(hh,:)=MeanMagMG;
MEANMAGGLS(hh,:)=MeanMagGLS;
clear MeanMagMG MeanMagGLS MagMgTHRESH MagGlsTHRESH
%-------------------------------------------------------------------%-------------------- Parameter Distribution -----------------------%-------------------------------------------------------------------[a,xout1]=hist(ESTTHETA(:,PP(1)),15);
[b,xout2]=hist(ESTTHETA(:,Na+1+PP(2)),15);
[amg,xout11]=hist(amg,length(a));
[bmg,xout21]=hist(bmg,length(b));
[agls,xout12]=hist(agls,length(a));
[bgls,xout22]=hist(bgls,length(b));
cd('/home/zeus/Desktop/RUN/DATA')
eval(sprintf('save abN%dNa%d a xout1 b xout2 amg xout11 bmg xout12 agls xout21 bgls
xout22',hh,Na));
eval(sprintf('save RCPmodalsN%dNa%d MGFN GLSFN',hh,Na));
cd('/home/zeus/Desktop/RUN')
clear a xout1 b xout2 amg xout11 bmg xout21 agls xout12 bgls xout22 MGFN GLSFN
end
cd('/home/zeus/Desktop/RUN/DATA')
eval(sprintf('save estthetaN%dNa%d ESTTHETA',N,Na));
cd('/home/zeus/Desktop/RUN')
waitbar(j/s)
end
filename=(['NdataArx',num2str(Na),'INR',num2str(INR),'M',num2str(M),'.mat']);
save(filename)
%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------

114

MODALS.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% MODALS.m
%
% Last Update: 24 - 09 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%-------------------------------------------------------------------------function [FN]=MODALS(nomtheta0,P,L,Ts,IT,Na)
nomdtheta=L*P;
nomtheta=bsxfun(@plus,nomdtheta',nomtheta0);
nomtheta=[ones(IT,1) nomtheta];
den=nomtheta(:,1:Na+1);
FN=zeros(IT,Na/2);
for i=1:IT
dpoles=roots(den(i,:));
cpoles=log(dpoles)/Ts;
for j=1:length(cpoles)
if imag(cpoles(j))>0;
ff(j)=(1/(2*pi))*abs(cpoles(j));
end
end
ff=ff';
fn=ff;
fn(~any(ff,2),:)=[];
fn=fn';
fn=sort(fn);
if length(fn)>Na/2
fn(Na/2+1:end)=[];
end
if length(fn)<Na/2
fn=[zeros(1,Na/2-length(fn)) fn];
end
FN(i,:)=fn;
clear ff fn
end
end

115

MG.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% MG.m
%
% Last Update: 22 - 09 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%-------------------------------------------------------------------------function [thetamg, GammaMG]=MG(ESTTHETA)
thetamg=mean(ESTTHETA,1);
GammaMG=cov(ESTTHETA); % This is the empirical (MG) parameter covariance matrix
end

116

GLS.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% GLS.m
%
% Last Update: 23 - 09 - 2010
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
% For any symbols not defined in EXECUTIONCODE.m check main thesis.
%-------------------------------------------------------------------------function [thetagls,GammaGLS]=GLS(M,Na,Nb,N,x,y,ESTTHETA)
dim=Na+Nb+1;
phik=zeros(N,dim);
PROD1=zeros(dim,dim,M);
MULT1=zeros(dim,dim,M);
MULT2=zeros(dim,dim,M);
Rk=zeros(dim,dim,M);
for i =1:M
yUin=[zeros(1,Na) y(i,:)]; % Adding zeros for initial conditions
xUin=[zeros(1,Na) x(i,1:N)];
for l=1:N
phik(l,:)=[-yUin(l-1+Na:-1:l) xUin(l-1+Nb+1:-1:l)];
end
ek=y(i,:)-(phik*ESTTHETA(i,:)')';
sigma2k=ek*ek'/N;
PROD1(:,:,i)=1/N*sigma2k*(eye(dim,dim)/(phik'*phik));
end
clear x y yUin xUin phik ek sigma2k
ESTTHETA0=mean(ESTTHETA,1);
dtheta=bsxfun(@minus,ESTTHETA,ESTTHETA0);
COR=mean(PROD1,3);
GammaGLS=cov(dtheta)-COR;
clear ESTTHETA0 dtheta COR
for ii=1:M
MULT1(:,:,ii)=eye(dim,dim)/(GammaGLS+PROD1(:,:,ii));
MULT2(:,:,ii)=MULT1(:,:,ii);
end
MULT1=eye(dim,dim)/sum(MULT1,3);
for ii=1:M
Rk(:,:,ii)=MULT1(:,:)*MULT2(:,:,ii);
PROD2(:,:,ii)=Rk(:,:,ii)*ESTTHETA(ii,:)';
end
clear Rk
thetagls=sum(PROD2,3);
end

117

RCPMonteCarlo.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% RCPMonteCarlo.m
%
% Last Update: 29 - 09 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%-------------------------------------------------------------------------function [amg bmg agls bgls MagMgTHRESH MagGlsTHRESH MeanMagMG MeanMagGLS index MGFN
GLSFN]=RCPMonteCarlo(GammaMG,GammaGLS,dim,Na,IT,Ts,thetamg,thetagls,W,PP)
index1=0;
index2=0;
index3=0;
%------EDIT-----[Lmg,pos]=chol(GammaMG,'lower');
if pos~=0;
index1=min(eig(GammaMG));
if index1<1e-10 && index1>-1e-10
GammaMG=GammaMG+(abs(index1)+1e-18)*eye(dim,dim);
Lmg=chol(GammaMG,'lower');
end
end
[Lgls,pos]=chol(GammaGLS,'lower');
if pos~=0;
index2=min(eig(GammaGLS));
if index2<1e-10 && index2>-1e-10
GammaGLS=GammaGLS+(abs(index2)+1e-18)*eye(dim,dim);
Lgls=chol(GammaGLS,'lower');
else
Lgls=Lmg;
index3=1;
end
end
index=[index1 index2 index3];
%----------------clear GammaMG GammaGLS
randn('seed',22)
Pert=randn(dim,IT);
MAGMG=zeros(IT,1001);
MAGGLS=zeros(IT,1001);
MGFN=zeros(IT,Na/2);
GLSFN=zeros(IT,Na/2);
amg=zeros(IT,1);
bmg=zeros(IT,1);
agls=zeros(IT,1);
bgls=zeros(IT,1);
for k=1:IT;
RandThetaMg=thetamg+(Lmg*Pert(:,k))'; % Random Theta vector
RandThetaGls=thetagls'+(Lgls*Pert(:,k))';%
|
% This is for the parameter plots
|
amg(k)=RandThetaMg(PP(1));
%
|
bmg(k)=RandThetaMg(Na+1+PP(2));%
|
agls(k)=RandThetaGls(PP(1));
%
|
bgls(k)=RandThetaGls(Na+1+PP(2));%
|
%--------------------------------V
mgden=[1 RandThetaMg(1:Na)];
% random denominator
glsden=[1 RandThetaGls(1:Na)];
%
&
[mgfn glsfn]=RCPMODALS(mgden,glsden,Ts,Na);
mgnum=RandThetaMg(Na+1:end);
% random numerator
glsnum=RandThetaGls(Na+1:end);

118

modelmg=idpoly(mgden,mgnum,[],[],[],[],Ts); % --> random model


modelgls=idpoly(glsden,glsnum,[],[],[],[],Ts);
[magmg]=ffplot(modelmg,W);
% --> FRF magn.
[maggls]=ffplot(modelgls,W);
MAGMG(k,:)=(reshape(magmg,1001,1))';
% all FRF mags
MAGGLS(k,:)=(reshape(maggls,1001,1))';
MGFN(k,:)=mgfn;
GLSFN(k,:)=glsfn;
end
MagMG=mean(MAGMG,1);
% mean
MagGLS=mean(MAGGLS,1);
stdevmg=std(MAGMG);
% standard dev.
stdevgls=std(MAGGLS);
MagMgTHRESH=[MagMG; MagMG]+3*[stdevmg;-stdevmg]; % mean +- 3*stdv
MagGlsTHRESH=[MagGLS; MagGLS]+3*[stdevgls;-stdevgls];
for ii=1:1001
% all negative values -> close to zero
for jj=1:2
if MagMgTHRESH(jj,ii)<=0;
MagMgTHRESH(jj,ii)=10^-10;
end
if MagGlsTHRESH(jj,ii)<=0;
MagGlsTHRESH(jj,ii)=10^-10;
end
end
end
MGMODEL=idpoly([1 thetamg(1:Na)],thetamg(Na+1:end),[],[],[],[],Ts);
[MeanMagMG]=ffplot(MGMODEL,W);
MeanMagMG=reshape(MeanMagMG,1001,1);
MeanMagMG=20*log10(MeanMagMG);
GLSMODEL=idpoly([1 thetagls(1:Na)'],thetagls(Na+1:end)',[],[],[],[],Ts);
[MeanMagGLS]=ffplot(GLSMODEL,W);
MeanMagGLS=reshape(MeanMagGLS,1001,1);
MeanMagGLS=20*log10(MeanMagGLS);
end
%%
function [mgfn glsfn]=RCPMODALS(mgden,glsden,Ts,Na)
mgdpoles=roots(mgden);
glsdpoles=roots(glsden);
mgcpoles=log(mgdpoles)/Ts;
glscpoles=log(glsdpoles)/Ts;
mgff=zeros(1,length(mgcpoles));
glsff=zeros(1,length(mgcpoles));
for j=1:length(mgcpoles)
if imag(mgcpoles(j))>0;
mgff(j)=(1/(2*pi))*abs(mgcpoles(j));
end
if imag(glscpoles(j))>0;
glsff(j)=(1/(2*pi))*abs(glscpoles(j));
end
end
mgff=mgff';
glsff=glsff';
mgfn=mgff;
glsfn=glsff;
mgfn(~any(mgff,2),:)=[];
glsfn(~any(glsff,2),:)=[];
mgfn=mgfn';
glsfn=glsfn';
if length(mgfn)>Na/2
mgfn(Na/2+1:end)=[];
end
mgfn=sort(mgfn);
if length(mgfn)<Na/2
mgfn=[zeros(1,Na/2-length(mgfn)) mgfn];
end
if length(glsfn)>Na/2
glsfn(Na/2+1:end)=[];
end
glsfn=sort(glsfn);
if length(glsfn)<Na/2
glsfn=[zeros(1,Na/2-length(glsfn)) glsfn];
end
end

119

MRESULTS.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% MRESULTS.m
%
% Last Update: 06 - 10 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
% IMPORTANT NOTE: CHANGE THE PATH/LOCATION IN THE cd AND load COMMAND
% ACCORDINGLY
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%--------------------------------------------------------------------------

%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%% THIS IS FOR THE M-ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%


%-------------------------------------------------------------------------%---------------------------- RESULT PLOTS -------------------------------%% ------------------- Parameter Covariance Matrix MSE Plots -------------figure(1)
subplot(2,1,1);
bar(M',[MGPCMSE2' GLSPCMSE2'],'grouped')
xlabel('Number of Data Sets, M','fontsize',7)
ylabel('Covariance MSE','fontsize',7)
leg=legend('MG','GLS');
set(leg,'fontsize',8);
title(['MSE of Par. Cov. Mat. (Nominal and Estimated), ARX Order ',num2str(Na),... '
(SpP=',num2str(spp),')'],'fontsize',8)
subplot(2,1,2);
bar(M',[MGPCMSE1' GLSPCMSE1'],'grouped')
title(['MSE of Par. Cov. Mat. (Source pop. and Estimated), ARX Order ',num2str(Na),'
(SpP=',num2str(spp),')'],'fontsize',8)
leg=legend('MG','GLS');
set(leg,'fontsize',8);
ylabel('Covariance MSE','fontsize',7)
xlabel('Number of Data Sets, M','fontsize',7)
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch',...
'paperposition',[0 0 8 5])
print -dpng MCovMatMSE
pause
close
%% ---------------- Parameter Covariance Matrix Condition Number Plots------start=1;
figure(2)
subplot(2,1,1);
bar(M(start:end),SourCond(start:end),'g');
hold
plot(M(start:end),ones(length(M)-start+1)*NomCond,'r')
xlabel('Number of Data Sets, M','fontsize',7)
ylabel('Parameter Cov. Mat. Cond. Number','fontsize',7)
title(['Parameter Cov. Mat. Condition Number (Source pop. and Nominal), ARX Order '...
,num2str(Na),' (SpP=',num2str(spp),')'],'fontsize',8)
leg=legend('Source Population','Nominal');
set(leg,'fontsize',8)
ylim([0, 15000])

120

subplot(2,1,2);
bar(M(start:end)',[MGCond(start:end)' GLSCond(start:end)'],'grouped' );
hold
plot(M(start:end),ones(length(M)-start+1)*NomCond,'r')
xlabel('Number of Data Sets, M','fontsize',7)
ylabel('Parameter Cov. Mat. Cond. Number','fontsize',7)
title(['Estimated Parameter Cov. Mat. Condition Number, ARX Order ',num2str(Na),'
(SpP=',num2str(spp),')'],'fontsize',8)
leg=legend('MG Est','GLS Est','Nominal');
set(leg,'fontsize',8)
ylim([0, 1500])
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng MCovMatCond
pause
close
%% ---------------------------- FRF Plots --------------------------------grey=[.6 .6 .6];
for hh=1:length(FP)
figure(1)
subplot(2,2,hh)
eval(['MAG' '=MAG' num2str(hh)]);
q=plot(W,20*log10(MAG),'Color','blue');
hold on
title(['FRF Magnitude, ARX Order ',num2str(Na),', (',num2str(spp),' SpP), ',
num2str(FP(hh)),' sets'],'fontsize',8)
xlabel('Frequency (Hz)','fontsize',7)
ylabel('Magnitude (dB)','fontsize',7)
qq=plot(W,MAGMGUP(hh,:),'Color','green','LineWidth',1);
plot(W,MAGMGDOWN(hh,:),'Color','green','LineWidth',1);
plot(W,MEANMAGMG(hh,:),'Color','green','LineWidth',1.25,'linestyle','--');
qqq=plot(W,MAGGLSUP(hh,:),'Color','red','LineWidth',1);
plot(W,MAGGLSDOWN(hh,:),'Color','red','LineWidth',1);
plot(W,MEANMAGGLS(hh,:),'Color','red','LineWidth',1.25,'linestyle','--')
ylim([-25 20]);
leg=legend([qq; qqq; q],'MG, +/- 3stdv','GLS, +/-3stdv','Single
ARX','location','southeast');
set(leg,'fontsize',6);
grid on
end
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng MFRF
pause
close
%% --------------------- Parameter Distribution Plots --------------------for ll=1:length(FP)
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
eval(sprintf('load abM%dNa%d',ll,Na));
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
figure(1);
subplot(2,4,ll)
bar(xout1,a/sum(a))
hold on
plot(xout11,amg/sum(amg),'g',xout12,agls/sum(agls),'r')
title(['a',num2str(PP(1)),', ARX ',num2str(Na),' (',num2str(spp),'SpP),
',num2str(FP(ll)),' sets'],'fontsize',8)
xlabel('Value','fontsize',7)
ylabel('Relative frequency','fontsize',7)
subplot(2,4,4+ll)
bar(xout2,b/sum(b))
hold on
plot(xout21,bmg/sum(bmg),'g',xout22,bgls/sum(bgls),'r')
title(['b',num2str(PP(2)),', ARX ',num2str(Na),' (',num2str(spp),'SpP),
',num2str(FP(ll)),' sets'],'fontsize',8)
xlabel('Value','fontsize',7)
ylabel('Relative frequency','fontsize',7)
end
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng MPar
pause

121

close
%% ---------------------- MODALS -----------------------------------------brown=[.7 .5 0];
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
eval(sprintf('load NomModalsNa%d',Na));
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
nommean=mean(NOMFN);
stdv=std(NOMFN);
nombound(1,:)=nommean+3*stdv;
nombound(2,:)=nommean-3*stdv;
nombound=nombound';
nommean=nommean';
for hh=1:length(FP)
if Na==4;
E=1;
else if Na==10;
E=2;
else if Na==16;
E=3;
else if Na==26;
E=4;
end
end
end
end
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
eval(sprintf('load RCPmodalsM%dNa%d',hh,Na));
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
mgmean=mean(MGFN);
mgbound(1,:)=mgmean+3*std(MGFN);
mgbound(2,:)=mgmean-3*std(MGFN);
mgmean=mgmean';
mgbound=mgbound';
glsmean=mean(GLSFN);
glsbound(1,:)=glsmean+3*std(GLSFN);
glsbound(2,:)=glsmean-3*std(GLSFN);
glsmean=glsmean';
glsbound=glsbound';
spmean=mean(NOMFN(1:FP(hh),:));
spbound(1,:)=spmean+3*std(NOMFN(1:FP(hh),:));
spbound(2,:)=spmean-3*std(NOMFN(1:FP(hh),:));
spmean=spmean';
spbound=spbound';
pltcs=[2 6 10];
for ll=1:length(pltcs)
figure(1)
subplot(length(pltcs),1,ll)
fill([FP(hh)-E*1.5 FP(hh)-E*0.5 FP(hh)-E*0.5 FP(hh)-E*1.5 FP(hh)E*1.5],[mgbound(pltcs(ll),2)...
mgbound(pltcs(ll),2) mgbound(pltcs(ll),1) mgbound(pltcs(ll),1)
mgbound(pltcs(ll),2)],'b')
hold on
fill([FP(hh)-E*0.5 FP(hh)+E*0.5 FP(hh)+E*0.5 FP(hh)-E*0.5 FP(hh)E*0.5],[glsbound(pltcs(ll),2)...
glsbound(pltcs(ll),2) glsbound(pltcs(ll),1) glsbound(pltcs(ll),1)
glsbound(pltcs(ll),2)],'m')
fill([FP(hh)+E*0.5 FP(hh)+E*1.5 FP(hh)+E*1.5 FP(hh)+E*0.5
FP(hh)+E*0.5],[spbound(pltcs(ll),2)...
spbound(pltcs(ll),2) spbound(pltcs(ll),1) spbound(pltcs(ll),1)
spbound(pltcs(ll),2)],'g')
plot([0 FP],ones(1,length(FP)+1)*nommean(pltcs(ll)),'--r')
plot([0 FP],ones(1,length(FP)+1)*nombound(pltcs(ll),1),'-r')
plot([0 FP],ones(1,length(FP)+1)*nombound(pltcs(ll),2),'-r')
plot([FP(hh)-E*2 FP(hh)],[mgmean(pltcs(ll)) mgmean(pltcs(ll))],'color','k','linewidth',2)
plot([FP(hh)-E*1 FP(hh)+E*1],[glsmean(pltcs(ll))
glsmean(pltcs(ll))],'color','k','linewidth',2)
plot([FP(hh) FP(hh)+E*2],[spmean(pltcs(ll)) spmean(pltcs(ll))],'color','k','linewidth',2)

122

grid on
leg=legend('MG, mean +-3 std','GLS, mean +-3 std','Source Population','Nominal');
set(leg,'Position',[0.63 0.83 0.091 0.03],'fontsize',5);
title(['Modal Uncertainty, ARX order ',num2str(Na),', Frequency Nr
',num2str(pltcs(ll))],'fontsize',8)
xlabel('Number of sets, M','fontsize',7)
ylabel('Frequency (Hz)','fontsize',7)
%xlim([0 260])
end
clear mgbound mgmean glsbound glsmean spbound spmean
end
clear nommean nombound
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng MMod
%pause
%close
%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------

123

NRESULTS.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% NRESULTS.m
%
% Last Update: 06 - 10 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
% IMPORTANT NOTE: CHANGE THE PATH/LOCATION IN THE cd AND load COMMAND
% ACCORDINGLY
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%--------------------------------------------------------------------------

%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%% THIS IS FOR THE N-ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%


%-------------------------------------------------------------------------%---------------------------- RESULT PLOTS -------------------------------%% ------------------- Parameter Covariance Matrix MSE Plots -------------figure(1)
subplot(2,1,1);
bar(spp',[MGPCMSE2' GLSPCMSE2'],'grouped')
xlabel('Samples per Parameter, Spp','fontsize',7)
ylabel('Covariance MSE','fontsize',7)
leg=legend('MG','GLS');
set(leg,'fontsize',8);
title(['MSE of Par. Cov. Mat. (Nominal and Estimated), ARX Order ',num2str(Na),'
(M=',num2str(M),')'],'fontsize',8)
ylim([0 5e-7])
subplot(2,1,2);
bar(spp',[MGPCMSE1' GLSPCMSE1'],'grouped')
title(['MSE of Par. Cov. Mat. (Source pop. and Estimated), ARX Order ',num2str(Na),'
(M=',num2str(M),')'],'fontsize',8)
leg=legend('MG','GLS');
set(leg,'fontsize',8);
ylabel('Covariance MSE','fontsize',7)
xlabel('Samples per Parameter, SpP','fontsize',7)
ylim([0 5e-7])
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng NCovMatMSE
pause
close
%% ---------------- Parameter Covariance Matrix Condition Number Plots------start=1;
figure(2)
subplot(2,1,1);
bar(spp(start:end),SourCond(start:end),'g');
hold
plot(spp(start:end),ones(length(spp)-start+1)*NomCond,'r')
xlabel('Number of Samples per Parameter, SpP','fontsize',7)
ylabel('Parameter Cov. Mat. Cond. Number','fontsize',7)
title(['Parameter Cov. Mat. Condition Number (Source pop. and Nominal), ARX Order
',num2str(Na),' (M=',num2str(M),')'],'fontsize',8)

124

leg=legend('Source Population','Nominal');
set(leg,'fontsize',8);
subplot(2,1,2);
bar(spp(start:end)',[MGCond(start:end)' GLSCond(start:end)'],'grouped' );
hold
plot(spp(start:end),ones(length(spp)-start+1)*NomCond,'r')
xlabel('Number of Samples per Parameter, SpP','fontsize',7)
ylabel('Parameter Cov. Mat. Cond. Number','fontsize',7)
title(['Estimated Parameter Cov. Mat. Condition Number, ARX Order ',num2str(Na),'
(M=',num2str(M),')'],'fontsize',8)
leg=legend('MG Est','GLS Est','Nominal');
set(leg,'fontsize',8);
%ylim([0 3e3])
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng NCovMatCond
pause
close
%% ---------------------------- FRF Plots --------------------------------grey=[.6 .6 .6];
for hh=1:length(FP)
figure(1)
subplot(2,2,hh)
eval(['MAG' '=MAG' num2str(hh)]);
q=plot(W,20*log10(MAG),'Color','blue');
hold on
title(['FRF Magnitude, ARX Order ',num2str(Na),', (',num2str(M),' sets), ',
num2str(FP(hh)),' SpP'],'fontsize',8)
xlabel('Frequency (Hz)','fontsize',7)
ylabel('Magnitude (dB)','fontsize',7)
qq=plot(W,MAGMGUP(hh,:),'Color','green','LineWidth',1);
plot(W,MAGMGDOWN(hh,:),'Color','green','LineWidth',1);
plot(W,MEANMAGMG(hh,:),'Color','green','LineWidth',1.25,'linestyle','--');
qqq=plot(W,MAGGLSUP(hh,:),'Color','red','LineWidth',1);
plot(W,MAGGLSDOWN(hh,:),'Color','red','LineWidth',1);
plot(W,MEANMAGGLS(hh,:),'Color','red','LineWidth',1.25,'linestyle','--');
ylim([-25 20]);
leg=legend([qq; qqq; q],'MG, +/- 3stdv','GLS, +/-3stdv','Single
ARX','location','southeast');
set(leg,'fontsize',6);
grid on
end
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng NFRF
pause
close
%% -------------- Parameter Hist Plots -----------------------------------for ll=1:length(FP)
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
eval(sprintf('load abN%dNa%d',ll,Na));
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
figure(1);
subplot(2,4,ll)
bar(xout1,a/sum(a))
hold on
plot(xout11,amg/sum(amg),'g',xout12,agls/sum(agls),'r')
title(['a',num2str(PP(1)),', ARX ',num2str(Na),' (',num2str(M),' sets),
',num2str(FP(ll)),' SpP'],'fontsize',8)
xlabel('Value','fontsize',7)
ylabel('Relative frequency','fontsize',7)
subplot(2,4,4+ll)
bar(xout2,b/sum(b))
hold on
plot(xout21,bmg/sum(bmg),'g',xout22,bgls/sum(bgls),'r')
title(['b',num2str(PP(2)),', ARX ',num2str(Na),' (',num2str(M),' sets),
',num2str(FP(ll)),' SpP'],'fontsize',8)
xlabel('Value','fontsize',7)
ylabel('Relative frequency','fontsize',7)
end
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])

125

print -dpng Npar


pause
close
%% ---------------------- MODALS -----------------------------------------brown=[.7 .5 0];
E=1;
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
eval(sprintf('load NomModalsNa%d',Na));
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
nommean=mean(NOMFN);
stdv=std(NOMFN);
nombound(1,:)=nommean+3*stdv;
nombound(2,:)=nommean-3*stdv;
nombound=nombound';
nommean=nommean';
spmean=mean(NOMFN(1:M,:));
spbound(1,:)=spmean+3*std(NOMFN(1:M,:));
spbound(2,:)=spmean-3*std(NOMFN(1:M,:));
spmean=spmean';
spbound=spbound';
for hh=1:length(FP)
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE\DATA')
eval(sprintf('load RCPmodalsN%dNa%d',hh,Na));
cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
%cd('C:\Users\G. Exarchos\Desktop\Thesis\MATLAB\Main\3.Pooled\EXE')
mgmean=mean(MGFN);
mgbound(1,:)=mgmean+3*std(MGFN);
mgbound(2,:)=mgmean-3*std(MGFN);
mgmean=mgmean';
mgbound=mgbound';
glsmean=mean(GLSFN);
glsbound(1,:)=glsmean+3*std(GLSFN);
glsbound(2,:)=glsmean-3*std(GLSFN);
glsmean=glsmean';
glsbound=glsbound';
pltcs=[2 6 10];
for ll=1:length(pltcs)
figure(1)
subplot(length(pltcs),1,ll)
fill([FP(hh)-E*1.5 FP(hh)-E*0.5 FP(hh)-E*0.5 FP(hh)-E*1.5 FP(hh)E*1.5],[mgbound(pltcs(ll),2)...
mgbound(pltcs(ll),2) mgbound(pltcs(ll),1) mgbound(pltcs(ll),1)
mgbound(pltcs(ll),2)],'b')
hold on
fill([FP(hh)-E*0.5 FP(hh)+E*0.5 FP(hh)+E*0.5 FP(hh)-E*0.5 FP(hh)E*0.5],[glsbound(pltcs(ll),2)...
glsbound(pltcs(ll),2) glsbound(pltcs(ll),1) glsbound(pltcs(ll),1)
glsbound(pltcs(ll),2)],'m')
fill([FP(hh)+E*0.5 FP(hh)+E*1.5 FP(hh)+E*1.5 FP(hh)+E*0.5
FP(hh)+E*0.5],[spbound(pltcs(ll),2)...
spbound(pltcs(ll),2) spbound(pltcs(ll),1) spbound(pltcs(ll),1)
spbound(pltcs(ll),2)],'g')
plot([0 FP],ones(1,length(FP)+1)*nommean(pltcs(ll)),'--r')
plot([0 FP],ones(1,length(FP)+1)*nombound(pltcs(ll),1),'-r')
plot([0 FP],ones(1,length(FP)+1)*nombound(pltcs(ll),2),'-r')
plot([FP(hh)-E*2 FP(hh)],[mgmean(pltcs(ll)) mgmean(pltcs(ll))],'color','k','linewidth',2)
plot([FP(hh)-E*1 FP(hh)+E*1],[glsmean(pltcs(ll))
glsmean(pltcs(ll))],'color','k','linewidth',2)
plot([FP(hh) FP(hh)+E*2],[spmean(pltcs(ll)) spmean(pltcs(ll))],'color','k','linewidth',2)
grid on
leg=legend('MG, mean +-3 std','GLS, mean +-3 std','Source Population','Nominal');
set(leg,'Position',[0.63 0.83 0.091 0.03],'fontsize',5);
title(['Modal Uncertainty, ARX order ',num2str(Na),', (',num2str(M),' Sets), Frequency Nr
',num2str(pltcs(ll))],'fontsize',8)
xlabel('Number of samples per parameter, SpP','fontsize',7)
ylabel('Frequency (Hz)','fontsize',7)
xlim([0 90])
end
clear mgbound mgmean glsbound glsmean

126

end
clear nommean nombound
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng NMod
%pause
%close
%-------------------------------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------

127

FPMC.m
%-------------------------------------------------------------------------%--------- Matlab Code for N.F./D.R-Parameter Statistics via MC ----------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% FPMC.m
%
% Last Update: 22 - 09 - 2010
%
% Description:
% This matlab code is designed to investigate the statistical distribution
% of a models AR parameters when the system's natural frequancies and
% damping ratios follow normal distribution with a small percentage of
% their value as standard deviation. The procedure involves selecting the
% nominal values of a number of natural frequancies and their respective
% damping ratios, and a percentage of deviation. Through the Monte Carlo
% iterative method, continuous time poles are created, which are converted
% to discrete time poles and finaly to AR parameters. Results are
% examined statisticaly.
%
% Version: wn,z~ND
%---------------------------- List of Symbols ----------------------------% INPUT:
% N : Number of Monte Carlo iterations.
% wn : Natural frequencies in angular speeds. Enter value in Hz within the
%
brackets.
% z : Damping ratios. Enter value in angle degrees within the brackets.
% u1 : Natural frequency value percentage used as standard deviation.
% u2 : Damping ratio value percentage used as standard deviation.
% Fs : Sampling frequency. Minimum input: 2*fmax.
%
% OUTPUT:
% Ts : Sampling period.
% Np : Number of poles (NOT including their conjugates).
% wnu
: Natural freq. in angl. speed with uncertainty.
% zu
: Damping ratios with uncertainty.
% cpoles : Continuous time poles
% dpoles : Discrete time poles
% den
: Denominator coefficients (one model).
% DEN
: Denominator coefficients (all models).
%-------------------------------------------------------------------------clear,clc,close all
N=100000;
wn=2*pi*[12 24 46 65 89];
z=cosd([80 82
u1=0.05;
u2=0.05;
Fs=200;
Ts=1/Fs;

%
%
%

% Number of iterations
% Enter N.F.
% Frequencies are converted to angular speeds.
86 84 80]);
% Enter D.R.
% Angles are converted to damping ratios.
N.F. standard deviation. Enter percentage of nominal wn value
D.R. standard deviation. Enter percentage of nominal zn value
Sampling Frequency (Minimum: 2*fmax)

Np=length(wn);
DEN=zeros(2*Np+1,N);
tic
for j=1:N
wnu=wn'+u1*wn'.*randn(Np,1);
zu=z'+u2*z'.*randn(Np,1);
cpoles(1:Np,1)=-(zu.*wnu)+1i*wnu.*sqrt(1-zu.*zu);
cpoles(Np+1:2*Np,1)=-(zu.*wnu)-1i*wnu.*sqrt(1-zu.*zu);
dpoles=exp(cpoles*Ts);
den=poly(dpoles);
DEN(:,j)=den;
end
toc
save('fpmcdata')
%% -------------------------- PLOTS --------------------------------------Parhistfit=figure('paperorientation','portrait','papertype','a4','paperunits','inch');
set(gcf,'paperposition',[0 0 8 5])
histfit(DEN(6,:))
title(['a5 AR Parameter Value Distribution for ',num2str(N),' Monte Carlo
Iterations'],'fontsize',13)

128

ylabel('Absolute Frequency','fontsize',13)
xlabel('Value','fontsize',13)
print -dpng ParHistFit
Parnormplot=figure('paperorientation','portrait','papertype','a4','paperunits','inch');
set(gcf,'paperposition',[0 0 8 5])
normplot(DEN(6,:))
title(['a5 AR Parameter Normal Probability Plot for ',num2str(N),' Monte Carlo
Iterations'],'fontsize',13)
print -dpng ParNormPlot

129

. MATLAB

130

ANALYSIS2.m
%-------------------------------------------------------------------------%----------- Matlab Code for RCP-ARX Model Identification ----------------%-------------------------------------------------------------------------% ANALYSIS2.m
%
% Author: J. Exarchos
%
%
% Last Update: 13 - 10 - 2010
%
%-------------------------------------------------------------------------%-------------------------------------------------------------------------%----------------------------- ARX ORDER SELECTION -----------------------%-------------------------------------------------------------------------clear, clc, close all
cd('/home/zeus/Desktop/RUN2/Experimental_data')
%cd('/home/fotis/Desktop/RUN2/Experimental_data')
%cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\4.ExpApp\Experimental_data')
load Exp1
%cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\4.ExpApp')
%cd('/home/fotis/Desktop/RUN2')
cd('/home/zeus/Desktop/RUN2')
y=VCAP_DATA(1:8e3,2);
x=VCAP_DATA(1:8e3,5);
y=detrend(y);
Fs=256;
DATA=iddata(y,x,1/Fs);
minord=40;
maxord=150;
ORDERSELECTION(DATA,Fs,minord,maxord)
pause
%-------------------------------------------------------------------------%-------------------------- END OF ARX ORDER SELECTION -------------------%-------------------------------------------------------------------------%%
%-------------------------------------------------------------------------%---------------------------- RCP IDENTIFICATION -------------------------%-------------------------------------------------------------------------clear, clc, close all
Fs=256;
na=136;
nb=na;
orders=[na nb+1 0];
M=80;
N=8e3;
W=0:0.1:100; % FRF plots frequency resolution
[thetamg,thetagls,GammaMG,GammaGLS,MAG,FN]=RCPANALYSIS(M,N,Fs,orders,W);
%-------------------------------------------------------------------------%------------------------ END OF RCP IDENTIFICATION ----------------------%-------------------------------------------------------------------------%%
%-------------------------------------------------------------------------%-------------------------- RCP MONTE CARLO ------------------------------%-------------------------------------------------------------------------PP=[1 2]; % Enter parameters to plot. Currently: a1,b2
IT=1000;
[amg bmg agls bgls MagMgTHRESH MagGlsTHRESH MeanMagMG MeanMagGLS index MGFN
GLSFN]=RCPMonteCarlo2(GammaMG,GammaGLS,orders,IT,Fs,thetamg,thetagls,W,PP);
MagMGup=20*log10(MagMgTHRESH(1,:));
MagMGdown=20*log10(MagMgTHRESH(2,:));
MagGLSup=20*log10(MagGlsTHRESH(1,:));
MagGLSdown=20*log10(MagGlsTHRESH(2,:));

131

save RESULTS
%-------------------------------------------------------------------------%-------------------------- END OF RCP MONTE CARLO -----------------------%-------------------------------------------------------------------------%%
[TXY,F]=NONPARAMETRIC(M,N,Fs);
% [r c]=size(TXY);
% for i=1:r
%
for j=1:c
%
if TXY(i,j)<=0;
%
TXY(i,j)=10^-10;
%
end
%
end
% end
save RESULTS -append
%-------------------------------------------------------------------------%% -------------------------------- RESULTS -------------------------------%-------------------------------------------------------------------------%
BIC- RSS/SSS
clear
load selectorder
i=10; ii=14;
figure
subplot(2,1,1),plot(minord:maxord,BIC(minord:maxord),'-o')
xlim([minord maxord])
title('BIC criterion','Fontname','TimesNewRoman','Fontsize',ii)
ylabel('BIC','Fontname','TimesNewRoman','Fontsize',ii)
set(gca,'fontsize',i)
subplot(2,1,2),plot(minord:maxord,rss(minord:maxord),'-o')
xlim([minord maxord])
title('RSS/SSS criterion','Fontname','TimesNewRoman','Fontsize',ii)
ylabel('RSS/SSS (%)','Fontname','TimesNewRoman','Fontsize',ii)
xlabel('ARX(n,n)','Fontname','TimesNewRoman','Fontsize',ii)
set(gca,'fontsize',i)
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng BICRSS

%% Frequency stabilization plot


i=10; ii=14;
figure, hold on
for order=minord:maxord
for jj=1:maxord/2
imagesc([5*fn(order,jj)],[order],[z(order,jj)])
end
end
axis([0,5*Fs/2,minord,maxord])
colorbar,box on,
h = get(gca,'xtick');
set(gca,'xticklabel',h/5,'fontsize',i);
title('Frequency stabilization plot (colormap indicates damping
ratio)','Fontname','TimesNewRoman','Fontsize',ii)
ylabel('ARX(n,n)','Fontname','TimesNewRoman','Fontsize',ii)
xlabel('Frequency (Hz)','Fontname','TimesNewRoman','Fontsize',ii)
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng frestab

%% FRF
l=0.5; ll=2;
figure(1)
subplot(2,1,1)
for i=1:M
q=plot(W, 20*log10(MAG(i,:)));

132

set(q,'color',[0.7 0.7 0.7]);


hold on
end
qq=plot(W,MagMGup,'Color','green','LineWidth',l,'linestyle','--');
plot(W,MagMGdown,'Color','green','LineWidth',l,'linestyle','--');
plot(W,MeanMagMG,'Color','green','LineWidth',ll);
leg=legend([qq; q],'MG, +/- 3 stdv','Single ARX','location','northwest');
set(leg,'fontsize',6);
title('Frequency Response Function')
ylim([-45 40])
xlim([17 100])
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')
subplot(2,1,2)
for i=1:M
q=plot(W, 20*log10(MAG(i,:)));
set(q,'color',[0.7 0.7 0.7]);
hold on
end
qqq=plot(W,MagGLSup,'Color','red','LineWidth',l,'linestyle','--');
plot(W,MagGLSdown,'Color','red','LineWidth',l,'linestyle','--');
plot(W,MeanMagGLS,'Color','red','LineWidth',ll)
leg=legend([qqq; q],'GLS, +/- 3 stdv','Single ARX','location','northwest');
set(leg,'fontsize',6);
xlim([17 100])
ylim([-25 20]);
title('Frequency Response Function')
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')
ylim([-45 40])
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng parFRF
%%
l=0.5; ll=2;
figure(1)
subplot(2,1,1)
for i=1:M
q=plot(F, 20*log10(TXY(i,:)));
set(q,'color',[0.7 0.7 0.7]);
hold on
end
qq=plot(W,MagMGup,'Color','green','LineWidth',l,'linestyle','--');
plot(W,MagMGdown,'Color','green','LineWidth',l,'linestyle','--');
plot(W,MeanMagMG,'Color','green','LineWidth',ll);
leg=legend([qq; q],'MG, +/- 3 stdv','Non Parametric Welch','location','northwest');
set(leg,'fontsize',6);
title('Frequency Response Function')
ylim([-45 40])
xlim([17 100])
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')
subplot(2,1,2)
for i=1:M
q=plot(F, 20*log10(TXY(i,:)));
set(q,'color',[0.7 0.7 0.7]);
hold on
end
qqq=plot(W,MagGLSup,'Color','red','LineWidth',l,'linestyle','--');
plot(W,MagGLSdown,'Color','red','LineWidth',l,'linestyle','--');
plot(W,MeanMagGLS,'Color','red','LineWidth',ll)
leg=legend([qqq; q],'GLS, +/- 3 stdv','Non Parametric Welch','location','northwest');
set(leg,'fontsize',6);
xlim([17 100])
ylim([-25 20]);
title('Frequency Response Function')
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')
ylim([-45 40])
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])

133

print -dpng nonparFRF


%% MODALS
clear, close all
load RESULTS
mode = [19.8 28.7 30.8 64.5 70.5 74];
indeces = zeros(6,80);
for mm = 1 : length(mode)
for ii = 1 : 80
indeces(mm,ii) = find(abs(FN{ii}-mode(mm)) == min(abs(FN{ii}-mode(mm))));
end
end
for ii=1:80
for mm=1:length(mode)
fn=FN{ii};
Fn(mm,ii)=fn(indeces(mm,ii));
end
end
smean=mean(Fn,2);
sbound(:,1)=smean+3*std(Fn,[],2);
sbound(:,2)=smean-3*std(Fn,[],2);
indeces = zeros(6,80);
clear fn Fn
for mm = 1 : length(mode)
for ii = 1 : 80
indeces(mm,ii) = find(abs(MGFN{ii}-mode(mm)) == min(abs(MGFN{ii}-mode(mm))));
end
end
for ii=1:80
for mm=1:length(mode)
fn=MGFN{ii};
Fn(mm,ii)=fn(indeces(mm,ii));
end
end
mgmean=mean(Fn,2);
mgbound(:,1)=mgmean+3*std(Fn,[],2);
mgbound(:,2)=mgmean-3*std(Fn,[],2);
indeces = zeros(6,80);
clear fn Fn
for mm = 1 : length(mode)
for ii = 1 : 80
indeces(mm,ii) = find(abs(GLSFN{ii}-mode(mm)) == min(abs(GLSFN{ii}-mode(mm))));
end
end
for ii=1:80
for mm=1:length(mode)
fn=GLSFN{ii};
Fn(mm,ii)=fn(indeces(mm,ii));
end
end
glsmean=mean(Fn,2);
glsbound(:,1)=glsmean+3*std(Fn,[],2);
glsbound(:,2)=glsmean-3*std(Fn,[],2);
FP=[1 2 3];
E=1;
pltcs=[1 2 3 4 5 6];
figure(2)
for ll=1:length(pltcs)
subplot(length(pltcs)/2,2,ll)
fill([FP(2)-E*1.5 FP(2)-E*0.5 FP(2)-E*0.5 FP(2)-E*1.5 FP(2)E*1.5],[mgbound(pltcs(ll),2)...
mgbound(pltcs(ll),2) mgbound(pltcs(ll),1) mgbound(pltcs(ll),1)
mgbound(pltcs(ll),2)],'b')
hold on
fill([FP(3)-E*0.5 FP(3)+E*0.5 FP(3)+E*0.5 FP(3)-E*0.5 FP(3)E*0.5],[glsbound(pltcs(ll),2)...
glsbound(pltcs(ll),2) glsbound(pltcs(ll),1) glsbound(pltcs(ll),1)
glsbound(pltcs(ll),2)],'m')
fill([FP(1)+E*0.5 FP(1)+E*1.5 FP(1)+E*1.5 FP(1)+E*0.5
FP(1)+E*0.5],[sbound(pltcs(ll),2)...
sbound(pltcs(ll),2) sbound(pltcs(ll),1) sbound(pltcs(ll),1) sbound(pltcs(ll),2)],'g')
plot([FP(2)-E*2 FP(2)],[mgmean(pltcs(ll)) mgmean(pltcs(ll))],'color','k','linewidth',2)

134

plot([FP(3)-E*1 FP(3)+E*1],[glsmean(pltcs(ll))
glsmean(pltcs(ll))],'color','k','linewidth',2)
plot([FP(1) FP(1)+E*2],[smean(pltcs(ll)) smean(pltcs(ll))],'color','k','linewidth',2)
grid on
leg=legend('MG, mean +-3 std','GLS, mean +-3 std','Simple ARX');
set(leg,'Position',[0.65 0.82 0.091 0.03],'fontsize',8);
title(['Modal Uncertainty, Frequency Nr ',num2str(pltcs(ll))],'fontsize',8)
ylabel('Frequency (Hz)','fontsize',7)
end
set(gcf,'paperorientation','portrait','papertype','a4','paperunits','inch','paperposition',[0
0 8 5])
print -dpng modals

135

ORDERSELECTION.m
%-------------------------------------------------------------------------%----------- Matlab Code for RCP-ARX Model Identification ----------------%-------------------------------------------------------------------------% ORDERSELECTION.m
%
% Editor: J. Exarchos
% Original authors: F. Kopsaftopoulos, A. Florakis & K.A.Petsounis
%
% Last Update: 12 - 10 - 2010
%
function ORDERSELECTION(DATA,Fs,minord,maxord)
NN=size(DATA);
N=NN(1);
tic
for order=minord:maxord
models{order}=arx(DATA,[order order+1 0]);
end
toc
Yp=cell(1,maxord); rss=zeros(1,maxord); BIC=zeros(1,maxord);
for order=minord:maxord
BIC(order)=log(models{order}.noisevariance)+...
(size(models{order}.parametervector,1)*log(N))/N;
end
for order=minord:maxord
Yp{order}=predict(models{order},DATA,1);
rss(order)=100*(norm(DATA.outputdata-Yp{order}.outputdata)^2)/(norm(DATA.outputdata)^2);
end
[D,fn,z] = deal(zeros(maxord,maxord/2));
for order=minord:maxord
clear num den
num = models{order}.B;
den = models{order}.A;
[DELTA,Wn,ZETA]=disper_new(num,den,Fs);
qq = length(DELTA);
D(order,1:qq) = DELTA';
fn(order,1:qq) = Wn';
z(order,1:qq) = ZETA';
end
save selectorder
%-------------------------------------------------------------------------% %-----------------------------------------------------------------------% %
Auxiliary Functions
% %-----------------------------------------------------------------------% %-----------------------------------------------------------------------function [Delta,fn,z]=disper_new(num,den,Fs)
% num
: The numerator of the transfer function
% den
: The denominator of the transfer function
% Fs
: The sampling frequency (Hz)
% Delta : The precentage dispersion
% fn
: The corresponding frequencies (Hz)
% z
: The corresponding damping (%)
% R
: The residues of the discrete system
% Mag
: The magnitude of the corresponding poles
% This function computes the dispersion of each frequency of a system. The System is
% enetred as a transfer function. In case the order of numerator polynomial is greater than
% that of the denominator the polynomial division is apllied, and the dispersion is considered
at
% the remaine tf. The analysis is done using the Residuez routine of MATLAB.
% The results are printed in the screen in asceding order of frequencies.
% This routine displays only the dispersions from the natural frequencies (Complex Poles).
% REFERENCE[1]:
% REFERENCE[2]:

MIMO LMS-ARMAX IDENTIFICATION OF VIBRATING STRUCTURES - A Critical Assessment


PANDIT WU

%-------------------------------------------% Created
: 08 December 1999.

136

% Author(s) : A. Florakis & K.A.Petsounis


% Updated
: 16 February 1999.
%-------------------------------------------% Sampling Period
% Ts=1/Fs;
% Calculate the residues of the Transfer Function
num=num(:).';
den=den(:).';
[R,P]=residuez(num,den);
R=R(:);P=P(:);
% Distinction between Real & Image Residues
[R,P,l_real,l_imag]=srtrp(R,P,'all');
% Construction of M(k) (Eq. 45 REF[1])
for k=1:length(P)
ELEM=R./(ones(length(P),1)-P(k).*P);
M(k)=R(k)*sum(ELEM);
clear ELEM
end

% Construction of the terms Ri/1-pk*pi


% Calculation of M(k)

% Dispersion of Modes (Eq. 46 & 47 REF[1])


D_real=real(M(1:l_real));D_imag=M(l_real+1:l_imag+l_real);
D=[D_real';D_imag'+conj(D_imag)'];
Delta=100*D./sum(D);
sum(Delta);
% Sorting Dispersions by asceding Frequency
lambda=P(l_real+1:l_imag+l_real);
Wn=Fs*abs(log(lambda));
% Corresponding Frequencies
z= -cos(angle(log(lambda)));
% Damping Ratios
[Wn sr]=sort(Wn);
fn=Wn./(2*pi);
% rad/sec==>Hz
z=100*z(sr);
Delta=Delta(l_real+1:l_real+l_imag);
Delta=Delta(sr);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [R,P,nr,ni]=srtrp(R,P,flg)
% if flg='hf' ==> Real Residues & Imag Residues (from Real poles)
% else if flg='all' ==> Real Residues & Imag Residues (from positive poles) & Imag Residues
(from negative Poles)
R_real=[];P_real=[];
R_imag_plus=[];P_imag_plus=[];
R_imag=[];P_imag=[];
for i=1:length(R)
if imag(P(i))==0
R_real=[R_real;R(i)];P_real=[P_real;P(i)];
elseif imag(P(i))>0
R_imag_plus=[R_imag_plus;R(i)];P_imag_plus=[P_imag_plus;P(i)];
else
R_imag=[R_imag;R(i)];P_imag=[P_imag;P(i)];
end
end
switch flg
case 'all'
R=[R_real;R_imag_plus;R_imag];P=[P_real;P_imag_plus;P_imag];
nr=length(P_real);ni=length(P_imag);
case 'hf'
P=[P_real;P_imag_plus];R=[R_real;R_imag_plus];
nr=length(P_real);ni=length(P_imag);
end
%-------------------------------------------------------------------------% %-----------------------------------------------------------------------% %
THE END
% %-----------------------------------------------------------------------% %------------------------------------------------------------------------

137

NONPARAMETRIC.m
function [TXY,F]=NONPARAMETRIC(M,N,Fs)
for ii=1:M
cd('/home/zeus/Desktop/RUN2/Experimental_data')
%cd('/home/fotis/Desktop/RUN2/Experimental_data')
%cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\4.ExpApp\Experimental_data')
eval(sprintf('load Exp%d',ii));
%cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\4.ExpApp')
%cd('/home/fotis/Desktop/RUN2')
cd('/home/zeus/Desktop/RUN2')
y=VCAP_DATA(1:N,2);
x=VCAP_DATA(1:N,5);
y=detrend(y);
[Txy,F]=tfestimate(x,y,2048,1800,[],Fs);
TXY(ii,:)=Txy;
waitbar(ii/M)
end

138

RCPANALYSIS.m
%-------------------------------------------------------------------------%----------- Matlab Code for RCP-ARX Model Identification ----------------%-------------------------------------------------------------------------% RCPANALYSIS.m
%
% Author: J. Exarchos
%
% Required Matlab Codes: MG.m GLS2.m
%
% Last Update: 13 - 10 - 2010
%
%-------------------------------------------------------------------------function [thetamg,thetagls,GammaMG,GammaGLS,MAG,FN]=RCPANALYSIS(M,N,Fs,orders,W)
for ii=1:M
cd('/home/zeus/Desktop/RUN2/Experimental_data')
%cd('/home/fotis/Desktop/RUN2/Experimental_data')
%cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\4.ExpApp\Experimental_data')
eval(sprintf('load Exp%d',ii));
%cd('C:\Users\John\Desktop\Thesis\MATLAB\Main\4.ExpApp')
%cd('/home/fotis/Desktop/RUN2')
cd('/home/zeus/Desktop/RUN2')
y=VCAP_DATA(1:N,2);
x=VCAP_DATA(1:N,5);
y=detrend(y);
X(ii,:)=x;
Y(ii,:)=y;
data=iddata(y,x,1/Fs);
m=arx(data,orders);
% ARX model identification of same orders
[estnum,estden]=tfdata(m,'v');
% Estimated model parameters
Na=orders(1);
fn=MODALS(estden,1/Fs);
FN{ii}=fn;
ESTTHETA(ii,:)=[estden(2:end) estnum];
clear data
[Mag]=ffplot(m,W);
Mag=reshape(Mag,1001,1);
MAG(ii,:)=Mag;
clear Mag
waitbar(ii/M)
end
[thetamg, GammaMG]=MG(ESTTHETA); %SEE FUNCTION MG.M
[thetagls,GammaGLS]=GLS2(M,orders,N,X,Y,ESTTHETA);
end
%%
function [fn]=MODALS(den,Ts)
dpoles=roots(den);
cpoles=log(dpoles)/Ts;
ff=zeros(1,length(cpoles));
for j=1:length(cpoles)
if imag(cpoles(j))>0;
ff(j)=(1/(2*pi))*abs(cpoles(j));
end
end
ff=ff';
fn=ff;
fn(~any(ff,2),:)=[];
fn=fn';
fn=sort(fn);
end

139

MG.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% MG.m
%
% Last Update: 22 - 09 - 2010
%
% Description: see EXECTUTIONCODE.m
%
% Required Matlab codes: EXECUTIONCODE.m,LargeARXcreation.m, MPOOLEDMODEL.m
%
NPOOLEDMODEL.m, ANALYSIS.m, MG.m, GLS.m,
%
RCPMonteCarlo.m, MODALS.m, MRESULTS.m, NRESULTS.m
%
%
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%-------------------------------------------------------------------------function [thetamg, GammaMG]=MG(ESTTHETA)
thetamg=mean(ESTTHETA,1);
GammaMG=cov(ESTTHETA); % This is the empirical (MG) parameter covariance matrix
end

140

GLS2.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification -------------------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% GLS2.m
%
% Last Update: 11 - 10 - 2010
%
%
% For any symbols not defined in EXECUTIONCODE.m check main thesis.
%-------------------------------------------------------------------------function [thetagls,GammaGLS]=GLS2(M,orders,N,x,y,ESTTHETA)
Na=orders(1);
Nb=Na;
dim=Na+Nb+1;
phik=zeros(N,dim);
PROD1=zeros(dim,dim,M);
MULT1=zeros(dim,dim,M);
MULT2=zeros(dim,dim,M);
Rk=zeros(dim,dim,M);
for i =1:M
yUin=[zeros(1,Na) y(i,:)]; % Adding zeros for initial conditions
xUin=[zeros(1,Na) x(i,:)];
for l=1:N
phik(l,:)=[-yUin(l-1+Na:-1:l) xUin(l-1+Nb+1:-1:l)];
end
ek=y(i,:)-(phik*ESTTHETA(i,:)')';
sigma2k=ek*ek'/N;
PROD1(:,:,i)=1/N*sigma2k*(eye(dim,dim)/(phik'*phik));
end
clear x y yUin xUin phik ek sigma2k
ESTTHETA0=mean(ESTTHETA,1);
dtheta=bsxfun(@minus,ESTTHETA,ESTTHETA0);
COR=mean(PROD1,3);
GammaGLS=cov(dtheta)-COR;
clear ESTTHETA0 dtheta COR
for ii=1:M
MULT1(:,:,ii)=eye(dim,dim)/(GammaGLS+PROD1(:,:,ii));
MULT2(:,:,ii)=MULT1(:,:,ii);
end
MULT1=eye(dim,dim)/sum(MULT1,3);
for ii=1:M
Rk(:,:,ii)=MULT1(:,:)*MULT2(:,:,ii);
PROD2(:,:,ii)=Rk(:,:,ii)*ESTTHETA(ii,:)';
end
clear Rk
thetagls=sum(PROD2,3);
end

141

RCPMonteCarlo2.m
%-------------------------------------------------------------------------%-------- Matlab Code for RCP-ARX Model Identification and Analysis ------%-------------------------------------------------------------------------% Author: J. Exarchos
%-------------------------------------------------------------------------% RCPMonteCarlo2.m
%
% Last Update: 13 - 10 - 2010
%
% Description: see EXECTUTIONCODE.m
%
%
%
%-------------------------------------------------------------------------%---------------------------- List of Symbols ----------------------------% SEE EXECUTIONCODE.m
%-------------------------------------------------------------------------function [amg bmg agls bgls MagMgTHRESH MagGlsTHRESH MeanMagMG MeanMagGLS index MGFN
GLSFN]=RCPMonteCarlo2(GammaMG,GammaGLS,orders,IT,Fs,thetamg,thetagls,W,PP)
Ts=1/Fs;
Na=orders(1);
Nb=Na;
dim=Na+Nb+1;
index1=0;
index2=0;
index3=0;
%------EDIT-----[Lmg,pos]=chol(GammaMG,'lower');
if pos~=0;
index1=min(eig(GammaMG));
if index1<1e-10 && index1>-1e-10
GammaMG=GammaMG+(abs(index1)+1e-18)*eye(dim,dim);
Lmg=chol(GammaMG,'lower');
end
end
[Lgls,pos]=chol(GammaGLS,'lower');
if pos~=0;
index2=min(eig(GammaGLS));
if index2<1e-10 && index2>-1e-10
GammaGLS=GammaGLS+(abs(index2)+1e-18)*eye(dim,dim);
Lgls=chol(GammaGLS,'lower');
else
Lgls=Lmg;
index3=1;
end
end
index=[index1 index2 index3];
%----------------clear GammaMG GammaGLS
randn('seed',22)
Pert=randn(dim,IT);
MAGMG=zeros(IT,1001);
MAGGLS=zeros(IT,1001);
amg=zeros(IT,1);
bmg=zeros(IT,1);
agls=zeros(IT,1);
bgls=zeros(IT,1);
for k=1:IT;
RandThetaMg=thetamg+(Lmg*Pert(:,k))'; % Random Theta vector
RandThetaGls=thetagls'+(Lgls*Pert(:,k))';%
|
% This is for the parameter plots
|
amg(k)=RandThetaMg(PP(1));
%
|
bmg(k)=RandThetaMg(Na+1+PP(2));%
|
agls(k)=RandThetaGls(PP(1));
%
|
bgls(k)=RandThetaGls(Na+1+PP(2));%
|
%--------------------------------V
mgden=[1 RandThetaMg(1:Na)];
% random denominator
glsden=[1 RandThetaGls(1:Na)];
%
&
[mgfn glsfn]=RCPMODALS(mgden,glsden,Ts);
mgnum=RandThetaMg(Na+1:end);
% random numerator
glsnum=RandThetaGls(Na+1:end);

142

modelmg=idpoly(mgden,mgnum,[],[],[],[],Ts); % --> random model


modelgls=idpoly(glsden,glsnum,[],[],[],[],Ts);
[magmg]=ffplot(modelmg,W);
% --> FRF magn.
[maggls]=ffplot(modelgls,W);
MAGMG(k,:)=(reshape(magmg,1001,1))';
% all FRF mags
MAGGLS(k,:)=(reshape(maggls,1001,1))';
MGFN{k}=mgfn;
GLSFN{k}=glsfn;
waitbar(k/IT)
end
MagMG=mean(MAGMG,1);
% mean
MagGLS=mean(MAGGLS,1);
stdevmg=std(MAGMG);
% standard dev.
stdevgls=std(MAGGLS);
MagMgTHRESH=[MagMG; MagMG]+3*[stdevmg;-stdevmg]; % mean +- 3*stdv
MagGlsTHRESH=[MagGLS; MagGLS]+3*[stdevgls;-stdevgls];
for ii=1:1001
% all negative values -> close to zero
for jj=1:2
if MagMgTHRESH(jj,ii)<=0;
MagMgTHRESH(jj,ii)=10^-10;
end
if MagGlsTHRESH(jj,ii)<=0;
MagGlsTHRESH(jj,ii)=10^-10;
end
end
end
MGMODEL=idpoly([1 thetamg(1:Na)],thetamg(Na+1:end),[],[],[],[],Ts);
[MeanMagMG]=ffplot(MGMODEL,W);
MeanMagMG=reshape(MeanMagMG,1001,1);
MeanMagMG=20*log10(MeanMagMG);
GLSMODEL=idpoly([1 thetagls(1:Na)'],thetagls(Na+1:end)',[],[],[],[],Ts);
[MeanMagGLS]=ffplot(GLSMODEL,W);
MeanMagGLS=reshape(MeanMagGLS,1001,1);
MeanMagGLS=20*log10(MeanMagGLS);
end
%%
function [mgfn glsfn]=RCPMODALS(mgden,glsden,Ts)
mgdpoles=roots(mgden);
glsdpoles=roots(glsden);
mgcpoles=log(mgdpoles)/Ts;
glscpoles=log(glsdpoles)/Ts;
mgff=zeros(1,length(mgcpoles));
glsff=zeros(1,length(mgcpoles));
for j=1:length(mgcpoles)
if imag(mgcpoles(j))>0;
mgff(j)=(1/(2*pi))*abs(mgcpoles(j));
end
if imag(glscpoles(j))>0;
glsff(j)=(1/(2*pi))*abs(glscpoles(j));
end
end
mgff=mgff';
glsff=glsff';
mgfn=mgff;
glsfn=glsff;
mgfn(~any(mgff,2),:)=[];
glsfn(~any(glsff,2),:)=[];
mgfn=mgfn';
glsfn=glsfn';
mgfn=sort(mgfn);
glsfn=sort(glsfn);
end

143

144


ARX (4,4), ARX(10,10),
ARX(16,16) ARX(26,26)
, 1 100 Hz.
,
(Input to Noise Ratio, INR, R=10, 5 2),

,
3 50 100

(SpP, Samples per


Parameter)
.

. 1:

1:

().
.
, SpP (samples per
parameter, ).
. .
. INR (Input to Noise Ratio,
).

.

.
FRF.

.
.
.


, , .
MATLAB (MODEL.m ARXIDENT.m

145

ARX
, INR=10

.
, 1:

1:


:
146

2: (FRF)

,
ARX .
3:

3:

147


,
, .

:

4: FRF , SpP, ARX(4,4)

5: FRF , SpP, ARX(10,10)

148

6: FRF , SpP, ARX(16,16)

7: FRF , SpP, ARX(26,26)


, .

149


.
, :

8:

,

(2 ), ,
SpP
(. . 9):

150

9: FRF


. AR
,
.

10: AR
.

,
,
.
151

.
, ,

. 11:

11: .


.
70 SpP,
12! ,
.

,
, .
,
12:
152

12: ARX(16,16)

(R=10, 5, 2)
( )
,
. (INR)
10, 5 2,
0.1, 0.25 0.5 .
,

.
.


.
, ,
. 13 14:

153

13: FRF
FRF ,
.

154

14: FRF
FRF ,
.

155


,
, . ,
INR 10 0.035
0.00012 48 SpP, 7.2e-4
, INR 2 2.9574 0.0024 39
, 0.076 !
,
, .
,
.
,
,

(. . 15):

15:
, , INR 10, 5, 2.
.

,
.


,
.

,
, .
156


( ).

.

FRF,
. , .

.

157

You might also like