Mercurial > hg > ltpda
view m-toolbox/html_help/help/ug/ltpda_training_topic_2_2.html @ 42:f90d4f666cc7 database-connection-manager
Cleanup
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 18:04:34 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html lang="en"> <head> <meta name="generator" content= "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org"> <meta http-equiv="Content-Type" content= "text/html; charset=us-ascii"> <title>Upsampling a time-series AO (LTPDA Toolbox)</title> <link rel="stylesheet" href="docstyle.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.52.2"> <meta name="description" content= "Presents an overview of the features, system requirements, and starting the toolbox."> </head> <body> <a name="top_of_page" id="top_of_page"></a> <p style="font-size:1px;"> </p> <table class="nav" summary="Navigation aid" border="0" width= "100%" cellpadding="0" cellspacing="0"> <tr> <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td> <td valign="baseline" align="right"><a href= "ltpda_training_topic_2_1.html"><img src="b_prev.gif" border="0" align= "bottom" alt="Downsampling a time-series AO"></a> <a href= "ltpda_training_topic_2_3.html"><img src="b_next.gif" border="0" align= "bottom" alt="Resampling a time-series AO"></a></td> </tr> </table> <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Upsampling a time-series AO</h1> <hr> <p> <p> Upsampling increases the sampling rate of the input AOs by an integer factor </p> <p>The <tt>ao/upsample</tt> method can take the following parameters: <table cellspacing="0" class="body" cellpadding="2" border="0" width="80%"> <colgroup> <col width="25%"/> <col width="75%"/> </colgroup> <thead> <tr valign="top"> <th class="categorylist">Key</th> <th class="categorylist">Description</th> </tr> </thead> <tbody> <!-- Key 'N' --> <tr valign="top"> <td bgcolor="#f3f4f5"> <p><tt>N</tt></p> </td> <td bgcolor="#f3f4f5"> <p>The upsample factor. The algorithm places 'N-1' zeros between each of the original samples.</p> </td> </tr> <!-- Key 'offset' --> <tr valign="top"> <td bgcolor="#f3f4f5"> <p><tt>PHASE</tt></p> </td> <td bgcolor="#f3f4f5"> <p>This parameter specifies an additional sample offet. The value must be between 0 and N-1.</p> </td> </tr> </tbody> </table> </p> <h2>Example 1</h2> <p> We will upsample a sine-wave by a factor of 3 with no initial phase offset. </p> <p> Start by creating a sine-wave at 1Hz with a 30Hz sample rate and 10 seconds long. We can use the <tt>ao</tt> "From Waveform" parameter set to do this. (Equally, we can do this with the "From Time-series Function" parameter set.) </p> <div class="fragment"><pre> pl = plist(<span class="string">'Waveform'</span>, <span class="string">'sine wave'</span>, <span class="string">'f'</span>, 1, <span class="string">'fs'</span>, 30, <span class="string">'nsecs'</span>, 10); x = ao(pl);</pre></div> <p> Now we can proceed to upsample this data by a factor 3. This will place 2 zero samples between each of the original samples. </p> <div class="fragment"><pre> pl_up = plist(<span class="string">'N'</span>, 3); <span class="comment">% increase the sampling frequency by a factor of 10</span> x_up = upsample(x, pl_up); <span class="comment">% resample the input AO (x) to obtain the upsampled AO (y) </span> iplot(x, x_up, plist(<span class="string">'XRanges'</span>, [0 1], <span class="string">'Markers'</span>, {<span class="string">'o'</span>, <span class="string">'s'</span>})) <span class="comment">% plot original and upsampled data</span> </pre> </div> <img src="images/ltpda_training_1/topic2/up1.png" alt="Upsample" border="3"> <br> <br> <h2>Example 2</h2> <p> In this second example, we will upsample some random noise by a factor 4 with a phase offset of 2 samples. </p> <p> Again, start by constructing some test data, in this case a white-noise data stream. We can do this again using the "From Waveform" parameter set with an <tt>ao</tt> constructor. </p> <div class="fragment"><pre> pl = plist(<span class="string">'Waveform'</span>, <span class="string">'noise'</span>, <span class="string">'fs'</span>, 10, <span class="string">'nsecs'</span>, 10, <span class="string">'yunits'</span>, <span class="string">'m'</span>); x = ao(pl); pl_upphase = plist(<span class="string">'N'</span>, 4,<span class="string">'phase'</span>, 2); <span class="comment">% increase the sampling frequency and add phase of 2 samples to the upsampled data</span> x_upphase = upsample(x, pl_upphase); <span class="comment">% resample the input AO (x) to obtain the upsampled and delayed AO</span> iplot(x, x_upphase, plist(<span class="string">'XRanges'</span>, [0 1], <span class="string">'Markers'</span>, {<span class="string">'o'</span>, <span class="string">'s'</span>})) <span class="comment">% plot original and upsampled data</span> </pre> </div> <img src="images/ltpda_training_1/topic2/up2.png" alt="Upsample" border="3"> </p> <br> <br> <table class="nav" summary="Navigation aid" border="0" width= "100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td align="left" width="20"><a href="ltpda_training_topic_2_1.html"><img src= "b_prev.gif" border="0" align="bottom" alt= "Downsampling a time-series AO"></a> </td> <td align="left">Downsampling a time-series AO</td> <td> </td> <td align="right">Resampling a time-series AO</td> <td align="right" width="20"><a href= "ltpda_training_topic_2_3.html"><img src="b_next.gif" border="0" align= "bottom" alt="Resampling a time-series AO"></a></td> </tr> </table><br> <p class="copy">©LTP Team</p> </body> </html>