ADDED mttroot/mtt/bin/trans/m/mat2tex.m Index: mttroot/mtt/bin/trans/m/mat2tex.m ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/m/mat2tex.m @@ -0,0 +1,35 @@ +function tex = mat2tex(mat) + ## mat2tex: converts matrix into LaTeX form. + ## tex = mat2tex(mat) + + + ############################################################### + ## Version control history + ############################################################### + ## $Id$ + ## $Log$ + ## Revision 1.1 1999/03/25 01:33:51 peterg + ## Initial revision + ## + ############################################################### + + [n,m]=size(mat); + + for i=1:n + for j=1:m + if mat(i,j) == 0 + printf("0 "); + else + printf("%5.2f", mat(i,j)); + endif + if j0 + r = sort(roots(pol)); + endif + + gain = pol(1); + + complex=0; + tex = sprintf("%g", gain); + for i=1:n + if complex + complex=0 + else + if imag(r(i))1 + tex = ''; + else + tex = '1'; + endif + else + tex = sprintf(" %1.2f", pol(1)); + endif + + if n>2 + tex = sprintf("%ss^%1.f", tex, n-1); + elseif n==2 + tex = sprintf("%ss", tex); + else + tex = sprintf("%s", tex); + endif + + for i=2:n + if pol(i)<0 + plusminus = '-'; + else + plusminus = '+'; + endif + tex = sprintf("%s %s %1.2f", tex, plusminus, abs(pol(i))); + if i