Overview
Comment:removed {}
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: e58523ede7eb0a44b2ad98e78a012390abe1129281b290d7f386f5389deac4cf
User & Date: gawthrop@users.sourceforge.net on 2001-07-11 03:58:41
Other Links: branch diff | manifest | tags
Context
2001-07-12
04:00:51
Now zeros y correctly - ie Ny NOT Nx elements check-in: 6c7a2c10a3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-07-11
03:58:41
removed {} check-in: e58523ede7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-07-08
03:32:36
Moved in""; command from lbl to cr check-in: d753d3904a user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/pol2tex.m from [ea33ca5e52] to [a2beafb6c0].

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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function tex = pol2tex(pol,name,f)
  ## pol2tex: converts polynomial into LaTeX form.
  ## tex = pol2tex(pol,[name,f])
  
  ## pol  polynomial (row vector)
  ## name name of the variable (eg s or z)
  ## f    format of the coefficients (eg %2.4f)

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$



  ## Revision 1.1  2001/05/10 11:44:40  gawthrop
  ## Useful conversion functions
  ##
  ## Revision 1.1  1999/03/25 01:33:51  peterg
  ## Initial revision
  ##
  ###############################################################

  if nargin<2
    name = "s"
  endif
  
  if nargin<3
    f = "%2.2f";
  endif
  
  n = length(pol);
  
  if pol(1) == 1
    if n>1
      tex = '';
    else
      tex = '1';
    endif
  else
    ff = sprintf(" %s",f);
    tex = sprintf(ff, pol(1));
  endif
  
  if n>2
    tex = sprintf("%s{%s}^%i", tex, name, n-1);
  elseif n==2
    tex = sprintf("%s{%s}", tex, name);
  else
    tex = sprintf("%s", tex);
  endif

  for i=2:n
    if pol(i)<0
      plusminus = '-';
    else
      plusminus = '+';
    endif
    ff = sprintf("%%s %%s %s",f);
    tex = sprintf(ff, tex, plusminus, abs(pol(i)));
    if i<n-1
      tex = sprintf("%s{%s}^%i", tex, name, n-i);
    elseif i==n-1
      tex = sprintf("%s{%s}", tex, name); 
    else
      tex = sprintf("%s", tex);
    endif
  endfor
endfunction
















>
>
>









|




















|

|













|

|








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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function tex = pol2tex(pol,name,f)
  ## pol2tex: converts polynomial into LaTeX form.
  ## tex = pol2tex(pol,[name,f])
  
  ## pol  polynomial (row vector)
  ## name name of the variable (eg s or z)
  ## f    format of the coefficients (eg %2.4f)

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.2  2001/05/10 19:08:35  gawthrop
  ## Cosmetic improvements
  ##
  ## Revision 1.1  2001/05/10 11:44:40  gawthrop
  ## Useful conversion functions
  ##
  ## Revision 1.1  1999/03/25 01:33:51  peterg
  ## Initial revision
  ##
  ###############################################################

  if nargin<2
    name = "s";
  endif
  
  if nargin<3
    f = "%2.2f";
  endif
  
  n = length(pol);
  
  if pol(1) == 1
    if n>1
      tex = '';
    else
      tex = '1';
    endif
  else
    ff = sprintf(" %s",f);
    tex = sprintf(ff, pol(1));
  endif
  
  if n>2
    tex = sprintf("%s%s^%i", tex, name, n-1);
  elseif n==2
    tex = sprintf("%s%s", tex, name);
  else
    tex = sprintf("%s", tex);
  endif

  for i=2:n
    if pol(i)<0
      plusminus = '-';
    else
      plusminus = '+';
    endif
    ff = sprintf("%%s %%s %s",f);
    tex = sprintf(ff, tex, plusminus, abs(pol(i)));
    if i<n-1
      tex = sprintf("%s%s^%i", tex, name, n-i);
    elseif i==n-1
      tex = sprintf("%s%s", tex, name); 
    else
      tex = sprintf("%s", tex);
    endif
  endfor
endfunction




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