<!-- $Id: constructor_examples_tsdata_content.html,v 1.1 2008/03/30 20:40:04 ingo Exp $ --><!-- -------------------------------------------------- --><!-- --------------- BEGIN CONTENT FILE --------------- --><!-- -------------------------------------------------- --><!-- --------------- Link box: begin --------------- --><table border="0" summary="Simple list" class="simplelist_nottable_last"> <tr> <td> <a href="constructor_examples_tsdata.html#empty">Construct empty TSDATA object</a> </td> </tr> <tr> <td> <a href="constructor_examples_tsdata.html#xml_file">Construct a TSDATA object by loading the object from a file</a> </td> </tr> <tr> <td> <a href="constructor_examples_tsdata.html#data_vector">Construct a TSDATA object from a data vector</a> </td> </tr> <tr> <td> <a href="constructor_examples_tsdata.html#data_freq_vector">Construct a TSDATA object from a data vector and time vector</a> </td> </tr> <tr> <td> <a href="constructor_examples_tsdata.html#data_frequency">Construct a TSDATA object from a data vector and the corresponding frequency</a> </td> </tr></table><!-- --------------- Link box: end --------------- --><!-- --------------- NEXT EXAMPLE --------------- --><hr><h2 class="title"><a name="empty"></a>Construct empty TSDATA object</h2><p>The following example creates an empty tsdata object</p><div class="fragment"><pre class="programlisting">ts = tsdata()-------- tsdata 01 ------------ name: None fs: 0 x: [0 0], double y: [0 0], doublexunits:yunits: nsecs: 0 t0: 1970-01-01 00:00:00.000-------------------------------</pre></div><!-- --------------- NEXT EXAMPLE --------------- --><hr><h2 class="title"><a name="xml_file"></a>Construct a TSDATA object by loading the object from a file</h2><p>The following example creates a new tsdata object by loading the tsdata object from disk.</p><div class="fragment"><pre class="programlisting">tsd = tsdata(<span class="string">'tsd.mat'</span>)tsd = tsdata(<span class="string">'tsd.xml'</span>)</pre></div><!-- --------------- NEXT EXAMPLE --------------- --><hr><h2 class="title"><a name="data_vector"></a>Construct a TSDATA object from a data vector</h2><p>Creates a time-series object with the given x-data. Sample rate of the data is assumed to be 1Hz.</p><div class="fragment"><pre class="programlisting">y = randn(1000,1);tsd = tsdata(y)</pre></div><!-- --------------- NEXT EXAMPLE --------------- --><hr><h2 class="title"><a name="data_freq_vector"></a>Construct a TSDATA object from a data vector and time vector</h2><p>Creates a time-series object with the given (t,x)-data. The sample rate is then set as 1/(t(2)-t(1)).</p><div class="fragment"><pre class="programlisting">fs = 10;x = linspace(0, fs/2, 1000);y = randn(1000,1);f1 = tsdata(x,y)</pre></div><!-- --------------- NEXT EXAMPLE --------------- --><hr><h2 class="title"><a name="data_frequency"></a>Construct a TSDATA object from a data vector and the corresponding frequency</h2><p>creates a time-series object with the given x-data. The time vector t[] is grown from the sample rate. The first sample is assigned time 0.</p><div class="fragment"><pre class="programlisting">y = randn(1000,1);fs = 100;tsd = tsdata(y,fs)</pre></div><!-- ------------------------------------------------ --><!-- --------------- END CONTENT FILE --------------- --><!-- ------------------------------------------------ -->