0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function cmds = getBlockCommands(blocks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % GETBLOCKCOMMANDS get a set of commands from a set of sLTPDA blocks.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % M Hewitson 27-03-07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 disp(' + compiling block list');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 cmds = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 for j=1:length(blocks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 b = blocks(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 blocktype = get(b, 'BlockType');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 maskType = get(b, 'MaskType');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 name = get(b, 'Name');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 if ~strcmp(name, 'variable')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 parent = get(b, 'Parent');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 name = [parent '_' name];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 name = sltpda_reduceVarName(name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 if ~strcmp(blocktype, 'Outport') && ~strcmp(blocktype, 'Inport') && ~strcmp(maskType, 'loop')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 fcn = getFcnName(b);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 if ~isempty(fcn)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % Get my inputs and outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 [inames, onames] = getIOnames(get(b, 'PortHandles'), name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % Get my parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 [params, pl] = getParameters(b);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % Form command
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % cmd = buildCmd(inames, onames, params, fcn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 cmd = sltpda_buildCmd(inames, onames, params, fcn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 % store info
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 info.fcn = fcn;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 info.params = params;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 info.plist = pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 info.ins = inames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 info.outs = onames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 info.outsUsed = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 info.cmd = cmd;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 info.name = get(b, 'Name');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 info.handle = get(b, 'Handle');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 info.ranges = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 cmds = [cmds info];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 % Get parameters from block mask
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 % MaskPromptString, MaskVariables, MaskValueString
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 function [params, pl] = getParameters(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 maskType = get(block, 'MaskType');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 if ~isempty(maskType)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 switch maskType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 case 'ltpda_tfe'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 [params, pl] = get_ltpda_tfe_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 case 'ltpda_pwelch'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 [params, pl] = get_ltpda_pwelch_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 case 'plot'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 [params, pl] = get_plot_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 case 'ao'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 [params, pl] = get_ao_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 case 'filter'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 [params, pl] = get_filter_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 case 'get'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 [params, pl] = get_get_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 case 'rdivide'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 [params, pl] = get_mrdivide_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 case 'minus'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 [params, pl] = get_minus_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 case 'plus'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 [params, pl] = get_plus_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 case 'times'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 [params, pl] = get_mtimes_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 case 'sqrt'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 [params, pl] = get_sqrt_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 case 'abs'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 [params, pl] = get_abs_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 case 'split'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 [params, pl] = get_split_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 case 'demux'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 [params, pl] = get_demux_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 case 'ltpda_timedomainfit'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 [params, pl] = get_ltpda_timedomainfit_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 case 'ltpda_lincom'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 [params, pl] = get_ltpda_lincom_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 case 'ltpda_polydetrend'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 [params, pl] = get_ltpda_polydetrend_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 case 'ltpda_lpsd'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 [params, pl] = get_ltpda_lpsd_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 case 'save'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 [params, pl] = get_save_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 case 'resample'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 [params, pl] = get_resample_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 case 'pzmresp'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 [params, pl] = get_pzmresp_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 case 'convert'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 [params, pl] = get_convert_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 case 'param'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 [params, pl] = get_param_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 case 'iparam'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 [params, pl] = get_iparam_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 case 'specwin'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 [params, pl] = get_specwin_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 case 'plist'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 [params, pl] = get_plist_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 case 'display'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 pl = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 params = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 case 'pole'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 [params, pl] = get_pole_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 case 'zero'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 [params, pl] = get_zero_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 case 'pzmodel'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 [params, pl] = get_pzmodel_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 case 'resp'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 [params, pl] = get_resp_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 case 'miir'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 [params, pl] = get_miir_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 case 'iirResp'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 [params, pl] = get_iirResp_params(block);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 warning(['### unknown mask type ' maskType]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 % Get parameters for abs block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 function [params, pl] = get_abs_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 params = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 % Get parameters for iirResp block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 function [params, pl] = get_iirResp_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 f1 = get(block, 'f1');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 f2 = get(block, 'f2');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 nf = get(block, 'nf');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 if isempty(f1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 f1 = '[]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 if isempty(f2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 f2 = '[]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 if isempty(nf)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 nf = '[]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 pl = plist( [param('f1', eval(f1)) param('f2', eval(f2)) param('nf', eval(nf))] );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 % Get parameters for miir block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 function [params, pl] = get_miir_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 fs = get(block, 'fs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 if isempty(fs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 fs = '[]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 pl = plist( param('fs', eval(fs)) );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 % Get parameters for resp block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 function [params, pl] = get_resp_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 f1 = get(block, 'f1');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 f2 = get(block, 'f2');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 nf = get(block, 'nf');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 scale = get(block, 'scale');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 if isempty(f1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 f1 = '[]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 if isempty(f2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 f2 = '[]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 if isempty(nf)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 nf = '[]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 pl = plist( [param('f1', eval(f1)) param('f2', eval(f2)) param('nf', eval(nf)) param('scale', scale)] );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 % Get parameters for pzmodel block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 function [params, pl] = get_pzmodel_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 params = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 % Get parameters for zero block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 function [params, pl] = get_zero_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 f = get(block, 'zerof');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 q = get(block, 'zeroQ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 if isempty(q)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 q = '0';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 pl = plist( [param('f', eval(f)) param('q', eval(q))] );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 % Get parameters for pole block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 function [params, pl] = get_pole_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 f = get(block, 'polef');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 q = get(block, 'poleQ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 if isempty(q)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 q = '0';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 pl = plist( [param('f', eval(f)) param('q', eval(q))] );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 % Get parameters for plist block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 function [params, pl] = get_plist_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 params = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 % Get parameters for iparam block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 function [params, pl] = get_iparam_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 key = get(block, 'key');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 pl = plist(param(key, -1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 % Get parameters for specwin block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 function [params, pl] = get_specwin_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 name = get(block, 'wname');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 N = get(block, 'wlen');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 psll = get(block, 'psll');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 % check what value is
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 pl = plist([param('Name', name) param('N', eval(N)) param('PSLL', eval(psll))]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 % Get parameters for param block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 function [params, pl] = get_param_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 key = get(block, 'key');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 val = get(block, 'val');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 % build output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 pl = plist([param('key', key) param('val', eval(val))]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 % Get parameters for convert block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 function [params, pl] = get_convert_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 params = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 % Get parameters for pzmresp block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 function [params, pl] = get_pzmresp_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 f1 = get(block, 'f1');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 f2 = get(block, 'f2');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 nf = get(block, 'nf');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 pzm = get(block, 'pzm');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 if ~isempty(f1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 pl = append(pl, param('f1', str2double(f1)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 if ~isempty(f2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 pl = append(pl, param('f2', str2double(f2)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 if ~isempty(nf)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 pl = append(pl, param('nf', str2double(nf)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 if ~isempty(pzm)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 pl = append(pl, param('pzmodel', eval(pzm)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 error('### pole/zero constructor is empty.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 % Get parameters for resample block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 function [params, pl] = get_resample_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 fsout = get(block, 'fsout');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 pl = append(pl, param('fsout', str2double(fsout)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 % Get parameters for save block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 function [params, pl] = get_save_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 fname = get(block, 'fname');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 pl = append(pl, param('filename', fname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 % Get parameters for ltpda_lpsd block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 function [params, pl] = get_ltpda_lpsd_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 Kdes = str2double(get(block, 'Kdes'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 Kmin = str2double(get(block, 'Kmin'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 Jdes = str2double(get(block, 'Jdes'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 Win = get(block, 'win');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 nolap = str2double(get(block, 'olap'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 psll = str2double(get(block, 'psll'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 pl = plist(param('Kdes', Kdes));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 pl = append(pl, param('Kmin', Kmin));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 pl = append(pl, param('Jdes', Jdes));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 nfft = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 switch Win
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 case 'Kaiser'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 if psll <=0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 error('### ltpda_lpsd block: please specify PSLL for Kaiser window.')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 p = sprintf('specwin(''Kaiser'', %f, %f)', nfft, psll);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 case 'Hanning'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 p = sprintf('specwin(''Hanning'', %f)', nfft);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 error('### ltpda_lpsd block: Unknown window name.');
|
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 pl = append(pl, param('win', eval(p)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 if nolap > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 pl = append(pl, param('Olap', nolap));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 % Get parameters for ltpda_polydetrend block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 function [params, pl] = get_ltpda_polydetrend_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 N = get(block, 'degree');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 pl = plist(param('N', N));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 % Get parameters for ltpda_lincom block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 function [params, pl] = get_ltpda_lincom_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 coeffs = get(block, 'coeffs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 pl = plist(param('coeffs', coeffs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 % Get parameters for ltpda_timedomainfit block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 function [params, pl] = get_ltpda_timedomainfit_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 % Get parameters for demux block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 function [params, pl] = get_demux_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 % Get parameters for sqrt block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 function [params, pl] = get_split_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 method = get(block, 'method');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 splits = get(block, 'splits');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 pl = append(pl, param(method, str2num(splits) ));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 params = string(pl);
|
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 % Get parameters for sqrt block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 function [params, pl] = get_sqrt_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 % Get parameters for mrdivide block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 function [params, pl] = get_mrdivide_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476 % Get parameters for mtimes block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 function [params, pl] = get_mtimes_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484 % Get parameters for minus block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 function [params, pl] = get_minus_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 % Get parameters for plus block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 function [params, pl] = get_plus_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 % Get parameters for get block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 function [params, pl] = get_get_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 params = ['''' get(block, 'param') ''''];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508 % Get parameters for filter block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 function [params, pl] = get_filter_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 % first we try for a standard filter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 fname = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 ftype = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 ftype = get(block, 'ftype');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 fgain = get(block, 'fgain');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 ffc = get(block, 'ffc');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520 forder = get(block, 'forder');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 % we design for 4*ffc and adjust later when
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 % we know the fs of the input data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 fc = str2num(ffc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 ffs = 4*fc(end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 fname = get(block, 'fname');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533 % start plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 if isempty(fname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537 % if not a standard filter, then a pole/zero filter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 if isempty(ftype)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540 miirstr = get(block, 'miirstr');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 eval(['pzm = ' miirstr ';']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542 pl = plist(param('filter', miir(plist(param('pzmodel', pzm)))));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 % else a standard filter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 % build standard filter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 if strcmp(ftype, 'bandpass') || strcmp(ftype, 'bandreject')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550 if length(str2num(ffc)) ~= 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 error('### supply upper and lower frequency for bandpass and bandreject filters.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 fpl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 fpl = append(fpl, param('type', ftype));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557 fpl = append(fpl, param('gain', str2double(fgain)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558 % fpl = append(fpl, param('fs', (ffs)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 fpl = append(fpl, param('fc', [str2num(ffc)]));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 fpl = append(fpl, param('order', [str2num(forder)]));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 pl = plist(param('filter', miir(fpl)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566 pl = plist(param('filter', miir(fname)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571 % Get parameters for ao block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573 function [params, pl] = get_ao_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 fname = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576 vals = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 fcn = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578 tsfcn = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579 waveform = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580 try fname = get(block, 'fname'); end;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581 try vals = get(block, 'vals'); end;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 try fcn = get(block, 'fcn'); end;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583 try tsfcn = get(block, 'tsfcn'); end;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 try waveform = get(block, 'waveform'); end;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 % execute
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587 if ~isempty(fname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589 pl = append(pl, param('filename', fname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 elseif ~isempty(vals)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 pl = plist(param('vals', str2num(vals)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594 elseif ~isempty(fcn)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 pl = plist(param('fcn', fcn));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597 elseif ~isempty(tsfcn)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598 nsecs = sltpda_getvar(block, 'nsecs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599 fs = sltpda_getvar(block, 'fs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 pl = append(pl, param('nsecs', nsecs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602 pl = append(pl, param('fs', fs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 pl = append(pl, param('tsfcn', tsfcn));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605 elseif ~isempty(waveform)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 switch waveform
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 %------------ Sine Wave
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609 case 'sine wave'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610 freq = get(block, 'freq');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611 phi = get(block, 'phi');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 tsfcn = sprintf('sin(2*pi*%f*t + %f*pi/180)', eval(freq), eval(phi));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 %------------ Noise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614 case 'noise'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 ntype = get(block, 'ntype');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616 switch ntype
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 case 'Normal'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 tsfcn = 'randn(size(t))';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619 case 'Uniform'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
620 tsfcn = 'rand(size(t))';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 %------------ Chirp
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 case 'chirp'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624 f0 = get(block, 'chirp_f0');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 fe = get(block, 'chirp_fe');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 te = get(block, 'chirp_te');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 tsfcn = sprintf('chirp(t,%f,%f,%f)', eval(f0), eval(fe), eval(te))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628 %------------ Gaussian pulse
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629 case 'Gaussian pulse'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630 fc = get(block, 'gp_f0');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 bw = get(block, 'gp_bw');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 tsfcn = sprintf('gauspuls(t,%f,%f)', eval(fc), eval(bw));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 case 'Square wave'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634 freq = get(block, 'freq');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635 duty = get(block, 'square_duty');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636 tsfcn = sprintf('square(2*pi*%f*t,%f)', eval(freq), eval(duty));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 case 'Sawtooth'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638 freq = get(block, 'freq');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 width = get(block, 'sawtooth_width');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 tsfcn = sprintf('sawtooth(2*pi*%f*t,%f)', eval(freq), eval(width));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 pl = append(pl, param('tsfcn', tsfcn));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646 error('### unknown parameter method for AO construction.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650 % Get parameters for plot block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 function [params, pl] = get_plot_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656 xscale = get(block, 'xscale');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657 yscale = get(block, 'yscale');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 params = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663 % Get parameters for ltpda_pwelch block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665 function [params, pl] = get_ltpda_pwelch_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669 nfft = get(block, 'Nfft');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670 nolap = get(block, 'Nolap');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672 if isempty(nfft)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 nfft = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 nfft = str2double(nfft);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 if isempty(nolap)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678 nolap = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680 nolap = str2double(nolap);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684 if nfft > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685 pl = append(pl, param('Nfft', nfft));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 if nolap > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688 pl = append(pl, param('Nolap', nolap));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 % Get parameters for ltpda_tfe block.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 function [params, pl] = get_ltpda_tfe_params(block)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697 winname = get(block, 'win');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698 nfft = get(block, 'nfft');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699 nolap = get(block, 'nolap');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 psll = get(block, 'psll');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 if isempty(nfft)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703 nfft = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705 nfft = str2double(nfft);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707 if isempty(nolap)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708 nolap = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 nolap = str2double(nolap);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 if isempty(psll)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713 psll = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715 psll = str2double(psll);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718 switch winname
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 case 'Kaiser'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720 if psll <=0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721 error('### ltpda_tfe block: please specify PSLL for Kaiser window.')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723 p = sprintf('specwin(''Kaiser'', %f, %f)', nfft, psll);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724 case 'Hanning'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725 p = sprintf('specwin(''Hanning'', %f)', nfft);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727 error('### ltpda_tfe block: Unknown window name.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731 pl = append(pl, param('Nfft', nfft));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732 pl = append(pl, param('Win', eval(p)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 if nolap > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 pl = append(pl, param('Nolap', nolap));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736 params = string(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739 % Build command string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741 function cmd = buildCmd(inames, onames, params, fcn)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743 cmd = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745 % add outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 if ~isempty(onames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 cmd = [cmd '['];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748 for k=1:length(onames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749 cmd = [cmd onames{k} ','];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751 cmd = [cmd(1:end-1) ']'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752 cmd = [cmd ' = '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 % add fcn name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756 cmd = [cmd fcn];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 % add inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759 cmd = [cmd '('];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 if ~isempty(inames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761 for k=1:length(inames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 cmd = [cmd inames{k} ','];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766 % add parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 if ~isempty(params)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768 cmd = [cmd params];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770 cmd = cmd(1:end-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
771 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
772
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
773 cmd = [cmd ')'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
774 cmd = [cmd ';'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
775
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
776 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
777 % get function name from block handle
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
778 function fcn = getFcnName(b)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
779
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
780 blocktype = get(b, 'blocktype');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
781 if ~strcmp(blocktype, 'Outport') && ~ strcmp(blocktype, 'Inport')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
782 name = get(b, 'Name');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
783 masktype = get(b, 'MaskType');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
784
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
785 if isempty(masktype) && ~strcmp(blocktype, 'SubSystem')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
786 fcn = name;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
787 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
788 fcn = masktype;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
789 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
790
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
791 % Some overrides to this
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
792 switch blocktype
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
793 case 'Sum'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
794 fcn = 'plus';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
795 case 'Mux'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
796 fcn = 'mux';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
797 case 'Demux';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
798 fcn = 'demux';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
799 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
800
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
801 % Some function replacements
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
802 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
803 case 'plot'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
804 fcn = 'figure,plot';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
805 case 'filter'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
806 fcn = get(b, 'method');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
807 case 'convert'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
808 fcn = get(b, 'fcn');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
809 case 'iparam'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
810 fcn = 'param';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
811 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
812 fcn = sltpda_fixvar(fcn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
813 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
814
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
815 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
816 function [inames, onames] = getIOnames(myports, name)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
817
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
818 % Get my inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
819 inames = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
820
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
821 ins = myports.Inport;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
822 % get name of each input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
823 for k=1:length(ins)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
824 ip = ins(k);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
825 lineState = get(ip, 'Line');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
826 pn = get(ip, 'PortNumber');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
827 if lineState == -1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
828 inames = [inames cellstr('[]')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
829 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
830 pstr = strrep([name '_in_' num2str(pn)], ' ', '_');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
831 pstr = sltpda_fixvar(pstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
832 inames = [inames cellstr(pstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
833 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
834 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
835
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
836 % Get my outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
837 onames = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
838 outs = myports.Outport;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
839 % get name of each output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
840 for k=1:length(outs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
841 op = outs(k);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
842 pn = get(op, 'PortNumber');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
843 pstr = strrep([name '_out_' num2str(pn)], ' ', '_');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
844 pstr = sltpda_fixvar(pstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
845 onames = [onames cellstr(pstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
846 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
847
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
848
|