comparison m-toolbox/html_help/help/ug/constructor_examples_rational_content.html @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 <!-- $Id: constructor_examples_rational_content.html,v 1.1 2009/02/27 16:51:57 ingo Exp $ -->
2
3 <!-- -------------------------------------------------- -->
4 <!-- --------------- BEGIN CONTENT FILE --------------- -->
5 <!-- -------------------------------------------------- -->
6
7
8 <!-- --------------- Link box: begin --------------- -->
9 <table border="0" summary="Simple list" class="simplelist_nottable_last">
10 <tr>
11 <td>
12 <a href="constructor_examples_rational.html#copy">Copy an rational object</a>
13 </td>
14 </tr>
15 <tr>
16 <td>
17 <a href="constructor_examples_rational.html#xml_file">Construct an rational object by loading the object from a file</a>
18 </td>
19 </tr>
20 <tr>
21 <td>
22 <a href="constructor_examples_rational.html#rational">Construct an rational object from an parfrac object</a>
23 </td>
24 </tr>
25 <tr>
26 <td>
27 <a href="constructor_examples_rational.html#pzmodel">Construct an rational object from a pole/zero model</a>
28 </td>
29 </tr>
30 <tr>
31 <td>
32 <a href="constructor_examples_rational.html#coeffs">Construct an rational object from numerator and denominator coefficients</a>
33 </td>
34 </tr>
35 <tr>
36 <td>
37 <a href="constructor_examples_rational.html#plist">Construct an rational object from a parameter list object (PLIST)</a>
38 </td>
39 </tr>
40 </table>
41
42 <!-- --------------- NEXT EXAMPLE --------------- -->
43
44 <hr>
45 <h2 class="title"><a name="copy"></a>Copy an rational object</h2>
46 <p>The following example creates a copy of an rational object (blue command).</p>
47 <div class="fragment"><pre class="programlisting">
48 >> ra1 = rational([1 2 3], [4 5 6 7], <span class="string">'my rational'</span>);
49 <span class="blue">>> ra2 = rational(ra1)</span>
50 ---- rational 1 ----
51 model: my rational
52 num: [1 2 3]
53 den: [4 5 6 7]
54 iunits: []
55 ounits: []
56 --------------------
57 </pre></div>
58 <br></br>
59 <p>REMARK: The following command copies only the handle of an object and doesn't create a copy of the object (as above). This means that everything that happens to the copy or original happens to the other object.</p>
60 <div class="fragment"><pre class="programlisting">
61 >> ra1 = rational()
62 ---- rational 1 ----
63 model: none
64 num: []
65 den: []
66 iunits: []
67 ounits: []
68 --------------------
69 >> ra2 = ra1;
70 >> ra2.setName(<span class="string">'my new name'</span>)
71 ---- rational 1 ----
72 model: <span class="string">my new name</span>
73 num: [1 2 3]
74 den: [4 5 6 7]
75 iunits: []
76 ounits: []
77 --------------------
78 </pre></div>
79 <br></br>
80 <p>If we display ra1 again then we see that the property 'name' was changed although we only have changed ra2.</p>
81 <div class="fragment"><pre class="programlisting">
82 >> ra1
83 ---- rational 1 ----
84 model: <span class="string">my new name</span>
85 num: [1 2 3]
86 den: [4 5 6 7]
87 iunits: []
88 ounits: []
89 --------------------
90 </pre></div>
91
92
93 <!-- --------------- NEXT EXAMPLE --------------- -->
94
95 <hr>
96 <h2 class="title"><a name="xml_file"></a>Construct an rational object by loading the object from a file</h2>
97 <p>The following example creates a new rational object by loading the object from disk.</p>
98 <div class="fragment"><pre class="programlisting">
99 ra = rational(<span class="string">'rational_object.mat'</span>)
100 ra = rational(<span class="string">'rational_object.xml'</span>)
101 </pre></div>
102 <p>or in a <tt>PLIST</tt></p>
103 <div class="fragment"><pre class="programlisting">
104 pl = plist(<span class="string">'filename'</span>, <span class="string">'rational_object.xml'</span>);
105 ra = rational(pl)
106 </pre></div>
107
108
109 <!-- --------------- NEXT EXAMPLE --------------- -->
110
111 <hr>
112 <h2 class="title"><a name="rational"></a>Construct an rational object from an parfrac object</h2>
113 <p>The following example creates a new rational object from an parfrac object.</p>
114 <div class="fragment"><pre class="programlisting">
115 >> pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], 3, <span class="string">'my parfrac'</span>)
116 ---- parfrac 1 ----
117 model: my parfrac
118 res: [1;2+i*1;2-i*1]
119 poles: [6;1+i*3;1-i*3]
120 dir: 3
121 pmul: [1;1;1]
122 iunits: []
123 ounits: []
124 -------------------
125 >> ra = rational(pf)
126 ---- rational 1 ----
127 model: rational(my parfrac)
128 num: [3 -19 30 -110]
129 den: [1 -8 22 -60]
130 iunits: []
131 ounits: []
132 --------------------
133 </pre></div>
134 <p>or in a plist</p>
135 <div class="fragment"><pre class="programlisting">
136 >> pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], 3, <span class="string">'my parfrac'</span>);
137 >> pl = plist(<span class="string">'rational'</span>, rat)
138 >> ra = rational(pl)
139 </pre></div>
140
141
142 <!-- --------------- NEXT EXAMPLE --------------- -->
143
144 <hr>
145 <h2 class="title"><a name="pzmodel"></a>Construct an rational object from a pole/zero model</h2>
146 <p>The following example creates a new rational object from a pole/zero model.</p>
147 <div class="fragment"><pre class="programlisting">
148 >> pzm = pzmodel(1, {1 2 3}, {4 5}, <span class="string">'my pzmodel'</span>)
149 ---- pzmodel 1 ----
150 name: my pzmodel
151 gain: 1
152 delay: 0
153 iunits: []
154 ounits: []
155 pole 001: (f=1 Hz,Q=NaN)
156 pole 002: (f=2 Hz,Q=NaN)
157 pole 003: (f=3 Hz,Q=NaN)
158 zero 001: (f=4 Hz,Q=NaN)
159 zero 002: (f=5 Hz,Q=NaN)
160 -------------------
161 >> ra = rational(pzm)
162 ---- rational 1 ----
163 model: rational(None)
164 num: [0.0012 0.0716 1]
165 den: [0.0001 0.0036 0.0401 0.2122 1]
166 iunits: []
167 ounits: []
168 --------------------
169 </pre></div>
170 <p>or in a plist</p>
171 <div class="fragment"><pre class="programlisting">
172 >> pzm = pzmodel(1, {1 2 3}, {4 5}, <span class="string">'my pzmodel'</span>)
173 >> pl = plist(<span class="string">'pzmodel'</span>, pzm)
174 >> ra = rational(pl)
175 </pre></div>
176
177
178 <!-- --------------- NEXT EXAMPLE --------------- -->
179
180 <hr>
181 <h2 class="title"><a name="coeffs"></a>Construct an rational object from numerator and denominator coefficients</h2>
182 <p>The following example creates a new rational direct from the numerator and denominator coefficients.</p>
183 <div class="fragment"><pre class="programlisting">
184 >> num = [1 2 3];
185 >> den = [4 5 6];
186 >> name = <span class="string">'my rational'</span>;
187 >> iunits = <span class="string">'Hz'</span>;
188 >> ounits = <span class="string">'V'</span>;
189
190 >> ra = rational(num, den)
191 >> ra = rational(num, den, name)
192 >> ra = rational(num, den, name, iunits, ounits)
193 ---- rational 1 ----
194 model: my rational
195 num: [1 2 3]
196 den: [4 5 6]
197 iunits: [Hz]
198 ounits: [V]
199 --------------------
200 </pre></div>
201
202
203 <!-- --------------- NEXT EXAMPLE --------------- -->
204
205 <hr>
206 <h2 class="title"><a name="plist"></a>Construct an rational object from a parameter list (<tt>plist</tt>)</h2>
207 <p>Constructs an rational object from the description given in the parameter list.</p>
208
209 <!-- --------------- Link box: begin --------------- -->
210 <table border="0" summary="Simple list" class="simplelist_nottable_last">
211 <tr>
212 <td>
213 <a href="constructor_examples_rational.html#hostname">Use the key word 'hostname'</a>
214 </td>
215 </tr>
216 <tr>
217 <td>
218 <a href="constructor_examples_rational.html#pl_coeffs">Use the key word 'num' or 'den'</a>
219 </td>
220 </tr>
221 </table>
222 <!-- --------------- Link box: end --------------- -->
223
224
225 <!-- --------------- 'hostname' --------------- -->
226
227 <hr>
228 <h3 class="title"><a name="hostname"></a>Use the key word 'hostname'</h3>
229 <p>Construct an rational object by retrieving it from a LTPDA repository.</p>
230 <p>The relevant parameters are:</p>
231 <p>
232 <table cellspacing="0" border="0" cellpadding="2" class="simplelist_nottable_last" width="80%">
233 <colgroup>
234 <col width="25%"/>
235 <col width="75%"/>
236 </colgroup>
237 <thead>
238 <tr valign="top">
239 <th class="subcategorylist">Key</th>
240 <th class="subcategorylist">Description</th>
241 </tr>
242 </thead>
243 <tbody>
244 <tr valign="top">
245 <td>
246 <p>'hostname'</p>
247 </td>
248 <td>
249 <p>the repository hostname. [default: 'localhost']</p>
250 </td>
251 </tr>
252 <tr valign="top">
253 <td>
254 <p>'database'</p>
255 </td>
256 <td>
257 <p>The database name [default: 'ltpda']</p>
258 </td>
259 </tr>
260 <tr valign="top">
261 <td>
262 <p>'id'</p>
263 </td>
264 <td>
265 <p>A vector of object IDs. [default: []]</p>
266 </td>
267 </tr>
268 <tr valign="top">
269 <td>
270 <p>'cid'</p>
271 </td>
272 <td>
273 <p>Retrieve all rational objects from a particular collection</p>
274 </td>
275 </tr>
276 <tr valign="top">
277 <td>
278 <p>'binary'</p>
279 </td>
280 <td>
281 <p>Set to 'yes' to retrieve from stored binary representation (not always available). [default: yes]</p>
282 </td>
283 </tr>
284 </tbody>
285 </table>
286 </p>
287 <div class="fragment"><pre class="programlisting">
288 pl = plist(<span class="string">'hostname'</span>, <span class="string">'130.75.117.67'</span>, <span class="string">'database'</span>, <span class="string">'ltpda_test'</span>, <span class="string">'id'</span>, 1)
289 a1 = rational(pl)
290 </pre></div>
291
292
293 <!-- --------------- 'direct_terms' --------------- -->
294
295 <hr>
296 <h3 class="title"><a name="direct_terms"></a>Use the key word 'num' or 'den'</h3>
297 <p>Construct an rational object direct from the coefficients.<br></br>
298 The relevant parameters are:</p>
299 <p>
300 <table cellspacing="0" border="0" cellpadding="2" class="simplelist_nottable_last" width="80%">
301 <colgroup>
302 <col width="25%"/>
303 <col width="75%"/>
304 </colgroup>
305 <thead>
306 <tr valign="top">
307 <th class="subcategorylist">Key</th>
308 <th class="subcategorylist">Description</th>
309 </tr>
310 </thead>
311 <tbody>
312 <tr valign="top">
313 <td>
314 <p>'num'</p>
315 </td>
316 <td>
317 <p>numerator coefficients [default: []]</p>
318 </td>
319 </tr>
320 <tr valign="top">
321 <td>
322 <p>'den'</p>
323 </td>
324 <td>
325 <p>denominator coefficients [default: []]</p>
326 </td>
327 </tr>
328 </tbody>
329 </table>
330 </p>
331 <p>You can also specify optional parameters:</p>
332 <p>
333 <table cellspacing="0" border="0" cellpadding="2" class="simplelist_nottable_last" width="80%">
334 <colgroup>
335 <col width="25%"/>
336 <col width="75%"/>
337 </colgroup>
338 <thead>
339 <tr valign="top">
340 <th class="subcategorylist">Key</th>
341 <th class="subcategorylist">Description</th>
342 </tr>
343 </thead>
344 <tbody>
345 <tr valign="top">
346 <td>
347 <p>'name'</p>
348 </td>
349 <td>
350 <p>name of the rational object [default: 'none']</p>
351 </td>
352 </tr>
353 <tr valign="top">
354 <td>
355 <p>'xunits'</p>
356 </td>
357 <td>
358 <p>unit of the x-axis</p>
359 </td>
360 </tr>
361 <tr valign="top">
362 <td>
363 <p>'yunits'</p>
364 </td>
365 <td>
366 <p>unit of the y-axis</p>
367 </td>
368 </tr>
369 </tbody>
370 </table>
371 </p>
372 <div class="fragment"><pre class="programlisting">
373 num = [1 2 3];
374 den = [4 5 6];
375 name = <span class="string">'my rational'</span>;
376 iunits = <span class="string">'Hz'</span>;
377 ounits = <span class="string">'V'</span>;
378
379 pl = plist(<span class="string">'num'</span>, num, <span class="string">'den'</span>, den);
380 ra = rational(pl)
381 ---- rational 1 ----
382 model: None
383 num: [1 2 3]
384 den: [4 5 6]
385 iunits: []
386 ounits: []
387 --------------------
388
389 pl = plist(<span class="string">'num'</span>, num, <span class="string">'den'</span>, den, <span class="string">'name'</span>, name, <span class="string">'iunits'</span>, iunits, <span class="string">'ounits'</span>, ounits);
390 pf = rational(pl)
391 ---- rational 1 ----
392 model: my rational
393 num: [1 2 3]
394 den: [4 5 6]
395 iunits: [Hz]
396 ounits: [V]
397 --------------------
398 </pre></div>
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435