comparison m-toolbox/html_help/help/ug/constructor_examples_rational.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 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
3
4 <html lang="en">
5 <head>
6 <meta name="generator" content=
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org">
8 <meta http-equiv="Content-Type" content=
9 "text/html; charset=us-ascii">
10
11 <title>Constructor examples of the RATIONAL class (LTPDA Toolbox)</title>
12 <link rel="stylesheet" href="docstyle.css" type="text/css">
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2">
14 <meta name="description" content=
15 "Presents an overview of the features, system requirements, and starting the toolbox.">
16 </head>
17
18 <body>
19 <a name="top_of_page" id="top_of_page"></a>
20
21 <p style="font-size:1px;">&nbsp;</p>
22
23 <table class="nav" summary="Navigation aid" border="0" width=
24 "100%" cellpadding="0" cellspacing="0">
25 <tr>
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td>
27
28 <td valign="baseline" align="right"><a href=
29 "constructor_examples_parfrac.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Constructor examples of the PARFRAC class"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "constructor_examples_timespan.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Constructor examples of the TIMESPAN class"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Constructor examples of the RATIONAL class</h1>
37 <hr>
38
39 <p>
40
41 <!-- -------------------------------------------------- -->
42 <!-- --------------- BEGIN CONTENT FILE --------------- -->
43 <!-- -------------------------------------------------- -->
44
45
46 <!-- --------------- Link box: begin --------------- -->
47 <table border="0" summary="Simple list" class="simplelist_nottable_last">
48 <tr>
49 <td>
50 <a href="constructor_examples_rational.html#copy">Copy an rational object</a>
51 </td>
52 </tr>
53 <tr>
54 <td>
55 <a href="constructor_examples_rational.html#xml_file">Construct an rational object by loading the object from a file</a>
56 </td>
57 </tr>
58 <tr>
59 <td>
60 <a href="constructor_examples_rational.html#rational">Construct an rational object from an parfrac object</a>
61 </td>
62 </tr>
63 <tr>
64 <td>
65 <a href="constructor_examples_rational.html#pzmodel">Construct an rational object from a pole/zero model</a>
66 </td>
67 </tr>
68 <tr>
69 <td>
70 <a href="constructor_examples_rational.html#coeffs">Construct an rational object from numerator and denominator coefficients</a>
71 </td>
72 </tr>
73 <tr>
74 <td>
75 <a href="constructor_examples_rational.html#plist">Construct an rational object from a parameter list object (PLIST)</a>
76 </td>
77 </tr>
78 </table>
79
80 <!-- --------------- NEXT EXAMPLE --------------- -->
81
82 <hr>
83 <h2 class="title"><a name="copy"></a>Copy an rational object</h2>
84 <p>The following example creates a copy of an rational object (blue command).</p>
85 <div class="fragment"><pre class="programlisting">
86 >> ra1 = rational([1 2 3], [4 5 6 7], <span class="string">'my rational'</span>);
87 <span class="blue">>> ra2 = rational(ra1)</span>
88 ---- rational 1 ----
89 model: my rational
90 num: [1 2 3]
91 den: [4 5 6 7]
92 iunits: []
93 ounits: []
94 --------------------
95 </pre></div>
96 <br></br>
97 <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>
98 <div class="fragment"><pre class="programlisting">
99 >> ra1 = rational()
100 ---- rational 1 ----
101 model: none
102 num: []
103 den: []
104 iunits: []
105 ounits: []
106 --------------------
107 >> ra2 = ra1;
108 >> ra2.setName(<span class="string">'my new name'</span>)
109 ---- rational 1 ----
110 model: <span class="string">my new name</span>
111 num: [1 2 3]
112 den: [4 5 6 7]
113 iunits: []
114 ounits: []
115 --------------------
116 </pre></div>
117 <br></br>
118 <p>If we display ra1 again then we see that the property 'name' was changed although we only have changed ra2.</p>
119 <div class="fragment"><pre class="programlisting">
120 >> ra1
121 ---- rational 1 ----
122 model: <span class="string">my new name</span>
123 num: [1 2 3]
124 den: [4 5 6 7]
125 iunits: []
126 ounits: []
127 --------------------
128 </pre></div>
129
130
131 <!-- --------------- NEXT EXAMPLE --------------- -->
132
133 <hr>
134 <h2 class="title"><a name="xml_file"></a>Construct an rational object by loading the object from a file</h2>
135 <p>The following example creates a new rational object by loading the object from disk.</p>
136 <div class="fragment"><pre class="programlisting">
137 ra = rational(<span class="string">'rational_object.mat'</span>)
138 ra = rational(<span class="string">'rational_object.xml'</span>)
139 </pre></div>
140 <p>or in a <tt>PLIST</tt></p>
141 <div class="fragment"><pre class="programlisting">
142 pl = plist(<span class="string">'filename'</span>, <span class="string">'rational_object.xml'</span>);
143 ra = rational(pl)
144 </pre></div>
145
146
147 <!-- --------------- NEXT EXAMPLE --------------- -->
148
149 <hr>
150 <h2 class="title"><a name="rational"></a>Construct an rational object from an parfrac object</h2>
151 <p>The following example creates a new rational object from an parfrac object.</p>
152 <div class="fragment"><pre class="programlisting">
153 >> pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], 3, <span class="string">'my parfrac'</span>)
154 ---- parfrac 1 ----
155 model: my parfrac
156 res: [1;2+i*1;2-i*1]
157 poles: [6;1+i*3;1-i*3]
158 dir: 3
159 pmul: [1;1;1]
160 iunits: []
161 ounits: []
162 -------------------
163 >> ra = rational(pf)
164 ---- rational 1 ----
165 model: rational(my parfrac)
166 num: [3 -19 30 -110]
167 den: [1 -8 22 -60]
168 iunits: []
169 ounits: []
170 --------------------
171 </pre></div>
172 <p>or in a plist</p>
173 <div class="fragment"><pre class="programlisting">
174 >> pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], 3, <span class="string">'my parfrac'</span>);
175 >> pl = plist(<span class="string">'rational'</span>, rat)
176 >> ra = rational(pl)
177 </pre></div>
178
179
180 <!-- --------------- NEXT EXAMPLE --------------- -->
181
182 <hr>
183 <h2 class="title"><a name="pzmodel"></a>Construct an rational object from a pole/zero model</h2>
184 <p>The following example creates a new rational object from a pole/zero model.</p>
185 <div class="fragment"><pre class="programlisting">
186 >> pzm = pzmodel(1, {1 2 3}, {4 5}, <span class="string">'my pzmodel'</span>)
187 ---- pzmodel 1 ----
188 name: my pzmodel
189 gain: 1
190 delay: 0
191 iunits: []
192 ounits: []
193 pole 001: (f=1 Hz,Q=NaN)
194 pole 002: (f=2 Hz,Q=NaN)
195 pole 003: (f=3 Hz,Q=NaN)
196 zero 001: (f=4 Hz,Q=NaN)
197 zero 002: (f=5 Hz,Q=NaN)
198 -------------------
199 >> ra = rational(pzm)
200 ---- rational 1 ----
201 model: rational(None)
202 num: [0.0012 0.0716 1]
203 den: [0.0001 0.0036 0.0401 0.2122 1]
204 iunits: []
205 ounits: []
206 --------------------
207 </pre></div>
208 <p>or in a plist</p>
209 <div class="fragment"><pre class="programlisting">
210 >> pzm = pzmodel(1, {1 2 3}, {4 5}, <span class="string">'my pzmodel'</span>)
211 >> pl = plist(<span class="string">'pzmodel'</span>, pzm)
212 >> ra = rational(pl)
213 </pre></div>
214
215
216 <!-- --------------- NEXT EXAMPLE --------------- -->
217
218 <hr>
219 <h2 class="title"><a name="coeffs"></a>Construct an rational object from numerator and denominator coefficients</h2>
220 <p>The following example creates a new rational direct from the numerator and denominator coefficients.</p>
221 <div class="fragment"><pre class="programlisting">
222 >> num = [1 2 3];
223 >> den = [4 5 6];
224 >> name = <span class="string">'my rational'</span>;
225 >> iunits = <span class="string">'Hz'</span>;
226 >> ounits = <span class="string">'V'</span>;
227
228 >> ra = rational(num, den)
229 >> ra = rational(num, den, name)
230 >> ra = rational(num, den, name, iunits, ounits)
231 ---- rational 1 ----
232 model: my rational
233 num: [1 2 3]
234 den: [4 5 6]
235 iunits: [Hz]
236 ounits: [V]
237 --------------------
238 </pre></div>
239
240
241 <!-- --------------- NEXT EXAMPLE --------------- -->
242
243 <hr>
244 <h2 class="title"><a name="plist"></a>Construct an rational object from a parameter list (<tt>plist</tt>)</h2>
245 <p>Constructs an rational object from the description given in the parameter list.</p>
246
247 <!-- --------------- Link box: begin --------------- -->
248 <table border="0" summary="Simple list" class="simplelist_nottable_last">
249 <tr>
250 <td>
251 <a href="constructor_examples_rational.html#hostname">Use the key word 'hostname'</a>
252 </td>
253 </tr>
254 <tr>
255 <td>
256 <a href="constructor_examples_rational.html#pl_coeffs">Use the key word 'num' or 'den'</a>
257 </td>
258 </tr>
259 </table>
260 <!-- --------------- Link box: end --------------- -->
261
262
263 <!-- --------------- 'hostname' --------------- -->
264
265 <hr>
266 <h3 class="title"><a name="hostname"></a>Use the key word 'hostname'</h3>
267 <p>Construct an rational object by retrieving it from a LTPDA repository.</p>
268 <p>The relevant parameters are:</p>
269 <p>
270 <table cellspacing="0" border="0" cellpadding="2" class="simplelist_nottable_last" width="80%">
271 <colgroup>
272 <col width="25%"/>
273 <col width="75%"/>
274 </colgroup>
275 <thead>
276 <tr valign="top">
277 <th class="subcategorylist">Key</th>
278 <th class="subcategorylist">Description</th>
279 </tr>
280 </thead>
281 <tbody>
282 <tr valign="top">
283 <td>
284 <p>'hostname'</p>
285 </td>
286 <td>
287 <p>the repository hostname. [default: 'localhost']</p>
288 </td>
289 </tr>
290 <tr valign="top">
291 <td>
292 <p>'database'</p>
293 </td>
294 <td>
295 <p>The database name [default: 'ltpda']</p>
296 </td>
297 </tr>
298 <tr valign="top">
299 <td>
300 <p>'id'</p>
301 </td>
302 <td>
303 <p>A vector of object IDs. [default: []]</p>
304 </td>
305 </tr>
306 <tr valign="top">
307 <td>
308 <p>'cid'</p>
309 </td>
310 <td>
311 <p>Retrieve all rational objects from a particular collection</p>
312 </td>
313 </tr>
314 <tr valign="top">
315 <td>
316 <p>'binary'</p>
317 </td>
318 <td>
319 <p>Set to 'yes' to retrieve from stored binary representation (not always available). [default: yes]</p>
320 </td>
321 </tr>
322 </tbody>
323 </table>
324 </p>
325 <div class="fragment"><pre class="programlisting">
326 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)
327 a1 = rational(pl)
328 </pre></div>
329
330
331 <!-- --------------- 'direct_terms' --------------- -->
332
333 <hr>
334 <h3 class="title"><a name="direct_terms"></a>Use the key word 'num' or 'den'</h3>
335 <p>Construct an rational object direct from the coefficients.<br></br>
336 The relevant parameters are:</p>
337 <p>
338 <table cellspacing="0" border="0" cellpadding="2" class="simplelist_nottable_last" width="80%">
339 <colgroup>
340 <col width="25%"/>
341 <col width="75%"/>
342 </colgroup>
343 <thead>
344 <tr valign="top">
345 <th class="subcategorylist">Key</th>
346 <th class="subcategorylist">Description</th>
347 </tr>
348 </thead>
349 <tbody>
350 <tr valign="top">
351 <td>
352 <p>'num'</p>
353 </td>
354 <td>
355 <p>numerator coefficients [default: []]</p>
356 </td>
357 </tr>
358 <tr valign="top">
359 <td>
360 <p>'den'</p>
361 </td>
362 <td>
363 <p>denominator coefficients [default: []]</p>
364 </td>
365 </tr>
366 </tbody>
367 </table>
368 </p>
369 <p>You can also specify optional parameters:</p>
370 <p>
371 <table cellspacing="0" border="0" cellpadding="2" class="simplelist_nottable_last" width="80%">
372 <colgroup>
373 <col width="25%"/>
374 <col width="75%"/>
375 </colgroup>
376 <thead>
377 <tr valign="top">
378 <th class="subcategorylist">Key</th>
379 <th class="subcategorylist">Description</th>
380 </tr>
381 </thead>
382 <tbody>
383 <tr valign="top">
384 <td>
385 <p>'name'</p>
386 </td>
387 <td>
388 <p>name of the rational object [default: 'none']</p>
389 </td>
390 </tr>
391 <tr valign="top">
392 <td>
393 <p>'xunits'</p>
394 </td>
395 <td>
396 <p>unit of the x-axis</p>
397 </td>
398 </tr>
399 <tr valign="top">
400 <td>
401 <p>'yunits'</p>
402 </td>
403 <td>
404 <p>unit of the y-axis</p>
405 </td>
406 </tr>
407 </tbody>
408 </table>
409 </p>
410 <div class="fragment"><pre class="programlisting">
411 num = [1 2 3];
412 den = [4 5 6];
413 name = <span class="string">'my rational'</span>;
414 iunits = <span class="string">'Hz'</span>;
415 ounits = <span class="string">'V'</span>;
416
417 pl = plist(<span class="string">'num'</span>, num, <span class="string">'den'</span>, den);
418 ra = rational(pl)
419 ---- rational 1 ----
420 model: None
421 num: [1 2 3]
422 den: [4 5 6]
423 iunits: []
424 ounits: []
425 --------------------
426
427 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);
428 pf = rational(pl)
429 ---- rational 1 ----
430 model: my rational
431 num: [1 2 3]
432 den: [4 5 6]
433 iunits: [Hz]
434 ounits: [V]
435 --------------------
436 </pre></div>
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475 </p>
476
477 <br>
478 <br>
479 <table class="nav" summary="Navigation aid" border="0" width=
480 "100%" cellpadding="0" cellspacing="0">
481 <tr valign="top">
482 <td align="left" width="20"><a href="constructor_examples_parfrac.html"><img src=
483 "b_prev.gif" border="0" align="bottom" alt=
484 "Constructor examples of the PARFRAC class"></a>&nbsp;</td>
485
486 <td align="left">Constructor examples of the PARFRAC class</td>
487
488 <td>&nbsp;</td>
489
490 <td align="right">Constructor examples of the TIMESPAN class</td>
491
492 <td align="right" width="20"><a href=
493 "constructor_examples_timespan.html"><img src="b_next.gif" border="0" align=
494 "bottom" alt="Constructor examples of the TIMESPAN class"></a></td>
495 </tr>
496 </table><br>
497
498 <p class="copy">&copy;LTP Team</p>
499 </body>
500 </html>