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