0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % OBJ2TEX converts the input data to TeX code
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: OBJ2TEX converts the input data to TeX code
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % utils.helper.obj2tex(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % txt = utils.helper.obj2tex(obj) Returns the display text
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % HISTORY: 3-09-2010 A. Grynagier
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % Creation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % VERSION: $Id: obj2tex.m,v 1.2 2010/09/06 17:07:58 adrien Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 function varargout = obj2tex(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 if nargin~=1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 error(['utils.helper.obj2tex only takes one input object at a time and nargin is ' num2str(nargin)])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 %#ok<*AGROW>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 obj = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 % objClasses = {'param' 'tsdata' 'data2D' 'paramValue' 'smodel' 'unit' 'data3D' 'parfrac' 'specwin' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 % 'filterbank' 'pest' 'xydata' 'fsdata' 'matrix' 'plist' 'ssm' 'xyzdata' 'mfir' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 % 'ssmblock' 'ao' 'ltpda_data' 'miir' 'pz' 'ssmport' 'cdata' 'ltpda_filter' 'pzmodel' 'time'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % 'collection' 'msym' 'rational' 'timespan'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % otherClasses = {'double' 'sym' 'char'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 % if numel(obj)~=1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % error('only takes a single object')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % txt = cell(size(objs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % for ii=1:numel(txt)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % txt{ii} = utils.helper.obj2tex(obj(ii));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % varargout = txt;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % if nargout == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 % display(txt)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % elseif numel(obj)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 %% special cases for empty objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 if numel(obj)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 switch lower(class(obj))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 case {'double' 'logical' 'cell' 'sym'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 varargout = {''};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 %% dealing with objects of size more than one
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 if numel(obj)>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 switch lower(class(obj))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 case {'double' 'logical' 'ao' 'ssmblock' 'sym' 'cell' 'char'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 case {'plist' 'units' 'parfrac' 'pest' 'miir' 'rational' 'pzmodel'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 error('multiple objects of this class are not handled yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 varargout = {''};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 %% dealing with objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 switch lower(class(obj))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 case 'ao' %% ao, does not plot content
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 txt = ' \begin{tabular}{cll} NAME & DESCRIPTION & DATA \\ \hline \\ ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 for ii=1:numel(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 if ii>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 txt = [txt ' \\ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 txt = [ txt ' \texttt{' utils.helper.obj2tex(obj(ii).name) '} & ' utils.helper.obj2tex(obj(ii).description) ' & ' utils.helper.obj2tex(obj(ii).data) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 txt = [txt ' \end{tabular} '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 case 'plist' %% plist, does not plot all options so far. A tabular may be better... TBC...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 txt = ' \begin{tabular}{cll} KEY & VALUE & DESCRIPTION \\ \hline \\ ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 for ii=1:obj.nparams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 if ii>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 txt = [txt ' \\ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 txt = [txt ' \texttt{' utils.helper.obj2tex(obj.params(ii).key) '} & $ ' utils.helper.obj2tex( obj.params(ii).getVal ) ' $ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 objmin = obj.params(ii).getProperty('min');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 objmax = obj.params(ii).getProperty('max');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 objunits = obj.params(ii).getProperty('units');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 if ~isempty(objmin) && ~isempty(objmax )
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 txt = [ txt ' $ \in \left[ ' utils.helper.obj2tex( eval(objmin) ) ';' utils.helper.obj2tex( eval(objmax) ) ' \right] $ ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 if ~isempty(objunits)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 if ischar( objunits )
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 objunits = strrep( objunits , '(' , '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 objunits = strrep( objunits , ')' , '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 objunits = strrep( objunits , ' ^' , '^');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 txt = [ txt ' $ \, ' utils.helper.obj2tex( unit(objunits) ) ' $ ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 elseif ischar(objunits)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 txt = [ txt ' $ \, ' utils.helper.obj2tex( unit ) ' $ ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 txt = [txt ' & ' utils.helper.obj2tex( obj.params(ii).desc ) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 txt = [txt ' \end{tabular} '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 case 'param' %% called by the plist function
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 error('param should always be provided inside a plist object')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 case lower('paramValue')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 error('paramValue should always be provided inside a param object')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 case 'smodel'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 % { 'expr' 'params' 'values' 'trans' 'xvar' 'xvals' 'xunits' 'yunits' 'name'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 error('smodel is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 case 'unit'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 txt = ' \left[';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 if numel(obj.strs)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 txt = [txt ' - '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 for ii=1:numel(obj.strs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 if ii>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 txt = [txt ' \,' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 p = val2prefix(obj.vals(ii));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 if obj.exps(ii) == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 elseif obj.exps(ii) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 txt = [txt ' \mathrm{' p ' ' obj.strs{ii} '} ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 txt = [txt ' \mathrm{' p ' ' obj.strs{ii} '}^{' num2str(obj.exps(ii)) '}' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 txt = [txt ' \right] '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 case 'parfrac'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 %{ 'res' 'poles' 'pmul' 'dir' 'iunits' 'ounits' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 display('warning, the parfrac was not tested so far')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 txt = [' G_{\texttt{' utils.helper.obj2tex(obj.name) '}} (s) = '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 for ii=1:numel(obj.res)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 if ii>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 txt = [txt ' + '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 if obj.pmul(ii)>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 txt = [txt '\frac{ ' utils.helper.obj2tex(obj.res(ii)) ' }{ \left( s-' utils.helper.obj2tex(obj.poles(ii)) ' \right)^{' utils.helper.obj2tex(obj.pmul(ii)) '} }' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 elseif obj.pmul(ii)==1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 txt = [txt '\frac{ ' utils.helper.obj2tex(obj.res(ii)) ' }{ s-(' utils.helper.obj2tex(obj.poles(ii)) ') }' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 txt = [txt ' + ' utils.helper.obj2tex(obj.dir) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 txt = [txt ' \, ' utils.helper.obj2tex( simplify(obj.ounits/obj.iunits) ) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 case 'filterbank'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 %{'filters' 'type' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 error('filterbank is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 case 'pest'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 %{ 'dy' 'y' 'names' 'yunits' 'pdf' 'cov' 'corr' 'chi2' 'dof' 'chain' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 % plotting names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 txt = ' \left[ \begin{array}{c} ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 for ii=1:numel(obj.y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 if ii>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 txt = [txt ' \\ ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 txt = [txt '\mathrm{' utils.helper.obj2tex(obj.names{ii}) '}' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 txt = [ txt ' \end{array} \right] = '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 % plotting values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 txt = [ txt ' \left[ \begin{array}{rl} ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 for ii=1:numel(obj.y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 if ii>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 txt = [txt ' \\ ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 if ~isempty(obj.dy)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 txt = [txt utils.helper.obj2tex(num2str(obj.y(ii))) ' \, \pm \, ' utils.helper.obj2tex(num2str(obj.dy(ii))) ' & ' utils.helper.obj2tex(obj.yunits(ii)) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 txt = [txt utils.helper.obj2tex(num2str(obj.y(ii))) ' & ' utils.helper.obj2tex(obj.yunits(ii)) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 txt = ' \end{array} \right] ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 if ~isempty(obj.corr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 txt = [txt ' \\ \mathrm{CORR}= \left[ ' utils.helper.obj2tex(obj.corr) ' \right] '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 if ~isempty(obj.cov)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 txt = [txt ' \\ \mathrm{COV}= \left[ ' utils.helper.obj2tex(obj.cov) ' \right] '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 if ~isempty(obj.cov)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 txt = [txt ' \\ \chi_2 = ' utils.helper.obj2tex(obj.chi2) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 case 'matrix'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 %{ 'objs' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 error('matrix is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 case 'ssm'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 %{ 'amats' 'bmats' 'cmats' 'dmats' 'timestep' 'inputs' 'states' 'outputs' 'numparams' 'params' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 % 'Ninputs' 'inputsizes' 'Noutputs' 'outputsizes' 'Nstates' 'statesizes' 'Nnumparams' 'Nparams' 'isnumerical' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 txt = '\begin{longtable}{|rl|} \hline \textbf{FIELD} & \textbf{PROPERTY} \\ \hline \hline ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 txt = [txt ' \textbf{NAME:} & \texttt{' utils.helper.obj2tex(obj.name) '} '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 txt = [ txt ' \\ \hline & \\[3pt] \textbf{DESCRIPTION:} & ' utils.helper.obj2tex(obj.description) ' ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 txt = [ txt ' \\ \hline & \\[3pt] \textbf{REALIZATION:} & $ \begin{array}{c|c} A & B \\ \hline C & D \end{array} ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 txt = [ txt ' \sim \begin{array}{c|c} ' utils.helper.obj2tex(obj.amats) ' & ' utils.helper.obj2tex(obj.bmats) ' \\ \hline ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 txt = [ txt utils.helper.obj2tex(obj.cmats) ' & ' utils.helper.obj2tex(obj.dmats) ' \end{array} $'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 txt = [ txt ' \\ \hline \textbf{TIMESTEP:} & ' utils.helper.obj2tex(obj.timestep) ' $' utils.helper.obj2tex( unit('s') ) '$' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 txt = [ txt ' \\ \hline & \\[3pt] \textbf{INPUTS:} & ' utils.helper.obj2tex(obj.inputs) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 txt = [ txt ' \\ \hline & \\[3pt] \textbf{STATES:} & ' utils.helper.obj2tex(obj.states) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 txt = [ txt ' \\ \hline & \\[3pt] \textbf{OUTPUTS:} & ' utils.helper.obj2tex(obj.outputs) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 txt = [ txt ' \\ \hline & \\[3pt] \textbf{PARAMS:} & ' utils.helper.obj2tex(obj.params) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 txt = [ txt ' \\ \hline & \\[3pt] \textbf{NUMPARAMS:} & ' utils.helper.obj2tex(obj.numparams) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 txt = [ txt ' \\ \hline \end{longtable} ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 case 'mfir'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 %{ 'gd' 'ntaps' 'fs' 'a' 'iunits' 'ounits' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 error('mfir is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 case 'ssmblock'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 %{ 'name' 'ports' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 txt = ' \begin{tabular}{r|lcl} BLOCK & PORT & UNITS & DESCRIPTION ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 for kk = 1:numel(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 txt = [txt ' \\ \hline '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 for ii=1:numel(obj(kk).ports)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 [blockName, portName] = ssmblock.splitName(obj(kk).ports(ii).name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 if ~strcmp(blockName, obj(kk).name)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 portName = obj(kk).ports(ii).name;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 if ii>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 txt = [txt ' \\ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 if ii==1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 txt = [txt ' \texttt{' utils.helper.obj2tex(obj(kk).name) '} & & & ' utils.helper.obj2tex(obj(kk).description) ' \\ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 txt = [txt ' & \texttt{' utils.helper.obj2tex(portName) '} & $ ' utils.helper.obj2tex(obj(kk).ports(ii).units) ' $ & ' utils.helper.obj2tex(obj(kk).ports(ii).description) ' '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 txt = [ txt ' \end{tabular} '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 case 'pz'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 %{ 'f' 'q' 'ri'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 if isnan(obj.q)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 txt = [' \left( s - 2 \pi \left( ' num2str(obj.f) '\right) \right) ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 txt = [' \left( s^2 + 2 \pi \left( \frac{' utils.helper.obj2tex(obj.f) '}{' utils.helper.obj2tex(obj.q) '} \right) s + 4 \pi^2 \left(' utils.helper.obj2tex(abs(obj.f)) '\right)^2 s^2 \right) ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 case 'ssmport'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 %{'name' 'units' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 error('ssmports should always be provided inside a ssmblock object')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 case 'pzmodel'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 %{ 'poles' 'zeros' 'gain' 'delay' 'iunits' 'ounits' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 txt = [' G_{\texttt{' utils.helper.obj2tex(obj.name) '}} (s) = ' utils.helper.obj2tex(obj.gain) ' \times \frac{'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 if numel(obj.zeros)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 for ii=1:numel(obj.zeros)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 txt = [txt utils.helper.obj2tex(obj.zeros(ii)) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 txt = [txt ' 1 ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 txt = [ txt ' }{ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 if numel(obj.poles)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 for ii=1:numel(obj.poles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 txt = [txt utils.helper.obj2tex(obj.poles(ii)) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 txt = [txt ' 1 ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 txt = [txt ' } ' utils.helper.obj2tex( simplify(obj.ounits/obj.iunits) ) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 case 'collection'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 %{ 'objs' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 error('collection is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 case 'msym'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 %{'use fieldnames'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 txt = obj.s;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 txt = strrep(txt, '*', '\times');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 txt = strrep(txt, '(', '{ \left(');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 txt = strrep(txt, ')', '\right) }');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 case 'specwin'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 %{ 'type' 'alpha' 'psll' 'rov' 'nenbw' 'w3db' 'flatness' 'ws' 'ws2' 'win'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 error('specwin is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 case 'miir'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 %{ 'b' 'ntaps' 'fs' 'a' 'iunits' 'ounits' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 %{ 'poles' 'zeros' 'gain' 'delay' 'iunits' 'ounits' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 txt = [' G_{\texttt{' utils.helper.obj2tex(obj.name) '}} (z) = \frac{'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 for ii=1:numel(obj.a)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 if ii>1 && obj.a(ii)>=0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 txt = [txt ' + '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 txt = [txt utils.helper.obj2tex(obj.a(ii)) 'z^{-' num2str(ii) '}' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 txt = [ txt ' }{ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 for ii=1:numel(obj.b)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 if ii>1 && obj.b(ii)>=0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 txt = [txt ' + '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 txt = [txt utils.helper.obj2tex(obj.b(ii)) 'z^{-' num2str(ii) '}' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 txt = [txt ' } ' utils.helper.obj2tex( simplify(obj.ounits/obj.iunits) ) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 case 'rational'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 %{ 'num' 'den' 'iunits' 'ounits' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 %{ 'poles' 'zeros' 'gain' 'delay' 'iunits' 'ounits' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 txt = [' G_{\texttt{' utils.helper.obj2tex(obj.name) '}} (s) = \frac{'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 for ii=1:numel(obj.num)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 if ii>1 && obj.num(ii) >=0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 txt = [txt ' + '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 txt = [txt utils.helper.obj2tex(obj.num(ii)) 's^{' num2str(ii) '}' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 txt = [ txt ' }{ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 for ii=1:numel(obj.den)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 if ii>1 && obj.den(ii)>=0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 txt = [txt ' + '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 txt = [txt utils.helper.obj2tex(obj.den(ii)) 's^{' num2str(ii) '}' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 txt = [txt ' } ' utils.helper.obj2tex( simplify(obj.ounits/obj.iunits) ) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 case 'timespan'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 %{ 'startT' 'endT' 'interval' 'timeformat' 'timezone' 'name' }
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 error('timespan is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 case 'tsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 %{ 't0' 'fs' 'nsecs' 'xunits' 'yunits' 'x' 'y' 'dx' 'dy'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 txt = [ ' $(1 \times ' utils.helper.obj2tex(numel(obj.y)) ')$ times series, units: $' utils.helper.obj2tex(obj.yunits) '$vs$' utils.helper.obj2tex(obj.xunits) ' $ at $' num2str(obj.fs) '$Hz '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 case 'xydata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 txt = [ ' $(1 \times ' utils.helper.obj2tex(numel(obj.y)) ')$ x-y data, units: $' utils.helper.obj2tex(obj.yunits) '$vs$' utils.helper.obj2tex(obj.xunits) '$ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 %{ 'xunits' 'yunits' 'x' 'y' 'dx' 'dy'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 case 'fsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 %{ 't0' 'navs' 'fs' 'enbw' 'xunits' 'yunits' 'x' 'y' 'dx' 'dy'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 txt = [ ' $(1 \times ' utils.helper.obj2tex(numel(obj.y)) ')$ frequency series, units: $' utils.helper.obj2tex(obj.yunits) '$vs$' utils.helper.obj2tex(obj.xunits) ' $ up to $' num2str(obj.fs) '$Hz '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 case 'xyzdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 %{ 'zunits' 'z' 'xunits' 'yunits' 'x' 'y' 'dx' 'dy'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 display('warning, xyz data was not tested yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 txt = [ ' $(' utils.helper.obj2tex(numel(obj.x)) ' \times ' utils.helper.obj2tex(numel(obj.y)) ')$ table, units: $' utils.helper.obj2tex(obj.yunits) '$vs$ \left(' utils.helper.obj2tex(obj.xunits) ' \times ' utils.helper.obj2tex(obj.yunits) '\right)$ '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 case 'cdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 %{ 'yunits' 'y' 'dy'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 error('cdata is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 case 'double'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 [n1, n2] = size(obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 if n1==0 || n2==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 % array of size 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 txt = [' 0_{ \left[ ' num2str(n1) ' \times ' num2str(n2) ' \right] } '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 elseif n1==1 && n2==1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 % array of size 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 if isnan(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 txt = '\mathrm{NaN}';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 elseif isinf(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 txt = ' \pm \infty ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 if isreal(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 txt1 = num2str(obj, '%10.5e');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 [txt2, txt1] = strtok(txt1, 'e');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 expo = eval(txt1(2:end));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 if expo==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 txt = [ ' ' txt2 ' ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 txt = [ ' ' txt2 '.10^{' num2str(expo) '} ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 if imag(obj)>= 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 txt = [ ' ' utils.helper.obj2tex( real(obj) ) '+' utils.helper.obj2tex( imag(obj) ) ' i ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 txt = [ ' ' utils.helper.obj2tex( real(obj) ) '' utils.helper.obj2tex( imag(obj) ) ' i ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 % array of size nxm
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 txt = ' \left[ \begin{array}{';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 for ii=1:size(obj,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 txt = [txt 'c' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 txt = [txt '} '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 for ii=1:size(obj,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 for jj=1:size(obj,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 if jj>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 txt = [ txt ' & '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 val = obj(ii,jj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 txt = [ txt ' ' utils.helper.obj2tex(val) ]; % reccursive call with a singleton
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 if ii<size(obj,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 txt = [ txt ' \\ ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 txt = [ txt ' \end{array} \right] ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 case 'logical'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 txt = utils.helper.obj2tex( double(obj) );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 case 'sym'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 error('sym is not supported yet')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 case 'cell'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 [n1, n2] = size(obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 if n1==0 || n2==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 % array of size 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 txt = [' \texttt{cell}_{ \left[ ' num2str(n1) ' \times ' num2str(n2) ' \right] } '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 elseif n1==1 && n2==1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 % array of size 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 txt = ['{' num2str(size(obj{1},1)) ' \times ' num2str(size(obj{1},2)) ' \texttt{ ' class(obj{1}) '} } ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 % array of size mxn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 txt = ' \left[ \begin{array}{';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 for ii=1:size(obj,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 txt = [txt 'c' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 txt = [txt '} '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 for ii=1:size(obj,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 for jj=1:size(obj,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 if jj>1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 txt = [ txt ' & '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 val = obj{ii,jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 txt = [ txt ' {' num2str(size(val,1)) ' \times ' num2str(size(val,2)) ' \texttt{ ' class(val) '} } ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 if ii<size(obj,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 txt = [ txt ' \\ ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 txt = [ txt ' \end{array} \right] ' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 case 'char'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 txt = obj;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 txt = strrep( txt, '_', '\_');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 txt = strrep( txt, '^', '\^');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 txt = strrep( txt, '->', '$\rightarrow$');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 error(['conversion to TeX is not yet implemented for class ' class(obj) '!'])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 if nargout == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 display(txt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 elseif nargout == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 varargout{1} = txt;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 % private function of unit class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 function p = val2prefix(val)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 [pfxs, pfxvals] = unit.supportedPrefixes;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 res = val==pfxvals;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 if any(res)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 p = pfxs{val==pfxvals};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 p = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 end
|