ADDED mttroot/mtt/bin/trans/dm_r2m Index: mttroot/mtt/bin/trans/dm_r2m ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/dm_r2m @@ -0,0 +1,104 @@ +#! /bin/sh + + ###################################### + ##### Model Transformation Tools ##### + ###################################### + +# Bourne shell script: dm_r2m +# Reduce descriptor state-space A,B,C,D and E matrices to Matlab +# P.J.Gawthrop 29th July 1990, 6th Feb 1991, 28 May 1991, Dec 1993, Jan 94 +# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993,1994. + +############################################################### +## Version control history +############################################################### +## $Id$ +## $Log$ +############################################################### + +#Inform user +echo Creating $1_dm.m + +# Remove the old log file +rm -f dm_r2m.log + +# Use reduce to accomplish the transformation +reduce >dm_r2m.log << EOF + +ON BigFloat, NumVal; +PRECISION 16; %Compatible with Matlab + +%Read in the definitions file +in "$1_def.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"; + +%Read the reduce state-space A,B,C and D matrices file +in "$1_dm.r"; + + +OUT "$1_dm.m"; + +%Headings - Matlab style +%(Note. The ;; are deleted by for2mat) + +IF MTTNvar>0 THEN +BEGIN + write "function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_dm(..."; + FOR i := 1:MTTNvar DO + BEGIN + IF i0 THEN +BEGIN + write "%function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_dm(..."; + FOR i := 1:MTTNvar DO + BEGIN + IF i