Overview
Comment:Included and updated the missing tf_r2m
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c13b3e7399ece714433cb511f1022a7e4bc60e57f659178922da030c3d58b7d4
User & Date: gawthrop@users.sourceforge.net on 2001-05-24 07:42:12
Other Links: branch diff | manifest | tags
Context
2001-05-24
07:44:36
Minor updates .. check-in: 8eaae9b2f2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
07:42:12
Included and updated the missing tf_r2m check-in: c13b3e7399 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-05-10
19:08:35
Cosmetic improvements check-in: ced8204712 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_header from [6a295989c6] to [dbbc0973db].

8
9
10
11
12
13
14




15
16
17
18
19
20
21
# Copyright (C) 2000 by Peter J. Gawthrop

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




## Revision 1.30  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.29  2001/03/27 13:10:23  geraint
## Improved determination of Octave version.
##
## Revision 1.28  2001/02/17 03:48:17  geraint







>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.31  2001/04/03 14:49:42  gawthrop
## Revised to incorporate new ssim (sensitivity simulation)
## representation (m only just now).
##
## Revision 1.30  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.29  2001/03/27 13:10:23  geraint
## Improved determination of Octave version.
##
## Revision 1.28  2001/02/17 03:48:17  geraint
283
284
285
286
287
288
289






290
291
292
293
294
295
296
297
    ssim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,y_par'
        args='x0,par,simpar,u,index'
	;;






    *)
	echo Representation $rep not supported - sorry; exit 1
esac

## Sort out parentheses
if [ -n "$args" ]; then
    Args='('$args')'
fi







>
>
>
>
>
>
|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
    ssim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,y_par'
        args='x0,par,simpar,u,index'
	;;
    tf)
	states=no;
	inputs=no;
	parameters=yes;
        output='mttnum,mttden'
        args=mttpar;
	;;    *)
	echo Representation $rep not supported - sorry; exit 1
esac

## Sort out parentheses
if [ -n "$args" ]; then
    Args='('$args')'
fi

Added mttroot/mtt/bin/trans/tf_r2m version [443b4828f1].















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
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
74
75
76
77
78
79
80
81
82
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: tf_r2m
# Reduce transfer-function matrices to Matlab MV toolbox matrices.
# P.J.Gawthrop 9 June 1990, 8 July 1990, Dec 993
# Copyright (c) P.J.Gawthrop, 1990, 1993.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1996/09/18 14:05:31  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_tf.m

# Remove the old log file
rm -f tf_r2m.log

# Use reduce to accomplish the transformation
reduce >tf_r2m.log << EOF

%Read the definitions file
in "$1_def.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
%%in "$1_sympar.r";

%Read the transfer-function matrices file
OFF Exp; ON GCD; 
in "$1_tf.r";

OFF Echo;
%OFF Nat;
OFF factor;

%Find the largest degree numerator polynomial
NnMax := 0;
  FOR Row := 1:MTTNy DO
  BEGIN
    FOR Col := 1:MTTNu DO
    BEGIN
    Nn := length(coeff(num(MTTtf(Row,Col)),s));
    IF Nn>NnMax THEN NnMax := Nn;
    END;
  END;

NnMax;

%Find the largest degree denominator polynomial, and corresp indices
NdMax := 0;
  FOR Row := 1:MTTNy DO
  BEGIN
    FOR Col := 1:MTTNu DO
    BEGIN
    Nd := length(coeff(den(MTTtf(Row,Col)),s));
    IF Nd>NdMax THEN 
                BEGIN
                  NdMax := Nd; MaxRow := Row; MaxCol := Col;
                END
    END;
  END;

NdMax; MaxRow; MaxCol;

IF NnMax>NdMax THEN NMax := NnMax ELSE NMax := NdMax;
Nmax;

%Use any denominator with maximum degree as the common denominator
MTTden := den(MTTtf(MaxRow,MaxCol));

%Find the corresponding numerator
matrix MTTnum(MTTNy,MTTNu);
  FOR Row := 1:MTTNy DO
  BEGIN
    FOR Col := 1:MTTNu DO
    MTTnum(Row,Col) := num(MTTtf(Row,Col))*(MTTden/den(MTTtf(Row,Col)));
  END;
MTTnum;

%Put coefficients into matrices
matrix MTTdenco(1,Nmax);
MTTCoeff := Coeff(MTTden,s);
FOR i := 1:Nmax DO
BEGIN
  j := Nmax-i+1;
  IF j>length(MTTCoeff) THEN MTTdenco(1,i) := 0 
                        ELSE MTTdenco(1,i) := part(MTTCoeff,j);
END; 

matrix MTTnumco(MTTNy,MTTNu*Nmax);
FOR MTTRow := 1:MTTNy DO
BEGIN
  FOR MTTCol := 1:MTTNu DO
  BEGIN
    MTTCoeff := Coeff(MTTnum(MTTRow,MTTCol),s);
    FOR MTTi := 1:Nmax DO
    BEGIN
      MTTj := Nmax-MTTi+1;
      MTTk := MTTi + (MTTCol-1)*Nmax;
      IF MTTj>length(MTTCoeff) THEN MTTnumco(MTTRow, MTTk) := 0 
                            ELSE MTTnumco(MTTRow, MTTk) := part(MTTCoeff,MTTj);
    END;
  END;
END;



OUT "$1_tf.m1";

write "mttden = zeros(1,", Nmax, ");";
write "mttnum =    zeros(", MTTNy, ",", Nmax*MTTNu, ");";

%Suppress zeros
ON NERO;

%Fortran switches - one line expressions
ON fort;
cardno!* := 1\$
fortwidth!* := 100\$
OFF period;

%Write out the matlab code
mttden := MTTdenco;
mttnum    := MTTnumco;
SHUT "$1_tf.m1";
quit;
EOF

#Headers
mtt_header $1 tf m > $1_tf.m

#Body
cat $1_tf.m1  >> $1_tf.m
echo '## END Code' >> $1_tf.m
rm -f $1_tf.m1





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