File mttroot/mtt/bin/trans/ode2odes_m artifact d32a28e7bf part of check-in 6537e9c687


#! /bin/sh

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

# Bourne shell script: ode2odesol_m

# Transforms descriptor matrix rep to step response

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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1996/08/15 16:24:43  peter
## Uses T in place of t to avoid name clash within function.
##
## 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(nx,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








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