Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/downsample_content.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 <h2>Description</h2> | |
2 <p> | |
3 Downsampling is the process of reducing the sampling rate of a signal. <a href="matlab:doc('ao/downsample')"><tt>Downsample</tt></a> | |
4 reduces the sampling rate of the input AOs by an integer factor by picking up one out of N samples. | |
5 Note that no anti-aliasing filter is applied to the original data. Moreover, a <tt>offset</tt> can be | |
6 specified, i.e., the sample at which the output data starts ---see examples below. | |
7 </p> | |
8 <h2>Syntax</h2> | |
9 <div class="fragment"><pre> | |
10 <br> | |
11 b = downsample(a, pl) | |
12 </pre> | |
13 </div> | |
14 <h2>Parameters</h2> | |
15 <p> The following parameters can be set in this method: | |
16 <ul> | |
17 <li> <tt>factor</tt> - decimation factor [by default is 1: no downsampling] (must be an integer) </li> | |
18 <li> <tt>offset</tt> - sample offset for decimation </li> | |
19 </ul> | |
20 </p> | |
21 <p> | |
22 <h2>Examples</h2> | |
23 </p> | |
24 <p> | |
25 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>. | |
26 </p> | |
27 <div class="fragment"><pre> | |
28 <br> | |
29 <span class="comment">% create an AO of random data with fs = 10 Hz</span> | |
30 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>); | |
31 x = ao(pl) | |
32 pl_down = plist(<span class="string">'factor'</span>, 4); <span class="comment">% add the decimation factor</span> | |
33 y = downsample(x, pl_down); <span class="comment">% downsample the input AO, x</span> | |
34 iplot(x, y) | |
35 </pre> | |
36 </div> | |
37 | |
38 <img src="images/downsample1.png" alt="Downsample" border="0"> | |
39 | |
40 <p> | |
41 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. | |
42 </p> | |
43 <div class="fragment"><pre> | |
44 <br> | |
45 <span class="comment">% create an AO of random data with fs = 10 Hz</span> | |
46 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>); | |
47 x = ao(pl) | |
48 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> | |
49 y = downsample(x, pl_downoff); <span class="comment">% downsample the input AO, x</span> | |
50 iplot(x, y) | |
51 </pre> | |
52 </div> | |
53 | |
54 <img src="images/downsample2.png" alt="Downsample" border="0"> |