Mercurial > hg > ltpda
diff m-toolbox/html_help/help/ug/objects_working_content.html @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/html_help/help/ug/objects_working_content.html Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,187 @@ +<p> + The use of LTPDA objects requires some understanding of the nature of objects as implemented in MATLAB. +</p> +<p> + For full details of objects in MATLAB, refer to <a href="matlab:web(['jar:file:///' matlabroot '/help/techdoc/help.jar!/matlab_oop/ug_intropage.html'])">MATLAB Classes and Object-Oriented Programming</a>. + For convenience, the most important aspects in the context of LTPDA are reviewed below. +</p> +<p> + <ul> + <li> + <p><a href="objects_working.html#calling">Calling object methods</a></p> + </li> + <li> + <p><a href="objects_working.html#set">Setting object properties</a></p> + </li> + <li> + <p><a href="objects_working.html#copy">Copying objects</a></p> + </li> + <li><a href="objects_working.html#exploring">Exploring objects</a></li> + </ul> +</p> + +<a name="calling" id= "calling"><h3 class="title">Calling object methods</h3></a> + +<p> + Each class in LTPDA has a set of methods (functions) which can operate/act on instances of the class (objects). + For example, the AO class has a method <tt>psd</tt> which can compute the Power Spectral Density estimate of a + time-series AO. +</p> +<p> + To see which methods a particular class has, use the <tt>methods</tt> command. For example, + <div class="fragment"><pre> + >> methods(<span class="string">'ao'</span>) + </pre></div> +</p> +<p> + To call a method on an object, <tt>obj.method</tt>, or, <tt>method(obj)</tt>. For example, + <div class="fragment"><pre> + >> b = a.psd + </pre></div> + or + <div class="fragment"><pre> + >> b = psd(a) + </pre></div> + Additional arguments can be passed to the method (a <tt>plist</tt>, for example), as follows: + <div class="fragment"><pre> + >> b = a.psd(pl) + </pre></div> + or + <div class="fragment"><pre> + >> b = psd(a, pl) + </pre></div> +</p><br> +<p> + In order to pass multiple objects to a method, you must use the form + <div class="fragment"><pre> + >> b = psd(a1, a2, pl) + </pre></div> +</p><br> +<p> + Some methods can behave as modifiers which means that the object which the method acts on is modified. To + modify an object, just give no output. If we start with a time-series AO then modify it with the <tt>psd</tt> + method, + <div class="fragment"><pre> + >> a = ao(1:100, randn(100,1), 10) + >> a + M: running ao/display + ----------- ao 01: a ----------- + + name: None + data: (0,0.840375529753905) (0.1,-0.88803208232901) (0.2,0.100092833139322) (0.3,-0.544528929990548) (0.4,0.303520794649354) ... + -------- tsdata 01 ------------ + + fs: 10 + x: [100 1], double + y: [100 1], double + dx: [0 0], double + dy: [0 0], double + xunits: [s] + yunits: [] + nsecs: 10 + t0: 1970-01-01 00:00:01.000 + ------------------------------- + + hist: ao / ao / SId: fromVals ... -->$Id: ao .... S + mdlfile: empty + description: + UUID: 8cffab46-61f0-494a-af03-eb310aa76114 + -------------------------------- + </pre></div><br> + Then call the <tt>psd</tt> method: + <div class="fragment"><pre> + >> a.psd + M: running ao/psd + M: running ao/len + M: running ao/len + M: running ao/display + ----------- ao 01: PSD(a) ----------- + + name: PSD(a) + data: (0,0.117412356146407) (0.1,0.179893990497347) (0.2,0.173957816470448) (0.3,0.245076068355785) (0.4,0.213036543621994) ... + ----------- fsdata 01 ----------- + + fs: 10 + x: [51 1], double + y: [51 1], double + dx: [0 0], double + dy: [0 0], double + xunits: [Hz] + yunits: [Hz^(-1)] + t0: 1970-01-01 00:00:01.000 + navs: 1 + --------------------------------- + + hist: ao / psd / SId: psd.m,v 1.52 2009/09/05 05:57:32 mauro Exp S + mdlfile: empty + description: + UUID: 0d2395cd-22af-4645-a94c-69fa32c15982 + ------------------------------------- + </pre></div><br> + then the object <tt>a</tt> is converted to a frequency-series AO. +</p><br> +<p> + This modifier behaviour only works with certain methods, in particular, methods requiring more than one input object + will not behave as modifiers. +</p><br> +<a name="set" id= "set"><h3 class="title">Setting object properties</h3></a> +<p> + All object properties must be set using the appropriate setter method. For example, to set the name of a IIR filter + object, + <div class="fragment"><pre> + >> ii = miir(); + >> ii.setName(<span class="string">'My Filter'</span>); + </pre></div> +</p> +<p> + Reading the value of a property is achieved by: + <div class="fragment"><pre> + >> ii.name + + ans = + + My Filter + </pre></div> +</p><br> + +<a name="copy" id= "copy"><h3 class="title">Copying objects</h3></a> +<br> +<p> + Since all objects in LTPDA are handle objects, creating copies of objects needs to be done differently than in standard + MATLAB. For example, + <div class="fragment"><pre> + >> a = ao(); + >> b = a; + </pre></div> + in this case, the variable <tt>b</tt> is a copy of the handle <tt>a</tt>, not a copy of the object pointed too + by the handle <tt>a</tt>. To see how this behaves, + <div class="fragment"><pre> + >> a = ao(); + >> b = a; + >> b.setName(<span class="string">'My Name'</span>); + >> a.name + + ans = + + My Name + </pre></div> +</p> +<p> + Copying the object can be achieved using the copy constructor: + <div class="fragment"><pre> + >> a = ao(); + >> b = ao(a); + >> b.setName(<span class="string">'My Name'</span>); + >> a.name + + ans = + + none + </pre></div> + <p>In this case, the variable <tt>b</tt> points to a new distinct copy of the object pointed to by <tt>a</tt>. + </p> +</p> + <p></p> +<h3 class="title"><a name="exploring" id="calling2">Exploring objects</a></h3> + <p> A browsing tool is provided on purpose to enable LTPDA objects exploring.</p> + <p><a href="gui_explorer.html">See the LTPDA Objects Explorer GUI documentation.</a></p>