File mttroot/mtt/bin/trans/dm2tf_r artifact 60f01453cb part of check-in f36162a6f1


#! /bin/sh

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

# Bourne shell script: dm2tf_r
# Reduce  descriptor matrices to transfer function
# P.J.Gawthrop 8th May 1991, Dec 1993, April 1994.
# Copyright (c) P.J.Gawthrop, 1991, 1993, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/03/27 15:00:23  peterg
## reduce ---> symbolic
##
## Revision 1.1  1996/08/25 10:09:55  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_tf.r

# Remove the old log file
rm -f dm2tf_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC >dm2tf_r.log << EOF

%ON FLOAT;

IN "$1_def.r";
IN "$1_dm.r";
IN "$1_subs.r";

OFF Echo;
OFF Nat;

%create sE-A
%MTT_SEA := s*MTTE-MTTA;

%Find the denominator of the TF - det(sE-A);
%comden := det(MTT_SEA);

%Find the Adjoint transpose.
%matrix AdjT(MTTNx,MTTNx);
%FOR i := 1:MTTNx DO
%  BEGIN
%  FOR j := 1:MTTNx DO
%    AdjT(i,j) := cofactor(MTT_SEA,i,j);
%  END;

%Adj := TP(AdjT);

%Find the numerator matrix
%Num := MTTC*Adj*MTTB + MTTD*comden;


%Create the transfer function matrix
MTTTF := MTTD;
IF MTTNy>0 THEN MTTTF := MTTTF + (MTTC * ((s*MTTE-MTTA)^-1) * MTTB);

%MTTTF := Num/comden;


OUT "$1_tf.r";

%Declare the transfer function matrix
write "matrix MTTTF(", MTTNy, ",", MTTNu, ")$"$

%And write it.
%MTTTF := MTTTF;
FOR i := 1:MTTNy DO
  BEGIN
  FOR j := 1:MTTNu DO
    IF MTTTF(i,j) NEQ 0 THEN write "MTTTF(", i, ",", j, ") := ", MTTTF(i,j)$
  END;

write ";END;"$
SHUT "$1_tf.r";

EOF

# Now invoke the standard error handling.
mtt_error_r dm2tf_r.log


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