Overview
Comment:Uses T in place of t to avoid name clash within function.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 6df02114e59f51008d349474850d97f3779a2323949e0452ba672cf465f2e303
User & Date: gawthrop@users.sourceforge.net on 1996-08-15 16:24:43.000
Other Links: branch diff | manifest | tags
Context
1996-08-15
16:24:55
Initial revision check-in: 26f89d6fe2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:24:43
Uses T in place of t to avoid name clash within function. check-in: 6df02114e5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:23:02
Now uses W in place of w for consistancy with time responses. check-in: 08362f64e8 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
11
12
13
14
15
16
17



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright (c) P.J.Gawthrop, 1996.

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



###############################################################

echo Creating $1_odesol.m
rm -f ode2odesol_m.log

if [ "$2" = "" ]; 
then
  PARAMS='t=[0:0.1:10]; x0=zeros(6,1);'
  echo Using default parameter $PARAMS
else
  PARAMS=$2;
fi

PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odesol_m.log

  [nx,ny,nu,nz,nyz] = $1_def;


  $PARAMS

  %Defaults
  if exist('t')==0
    t=[0:0.1:10]
  end;

  if exist('u0')==0
    u0 = ones(nu,1);
  end;

  if exist('x0')==0
    x0 = zeros(nx,1);
  end;

  [n,m]=size(t);
  if m>n
    t=t';
  end;

x = lsode('$1_ode', x0, t);

i=0;
for tt=t'
  i=i+1;
  y(i) = $1_odeo(x(i,:),t);
end;


write_matrix([t,y], '$1_odesol');

EOF












>
>
>







|











>
>



|
|
<
<
<
<






|

|


|


|

|


<
|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46




47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1996/08/15 11:56:38  peter
## Initial revision
##
###############################################################

echo Creating $1_odesol.m
rm -f ode2odesol_m.log

if [ "$2" = "" ]; 
then
  PARAMS='T=[0:0.1:10]; x0=zeros(10,1);u=1'
  echo Using default parameter $PARAMS
else
  PARAMS=$2;
fi

PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odesol_m.log

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

  $PARAMS

  %Defaults
  if exist('T')==0
    T=[0:0.1:10]




  end;

  if exist('x0')==0
    x0 = zeros(nx,1);
  end;

  [n,m]=size(T);
  if m>n
    T=T';
  end;

x = lsode('$1_ode', x0, T);

i=0;
for tt=T'
  i=i+1;
  y(i) = $1_odeo(x(i,:),tt);
end;


write_matrix([T,y], '$1_odesol');

EOF





︙︙
︙︙
12
13
14
15
16
17
18



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

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



## Revision 1.6  1996/08/14 09:15:02  peter
## Now encapsulates the data into an m file
## Name changed
##
## Revision 1.5  1996/08/12 20:19:06  peter
## Fiddled about with parameter passing - still not right
##







>
>
>







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.7  1996/08/15 11:54:32  peter
## Now has optional initial condition.
##
## Revision 1.6  1996/08/14 09:15:02  peter
## Now encapsulates the data into an m file
## Name changed
##
## Revision 1.5  1996/08/12 20:19:06  peter
## Fiddled about with parameter passing - still not right
##
︙︙
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
###############################################################

echo Creating $1_sr.m
rm -f dm2sr_m.log

if [ "$2" = "" ]; 
then
  PARAMS='t=[0:0.1:10];u0=ones(nu,1);x0=zeros(nx,1);'
  echo Using default parameter $PARAMS
else
  PARAMS=$2;
fi

PARAMS="$PARAMS ;"

$MATRIX << EOF > dm2sr_m.log

  [nx,ny,nu,nz,nyz] = $1_def;


  $PARAMS

  %Defaults
  if exist('t')==0
    t=[0:0.1:10]
  end;

  if exist('u0')==0
    u0 = ones(nu,1);
  end;

  if exist('x0')==0
    x0 = zeros(nx,1);
  end;


  [n,m]=size(t);
  if m>n
    t=t';
  end;

  [A,B,C,D,E] = $1_dm($1_numpar);
  y = dm2sr(A,B,C,D,E,t,u0,x0);

  write_matrix([t y], '$1_sr');

EOF








|










>
>



|
|











|

|



|

|



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
###############################################################

echo Creating $1_sr.m
rm -f dm2sr_m.log

if [ "$2" = "" ]; 
then
  PARAMS='T=[0:0.1:10];u0=ones(nu,1);x0=zeros(nx,1);'
  echo Using default parameter $PARAMS
else
  PARAMS=$2;
fi

PARAMS="$PARAMS ;"

$MATRIX << EOF > dm2sr_m.log

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

  $PARAMS

  %Defaults
  if exist('T')==0
    T=[0:0.1:10]
  end;

  if exist('u0')==0
    u0 = ones(nu,1);
  end;

  if exist('x0')==0
    x0 = zeros(nx,1);
  end;


  [n,m]=size(T);
  if m>n
    T=T';
  end;

  [A,B,C,D,E] = $1_dm($1_numpar);
  y = dm2sr(A,B,C,D,E,T,u0,x0);

  write_matrix([T y], '$1_sr');

EOF


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