9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Copyright (C) 2000 by Peter J. Gawthrop
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5 2000/05/17 16:01:42 peterg
## Fixed bug for n_y>1
##
## Revision 1.4 2000/05/16 18:57:15 peterg
## Still debugging
##
## Revision 1.3 2000/05/16 11:59:34 peterg
|
>
>
>
>
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Copyright (C) 2000 by Peter J. Gawthrop
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6 2000/05/17 17:20:49 peterg
## Fixed bugs with ny>1. Could be made faster by not generating y when
## y_sim >1
##
## Revision 1.5 2000/05/17 16:01:42 peterg
## Fixed bug for n_y>1
##
## Revision 1.4 2000/05/16 18:57:15 peterg
## Still debugging
##
## Revision 1.3 2000/05/16 11:59:34 peterg
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
## Step size
dt = t(2)-t(1);
iFirst = first/dt;
for i = 1:N
ti = t(i);
ui = u(:,i);
yi = $1_cseo(xi,ui,ti,par); # Output
if i>
y(:,i) = yi;
x(:,i) = xi;
dxi = $1_cse(xi,ui,ti,par); # State derivative
A = $1_smxa(xi,ui,dt,par); # (I-Adt)
A = reshape(A,$Nx,$Nx);
Ax = $1_smxax(xi,ui,dt,par); # (I-Adt)x
#open = eval(sprintf("%s_switchopen(x);", system_name)); # Open switches
#x = mtt_implicit(x,dx,A,Ax,dt,$Nx,zeros(20,1)); # Implicit update
xi = A\(Ax + dxi*dt); # Implicit update
endfor;
endfunction
EOF
fi
|
<
|
|
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
## Step size
dt = t(2)-t(1);
iFirst = first/dt;
for i = 1:N
ti = t(i);
ui = u(:,i);
yi = $1_cseo(xi,ui,ti,par); # Output
y(:,i) = yi;
x(:,i) = xi;
dxi = $1_cse(xi,ui,ti,par); # State derivative
A = $1_smxa(xi,ui,dt,par); # (I-Adt)
#A = reshape(A,$Nx,$Nx);
Ax = $1_smxax(xi,ui,dt,par); # (I-Adt)x
#open = eval(sprintf("%s_switchopen(x);", system_name)); # Open switches
#x = mtt_implicit(x,dx,A,Ax,dt,$Nx,zeros(20,1)); # Implicit update
xi = A\(Ax + dxi*dt); # Implicit update
endfor;
endfunction
EOF
fi
|