#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: dae2daesol_m
# Transforms descriptor matrix rep to step response
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.4 1996/08/24 14:27:59 peter
# Global parameters.
# Error handling.
#
## Revision 1.3 1996/08/18 12:00:19 peter
## Unified format of responses.
##
## Revision 1.2 1996/08/16 13:17:57 peter
## Changed default args to include nx+nz
## Fixed bug with vector outputs.
##
## Revision 1.1 1996/08/15 16:24:55 peter
## Initial revision
##
###############################################################
echo Creating $1_daes.m
echo Creating $1_daeso.m
rm -f dae2daes_m.log
rm -f $1_daes.m
rm -f $1_daeso.m
$MATRIX << EOF > dae2daes_m.log 2>mtt_error.txt
%Read the parameters
$1_numpar;
[nx,ny,nu,nz,nyz] = $1_def;
NX = nx+2*nz+nyz;
t=0; %Just in case its in the parameter list
%Defaults
if exist('T')==0
T=[0:0.1:10]
end;
if exist('x0')==0
x0 = zeros(NX,1);
end;
if exist('dx0')==0
dx0 = zeros(NX,1);
end;
[n,m]=size(T);
if m>n
T=T';
end;
if NX>0
x = dassl("$1_dae", x0, dx0, T);
write_matrix([T,x], '$1_daes');
else
x = zeros(size(T));
end;
if ny>0
i=0;
for tt=T'
i=i+1;
y(i,:) = $1_daeo(x(i,:),tt)';
end;
write_matrix([T,y], '$1_daeso');
end;
EOF
# Now invoke the standard error handling.
mtt_error mtt_error.txt