ADDED mttroot/mtt/bin/trans/sm_r2m Index: mttroot/mtt/bin/trans/sm_r2m ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/sm_r2m @@ -0,0 +1,108 @@ +#! /bin/sh + + ###################################### + ##### Model Transformation Tools ##### + ###################################### + +# Bourne shell script: sm_r2m +# Reduce constained state-space A,B,C,D and E matrices to Matlab +# P.J.Gawthrop July 1990, Feb 1991, May 1991, Sep 91, Dec 93, Jan 94, May 94. +# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1996. + +############################################################### +## Version control history +############################################################### +## $Id$ +## $Log$ +############################################################### + + +# Inform user +echo Creating $1_sm.m + +# Remove the old log file +rm -f sm_r2m.log + +# Use reduce to accomplish the transformation +reduce >sm_r2m.log << EOF + +%Read in the definitions file +IN "$1_def.r"; + +%Read the reduce state-space A,B,C and D matrices file +IN "$1_sm.r"; + +%Set up the number of argument variables to zero in case the user has forgotten +MTTNVar := 0; + +%Read in the parameter file +IN "$1_sympar.r"; + + +OUT "$1_sm.m"; + +%Headings - Matlab style +%(Note. The ;; are deleted by for2mat) + +IF MTTNvar>0 THEN +BEGIN + write "function [MTTA,MTTB,MTTC,MTTD] = $1_sm(..."; + FOR i := 1:MTTNvar DO + BEGIN + IF i0 THEN +BEGIN + write "%function [MTTA,MTTB,MTTC,MTTD] = $1_sm(..."; + FOR i := 1:MTTNvar DO + BEGIN + IF i