Differences From Artifact [9640440e1a]:

To Artifact [0f0069f5e3]:


11
12
13
14
15
16
17




18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$




## Revision 1.8  1996/09/13 17:54:08  peter
## Now writes default $PARAMS to $1_args.m - $1_ode may use it.
##
## Revision 1.7  1996/09/12 18:41:48  peter
## Standard error handling added.
##
## Revision 1.6  1996/08/24 14:11:04  peter







>
>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9  1997/01/06 21:36:44  peterg
## Fixed bug mtt_error --> mtt_error.txt
## Replaced lsode by Euler integration.
##
## Revision 1.8  1996/09/13 17:54:08  peter
## Now writes default $PARAMS to $1_args.m - $1_ode may use it.
##
## Revision 1.7  1996/09/12 18:41:48  peter
## Standard error handling added.
##
## Revision 1.6  1996/08/24 14:11:04  peter
54
55
56
57
58
59
60

61
62
63
64
65
66
67
fi

PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odes_m.log 2>mtt_error.txt


  %Read in parameters
  $1_numpar;

  [nx,ny,nu,nz,nyz] = $1_def;
  t=0;	%Just in case it appears in the parameter list.

  $PARAMS







>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
fi

PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odes_m.log 2>mtt_error.txt

  step_factor = 1; %Set up default step factor
  %Read in parameters
  $1_numpar;

  [nx,ny,nu,nz,nyz] = $1_def;
  t=0;	%Just in case it appears in the parameter list.

  $PARAMS
78
79
80
81
82
83
84

85
86
87
88

89
90


91

92
93


94
95
96
97
98
99
100
  [n,m]=size(T);
  if m>n
    T=T';
  end;

if nx>0
%  x = lsode('$1_ode', x0, T);

%Euler integration
  x = x0;
  X=[];
  dt = T(2)-T(1);

  for t=T'
    X = [X x];


    dx = $1_ode(x,t);

    x = x + dx*dt;
  end;


  X = X';
  write_matrix([T,X], '$1_odes');
else
  X = zeros(size(T));
end;

if ny>0







>



|
>


>
>
|
>
|
|
>
>







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  [n,m]=size(T);
  if m>n
    T=T';
  end;

if nx>0
%  x = lsode('$1_ode', x0, T);

%Euler integration
  x = x0;
  X=[];
  dt = (T(2)-T(1))/step_factor;

  for t=T'
    X = [X x];
    ts = t;
    for i=1:step_factor
      dx = $1_ode(x,ts);
      ts = ts + dt;
      x = x + dx*dt;
    end;
  end;

  X = X';
  write_matrix([T,X], '$1_odes');
else
  X = zeros(size(T));
end;

if ny>0

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]