Mercurial > hg > ltpda
view m-toolbox/html_help/help/ug/downsample_content.html @ 12:86aabb42dd84 database-connection-manager
Use utils.repository utilities
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
<h2>Description</h2> <p> Downsampling is the process of reducing the sampling rate of a signal. <a href="matlab:doc('ao/downsample')"><tt>Downsample</tt></a> reduces the sampling rate of the input AOs by an integer factor by picking up one out of N samples. Note that no anti-aliasing filter is applied to the original data. Moreover, a <tt>offset</tt> can be specified, i.e., the sample at which the output data starts ---see examples below. </p> <h2>Syntax</h2> <div class="fragment"><pre> <br> b = downsample(a, pl) </pre> </div> <h2>Parameters</h2> <p> The following parameters can be set in this method: <ul> <li> <tt>factor</tt> - decimation factor [by default is 1: no downsampling] (must be an integer) </li> <li> <tt>offset</tt> - sample offset for decimation </li> </ul> </p> <p> <h2>Examples</h2> </p> <p> 1. Downsampling a sequence of random data at original sampling rate of 10 Hz by a factor of 4 (<tt>fsout</tt> = 2.5 Hz) and no <tt>offset</tt>. </p> <div class="fragment"><pre> <br> <span class="comment">% create an AO of random data with fs = 10 Hz</span> pl = plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</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_down = plist(<span class="string">'factor'</span>, 4); <span class="comment">% add the decimation factor</span> y = downsample(x, pl_down); <span class="comment">% downsample the input AO, x</span> iplot(x, y) </pre> </div> <img src="images/downsample1.png" alt="Downsample" border="0"> <p> 2. Downsampling a sequence of random data at original sampling rate of 10 Hz by a factor of 4 (<tt>fsout</tt> = 2.5 Hz) and <tt>offset</tt> = 10. </p> <div class="fragment"><pre> <br> <span class="comment">% create an AO of random data with fs = 10 Hz</span> pl = plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</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_downoff = plist(<span class="string">'factor'</span>, 4,<span class="string">'offset'</span>,10); <span class="comment">% add the decimation factor and the offset parameter</span> y = downsample(x, pl_downoff); <span class="comment">% downsample the input AO, x</span> iplot(x, y) </pre> </div> <img src="images/downsample2.png" alt="Downsample" border="0">