File mtt/bin/trans/sm2sr_m artifact 9750108aef part of check-in af3953deae


#! /bin/sh

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

# Bourne shell script: sm2sr_m

# Transforms descriptor matrix rep to step response


# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.16  1998/08/11 13:31:05  peterg
## Lowercase mttLAST etc
##
## Revision 1.15  1998/07/27 20:31:40  peterg
## New simpar version
##
## Revision 1.14  1998/07/25 10:00:48  peterg
## *** empty log message ***
##
## Revision 1.13  1997/06/13 12:52:18  peterg
## Removed extra ; from $PARAMS
##
# Revision 1.12  1996/09/12  18:45:31  peter
# Back to rcs.
#
# Revision 1.11  1996/08/24  14:02:39  peter
# Included glabal parameter passing.
# Proper error handling.
#
## Revision 1.10  1996/08/19 15:34:14  peter
## Now based on state - not descriptor matrices.
##
## Revision 1.9  1996/08/18 12:01:45  peter
## Unified format of time responses.
##
## Revision 1.8  1996/08/15 16:23:39  peter
## Uses T in place of t to avoid name clash within function.
##
## 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
##
## 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
echo Creating $1_sro.m
rm -f sm2sr_m.log
rm -f $1_sr.m
rm -f $1_sro.m
rm -f mtt_error


# PARAMS="$PARAMS ;"

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

  % Read in the numeric system parameters
  mttpar = $1_numpar;

  % Read in the simulation parameters
  simpar = $1_simpar;

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

  T=[0:simpar.dt:simpar.last]'

  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] = $1_sm(mttpar);
  [y,x] = sm2sr(A,B,C,D,T,u0,x0);

  if nx>0
    write_matrix([T x], '$1_sr');
  end;
  if ny>0
    write_matrix([T y], '$1_sro');
  end;

EOF

# Now invoke the standard error handling.
mtt_error mtt_error.txt



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