24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
######################################
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7 2001/08/10 16:19:06 gawthrop
## Tidied up the optimisation stuff
##
## Revision 1.6 2001/07/03 22:59:10 gawthrop
## Fixed problems with argument passing for CRs
##
## Revision 1.5 2001/06/06 07:54:38 gawthrop
|
>
>
>
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
######################################
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8 2002/04/23 17:50:39 gawthrop
## error --> err to avoid name clash with built in function
##
## Revision 1.7 2001/08/10 16:19:06 gawthrop
## Tidied up the optimisation stuff
##
## Revision 1.6 2001/07/03 22:59:10 gawthrop
## Fixed problems with argument passing for CRs
##
## Revision 1.5 2001/06/06 07:54:38 gawthrop
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
## Revision 1.1 2000/12/28 11:58:07 peterg
## Put under CVS
##
###############################################################
## Copyright (C) 1999,2000 by Peter J. Gawthrop
sim_command = sprintf("%s_ssim(x_0,par,simpar,u,i_s)", system_name);
## Extract indices
i_t = free(:,1); # Parameters
i_s = free(:,2)'; # Sensitivities
if nargin<8
|
<
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
## Revision 1.1 2000/12/28 11:58:07 peterg
## Put under CVS
##
###############################################################
## Copyright (C) 1999,2000 by Peter J. Gawthrop
sim_command = sprintf("%s_ssim(x_0,par,simpar,u,i_s)", system_name);
## Extract indices
i_t = free(:,1); # Parameters
i_s = free(:,2)'; # Sensitivities
if nargin<8
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
if (N_y!=n_y)
mess = sprintf("n_y (%i) in data not same as n_y (%i) in model", n_y,N_y);
error(mess);
endif
## Use the last part of the simulation to compare with data
y = y(1+N_data-n_data:N_data,:);
y_par = y_par(1+N_data-n_data:N_data,:);
if extras.verbose # Diagnostics
## printf("y and y_0\n");
## [y,y_0]
endif
##Evaluate error, cost derivative J and cost second derivative JJ
err = 0;
J = zeros(n_th,1);
JJ = zeros(n_th,n_th);
for i = 1:n_y
E = y(:,i) - y_0(:,i); # Error in ith output
|
|
|
<
<
<
<
<
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
if (N_y!=n_y)
mess = sprintf("n_y (%i) in data not same as n_y (%i) in model", n_y,N_y);
error(mess);
endif
## Use the last part of the simulation to compare with data
y = y(N_data-n_data:N_data-1,:);
y_par = y_par(N_data-n_data:N_data-1,:);
##Evaluate error, cost derivative J and cost second derivative JJ
err = 0;
J = zeros(n_th,1);
JJ = zeros(n_th,n_th);
for i = 1:n_y
E = y(:,i) - y_0(:,i); # Error in ith output
|