comparison m-toolbox/html_help/help/ug/ltpda_training_topic_2_2.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>Upsampling 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;">&nbsp;</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_1.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Downsampling a time-series AO"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "ltpda_training_topic_2_3.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Resampling a time-series AO"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Upsampling a time-series AO</h1>
37 <hr>
38
39 <p>
40 <p>
41 Upsampling increases the sampling rate of the input AOs by an integer factor
42 </p>
43
44 <p>The <tt>ao/upsample</tt> method can take the following parameters:
45 <table cellspacing="0" class="body" cellpadding="2" border="0" width="80%">
46 <colgroup>
47 <col width="25%"/>
48 <col width="75%"/>
49 </colgroup>
50 <thead>
51 <tr valign="top">
52 <th class="categorylist">Key</th>
53 <th class="categorylist">Description</th>
54 </tr>
55 </thead>
56 <tbody>
57 <!-- Key 'N' -->
58 <tr valign="top">
59 <td bgcolor="#f3f4f5">
60 <p><tt>N</tt></p>
61 </td>
62 <td bgcolor="#f3f4f5">
63 <p>The upsample factor. The algorithm places 'N-1' zeros between each of the original samples.</p>
64 </td>
65 </tr>
66 <!-- Key 'offset' -->
67 <tr valign="top">
68 <td bgcolor="#f3f4f5">
69 <p><tt>PHASE</tt></p>
70 </td>
71 <td bgcolor="#f3f4f5">
72 <p>This parameter specifies an additional sample offet. The value must be between 0 and N-1.</p>
73 </td>
74 </tr>
75 </tbody>
76 </table>
77 </p>
78 <h2>Example 1</h2>
79 <p>
80 We will upsample a sine-wave by a factor of 3 with no initial phase offset.
81 </p>
82 <p>
83 Start by creating a sine-wave at 1Hz with a 30Hz sample rate and 10 seconds long. We can use
84 the <tt>ao</tt> "From Waveform" parameter set to do this. (Equally, we can do this with the "From Time-series Function"
85 parameter set.)
86 </p>
87 <div class="fragment"><pre>
88 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);
89 x = ao(pl);</pre></div>
90 <p>
91 Now we can proceed to upsample this data by a factor 3. This will place 2 zero samples between each of the
92 original samples.
93 </p>
94 <div class="fragment"><pre>
95 pl_up = plist(<span class="string">'N'</span>, 3); <span class="comment">% increase the sampling frequency by a factor of 10</span>
96 x_up = upsample(x, pl_up); <span class="comment">% resample the input AO (x) to obtain the upsampled AO (y) </span>
97 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>
98 </pre>
99 </div>
100 <img src="images/ltpda_training_1/topic2/up1.png" alt="Upsample" border="3">
101 <br>
102 <br>
103 <h2>Example 2</h2>
104
105 <p>
106 In this second example, we will upsample some random noise by a factor 4 with a phase offset of 2 samples.
107 </p>
108 <p>
109 Again, start by constructing some test data, in this case a white-noise data stream. We can do this
110 again using the "From Waveform" parameter set with an <tt>ao</tt> constructor.
111 </p>
112 <div class="fragment"><pre>
113 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>);
114 x = ao(pl);
115 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>
116 x_upphase = upsample(x, pl_upphase); <span class="comment">% resample the input AO (x) to obtain the upsampled and delayed AO</span>
117 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>
118 </pre>
119 </div>
120 <img src="images/ltpda_training_1/topic2/up2.png" alt="Upsample" border="3">
121
122
123 </p>
124
125 <br>
126 <br>
127 <table class="nav" summary="Navigation aid" border="0" width=
128 "100%" cellpadding="0" cellspacing="0">
129 <tr valign="top">
130 <td align="left" width="20"><a href="ltpda_training_topic_2_1.html"><img src=
131 "b_prev.gif" border="0" align="bottom" alt=
132 "Downsampling a time-series AO"></a>&nbsp;</td>
133
134 <td align="left">Downsampling a time-series AO</td>
135
136 <td>&nbsp;</td>
137
138 <td align="right">Resampling a time-series AO</td>
139
140 <td align="right" width="20"><a href=
141 "ltpda_training_topic_2_3.html"><img src="b_next.gif" border="0" align=
142 "bottom" alt="Resampling a time-series AO"></a></td>
143 </tr>
144 </table><br>
145
146 <p class="copy">&copy;LTP Team</p>
147 </body>
148 </html>