#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: dm2sr_m
# Transforms descriptor matrix rep to step response
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5 1996/08/12 20:19:06 peter
## Fiddled about with parameter passing - still not right
##
## Revision 1.4 1996/08/11 19:48:04 peter
## Parameter passing added.
##
## Revision 1.3 1996/08/11 10:38:30 peter
## Minor debugging changes.
##
## Revision 1.2 1996/08/11 10:06:50 peter
## Now allows e format and NaN numbers.
##
## Revision 1.1 1996/08/11 09:45:46 peter
## Initial revision
##
###############################################################
echo Creating $1_sr.m
rm -f dm2sr_m.log
if [ "$2" = "" ];
then
PARAMS='t=[0:0.1:10]'
echo Using default parameter $PARAMS
else
PARAMS=$2;
fi
PARAMS="$PARAMS ;"
echo $PARAMS
$MATRIX << EOF > dm2sr_m.log
$PARAMS
[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);
[Ny,Nu]=size(D);
NN = Ny*Nu;
xy = [t y(:,1)];
for i=2:NN
xy = [xy y(:,i)];
end;
xy
write_matrix(xy, '$1_sr');
EOF