Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/ltpda_training_topic_2_1.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 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> | |
3 | |
4 <html lang="en"> | |
5 <head> | |
6 <meta name="generator" content= | |
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org"> | |
8 <meta http-equiv="Content-Type" content= | |
9 "text/html; charset=us-ascii"> | |
10 | |
11 <title>Downsampling a time-series AO (LTPDA Toolbox)</title> | |
12 <link rel="stylesheet" href="docstyle.css" type="text/css"> | |
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2"> | |
14 <meta name="description" content= | |
15 "Presents an overview of the features, system requirements, and starting the toolbox."> | |
16 </head> | |
17 | |
18 <body> | |
19 <a name="top_of_page" id="top_of_page"></a> | |
20 | |
21 <p style="font-size:1px;"> </p> | |
22 | |
23 <table class="nav" summary="Navigation aid" border="0" width= | |
24 "100%" cellpadding="0" cellspacing="0"> | |
25 <tr> | |
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td> | |
27 | |
28 <td valign="baseline" align="right"><a href= | |
29 "ltpda_training_topic_2.html"><img src="b_prev.gif" border="0" align= | |
30 "bottom" alt="Topic 2 - Pre-processing of data"></a> <a href= | |
31 "ltpda_training_topic_2_2.html"><img src="b_next.gif" border="0" align= | |
32 "bottom" alt="Upsampling a time-series AO"></a></td> | |
33 </tr> | |
34 </table> | |
35 | |
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Downsampling a time-series AO</h1> | |
37 <hr> | |
38 | |
39 <p> | |
40 | |
41 Downsampling reduces the sampling rate of the input AOs by an integer factor, which can be very useful for example to reduce data load. | |
42 | |
43 <p>The <tt>downsample</tt> method takes the following parameters: | |
44 <table cellspacing="0" class="body" cellpadding="2" border="0" width="80%"> | |
45 <colgroup> | |
46 <col width="25%"/> | |
47 <col width="75%"/> | |
48 </colgroup> | |
49 <thead> | |
50 <tr valign="top"> | |
51 <th class="categorylist">Key</th> | |
52 <th class="categorylist">Description</th> | |
53 </tr> | |
54 </thead> | |
55 <tbody> | |
56 <!-- Key 'factor' --> | |
57 <tr valign="top"> | |
58 <td bgcolor="#f3f4f5"> | |
59 <p><tt>FACTOR</tt></p> | |
60 </td> | |
61 <td bgcolor="#f3f4f5"> | |
62 <p>The decimation factor [by default is 1: no downsampling] (must be an integer)</p> | |
63 </td> | |
64 </tr> | |
65 <!-- Key 'offset' --> | |
66 <tr valign="top"> | |
67 <td bgcolor="#f3f4f5"> | |
68 <p><tt>OFFSET</tt></p> | |
69 </td> | |
70 <td bgcolor="#f3f4f5"> | |
71 <p>The sample offset for where the downsampling starts counting. By default, this value is | |
72 zero so it starts counting from the first sample.</p> | |
73 </td> | |
74 </tr> | |
75 </tbody> | |
76 </table> | |
77 </p> | |
78 <h2><a name="example1">Example 1</h2> | |
79 <p> | |
80 First we'll create a time-series of random white noise at 10Hz. To do that, | |
81 define a <tt>plist</tt> with the key/value pairs shown below, and pass these | |
82 to the <tt>ao</tt> constructor. If you're using the workbench, add an <tt>ao</tt> | |
83 constructor block to the canvas and select the parameter set "From Time-series Function" and | |
84 set the parameters as they are in the <tt>plist</tt> below. | |
85 </p> | |
86 <div class="fragment"><pre> | |
87 <span class="comment">% create an AO of random data with fs = 10 Hz;</span> | |
88 pl = plist(<span class="string">'name'</span>, <span class="string">'None'</span>, ... | |
89 <span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</span>, <span class="keyword">...</span> | |
90 <span class="string">'fs'</span>, 10, <span class="keyword">...</span> | |
91 <span class="string">'yunits'</span>, <span class="string">'m'</span>, <span class="keyword">...</span> | |
92 <span class="string">'nsecs'</span>, 10); | |
93 x = ao(pl); <span class="comment">% create AO</span> | |
94 </pre> | |
95 </div> | |
96 <p> | |
97 Now we will downsample this data by a factor 5 to 2Hz. We use the method <tt>ao/downsample</tt> and set | |
98 the downsample factor in the <tt>plist</tt> as shown below. | |
99 </p> | |
100 <div class="fragment"><pre> | |
101 pl_down = plist(<span class="string">'factor'</span>, 5); <span class="comment">% add the decimation factor</span> | |
102 x_down = downsample(x, pl_down); <span class="comment">% downsample the input AO, x</span> | |
103 iplot(x, x_down) <span class="comment">% plot original,x, and decimated,x_down, AOs</span> | |
104 </pre> | |
105 </div> | |
106 <img src="images/ltpda_training_1/topic2/down1.png" alt="Downsample" border="3"> | |
107 <br> | |
108 <br> | |
109 <h2><a name="example2">Example 2</h2> | |
110 <p> | |
111 The <tt>downsample</tt> method takes an 'offset' key which controls where the counting starts. The default is | |
112 to output every Nth sample starting with the first. The 'offset' key tells <tt>downsample</tt> to start the counting | |
113 from a sample other than the first. The example | |
114 below outputs every 4th sample starting from sample 10. | |
115 </p> | |
116 <div class="fragment"><pre> | |
117 pl_downoff = plist(<span class="string">'factor'</span>, 4,<span class="string">'offset'</span>,10); <span class="comment">% add decimation factor and offset parameter</span> | |
118 x_downoff = downsample(x, pl_downoff); <span class="comment">% downsample the input AO, x</span> | |
119 iplot(x, x_downoff) <span class="comment">% plot original,x, and decimated,x_downoff, AOs</span> | |
120 </pre> | |
121 </div> | |
122 <img src="images/ltpda_training_1/topic2/down2.png" alt="Downsample" border="3"> | |
123 | |
124 | |
125 | |
126 </p> | |
127 | |
128 <br> | |
129 <br> | |
130 <table class="nav" summary="Navigation aid" border="0" width= | |
131 "100%" cellpadding="0" cellspacing="0"> | |
132 <tr valign="top"> | |
133 <td align="left" width="20"><a href="ltpda_training_topic_2.html"><img src= | |
134 "b_prev.gif" border="0" align="bottom" alt= | |
135 "Topic 2 - Pre-processing of data"></a> </td> | |
136 | |
137 <td align="left">Topic 2 - Pre-processing of data</td> | |
138 | |
139 <td> </td> | |
140 | |
141 <td align="right">Upsampling a time-series AO</td> | |
142 | |
143 <td align="right" width="20"><a href= | |
144 "ltpda_training_topic_2_2.html"><img src="b_next.gif" border="0" align= | |
145 "bottom" alt="Upsampling a time-series AO"></a></td> | |
146 </tr> | |
147 </table><br> | |
148 | |
149 <p class="copy">©LTP Team</p> | |
150 </body> | |
151 </html> |