Overview
Comment:Useful conversion functions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ccc5e5d04fa0f4dc1ae2a8e138b2895ac5ea38fe28806b5beb45a6faef84e7a1
User & Date: gawthrop@users.sourceforge.net on 2001-05-10 11:44:40
Other Links: branch diff | manifest | tags
Context
2001-05-10
19:08:35
Cosmetic improvements check-in: ced8204712 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:44:40
Useful conversion functions check-in: ccc5e5d04f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-05-09
08:50:02
Uses _art.fig to transmit the art work to the cbg.fig rep. check-in: fd1400ec9f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/m/mat2tex.m version [557dae5024].







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 j<m
 	printf("&");
      endif
    endfor
      printf("\\\\\n");
  endfor
  
endfunction



Added mttroot/mtt/bin/trans/m/pol2root2tex.m version [101be5a504].





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function tex = pol2root2tex(pol)
  ## pol2tex: converts polynomial into LaTeX form as (s-z_1)..(s-z_n)
  ## tex = pol2root2tex(pol)
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.1  1999/05/24 22:05:53  peterg
  ## Initial revision
  ##
  ###############################################################


  n = length(pol)-1;

  if n>0
    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))<eps
	tex = sprintf("%s (s + %g)", tex, -r(i));
      else
	tex = sprintf("%s (s + %g \\pm %g)", tex, -real(r(i)), imag(r(i)));
	complex=1;
      endif
    endif
  endfor
  
endfunction



Added mttroot/mtt/bin/trans/m/pol2tex.m version [b5ee4e9a89].













































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function tex = pol2tex(pol)
  ## pol2tex: converts polynomial into LaTeX form.
  ## tex = pol2tex(pol)
  

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.1  1999/03/25 01:33:51  peterg
  ## Initial revision
  ##
  ###############################################################

  n = length(pol);
  
  if pol(1) == 1
    if n>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<n-1
      tex = sprintf("%ss^%1.0f", tex, n-i);
    elseif i==n-1
      tex = sprintf("%ss", tex); 
    else
      tex = sprintf("%s", tex);
    endif
  endfor
endfunction




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