#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: smc_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################
# Inform user
echo Creating $1_smc.tex
# Remove the old log file
rm -f smc_r2tex.log
# Use reduce to accomplish the transformation
reduce >smc_r2tex.log<< EOF
%Read the definitions file
in "$1_def.r";
%Read the smconical-form matrices file
in "$1_smc.r";
%Read the simplification file
in "$1_simp.r";
%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";
OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;
OUT "$1_smc.tex";
%Write out the canonical matrices
write "%Canonical-form matrices $1";
write "%File: $1_smc.tex";
write"";
% Controllable form
MTT_Matrix := MTTA_c$
MTT_Matrix_name := "MTTA_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$
MTT_Matrix := MTTB_c$
MTT_Matrix_name := "MTTB_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$
MTT_Matrix := MTTC_c$
MTT_Matrix_name := "MTTC_c"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$
MTT_Matrix := MTTD_c$
MTT_Matrix_name := "MTTD_c"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$
write "% - Controllability matrix";
MTT_Matrix := MTTCon$
MTT_Matrix_name := "MTTCon"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$
write "% -Controllability matrix - controller form";
MTT_Matrix := MTTCon_c$
MTT_Matrix_name := "MTTCon_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$
write "% - Transformation matrix - controller form";
MTT_Matrix := MTTT_c$
MTT_Matrix_name := "MTTT_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$
SHUT "$1_smc.tex";
quit;
EOF